# USMS — Task Tracker & CRUD Progress

> Berdasarkan `project.md` — US Marshal Daily Report & Paycheck System (Laravel 10)

---

## 🏗️ FONDASI & INFRASTRUKTUR

- [x] Laravel 10 project setup
- [x] Composer install & dependencies
- [x] `.env` konfigurasi (DB, Discord, FiveManage)
- [x] Laravel Breeze v1.29 installed
- [x] Database `satumimpi_usms` dibuat & migrated
- [x] Layout portal (`layouts/portal.blade.php`) + sub-partials
- [x] Layout auth standalone (`layouts/auth.blade.php`)
- [x] Login page (`auth/login.blade.php`) — validasi, error, toggle password
- [x] `LoginController` — Auth::attempt, cek status aktif, redirect by role, update last_login
- [x] Route `login` / `logout` terpisah dari prefix portal
- [x] Middleware `IsAdmin` & `IsModerator` sudah ada
- [x] `Authenticate` middleware redirect ke `route('login')`

---

## 🗄️ DATABASE — MIGRATIONS & MODELS

### Tabel yang sudah ada (migrated ✅)
- [x] `users` — base Laravel + kolom USMS (`ic_name`, `badge_number`, `signature_image`, `profile_image`, `phone_number`, `role`, `status`, `last_login`)
- [x] `password_reset_tokens`
- [x] `failed_jobs`
- [x] `personal_access_tokens`

### Tabel yang BELUM dibuat ❌
- [ ] `activities` — `id`, `name`, `bonus_amount`
- [ ] `weapons` — `id`, `user_id`, `name`, `serial_number`
- [ ] `vehicles` — `id`, `user_id`, `name`, `plate_number`
- [ ] `absences` — `id`, `user_id`, `start_date`, `end_date`, `reason_ic`, `reason_ooc`
- [ ] `suspects` — `id`, `nik`, `nama`, `foto_suspect`, `cases` (JSON), `phone`, `notes`
- [ ] `reports` — `id`, `activity_id`, `title`, `incident_commander_id`, `briefing_activity`, `date`, `officers_involved`, `evidence`
- [ ] `user_reports` — `id`, `report_id`, `user_id`, `suspect_id`, `penal_code` (JSON)

### Models yang BELUM dibuat ❌
- [ ] `Activity`
- [ ] `Weapon`
- [ ] `Vehicle`
- [ ] `Absence`
- [ ] `Suspect`
- [ ] `Report`
- [ ] `UserReport`

---

## 🔐 AUTH & USER MANAGEMENT

### Auth
- [x] Login form & logic
- [x] Logout
- [x] Redirect by role (admin → `/portal/acp`, member → `/portal`)
- [x] Cek status akun (`active` / `pending` / `suspended`)
- [x] `AdminUserSeeder` — seed admin default (`admin@usms.local` / `password`)
- [ ] Register (hanya admin yang bisa tambah user — bukan self-register)

### Admin — User CRUD (`/portal/acp/users`)
- [x] Route resource terdaftar (index, create, store, show, edit, update, destroy)
- [x] Controller stub ada (`Admin\UserController`)
- [x] View stub ada (`admin/users/` — index, create, edit, show)
- [ ] `index` — listing users dengan search & filter status/role
- [ ] `create` — form tambah user baru (oleh admin)
- [ ] `store` — simpan user baru, hash password, set status pending
- [ ] `edit` — form edit user
- [ ] `update` — update data, termasuk ganti password jika diisi
- [ ] `show` — detail profil user (badge, weapons, vehicles, absences)
- [ ] `destroy` — hapus / ban user
- [ ] Ubah status user (pending → active / suspended / banned)

---

## 🎯 ACTIVITIES (Kategori Aktivitas & Bonus)

Admin-only CRUD untuk master data jenis aktivitas (Escorting, Full Trial, dll).

- [ ] Migration `create_activities_table`
- [ ] Model `Activity`
- [ ] Route resource `admin.activities`
- [ ] `Admin\ActivityController` — index, create, store, edit, update, destroy
- [ ] Views: index (list + bonus amount), create/edit form

---

## 🔫 WEAPONS (Registrasi Senjata)

- [ ] Migration `create_weapons_table`
- [ ] Model `Weapon` (belongsTo User)
- [ ] Route resource di portal member atau admin
- [ ] Controller & Views CRUD

---

## 🚗 VEHICLES (Registrasi Kendaraan)

- [ ] Migration `create_vehicles_table`
- [ ] Model `Vehicle` (belongsTo User)
- [ ] Route resource
- [ ] Controller & Views CRUD

---

## 📅 ABSENCES (Izin / Cuti)

- [ ] Migration `create_absences_table`
- [ ] Model `Absence` (belongsTo User)
- [ ] Route resource
- [ ] `AbsenceController` — member submit, admin/moderator approve/view
- [ ] Views: form submit izin, list izin per user

---

## 🕵️ SUSPECTS (Database Tersangka)

Core feature — Criminal Record.

- [ ] Migration `create_suspects_table`
- [ ] Model `Suspect` (`cases` di-cast sebagai JSON/array)
- [ ] Route resource (`admin.suspects` atau `portal.suspects`)
- [ ] `SuspectController` — index, create, store, edit, update, show, destroy
- [ ] Upload foto ke FiveManage CDN
- [ ] Views: list suspects (search by NIK/nama), detail, form create/edit
- [ ] Tampilkan riwayat `cases` (JSON) per suspect

---

## 📋 REPORTS (Incident Reporting)

Fitur utama — multi-officer incident report.

### Main Report (Incident Header)
- [ ] Migration `create_reports_table`
- [ ] Model `Report` (belongsTo Activity, belongsTo User as incident_commander, hasMany UserReport)
- [ ] Route resource
- [ ] `ReportController` — index, create, store, show, edit, update, destroy
- [ ] Upload evidence ke FiveManage CDN
- [ ] Auto-send notifikasi Discord saat report baru dibuat
- [ ] Views: list reports, detail report, form create/edit

### Sub-Report / User Report (Individual Contribution)
- [ ] Migration `create_user_reports_table`
- [ ] Model `UserReport` (belongsTo Report, belongsTo User, belongsTo Suspect, `penal_code` JSON)
- [ ] Controller untuk attach officer & suspect ke report
- [ ] Views: form tambah officer + tersangka ke incident

### Auto-Calculation Bonus
- [ ] Kalkulasi bonus officer berdasarkan activity yang diikuti
- [ ] Rekapitulasi gaji/bonus per periode (bulanan?)
- [ ] View paycheck summary per user

---

## 🔔 INTEGRASI DISCORD

- [ ] Notifikasi ke Discord channel saat report baru dibuat
- [ ] Embed Discord dengan detail: judul, aktivitas, commander, officer yang terlibat
- [ ] Config: `DISCORD_BOT_TOKEN`, `DISCORD_GUILD_ID` sudah ada di `.env`

---

## 🖼️ INTEGRASI FIVEMANAGE CDN

- [ ] Helper / Service untuk upload gambar ke FiveManage API
- [ ] `FIVEMANAGE_API_TOKEN` sudah ada di `.env`
- [ ] Digunakan di: foto suspect, evidence report, profile_image, signature_image user

---

## 🖥️ PORTAL VIEWS (Member-facing)

- [x] `portal/home.blade.php` — sudah ada (pakai `layouts.portal`)
- [x] `portal/dashboard.blade.php` — stub
- [x] `portal/forums.blade.php` — stub
- [ ] Portal home: Dashboard ringkasan (total report, total bonus, aktivitas terbaru)
- [ ] Portal: Halaman profil member (badge, weapons, vehicles, absences)
- [ ] Portal: Submit laporan (sebagai officer participant)
- [ ] Portal: Lihat paycheck / rekapitulasi bonus sendiri
- [ ] Portal: Submit izin/cuti

---

## 🛡️ ADMIN PANEL (`/portal/acp`)

- [x] Route ACP terdaftar (users, forums, categories)
- [x] Controller stubs ada
- [x] View stubs ada
- [ ] `admin/dashboard` — ringkasan: jumlah user, report bulan ini, total bonus dibayar
- [ ] User CRUD (detail di atas)
- [ ] Activity CRUD
- [ ] Suspect CRUD
- [ ] Report management (approve / review)
- [ ] Weapon & Vehicle registry (admin view semua)
- [ ] Absence management (approve/reject)

---

## 📊 PROGRESS SUMMARY

| Area | Selesai | Total | % |
|---|---|---|---|
| Fondasi & Auth | 15 | 16 | ~94% |
| Database / Migrations | 1 | 8 | 12% |
| Models | 1 | 8 | 12% |
| User CRUD (Admin) | 3 | 11 | 27% |
| Activities CRUD | 0 | 5 | 0% |
| Weapons CRUD | 0 | 4 | 0% |
| Vehicles CRUD | 0 | 4 | 0% |
| Absences CRUD | 0 | 5 | 0% |
| Suspects CRUD | 0 | 7 | 0% |
| Reports CRUD | 0 | 10 | 0% |
| Auto-Calc Bonus | 0 | 3 | 0% |
| Discord Integration | 0 | 3 | 0% |
| FiveManage CDN | 0 | 3 | 0% |
| Portal Views | 3 | 8 | 37% |
| Admin Panel Views | 3 | 10 | 30% |

---

## 🚦 URUTAN PENGERJAAN YANG DISARANKAN

1. **Migrations + Models** — buat semua tabel dulu (activities, weapons, vehicles, absences, suspects, reports, user_reports)
2. **Activities CRUD** (admin) — prerequisite untuk Reports
3. **User CRUD** (admin) — selesaikan store/update/destroy
4. **Suspects CRUD** (admin) — prerequisite untuk UserReport
5. **Reports CRUD** — fitur utama sistem
6. **UserReport** — relasi officer + suspect ke report
7. **Auto-calculation bonus** — kalkulasi paycheck
8. **Discord notification** — saat report dibuat
9. **FiveManage upload** — foto suspect & evidence
10. **Portal member views** — paycheck, profil, submit izin
11. **Weapons, Vehicles, Absences CRUD** — fitur pendukung
