243 lines
6.3 KiB
PHP
243 lines
6.3 KiB
PHP
@extends('guru.layouts.app')
|
|
|
|
@section('title', 'Edit Profil')
|
|
|
|
@push('styles')
|
|
<style>
|
|
.page-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
|
|
.page-subtitle { font-size: 14px; color: #64748b; margin-bottom: 28px; }
|
|
|
|
.profile-card {
|
|
background: white;
|
|
border-radius: 20px;
|
|
border: 2px solid #e5e5e5;
|
|
padding: 32px;
|
|
max-width: 560px;
|
|
}
|
|
|
|
.foto-wrap {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 24px;
|
|
margin-bottom: 32px;
|
|
padding-bottom: 28px;
|
|
border-bottom: 1px solid #f1f5f9;
|
|
}
|
|
|
|
.foto-preview {
|
|
width: 88px; height: 88px;
|
|
border-radius: 50%;
|
|
object-fit: cover;
|
|
border: 3px solid #e6f0ff;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.foto-placeholder {
|
|
width: 88px; height: 88px;
|
|
border-radius: 50%;
|
|
background: #e6f0ff;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
border: 3px solid #e6f0ff;
|
|
}
|
|
|
|
.foto-placeholder svg { width: 40px; height: 40px; color: #2b8ef3; }
|
|
.foto-info p { font-size: 13px; color: #64748b; margin: 0 0 10px; }
|
|
|
|
.btn-upload {
|
|
display: inline-block;
|
|
background: #e6f0ff;
|
|
color: #2b8ef3;
|
|
font-size: 13px;
|
|
font-weight: 700;
|
|
padding: 8px 18px;
|
|
border-radius: 10px;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
border: none;
|
|
}
|
|
|
|
.btn-upload:hover { background: #dbeeff; }
|
|
|
|
.field-group { margin-bottom: 18px; }
|
|
|
|
.field-label {
|
|
display: block;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
color: #475569;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.field-label span {
|
|
color: #94a3b8;
|
|
font-weight: 500;
|
|
text-transform: none;
|
|
letter-spacing: 0;
|
|
font-size: 11px;
|
|
margin-left: 4px;
|
|
}
|
|
|
|
.field-input {
|
|
width: 100%;
|
|
background: #f8fafc;
|
|
border: 1.5px solid #e2e8f0;
|
|
border-radius: 12px;
|
|
padding: 11px 14px;
|
|
font-size: 14px;
|
|
font-family: 'Poppins', sans-serif;
|
|
color: #1e293b;
|
|
outline: none;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.field-input:focus {
|
|
border-color: #2b8ef3;
|
|
background: white;
|
|
box-shadow: 0 0 0 3px rgba(43,142,243,0.1);
|
|
}
|
|
|
|
.field-input:disabled {
|
|
background: #f1f5f9;
|
|
color: #94a3b8;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.divider { border: none; border-top: 1px solid #f1f5f9; margin: 24px 0; }
|
|
|
|
.btn-save {
|
|
background: #2b8ef3;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 12px;
|
|
padding: 12px 28px;
|
|
font-size: 14px;
|
|
font-weight: 700;
|
|
font-family: 'Poppins', sans-serif;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
box-shadow: 0 4px 14px rgba(43,142,243,0.3);
|
|
}
|
|
|
|
.btn-save:hover { background: #1a7ae0; transform: translateY(-1px); }
|
|
|
|
.alert-success {
|
|
background: #f0fdf4;
|
|
border: 1.5px solid #86efac;
|
|
color: #166534;
|
|
border-radius: 12px;
|
|
padding: 12px 16px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.alert-error {
|
|
background: #fef2f2;
|
|
border: 1.5px solid #fca5a5;
|
|
color: #991b1b;
|
|
border-radius: 12px;
|
|
padding: 12px 16px;
|
|
font-size: 13px;
|
|
margin-bottom: 20px;
|
|
}
|
|
</style>
|
|
@endpush
|
|
|
|
@section('content')
|
|
|
|
@php $guru = Auth::guard('guru')->user(); @endphp
|
|
|
|
<h3 class="page-title">Edit Profil</h3>
|
|
<p class="page-subtitle">Perbarui foto profil dan password akunmu.</p>
|
|
|
|
@if(session('success'))
|
|
<div class="alert-success">✓ {{ session('success') }}</div>
|
|
@endif
|
|
|
|
@if($errors->any())
|
|
<div class="alert-error">
|
|
<ul style="margin:0;padding-left:16px">
|
|
@foreach($errors->all() as $error)
|
|
<li>{{ $error }}</li>
|
|
@endforeach
|
|
</ul>
|
|
</div>
|
|
@endif
|
|
|
|
<form method="POST" action="{{ route('guru.profile.update') }}" enctype="multipart/form-data">
|
|
@csrf
|
|
@method('PUT')
|
|
|
|
<div class="profile-card">
|
|
|
|
<div class="foto-wrap">
|
|
@if($guru->foto_profil)
|
|
<img src="{{ Storage::url($guru->foto_profil) }}" class="foto-preview" id="foto-preview" alt="Foto Profil">
|
|
@else
|
|
<div class="foto-placeholder" id="foto-placeholder">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
<circle cx="12" cy="8" r="4"/><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7"/>
|
|
</svg>
|
|
</div>
|
|
<img src="" class="foto-preview" id="foto-preview" alt="" style="display:none">
|
|
@endif
|
|
|
|
<div class="foto-info">
|
|
<p>Format: JPG, PNG, WEBP. Maks. 2MB.</p>
|
|
<label for="foto_profil" class="btn-upload">Pilih Foto</label>
|
|
<input type="file" name="foto_profil" id="foto_profil" accept="image/*" style="display:none">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field-group">
|
|
<label class="field-label">NIP <span>(tidak dapat diubah)</span></label>
|
|
<input type="text" class="field-input" value="{{ $guru->nip }}" disabled>
|
|
</div>
|
|
|
|
<div class="field-group">
|
|
<label class="field-label">Nama Lengkap <span>(tidak dapat diubah)</span></label>
|
|
<input type="text" class="field-input" value="{{ $guru->nama }}" disabled>
|
|
</div>
|
|
|
|
<hr class="divider">
|
|
|
|
<div class="field-group">
|
|
<label class="field-label">Password Baru <span>(kosongkan jika tidak ingin mengubah)</span></label>
|
|
<input type="password" name="password" class="field-input"
|
|
placeholder="Masukkan password baru" autocomplete="new-password">
|
|
</div>
|
|
|
|
<div class="field-group">
|
|
<label class="field-label">Konfirmasi Password Baru</label>
|
|
<input type="password" name="password_confirmation" class="field-input"
|
|
placeholder="Ulangi password baru" autocomplete="new-password">
|
|
</div>
|
|
|
|
<div style="margin-top:8px">
|
|
<button type="submit" class="btn-save">Simpan Perubahan</button>
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
document.getElementById('foto_profil').addEventListener('change', function () {
|
|
const file = this.files[0];
|
|
if (!file) return;
|
|
const url = URL.createObjectURL(file);
|
|
const preview = document.getElementById('foto-preview');
|
|
const placeholder = document.getElementById('foto-placeholder');
|
|
preview.src = url;
|
|
preview.style.display = 'block';
|
|
if (placeholder) placeholder.style.display = 'none';
|
|
});
|
|
</script>
|
|
@endpush |