diff --git a/app/Http/Controllers/Web/Konfigurasi/ProfileController.php b/app/Http/Controllers/Web/Konfigurasi/ProfileController.php index bc91d21..0bd16df 100644 --- a/app/Http/Controllers/Web/Konfigurasi/ProfileController.php +++ b/app/Http/Controllers/Web/Konfigurasi/ProfileController.php @@ -5,7 +5,16 @@ namespace App\Http\Controllers\Web\Konfigurasi; use App\Http\Controllers\Controller; use App\Models\User; use App\Models\Profile; +use App\Models\Pertanian\Lahan; +use App\Models\Pertanian\Komoditas; +use App\Models\Pertanian\Tanaman; +use App\Models\Wilayah\DesaKelurahan; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Validator; @@ -13,9 +22,221 @@ class ProfileController extends Controller { public function index() { - $userid = auth()->user()->id; - $profile = Profile::where('user_id', $userid)->first(); + $user = auth()->user(); + $profile = Profile::where('user_id', $user->id)->first(); + + $profileId = $profile?->id; + $jumlahLahan = $profileId ? Lahan::where('profile_id', $profileId)->count() : 0; + $totalLuasLahan = $profileId ? Lahan::where('profile_id', $profileId)->sum('luas_lahan') : 0; + $jumlahTanaman = $profileId ? Tanaman::where('profile_id', $profileId)->count() : 0; + $jumlahKomoditas = $profileId + ? Tanaman::where('profile_id', $profileId)->whereNotNull('komoditas_id')->distinct('komoditas_id')->count('komoditas_id') + : 0; + $problemSummary = $this->getProblemSummary(); + + $activities = $this->getProfileActivities($user, $profile); + $title = 'Profile'; - return view('konfigurasi.profile.index', compact('title', 'profile')); + return view('konfigurasi.profile.index', compact('title', 'profile', 'jumlahKomoditas', 'jumlahLahan', 'totalLuasLahan', 'jumlahTanaman', 'activities', 'problemSummary')); + } + + public function security() + { + $user = auth()->user(); + $profile = Profile::where('user_id', $user->id)->first(); + $loginSessions = $this->getLoginSessions($user); + $title = 'Keamanan Akun'; + + return view('konfigurasi.profile.security', compact('title', 'profile', 'loginSessions')); + } + + public function activities() + { + $user = auth()->user(); + $profile = Profile::where('user_id', $user->id)->first(); + + return response()->json([ + 'activities' => $this->getProfileActivities($user, $profile)->values(), + ]); + } + + public function updatePassword(Request $request) + { + $request->validate([ + 'current_password' => ['required', 'current_password'], + 'password' => ['required', 'string', 'min:8', 'confirmed'], + ], [ + 'current_password.current_password' => 'Password saat ini tidak sesuai.', + 'password.confirmed' => 'Konfirmasi password baru tidak cocok.', + 'password.min' => 'Password baru minimal 8 karakter.', + ]); + + $request->user()->update([ + 'password' => Hash::make($request->password), + ]); + + return back()->with('security_success', 'Password berhasil diperbarui.'); + } + + public function logoutDevices(Request $request) + { + if (Schema::hasTable('sessions')) { + DB::table('sessions') + ->where('user_id', $request->user()->id) + ->delete(); + } + + Auth::logout(); + + $request->session()->invalidate(); + $request->session()->regenerateToken(); + + return redirect()->route('login')->with('success', 'Berhasil logout dari semua perangkat.'); + } + + private function getLoginSessions(User $user) + { + if (!Schema::hasTable('sessions')) { + return collect(); + } + + return DB::table('sessions') + ->where('user_id', $user->id) + ->orderByDesc('last_activity') + ->limit(5) + ->get() + ->map(function ($session) { + return (object) [ + 'id' => $session->id, + 'ip_address' => $session->ip_address, + 'user_agent' => $session->user_agent, + 'last_activity' => \Carbon\Carbon::createFromTimestamp($session->last_activity), + 'is_current' => $session->id === session()->getId(), + ]; + }); + } + + private function getProblemSummary(): array + { + return [ + [ + 'label' => 'User belum diverifikasi', + 'count' => User::whereNull('email_verified_at')->count(), + 'icon' => 'tabler-user-exclamation', + 'color' => 'warning', + 'url' => route('users.index', ['tab' => 'pending']), + ], + [ + 'label' => 'Profile tanpa user', + 'count' => Profile::whereNull('user_id') + ->orWhereDoesntHave('user') + ->count(), + 'icon' => 'tabler-id-off', + 'color' => 'danger', + 'url' => route('profile.index'), + ], + [ + 'label' => 'Lahan tanpa luas', + 'count' => Lahan::whereNull('luas_lahan') + ->orWhere('luas_lahan', '<=', 0) + ->count(), + 'icon' => 'tabler-map-off', + 'color' => 'warning', + 'url' => route('lahan.index'), + ], + [ + 'label' => 'Tanaman tanpa komoditas', + 'count' => Tanaman::whereNull('komoditas_id')->count(), + 'icon' => 'tabler-plant-off', + 'color' => 'warning', + 'url' => route('tanaman.index'), + ], + [ + 'label' => 'Wilayah/desa tidak lengkap', + 'count' => DesaKelurahan::withoutGlobalScopes() + ->where(function (Builder $query) { + $query->whereNull('kode') + ->orWhere('kode', '') + ->orWhereNull('nama') + ->orWhere('nama', '') + ->orWhereNull('kecamatan_id') + ->orWhereNull('path'); + }) + ->count(), + 'icon' => 'tabler-map-pin-exclamation', + 'color' => 'info', + 'url' => route('desakelurahan.index'), + ], + ]; + } + + private function getProfileActivities(User $user, ?Profile $profile, int $limit = 20) + { + $sources = [ + ['model' => Profile::class, 'label' => 'Profil', 'name' => 'nama', 'profile_field' => null], + ['model' => Lahan::class, 'label' => 'Lahan', 'name' => 'nama', 'profile_field' => 'profile_id'], + ['model' => Tanaman::class, 'label' => 'Tanaman', 'name' => 'nama', 'profile_field' => 'profile_id'], + ['model' => Komoditas::class, 'label' => 'Komoditas', 'name' => 'nama', 'profile_field' => null], + ]; + + $activities = collect(); + + foreach ($sources as $source) { + $query = $source['model']::withTrashed(); + + $query->where(function ($query) use ($user) { + $query->where('created_by', $user->id) + ->orWhere('updated_by', $user->id) + ->orWhere('deleted_by', $user->id); + }); + + $query->where(function (Builder $query) { + $query->where('created_at', '>=', now()->subWeeks(2)) + ->orWhere('updated_at', '>=', now()->subWeeks(2)) + ->orWhere('deleted_at', '>=', now()->subWeeks(2)); + }); + + $query->latest('updated_at') + ->limit($limit) + ->get() + ->each(function ($record) use ($activities, $source) { + $activities->push($this->formatActivity($record, $source)); + }); + } + + return $activities + ->sortByDesc('sort_time') + ->take($limit) + ->values() + ->map(function ($activity) { + unset($activity['sort_time']); + return $activity; + }); + } + + private function formatActivity($record, array $source): array + { + $name = $record->{$source['name']} ?? 'Tanpa nama'; + $timestamp = $record->created_at; + $action = 'Menambahkan'; + $color = 'success'; + + if ($record->deleted_at) { + $timestamp = $record->deleted_at; + $action = 'Menghapus'; + $color = 'danger'; + } elseif ($record->updated_at && $record->created_at && $record->updated_at->gt($record->created_at)) { + $timestamp = $record->updated_at; + $action = 'Memperbarui'; + $color = 'primary'; + } + + return [ + 'title' => "{$action} {$source['label']}", + 'description' => "{$source['label']} {$name}", + 'time' => $timestamp ? $timestamp->diffForHumans() : '-', + 'color' => $color, + 'sort_time' => $timestamp, + ]; } } diff --git a/app/Http/Controllers/Web/Produktivitas/KualitasController.php b/app/Http/Controllers/Web/Produktivitas/KualitasController.php new file mode 100644 index 0000000..084571a --- /dev/null +++ b/app/Http/Controllers/Web/Produktivitas/KualitasController.php @@ -0,0 +1,162 @@ +orderBy('created_at', 'desc'); + + if ($request->filled('search')) { + $query->where(function ($q) use ($request) { + $search = '%' . $request->search . '%'; + $q->where('grade', 'like', $search) + ->orWhere('pemeriksa', 'like', $search) + ->orWhereHas('profile', fn ($profile) => $profile->where('nama', 'like', $search)) + ->orWhereHas('komoditas', fn ($komoditas) => $komoditas->where('nama', 'like', $search)) + ->orWhereHas('produksi', fn ($produksi) => $produksi->where('kode_produksi', 'like', $search)); + }); + } + + if ($request->filled('status_kelayakan')) { + $query->where('status_kelayakan', $request->status_kelayakan); + } + + $kualitas = $query->paginate($request->per_page ?? 10); + + return view('produktivitas.kualitas.index', compact('kualitas')); + } + + public function create() + { + return view('produktivitas.kualitas.add', $this->formData()); + } + + public function store(Request $request) + { + $validator = $this->validator($request); + + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(); + } + + Kualitas::create($this->payload($request) + [ + 'created_by' => auth()->id(), + 'updated_by' => auth()->id(), + ]); + + return redirect()->route('kualitas.index')->with('success', 'Data kualitas berhasil ditambahkan.'); + } + + public function show($id) + { + $kualitas = Kualitas::with(['produksi', 'profile', 'lahan', 'komoditas'])->findOrFail($id); + + return view('produktivitas.kualitas.view', compact('kualitas')); + } + + public function edit($id) + { + $kualitas = Kualitas::findOrFail($id); + + return view('produktivitas.kualitas.edit', $this->formData() + compact('kualitas')); + } + + public function update(Request $request, $id) + { + $validator = $this->validator($request); + + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(); + } + + $kualitas = Kualitas::findOrFail($id); + $kualitas->update($this->payload($request) + [ + 'updated_by' => auth()->id(), + ]); + + return redirect()->route('kualitas.index')->with('success', 'Data kualitas berhasil diperbarui.'); + } + + public function destroy($id) + { + $kualitas = Kualitas::findOrFail($id); + $kualitas->update(['deleted_by' => auth()->id()]); + $kualitas->delete(); + + return response()->json(['status' => 'success', 'message' => 'Data kualitas berhasil dihapus.']); + } + + private function formData(): array + { + return [ + 'produksi' => Produksi::with(['komoditas', 'profile'])->orderBy('created_at', 'desc')->get(), + 'profiles' => Profile::where('role', Role::PETANI->value)->orderBy('nama')->get(), + 'lahan' => Lahan::whereHas('profile', function ($query) { + $query->where('role', Role::PETANI->value); + })->orderBy('nama')->get(), + 'komoditas' => Komoditas::orderBy('nama')->get(), + ]; + } + + private function validator(Request $request) + { + return Validator::make($request->all(), [ + 'produksi_id' => ['nullable', 'exists:produksi,id'], + 'profile_id' => [ + 'required', + Rule::exists('profiles', 'id')->where('role', Role::PETANI->value), + ], + 'lahan_id' => [ + 'required', + Rule::exists('map_lahan', 'id')->where('profile_id', $request->profile_id), + ], + 'komoditas_id' => ['required', 'exists:master_komoditas,id'], + 'tanggal_pemeriksaan' => ['nullable', 'date'], + 'grade' => ['required', 'string', 'max:50'], + 'kadar_air' => ['nullable', 'numeric', 'min:0'], + 'berat_bersih' => ['nullable', 'numeric', 'min:0'], + 'berat_rusak' => ['nullable', 'numeric', 'min:0'], + 'standar_mutu' => ['nullable', 'string', 'max:255'], + 'status_kelayakan' => ['required', 'in:layak,perlu_sortir,tidak_layak'], + 'pemeriksa' => ['nullable', 'string', 'max:255'], + 'catatan' => ['nullable', 'string'], + ]); + } + + private function payload(Request $request): array + { + $beratBersih = (float) $request->berat_bersih; + $beratRusak = (float) $request->berat_rusak; + + return [ + 'produksi_id' => $request->produksi_id, + 'profile_id' => $request->profile_id, + 'lahan_id' => $request->lahan_id, + 'komoditas_id' => $request->komoditas_id, + 'tanggal_pemeriksaan' => $request->tanggal_pemeriksaan, + 'grade' => $request->grade, + 'kadar_air' => $request->kadar_air, + 'berat_bersih' => $request->berat_bersih, + 'berat_rusak' => $request->berat_rusak, + 'persentase_kerusakan' => $beratBersih > 0 ? round(($beratRusak / $beratBersih) * 100, 2) : null, + 'standar_mutu' => $request->standar_mutu, + 'status_kelayakan' => $request->status_kelayakan, + 'pemeriksa' => $request->pemeriksa, + 'catatan' => $request->catatan, + ]; + } +} diff --git a/app/Http/Controllers/Web/Produktivitas/ProduksiController.php b/app/Http/Controllers/Web/Produktivitas/ProduksiController.php new file mode 100644 index 0000000..c90b825 --- /dev/null +++ b/app/Http/Controllers/Web/Produktivitas/ProduksiController.php @@ -0,0 +1,162 @@ +orderBy('created_at', 'desc'); + + if ($request->filled('search')) { + $query->where(function ($q) use ($request) { + $search = '%' . $request->search . '%'; + $q->where('kode_produksi', 'like', $search) + ->orWhere('periode', 'like', $search) + ->orWhereHas('profile', fn ($profile) => $profile->where('nama', 'like', $search)) + ->orWhereHas('lahan', fn ($lahan) => $lahan->where('nama', 'like', $search)) + ->orWhereHas('komoditas', fn ($komoditas) => $komoditas->where('nama', 'like', $search)); + }); + } + + if ($request->filled('status_panen')) { + $query->where('status_panen', $request->status_panen); + } + + $produksi = $query->paginate($request->per_page ?? 10); + + return view('produktivitas.produksi.index', compact('produksi')); + } + + public function create() + { + return view('produktivitas.produksi.add', $this->formData()); + } + + public function store(Request $request) + { + $validator = $this->validator($request); + + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(); + } + + Produksi::create($this->payload($request) + [ + 'created_by' => auth()->id(), + 'updated_by' => auth()->id(), + ]); + + return redirect()->route('produksi.index')->with('success', 'Data produksi berhasil ditambahkan.'); + } + + public function show($id) + { + $produksi = Produksi::with(['profile', 'lahan', 'tanaman', 'komoditas', 'kualitas'])->findOrFail($id); + + return view('produktivitas.produksi.view', compact('produksi')); + } + + public function edit($id) + { + $produksi = Produksi::findOrFail($id); + + return view('produktivitas.produksi.edit', $this->formData() + compact('produksi')); + } + + public function update(Request $request, $id) + { + $validator = $this->validator($request); + + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(); + } + + $produksi = Produksi::findOrFail($id); + $produksi->update($this->payload($request) + [ + 'updated_by' => auth()->id(), + ]); + + return redirect()->route('produksi.index')->with('success', 'Data produksi berhasil diperbarui.'); + } + + public function destroy($id) + { + $produksi = Produksi::findOrFail($id); + $produksi->update(['deleted_by' => auth()->id()]); + $produksi->delete(); + + return response()->json(['status' => 'success', 'message' => 'Data produksi berhasil dihapus.']); + } + + private function formData(): array + { + return [ + 'profiles' => Profile::where('role', Role::PETANI->value)->orderBy('nama')->get(), + 'lahan' => Lahan::whereHas('profile', function ($query) { + $query->where('role', Role::PETANI->value); + })->orderBy('nama')->get(), + 'tanaman' => Tanaman::with('komoditas')->orderBy('nama')->get(), + 'komoditas' => Komoditas::orderBy('nama')->get(), + ]; + } + + private function validator(Request $request) + { + return Validator::make($request->all(), [ + 'kode_produksi' => ['nullable', 'string', 'max:255'], + 'profile_id' => [ + 'required', + Rule::exists('profiles', 'id')->where('role', Role::PETANI->value), + ], + 'lahan_id' => [ + 'required', + Rule::exists('map_lahan', 'id')->where('profile_id', $request->profile_id), + ], + 'tanaman_id' => ['nullable', 'exists:map_tanaman,id'], + 'komoditas_id' => ['required', 'exists:master_komoditas,id'], + 'periode' => ['nullable', 'string', 'max:255'], + 'tanggal_panen' => ['nullable', 'date'], + 'luas_tanam' => ['nullable', 'numeric', 'min:0'], + 'luas_panen' => ['nullable', 'numeric', 'min:0'], + 'jumlah_panen' => ['nullable', 'numeric', 'min:0'], + 'satuan' => ['required', 'string', 'max:20'], + 'status_panen' => ['required', 'in:belum_panen,panen_sebagian,selesai'], + 'catatan' => ['nullable', 'string'], + ]); + } + + private function payload(Request $request): array + { + $luasPanen = (float) $request->luas_panen; + $jumlahPanen = (float) $request->jumlah_panen; + + return [ + 'kode_produksi' => $request->kode_produksi, + 'profile_id' => $request->profile_id, + 'lahan_id' => $request->lahan_id, + 'tanaman_id' => $request->tanaman_id, + 'komoditas_id' => $request->komoditas_id, + 'periode' => $request->periode, + 'tanggal_panen' => $request->tanggal_panen, + 'luas_tanam' => $request->luas_tanam, + 'luas_panen' => $request->luas_panen, + 'jumlah_panen' => $request->jumlah_panen, + 'satuan' => $request->satuan, + 'produktivitas' => $luasPanen > 0 ? round($jumlahPanen / $luasPanen, 2) : null, + 'status_panen' => $request->status_panen, + 'catatan' => $request->catatan, + ]; + } +} diff --git a/app/Http/Controllers/Web/Produktivitas/ProfileController.php b/app/Http/Controllers/Web/Produktivitas/ProfileController.php index 7424625..4f637b0 100644 --- a/app/Http/Controllers/Web/Produktivitas/ProfileController.php +++ b/app/Http/Controllers/Web/Produktivitas/ProfileController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Web\Produktivitas; use App\Http\Controllers\Controller; use Illuminate\Http\Request; +use App\Enums\Role; use App\Models\Wilayah\Provinsi; use App\Models\Profile; use App\Models\User; @@ -18,11 +19,15 @@ class ProfileController extends Controller $provinsi = Provinsi::orderBy('nama', 'asc')->get(); // Query untuk tabel dengan fitur search dan pagination - $query = Profile::with('desakelurahan')->orderBy('created_at', 'desc'); + $query = Profile::with('desakelurahan') + ->where('role', Role::PETANI->value) + ->orderBy('created_at', 'desc'); if ($request->search) { - $query->where('nama', 'like', '%' . $request->search . '%') - ->orWhere('email', 'like', '%' . $request->search . '%'); + $query->where(function ($query) use ($request) { + $query->where('nama', 'like', '%' . $request->search . '%') + ->orWhere('email', 'like', '%' . $request->search . '%'); + }); } $profiles = $query->paginate($request->per_page ?? 10); diff --git a/app/Models/Pertanian/Kualitas.php b/app/Models/Pertanian/Kualitas.php new file mode 100644 index 0000000..062d782 --- /dev/null +++ b/app/Models/Pertanian/Kualitas.php @@ -0,0 +1,58 @@ + 'date', + ]; + + public function produksi() + { + return $this->belongsTo(Produksi::class, 'produksi_id'); + } + + public function profile() + { + return $this->belongsTo(Profile::class, 'profile_id'); + } + + public function lahan() + { + return $this->belongsTo(Lahan::class, 'lahan_id'); + } + + public function komoditas() + { + return $this->belongsTo(Komoditas::class, 'komoditas_id'); + } +} diff --git a/app/Models/Pertanian/Produksi.php b/app/Models/Pertanian/Produksi.php new file mode 100644 index 0000000..ce1cab2 --- /dev/null +++ b/app/Models/Pertanian/Produksi.php @@ -0,0 +1,63 @@ + 'date', + ]; + + public function profile() + { + return $this->belongsTo(Profile::class, 'profile_id'); + } + + public function lahan() + { + return $this->belongsTo(Lahan::class, 'lahan_id'); + } + + public function tanaman() + { + return $this->belongsTo(Tanaman::class, 'tanaman_id'); + } + + public function komoditas() + { + return $this->belongsTo(Komoditas::class, 'komoditas_id'); + } + + public function kualitas() + { + return $this->hasMany(Kualitas::class, 'produksi_id'); + } +} diff --git a/database/migrations/2026_06_05_000001_create_produksi_table.php b/database/migrations/2026_06_05_000001_create_produksi_table.php new file mode 100644 index 0000000..4055c25 --- /dev/null +++ b/database/migrations/2026_06_05_000001_create_produksi_table.php @@ -0,0 +1,39 @@ +id(); + $table->string('kode_produksi')->nullable(); + $table->foreignId('profile_id')->nullable()->constrained('profiles')->onDelete('set null'); + $table->foreignId('lahan_id')->nullable()->constrained('map_lahan')->onDelete('set null'); + $table->foreignId('tanaman_id')->nullable()->constrained('map_tanaman')->onDelete('set null'); + $table->foreignId('komoditas_id')->nullable()->constrained('master_komoditas')->onDelete('set null'); + $table->string('periode')->nullable(); + $table->date('tanggal_panen')->nullable(); + $table->decimal('luas_tanam', 12, 2)->nullable(); + $table->decimal('luas_panen', 12, 2)->nullable(); + $table->decimal('jumlah_panen', 12, 2)->nullable(); + $table->string('satuan', 20)->default('kg'); + $table->decimal('produktivitas', 12, 2)->nullable(); + $table->string('status_panen')->default('belum_panen'); + $table->text('catatan')->nullable(); + $table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null'); + $table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null'); + $table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('produksi'); + } +}; diff --git a/database/migrations/2026_06_05_000002_create_kualitas_table.php b/database/migrations/2026_06_05_000002_create_kualitas_table.php new file mode 100644 index 0000000..69101d9 --- /dev/null +++ b/database/migrations/2026_06_05_000002_create_kualitas_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignId('produksi_id')->nullable()->constrained('produksi')->onDelete('set null'); + $table->foreignId('profile_id')->nullable()->constrained('profiles')->onDelete('set null'); + $table->foreignId('lahan_id')->nullable()->constrained('map_lahan')->onDelete('set null'); + $table->foreignId('komoditas_id')->nullable()->constrained('master_komoditas')->onDelete('set null'); + $table->date('tanggal_pemeriksaan')->nullable(); + $table->string('grade')->nullable(); + $table->decimal('kadar_air', 8, 2)->nullable(); + $table->decimal('berat_bersih', 12, 2)->nullable(); + $table->decimal('berat_rusak', 12, 2)->nullable(); + $table->decimal('persentase_kerusakan', 8, 2)->nullable(); + $table->string('standar_mutu')->nullable(); + $table->string('status_kelayakan')->default('layak'); + $table->string('pemeriksa')->nullable(); + $table->text('catatan')->nullable(); + $table->foreignId('created_by')->nullable()->constrained('users')->onDelete('set null'); + $table->foreignId('updated_by')->nullable()->constrained('users')->onDelete('set null'); + $table->foreignId('deleted_by')->nullable()->constrained('users')->onDelete('set null'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('kualitas'); + } +}; diff --git a/resources/views/konfigurasi/profile/index.blade.php b/resources/views/konfigurasi/profile/index.blade.php index 988529f..da74468 100644 --- a/resources/views/konfigurasi/profile/index.blade.php +++ b/resources/views/konfigurasi/profile/index.blade.php @@ -1,6 +1,17 @@ @extends('layout.main') @section('content') +@php + $desa = $profile?->desaKelurahan; + $alamatLengkapParts = array_filter([ + $profile?->alamat, + $desa?->nama, + $desa?->kecamatan?->nama, + $desa?->kecamatan?->kabupatenkota?->nama, + $desa?->kecamatan?->kabupatenkota?->provinsi?->nama, + ]); + $alamatLengkap = count($alamatLengkapParts) ? implode(', ', $alamatLengkapParts) : null; +@endphp
@@ -37,9 +48,6 @@
- - Connected -
@@ -59,18 +67,8 @@ > - - @@ -85,28 +83,41 @@
-

Tentang Pengguna

+
+

Tentang Pengguna

+ @if($profile) + + @endif +

Kontak

-

Teams

+

Akun

@@ -135,19 +154,23 @@
-

Overview

+

Overview Profil

  • - Komoditas: 13.5k + Lahan Saya: {{ number_format($jumlahLahan) }}
  • - Jumlah Lahan: 146 + Luas Lahan Saya: {{ number_format($totalLuasLahan, 2) }} Ha +
  • +
  • + Tanaman Saya: {{ number_format($jumlahTanaman) }}
  • - Total Luas Lahan: 897 + Komoditas Saya: {{ number_format($jumlahKomoditas) }}
@@ -155,6 +178,34 @@
+ @if(auth()->user()->role === \App\Enums\Role::SUPER_ADMIN) +
+
+
+ Ringkasan Data Bermasalah +
+
+
+
    + @foreach($problemSummary as $problem) +
  • +
    + + {{ $problem['label'] }} +
    +
    + {{ number_format($problem['count']) }} + + + +
    +
  • + @endforeach +
+
+
+ @endif +
@@ -179,380 +230,229 @@
-
-
-
- -
-
-
-
Connections
-
- -
-
-
-
    -
  • -
    -
    -
    - Avatar -
    -
    -
    Cecilia Payne
    - 45 Connections -
    -
    -
    - -
    -
    -
  • -
  • -
    -
    -
    - Avatar -
    -
    -
    Curtis Fletcher
    - 1.32k Connections -
    -
    -
    - -
    -
    -
  • -
  • -
    -
    -
    - Avatar -
    -
    -
    Alice Stone
    - 125 Connections -
    -
    -
    - -
    -
    -
  • -
  • -
    -
    -
    - Avatar -
    -
    -
    Darrell Barnes
    - 456 Connections -
    -
    -
    - -
    -
    -
  • - -
  • -
    -
    -
    - Avatar -
    -
    -
    Eugenia Moore
    - 1.2k Connections -
    -
    -
    - -
    -
    -
  • -
  • - View all connections -
  • -
-
-
-
- - -
-
-
-
Teams
-
- -
-
-
-
    -
  • -
    -
    -
    - Avatar -
    -
    -
    React Developers
    - 72 Members -
    -
    -
    - Developer -
    -
    -
  • -
  • -
    -
    -
    - Avatar -
    -
    -
    Support Team
    - 122 Members -
    -
    -
    - Support -
    -
    -
  • -
  • -
    -
    -
    - Avatar -
    -
    -
    UI Designers
    - 7 Members -
    -
    -
    - Designer -
    -
    -
  • -
  • -
    -
    -
    - Avatar -
    -
    -
    Vue.js Developers
    - 289 Members -
    -
    -
    - Developer -
    -
    -
  • -
  • -
    -
    -
    - Avatar -
    -
    -
    Digital Marketing
    - 24 Members -
    -
    -
    - Marketing -
    -
    -
  • -
  • - View all teams -
  • -
-
-
-
- -
- - -
+ + @if($profile) +
+
+
Edit Profil
+ +
+
+
+ @csrf + @method('PUT') + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
Wilayah desa sampai provinsi tetap mengikuti data wilayah profil.
+
+ +
+ + +
+
+
+
+ @endif -@endsection \ No newline at end of file +@endsection + +@push('scripts-head') + +@endpush + +@push('scripts') + +@endpush diff --git a/resources/views/konfigurasi/profile/security.blade.php b/resources/views/konfigurasi/profile/security.blade.php new file mode 100644 index 0000000..5ebd385 --- /dev/null +++ b/resources/views/konfigurasi/profile/security.blade.php @@ -0,0 +1,147 @@ +@extends('layout.main') + +@section('content') +
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ Keamanan Akun +
+
+
+ @if(session('security_success')) +
{{ session('security_success') }}
+ @endif + +
+
+

Ubah Password

+
+ @csrf + @method('PATCH') +
+ + + @error('current_password')
{{ $message }}
@enderror +
+
+ + + @error('password')
{{ $message }}
@enderror +
+
+ + +
+ +
+
+ +
+

Status Verifikasi

+
    +
  • + + Email: + {{ auth()->user()->email }} +
  • +
  • + + Status: + @if(auth()->user()->email_verified_at) + Terverifikasi + @else + Belum Terverifikasi + @endif +
  • +
+ +
+

Riwayat Login

+
+ @csrf + +
+
+ +
    + @forelse($loginSessions as $loginSession) +
  • + +
    +
    + {{ $loginSession->ip_address ?? 'IP tidak tersedia' }} + @if($loginSession->is_current) + Saat Ini + @endif +
    + {{ $loginSession->last_activity->diffForHumans() }} + {{ $loginSession->user_agent ?? 'Perangkat tidak tersedia' }} +
    +
  • + @empty +
  • Riwayat login belum tersedia.
  • + @endforelse +
+
+
+
+
+
+@endsection diff --git a/resources/views/layout/sidebar.blade.php b/resources/views/layout/sidebar.blade.php index 1e8bf4b..80722c3 100644 --- a/resources/views/layout/sidebar.blade.php +++ b/resources/views/layout/sidebar.blade.php @@ -68,34 +68,41 @@ -