137 lines
7.8 KiB
PHP
137 lines
7.8 KiB
PHP
{{-- resources/views/user/profil.blade.php --}}
|
|
@extends('layouts.app')
|
|
@section('title', 'Profil Saya')
|
|
|
|
@push('styles')
|
|
<style>
|
|
.profil-wrap { max-width: 580px; margin: 0 auto; }
|
|
.profil-hero {
|
|
background: linear-gradient(135deg, var(--gd) 0%, #0F3D24 100%);
|
|
border-radius: 20px; padding: 32px; margin-bottom: 20px;
|
|
text-align: center; position: relative; overflow: hidden;
|
|
box-shadow: 0 12px 32px rgba(26,77,46,0.2);
|
|
}
|
|
.profil-hero::before { content:'🌶️'; position:absolute; bottom:8px; right:16px; font-size:80px; opacity:0.07; line-height:1; }
|
|
.avatar-wrap { position: relative; display: inline-block; margin-bottom: 16px; }
|
|
.avatar-img, .avatar-initial { width: 90px; height: 90px; border-radius: 50%; border: 3px solid rgba(76,175,114,0.5); box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
|
|
.avatar-img { object-fit: cover; }
|
|
.avatar-initial { background: var(--rm); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800; }
|
|
.avatar-edit-btn { position: absolute; bottom: 2px; right: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--gl); color: #fff; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: all 0.2s; }
|
|
.avatar-edit-btn:hover { background: var(--gm); transform: scale(1.1); }
|
|
.profil-name { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 4px; }
|
|
.profil-email { font-size: 13px; color: rgba(255,255,255,0.6); margin-bottom: 12px; }
|
|
.profil-role { display: inline-block; background: rgba(76,175,114,0.2); color: #6CE89B; font-size: 11px; font-weight: 700; padding: 4px 14px; border-radius: 100px; border: 1px solid rgba(76,175,114,0.3); letter-spacing: 0.05em; text-transform: uppercase; }
|
|
.stats-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
|
|
.stat-mini { background: var(--white); border-radius: 12px; padding: 16px; text-align: center; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
|
|
.stat-mini-val { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 26px; font-weight: 800; color: var(--rm); }
|
|
.stat-mini-label { font-size: 12px; color: var(--text2); margin-top: 2px; }
|
|
.form-section { background: var(--white); border-radius: 16px; border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow-sm); }
|
|
.form-section-header { padding: 16px 22px; border-bottom: 1px solid var(--border); }
|
|
.form-section-header h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; font-weight: 800; color: var(--text); }
|
|
.form-section-body { padding: 22px; }
|
|
.form-group { margin-bottom: 16px; }
|
|
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
|
|
.form-input { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; color: var(--text); font-family: 'DM Sans', sans-serif; outline: none; background: var(--white); transition: border-color 0.2s, box-shadow 0.2s; }
|
|
.form-input:focus { border-color: var(--gl); box-shadow: 0 0 0 3px rgba(76,175,114,0.1); }
|
|
.form-input:disabled { background: var(--gpl); color: var(--text2); cursor: not-allowed; }
|
|
.form-hint { font-size: 11px; color: var(--text3); margin-top: 5px; }
|
|
.form-error { font-size: 12px; color: var(--rm); margin-top: 5px; }
|
|
.divider { height: 1px; background: var(--border); margin: 20px 0; }
|
|
.btn-full { width: 100%; padding: 13px; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; font-family: 'Plus Jakarta Sans', sans-serif; cursor: pointer; transition: all 0.2s; }
|
|
.btn-save { background: var(--gm); color: #fff; margin-bottom: 10px; box-shadow: 0 4px 12px rgba(45,122,79,0.2); }
|
|
.btn-save:hover { background: var(--gd); transform: translateY(-1px); }
|
|
.btn-keluar { background: var(--rp); color: var(--rm); border: 1.5px solid #FADBD8; }
|
|
.btn-keluar:hover { background: var(--rm); color: #fff; }
|
|
</style>
|
|
@endpush
|
|
|
|
@section('content')
|
|
<div class="profil-wrap">
|
|
<div class="profil-hero">
|
|
<div class="avatar-wrap">
|
|
@if(auth()->user()->foto)
|
|
<img src="{{ asset('storage/' . auth()->user()->foto) }}" class="avatar-img" id="avatar-preview" alt="Foto profil">
|
|
@else
|
|
<div class="avatar-initial" id="avatar-initial">{{ strtoupper(substr(auth()->user()->name, 0, 2)) }}</div>
|
|
<img src="" class="avatar-img" id="avatar-preview" alt="" style="display:none;">
|
|
@endif
|
|
<label for="foto-input" class="avatar-edit-btn" title="Ganti foto">✏️</label>
|
|
</div>
|
|
<div class="profil-name">{{ auth()->user()->name }}</div>
|
|
<div class="profil-email">{{ auth()->user()->email }}</div>
|
|
<div class="profil-role">{{ ucfirst(auth()->user()->role) }}</div>
|
|
</div>
|
|
|
|
<div class="stats-mini">
|
|
<div class="stat-mini">
|
|
<div class="stat-mini-val">{{ $totalDiagnosa }}</div>
|
|
<div class="stat-mini-label">Total diagnosa</div>
|
|
</div>
|
|
<div class="stat-mini">
|
|
<div class="stat-mini-val">{{ $bulanIni }}</div>
|
|
<div class="stat-mini-label">Bulan ini</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-section">
|
|
<div class="form-section-header"><h2>Edit profil</h2></div>
|
|
<div class="form-section-body">
|
|
@if(session('success'))
|
|
<div class="alert alert-success" style="margin-bottom:16px;">✅ {{ session('success') }}</div>
|
|
@endif
|
|
<form method="POST" action="{{ route('user.profil.update') }}" enctype="multipart/form-data">
|
|
@csrf @method('PUT')
|
|
<input type="file" name="foto" id="foto-input" accept="image/*" style="display:none;" onchange="previewFoto(this)">
|
|
<div class="form-group">
|
|
<label class="form-label">Nama lengkap</label>
|
|
<input class="form-input" type="text" name="name" value="{{ old('name', auth()->user()->name) }}" required>
|
|
@error('name') <div class="form-error">{{ $message }}</div> @enderror
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">Alamat email</label>
|
|
<input class="form-input" type="email" value="{{ auth()->user()->email }}" disabled>
|
|
<div class="form-hint">Email tidak dapat diubah</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">Nomor telepon</label>
|
|
<input class="form-input" type="text" name="no_telp" value="{{ old('no_telp', auth()->user()->no_telp) }}" placeholder="08xxxxxxxxxx">
|
|
</div>
|
|
<div class="divider"></div>
|
|
<div class="form-group">
|
|
<label class="form-label">Kata sandi baru <span style="color:var(--text3);font-weight:400;">(kosongkan jika tidak berubah)</span></label>
|
|
<input class="form-input" type="password" name="password" placeholder="Minimal 8 karakter">
|
|
@error('password') <div class="form-error">{{ $message }}</div> @enderror
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">Konfirmasi kata sandi baru</label>
|
|
<input class="form-input" type="password" name="password_confirmation" placeholder="Ulangi kata sandi baru">
|
|
</div>
|
|
<button type="submit" class="btn-full btn-save">Simpan perubahan</button>
|
|
</form>
|
|
<div class="divider"></div>
|
|
<form method="POST" action="{{ route('logout') }}">
|
|
@csrf
|
|
<button type="submit" class="btn-full btn-keluar">Keluar dari akun</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
function previewFoto(input) {
|
|
if (input.files && input.files[0]) {
|
|
const reader = new FileReader();
|
|
reader.onload = e => {
|
|
const preview = document.getElementById('avatar-preview');
|
|
const initial = document.getElementById('avatar-initial');
|
|
preview.src = e.target.result;
|
|
preview.style.display = 'block';
|
|
if (initial) initial.style.display = 'none';
|
|
};
|
|
reader.readAsDataURL(input.files[0]);
|
|
}
|
|
}
|
|
</script>
|
|
@endpush |