refactor: form input edit profile

This commit is contained in:
zhadaarsita 2025-11-12 14:14:36 +07:00
parent 34168d5d53
commit a3b520fda9
2 changed files with 57 additions and 18 deletions

View File

@ -8,7 +8,7 @@
</div>
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="col-lg-10">
<div class="card border-0 shadow-sm mb-4">
<div class="card-body p-4">
@include('profile.partials.update-profile-information-form')

View File

@ -1,11 +1,11 @@
<section>
<header>
<h2 class="h5 fw-bold">
{{ __('Profile Information') }}
{{ __('Informasi Profil') }}
</h2>
<p class="mt-1 text-muted small">
{{ __("Update your account's profile information and email address.") }}
{{ __("Perbarui informasi profil dan alamat email akun Anda.") }}
</p>
</header>
@ -17,17 +17,17 @@
@csrf
@method('patch')
{{-- Name --}}
{{-- Bagian Nama Lengkap --}}
<div class="mb-3">
<label for="name" class="form-label">{{ __('Name') }}</label>
<input id="name" name="name" type="text" class="form-control @error('name') is-invalid @enderror"
value="{{ old('name', $user->name) }}" required autofocus autocomplete="name">
@error('name')
<label for="nama_lengkap" class="form-label">{{ __('Nama Lengkap') }}</label>
<input id="nama_lengkap" name="nama_lengkap" type="text" class="form-control @error('nama_lengkap') is-invalid @enderror"
value="{{ old('nama_lengkap', $user->nama_lengkap) }}" required autofocus autocomplete="name">
@error('nama_lengkap')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
{{-- Email --}}
{{-- Bagian Email --}}
<div class="mb-3">
<label for="email" class="form-label">{{ __('Email') }}</label>
<input id="email" name="email" type="email"
@ -40,28 +40,67 @@ class="form-control @error('email') is-invalid @enderror" value="{{ old('email',
@if ($user instanceof \Illuminate\Contracts\Auth\MustVerifyEmail && !$user->hasVerifiedEmail())
<div class="mt-2">
<p class="small text-muted">
{{ __('Your email address is unverified.') }}
{{ __('Alamat email Anda belum terverifikasi.') }}
<button form="send-verification" class="btn btn-link text-decoration-underline p-0 small">
{{ __('Click here to re-send the verification email.') }}
{{ __('Klik di sini untuk mengirim ulang email verifikasi.') }}
</button>
</p>
@if (session('status') === 'verification-link-sent')
<p class="mt-2 fw-medium small text-success">
{{ __('A new verification link has been sent to your email address.') }}
{{ __('Tautan verifikasi baru telah dikirim ke alamat email Anda.') }}
</p>
@endif
</div>
@endif
</div>
{{-- Bagian Nomor Telepon (Editable - Hanya jika ada) --}}
@if ($user->nomor_hp)
<div class="mb-3">
<label for="nomor_hp" class="form-label">{{ __('Nomor Telepon (WA)') }}</label>
<input id="nomor_hp" name="nomor_hp" type="text" class="form-control @error('nomor_hp') is-invalid @enderror"
value="{{ old('nomor_hp', $user->nomor_hp) }}" required>
@error('nomor_hp')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
</div>
@endif
<hr class="my-4">
<div class="d-flex align-items-center gap-3">
<button type="submit" class="btn btn-primary">{{ __('Save') }}</button>
{{-- Bagian Info Spesifik Role (Tidak Dapat Diubah) --}}
@if ($user->role == 'siswa')
<div class="mb-3">
<label for="nisn" class="form-label">NISN (Nomor Induk Siswa Nasional)</label>
<input id="nisn" type="text" class="form-control" value="{{ $user->nisn }}" readonly disabled>
<small class="text-muted">NISN tidak dapat diubah.</small>
</div>
<div class="row g-3">
<div class="col-md-6 mb-3">
<label for="kelas" class="form-label">Kelas</label>
<input id="kelas" type="text" class="form-control" value="{{ $user->kelas }}" readonly disabled>
</div>
<div class="col-md-6 mb-3">
<label for="golongan" class="form-label">Golongan</label>
<input id="golongan" type="text" class="form-control" value="{{ $user->golongan }}" readonly disabled>
</div>
</div>
@else
{{-- Untuk Guru atau Penjaga Perpus --}}
<div class="mb-3">
<label for="nip" class="form-label">NIP (Nomor Induk Pegawai)</label>
<input id="nip" type="text" class="form-control" value="{{ $user->nip }}" readonly disabled>
<small class="text-muted">NIP tidak dapat diubah.</small>
</div>
@endif
<div class="d-flex align-items-center gap-3 mt-3">
<button type="submit" class="btn btn-primary">{{ __('Simpan') }}</button>
@if (session('status') === 'profile-updated')
<span class="text-success fw-bold">{{ __('Saved.') }}</span>
<span class="text-success fw-bold">{{ __('Tersimpan.') }}</span>
@endif
</div>
</form>
</section>
</section>