chore: remove outdated documentation files for cooperation module
This commit is contained in:
parent
89fe9a339b
commit
ae85231356
@ -1,320 +0,0 @@
|
||||
# Modul Kerja Sama - Dokumentasi
|
||||
|
||||
## Overview
|
||||
Modul Kerja Sama adalah sistem manajemen kerjasama antara Admin dan Media Partner. Modul ini mengelola seluruh flow dari pengajuan kerjasama hingga pelaporan.
|
||||
|
||||
## Flow Kerja Sama
|
||||
|
||||
### 1. Admin Mengajukan Kerja Sama
|
||||
- Admin membuat data Cooperation baru dengan informasi:
|
||||
- Judul Kerja Sama
|
||||
- Tanggal Pengajuan Awal (initial_submission_date)
|
||||
- Tanggal Pengajuan Akhir (final_submission_date)
|
||||
- Deadline Media Order (assignment_deadline)
|
||||
- Deadline Verifikasi (verification_deadline)
|
||||
- Deskripsi
|
||||
- Admin mengirim pengajuan ke Media Partner (CooperationMedia)
|
||||
- Status awal: **MENUNGGU**
|
||||
|
||||
### 2. Media Menerima/Menolak Pengajuan
|
||||
- Media mereview pengajuan kerjasama dalam periode initial_submission_date sampai final_submission_date
|
||||
- Media dapat:
|
||||
- **MENERIMA**: Status berubah menjadi ACCEPTED, lanjut ke step 3
|
||||
- **MENOLAK**: Status berubah menjadi REJECTED, flow selesai (dengan alasan penolakan/rejection reason)
|
||||
|
||||
### 3. Media Mengajukan Proposal
|
||||
- Jika Media menerima, Media mengajukan proposal (CooperationProposal)
|
||||
- Proposal berisi:
|
||||
- Deskripsi
|
||||
- Tanggal mulai dan akhir proposed
|
||||
- E-Catalog
|
||||
- File dokumen (via Spatie Media Library)
|
||||
- Jurnalis yang terlibat
|
||||
- Status proposal: **MENUNGGU**
|
||||
|
||||
### 4. Admin Meninjau Proposal
|
||||
- Admin mereview proposal yang diajukan Media
|
||||
- Admin dapat:
|
||||
- **MENERIMA**: Status proposal menjadi ACCEPTED, lanjut ke step 5
|
||||
- **MENOLAK**: Status proposal menjadi REJECTED, Media harus ajukan ulang (dengan alasan penolakan)
|
||||
|
||||
### 5. Admin Kirim Media Order
|
||||
- Jika Admin menerima proposal, Admin membuat Task Assignment
|
||||
- Task Assignment berisi:
|
||||
- Start Date
|
||||
- End Date
|
||||
- Task Description
|
||||
- Report Amount (jumlah report yang harus dibuat)
|
||||
- Admin assign task ke Media Partner (TaskAssignmentMedia)
|
||||
- Status: **MENUNGGU**
|
||||
|
||||
### 6. Media Mengirim Laporan
|
||||
- Media membuat Report berdasarkan Task Assignment
|
||||
- Report berisi:
|
||||
- Title
|
||||
- Publication Date
|
||||
- Link
|
||||
- Description
|
||||
- Image (via Spatie Media Library)
|
||||
- Status report: **MENUNGGU** (untuk verifikasi admin)
|
||||
- Media dapat membuat multiple reports sesuai report_amount yang diminta
|
||||
|
||||
### 7. Admin Menerima/Menolak Laporan
|
||||
- Admin mereview laporan yang dikirim Media
|
||||
- Admin dapat:
|
||||
- **MENERIMA**: Status report menjadi ACCEPTED
|
||||
- **MENOLAK**: Status report menjadi REJECTED, Media harus kirim ulang (dengan alasan penolakan)
|
||||
|
||||
## Status Otomatis Berdasarkan Deadline
|
||||
|
||||
### Status Cooperation (otomatis berubah berdasarkan waktu):
|
||||
- **MENUNGGU**: Status awal ketika admin kirim kerja sama
|
||||
- **PENUGASAN**: Ketika tanggal final_submission_date habis (media sudah tidak bisa ajukan proposal)
|
||||
- **VERIFIKASI**: Ketika assignment_deadline habis (media sudah selesai kirim laporan)
|
||||
- **PEMBAYARAN**: Ketika verification_deadline habis (admin sudah selesai verifikasi laporan)
|
||||
- **COMPLETED**: Ketika pembayaran sudah selesai (payment_date diisi)
|
||||
|
||||
### Status Individual Components:
|
||||
- **ACCEPTED**: Diterima (untuk proposal, report, dll)
|
||||
- **REJECTED**: Ditolak (untuk proposal, report, dll) - selalu dengan alasan penolakan
|
||||
|
||||
## Database Schema
|
||||
|
||||
### Table: cooperations
|
||||
- id
|
||||
- title (varchar 200)
|
||||
- initial_submission_date (date) - Tanggal mulai pengajuan proposal
|
||||
- final_submission_date (date) - Tanggal akhir pengajuan proposal
|
||||
- assignment_deadline (date, nullable) - Deadline penyelesaian media order
|
||||
- verification_deadline (date, nullable) - Deadline verifikasi laporan
|
||||
- description (text)
|
||||
- payment_amount (unsigned integer, nullable) - Jumlah pembayaran
|
||||
- payment_date (date, nullable) - Tanggal pembayaran
|
||||
- status (enum: MENUNGGU, PENUGASAN, VERIFIKASI, PEMBAYARAN, COMPLETED, ACCEPTED, REJECTED)
|
||||
- created_at, updated_at, deleted_at
|
||||
|
||||
### Table: cooperation_media (Pivot)
|
||||
- id
|
||||
- cooperation_id (FK)
|
||||
- partner_media_id (FK)
|
||||
- status (enum: PENDING, ACCEPTED, REJECTED)
|
||||
- created_at, updated_at
|
||||
|
||||
### Table: cooperation_proposals
|
||||
- id
|
||||
- cooperation_id (FK)
|
||||
- partner_media_id (FK)
|
||||
- description (text, nullable)
|
||||
- e_catalog (varchar 50, nullable)
|
||||
- status (enum: PENDING, ACCEPTED, REJECTED)
|
||||
- created_at, updated_at
|
||||
|
||||
### Table: task_assignments
|
||||
- id
|
||||
- cooperation_id (FK)
|
||||
- start_date (date)
|
||||
- end_date (date)
|
||||
- task_description (text)
|
||||
- report_amount (unsigned integer)
|
||||
- status (enum: PENDING, ACCEPTED, REJECTED)
|
||||
- created_at, updated_at
|
||||
|
||||
### Table: task_assignment_media (Pivot)
|
||||
- id
|
||||
- task_assignment_id (FK)
|
||||
- partner_media_id (FK)
|
||||
- status (enum: PENDING, ACCEPTED, REJECTED)
|
||||
- created_at, updated_at
|
||||
|
||||
### Table: reports
|
||||
- id
|
||||
- task_assignment_id (FK)
|
||||
- title (varchar 200)
|
||||
- publication_date (date)
|
||||
- link (varchar 50, nullable)
|
||||
- description (text, nullable)
|
||||
- status (enum: MENUNGGU, ACCEPTED, REJECTED)
|
||||
- created_at, updated_at, deleted_at
|
||||
- Media files (handled by Spatie Media Library)
|
||||
|
||||
### Table: rejection_reasons (Polymorphic)
|
||||
- id
|
||||
- rejectable_type (morphs)
|
||||
- rejectable_id (morphs)
|
||||
- reason (text)
|
||||
- created_at, updated_at
|
||||
|
||||
## Models
|
||||
|
||||
### Cooperation
|
||||
**Location**: `app/Models/Cooperation.php`
|
||||
|
||||
**Relationships**:
|
||||
- `partnerMedia()`: BelongsToMany - Media yang terlibat dalam kerjasama
|
||||
- `cooperationMedia()`: HasMany - Pivot records dengan status
|
||||
- `cooperationProposals()`: HasMany - Proposal yang diupload media
|
||||
- `taskAssignment()`: HasOne - Task yang diberikan ke media
|
||||
|
||||
### CooperationMedia (Pivot)
|
||||
**Location**: `app/Models/CooperationMedia.php`
|
||||
|
||||
**Relationships**:
|
||||
- `cooperation()`: BelongsTo
|
||||
- `partnerMedia()`: BelongsTo
|
||||
- `rejectionReasons()`: MorphMany
|
||||
|
||||
### CooperationProposal
|
||||
**Location**: `app/Models/CooperationProposal.php`
|
||||
|
||||
**Relationships**:
|
||||
- `cooperation()`: BelongsTo
|
||||
- `partnerMedia()`: BelongsTo
|
||||
- `rejectionReasons()`: MorphMany
|
||||
|
||||
### TaskAssignment
|
||||
**Location**: `app/Models/TaskAssignment.php`
|
||||
|
||||
**Relationships**:
|
||||
- `cooperation()`: BelongsTo
|
||||
- `partnerMedia()`: BelongsToMany (via task_assignment_media)
|
||||
- `taskAssignmentMedia()`: HasMany
|
||||
- `rejectionReasons()`: MorphMany
|
||||
- `reports()`: HasMany (commented, needs to be uncommented)
|
||||
|
||||
### Report
|
||||
**Location**: `app/Models/Report.php`
|
||||
|
||||
**Relationships**:
|
||||
- `taskAssignment()`: BelongsTo
|
||||
- `rejectionReasons()`: MorphMany
|
||||
|
||||
**Implements**: HasMedia (Spatie Media Library) untuk handle image dan file attachments
|
||||
|
||||
**Implements**: HasMedia (Spatie Media Library)
|
||||
|
||||
### RejectionReason
|
||||
**Location**: `app/Models/RejectionReason.php`
|
||||
|
||||
**Relationships**:
|
||||
- `rejectable()`: MorphTo - Dapat digunakan untuk CooperationMedia, CooperationProposal, TaskAssignment, Report
|
||||
|
||||
## Filament Resources
|
||||
|
||||
### CooperationResource
|
||||
**Location**: `app/Filament/Resources/Manage/Cooperations/CooperationResource.php`
|
||||
|
||||
**Navigation**:
|
||||
- Group: Manage
|
||||
- Label: Kerja Sama
|
||||
- Icon: HandRaised
|
||||
- Sort: 20
|
||||
- Slug: manage/cooperations
|
||||
|
||||
**Pages**:
|
||||
- List: `/manage/cooperations`
|
||||
- Create: `/manage/cooperations/create`
|
||||
- Edit: `/manage/cooperations/{record}/edit`
|
||||
|
||||
**Form Fields** (CooperationForm):
|
||||
- Title (required, max 200)
|
||||
- Initial Submission Date (required, date)
|
||||
- Final Submission Date (required, date, after initial_submission_date)
|
||||
- Description (required, textarea)
|
||||
|
||||
**Table Columns** (CooperationsTable):
|
||||
- Title
|
||||
- Initial Submission Date
|
||||
- Final Submission Date
|
||||
- Description
|
||||
- Created At
|
||||
- Updated At
|
||||
|
||||
## Status Enum
|
||||
|
||||
### CooperationStatus
|
||||
**Location**: `app/Enums/CooperationStatus.php`
|
||||
|
||||
**Values**:
|
||||
- `MENUNGGU` (1): Menunggu - Status awal kerja sama
|
||||
- `PENUGASAN` (2): Media Order - Ketika deadline proposal habis
|
||||
- `VERIFIKASI` (3): Verifikasi - Ketika deadline media order habis
|
||||
- `PEMBAYARAN` (4): Pembayaran - Ketika verifikasi selesai
|
||||
- `COMPLETED` (5): Selesai - Ketika pembayaran selesai
|
||||
- `ACCEPTED` (6): Diterima - Untuk proposal/report yang diterima
|
||||
- `REJECTED` (7): Ditolak - Untuk proposal/report yang ditolak
|
||||
|
||||
**Colors**:
|
||||
- MENUNGGU: warning (yellow)
|
||||
- PENUGASAN: info (blue)
|
||||
- VERIFIKASI: primary (blue)
|
||||
- PEMBAYARAN: secondary (gray)
|
||||
- COMPLETED: success (green)
|
||||
- ACCEPTED: success (green)
|
||||
- REJECTED: danger (red)
|
||||
|
||||
## Next Steps / TODO
|
||||
|
||||
1. **Uncomment Report Relationship** di TaskAssignment model
|
||||
2. **Fix Status Colors** di CooperationStatus enum (ACCEPTED should be success, REJECTED should be danger)
|
||||
3. **Create Relation Managers** untuk:
|
||||
- CooperationMedia (di Cooperation Resource)
|
||||
- CooperationProposal (di Cooperation Resource)
|
||||
- TaskAssignment (di Cooperation Resource)
|
||||
- Report (di TaskAssignment Resource)
|
||||
4. **Create Custom Actions** untuk:
|
||||
- Send to Media (dari Cooperation)
|
||||
- Accept/Reject Cooperation (dari Media side)
|
||||
- Upload Proposal (dari Media side)
|
||||
- Accept/Reject Proposal (dari Admin side)
|
||||
- Create Task Assignment (dari Admin side)
|
||||
- Create Report (dari Media side)
|
||||
5. **Add Permissions** untuk role Admin dan Media
|
||||
6. **Create Notifications** untuk setiap perubahan status
|
||||
7. **Add Validation** untuk memastikan flow berjalan dengan benar
|
||||
8. **Create Dashboard Widgets** untuk monitoring kerjasama
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
app/
|
||||
├── Enums/
|
||||
│ └── CooperationStatus.php
|
||||
├── Filament/
|
||||
│ └── Resources/
|
||||
│ └── Manage/
|
||||
│ └── Cooperations/
|
||||
│ ├── CooperationResource.php
|
||||
│ ├── Pages/
|
||||
│ │ ├── ListCooperations.php
|
||||
│ │ ├── CreateCooperation.php
|
||||
│ │ └── EditCooperation.php
|
||||
│ ├── Schemas/
|
||||
│ │ └── CooperationForm.php
|
||||
│ └── Tables/
|
||||
│ └── CooperationsTable.php
|
||||
└── Models/
|
||||
├── Cooperation.php
|
||||
├── CooperationMedia.php
|
||||
├── CooperationProposal.php
|
||||
├── TaskAssignment.php
|
||||
├── Report.php
|
||||
└── RejectionReason.php
|
||||
|
||||
database/
|
||||
└── migrations/
|
||||
├── 2025_12_12_111212_create_cooperations_table.php
|
||||
├── 2025_12_12_111307_create_cooperation_media_table.php
|
||||
├── 2025_12_12_132245_create_cooperation_proposals_table.php
|
||||
├── 2025_12_12_132453_create_task_assignments_table.php
|
||||
├── 2025_12_12_133823_create_media_task_assignment_table.php
|
||||
├── 2025_12_12_135847_create_reports_table.php
|
||||
└── 2025_12_12_135855_create_rejection_reasons_table.php
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Semua tabel sudah di-migrate
|
||||
- Model Cooperation sudah dilengkapi dengan relationships
|
||||
- Resource Cooperation sudah dibuat dan siap digunakan
|
||||
- Typo di migration task_assignments sudah diperbaiki (task_description dari date ke text)
|
||||
- Icon Handshake diganti dengan HandRaised karena tidak tersedia di Heroicon
|
||||
@ -1,91 +0,0 @@
|
||||
# Clean Code Guidelines for Filament Resources
|
||||
|
||||
This document outlines the coding standards and structure for Filament Resources in this project.
|
||||
|
||||
## 1. Class Properties
|
||||
|
||||
Properties within the Resource class should be ordered alphabetically.
|
||||
|
||||
**Example:**
|
||||
```php
|
||||
protected static ?string $model = User::class;
|
||||
protected static ?string $navigationGroup = 'Master';
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::UserGroup;
|
||||
protected static ?string $navigationLabel = 'Pengguna';
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
protected static ?string $slug = 'master/users';
|
||||
```
|
||||
|
||||
## 2. Form Structure
|
||||
|
||||
Form components should be structured with method calls in the following order:
|
||||
|
||||
1. **Basic**: `make`, `label`, `placeholder`
|
||||
2. **HTML Attributes**: `autocomplete`, `autofocus`, etc.
|
||||
3. **Validation**: `required`, `maxLength`, `email`, `unique`, `regex`, etc.
|
||||
4. **Filament/Logic**: `relationship`, `live`, `afterStateUpdated`, etc.
|
||||
|
||||
**Formatting:**
|
||||
- Use a blank line between each component definition.
|
||||
|
||||
**Example:**
|
||||
```php
|
||||
TextInput::make('name')
|
||||
->label('Nama')
|
||||
->placeholder('John Doe')
|
||||
->autocomplete(false)
|
||||
->autofocus()
|
||||
->required()
|
||||
->maxLength(100),
|
||||
|
||||
TextInput::make('email')
|
||||
->label('Alamat Surel')
|
||||
->placeholder('email@example.com')
|
||||
->autocomplete(false)
|
||||
->required()
|
||||
->email(),
|
||||
```
|
||||
|
||||
## 3. Table Structure
|
||||
|
||||
### Columns
|
||||
Column definitions should be structured in the following order:
|
||||
|
||||
1. **Basic**: `make`, `label`
|
||||
2. **Search & Sort**: `searchable`, `sortable` (These should be present for most fields)
|
||||
3. **State & Attributes**: `getStateUsing`, `updateStateUsing`, `badge`, `icon`
|
||||
4. **Formatting**: `dateTime`, `money`, etc.
|
||||
|
||||
**Formatting:**
|
||||
- Use a blank line between each column definition.
|
||||
|
||||
**Example:**
|
||||
```php
|
||||
TextColumn::make('name')
|
||||
->label('Nama')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Status')
|
||||
->sortable()
|
||||
->updateStateUsing(...),
|
||||
```
|
||||
|
||||
### Table Method Order
|
||||
The methods chained to the `$table` object should follow this order:
|
||||
|
||||
1. `columns([\ ... ])`
|
||||
2. `filters([\ ... ])`
|
||||
3. `recordActions([\ ... ])` (or `actions`)
|
||||
4. `toolbarActions([\ ... ])` (or `headerActions`)
|
||||
5. `emptyStateIcon(...)`
|
||||
6. `emptyStateDescription(...)`
|
||||
7. `defaultSort(...)`
|
||||
8. `deferFilters(...)`
|
||||
9. Other configuration methods.
|
||||
|
||||
## 4. General Formatting
|
||||
|
||||
- Ensure consistent indentation.
|
||||
- Always use a blank line to separate distinct logical blocks or component definitions to improve readability.
|
||||
Loading…
Reference in New Issue
Block a user