dstpabuaran.com/.ai/CONTEXT.md
Yoga Pangestu 0023309a8f Refactor services to improve role checks and streamline data retrieval
- Updated CustomerService to simplify getAll method.
- Refactored ProductService to utilize HasRoleChecks trait and improved role verification logic.
- Enhanced ProductVariantService with new methods for fetching data for restocking and transactions.
- Cleaned up RawMaterialService by removing unused methods and improving data retrieval.
- Adjusted SupplierService to streamline getAll method.
- Refactored RoleService to use Spatie's Role model and improved role filtering logic.
- Updated NotificationService to handle role labels more effectively.
- Improved StockMutationService by removing redundant paginated method.
- Cleaned up various frontend components to directly accept necessary props instead of nested data objects.
- Updated tests to reflect changes in service method names and ensure proper notification handling.
2026-08-09 11:33:25 +07:00

89 lines
4.7 KiB
Markdown

# DST Collection — Project Context
## Tentang Project
**DST Collection** adalah aplikasi ERP untuk brand pakaian wanita (daster, dress, dll). Aplikasi ini mengelola dua area bisnis utama:
1. **Toko** — penjualan, produk, keuangan, HR
2. **Konveksi** — bahan baku, cutting, pembelian bahan
## Tech Stack
| Layer | Technology |
|-------|------------|
| Backend | Laravel 13, PHP 8.3 |
| Frontend | React 19, Inertia.js 3, TypeScript |
| UI | shadcn/ui, Radix UI, Tailwind CSS 4 |
| Auth | Laravel Fortify, Spatie Permission |
| DB | MySQL (SoftDeletes di semua model utama) |
## Roles & Akses
### role: `developer`, `owner`
- **Akses**: Semua module, semua aksi
- **Catatan**: Selalu muncul di semua sidebar
### role: `admin-toko`
- **Akses**: Full CRUD semua module toko
- **Modules**: Kategori, Produk, Customer, Transaksi, Restock, Kas Toko, Pengeluaran, Kasbon, Gaji, Pegawai, Presensi, Cuti, Settings
- **Catatan**: TIDAK akses Supplier, Bahan Baku, Belanja, Cutting
### role: `direktur`
- **Akses**: Readonly semua data toko + bisa ajukan kasbon
- **Modules**: Semua module toko (readonly), kecuali Supplier, Bahan Baku, Belanja, Cutting
- **Catatan**: Bisa lihat semua data pegawai toko, tapi bukan admin bahan baku
### role: `admin-bahan-baku`
- **Akses**: Full CRUD untuk konveksi
- **Modules**: Bahan Baku, Supplier, Belanja, Cutting, Pegawai (hanya role admin-bahan-baku), Kasbon (lihat semua + ACC/bayar)
- **Catatan**: TIDAK akses module toko lainnya
### role: `cashier`
- **Akses**: Transaksi (full CRUD), Customer (full CRUD), Produk (readonly), Kasbon (CRUD own data)
- **Modules**: Transaksi, Customer, Produk (view), Kasbon, Gaji (view), Presensi, Cuti
### role: `marketing-offline`, `marketing-online`
- **Akses**: Transaksi (readonly yang punya dia), Produk (readonly), Customer (full CRUD)
- **Modules**: Transaksi (view only own), Produk (view), Customer, Kasbon (CRUD own data), Presensi, Cuti
### role: `stok-opname`
- **Akses**: Stok Opname (full CRUD + submit)
- **Modules**: Stok Opname, Produk (view), Presensi, Cuti
### role: `non-operator`
- **Akses**: Basic (dashboard, presensi, cuti, kasbon)
- **Modules**: Presensi, Cuti, Kasbon (CRUD own data)
## Module Overview
| # | Module | Route Group | Controller Path | Service Path |
|---|--------|-------------|-----------------|--------------|
| 1 | Kategori | `admin/master/categories` | `Admin/Master/CategoryController` | `Admin/Master/CategoryService` |
| 2 | Produk | `admin/master/products` | `Admin/Master/Product/ProductController` | `Admin/Master/Product/ProductService` |
| 3 | Bahan Baku | `admin/master/raw-materials` | `Admin/Master/RawMaterial/RawMaterialController` | `Admin/Master/RawMaterial/RawMaterialService` |
| 4 | Supplier | `admin/master/suppliers` | `Admin/Master/SupplierController` | `Admin/Master/SupplierService` |
| 5 | Customer | `admin/master/customers` | `Admin/Master/CustomerController` | `Admin/Master/CustomerService` |
| 6 | Belanja | `admin/manage/purchases` | `Admin/Manage/PurchaseController` | `Admin/Manage/PurchaseService` |
| 7 | Cutting | `admin/manage/cuttings` | `Admin/Manage/CuttingController` | `Admin/Manage/CuttingService` |
| 8 | Transaksi | `admin/manage/transactions` | `Admin/Manage/TransactionController` | `Admin/Manage/TransactionService` |
| 9 | Restock | `admin/manage/restocks` | `Admin/Manage/RestockController` | `Admin/Manage/RestockService` |
| 10 | Stok Opname | `admin/manage/stok-opnames` | (via StockMutationController) | — |
| 11 | Kas Toko | `admin/finance/cash-accounts` | `Admin/Finance/CashAccountController` | `Admin/Finance/Cash/CashAccountService`, `Admin/Finance/Cash/CashTransactionService` |
| 12 | Pengeluaran | `admin/finance/expenses` | `Admin/Finance/ExpenseController` | `Admin/Finance/ExpenseService` |
| 13 | Kasbon | `admin/finance/employee-advances` | `Admin/Finance/EmployeeAdvanceController` | `Admin/Finance/EmployeeAdvanceService` |
| 14 | Gaji | `admin/finance/payroll-periods` | `Admin/Finance/PayrollController` | `Admin/Finance/Payroll/PayrollPeriodService`, `Admin/Finance/Payroll/PayrollAdjustmentService` |
| 15 | Pegawai | `admin/hr/employees` | `Admin/HR/EmployeeController` | `Admin/HR/EmployeeService` |
| 16 | Presensi | `admin/hr/attendances` | `Admin/HR/AttendanceController` | `Admin/HR/AttendanceService` |
| 17 | Cuti | `admin/hr/leave-requests` | `Admin/HR/LeaveRequestController` | `Admin/HR/LeaveRequestService` |
| 18 | Role & Permission | `admin/settings/roles` | `Admin/RoleController` | `Admin/Settings/RoleService` |
| 19 | Pengaturan | `admin/settings` | `Admin/AdminSettingsController` | `Admin/AdminSettingsService` |
## Statistics
| Metric | Count |
|--------|-------|
| Tables | 48 |
| Models | 43 |
| Enums | 21 |
| Services | 30 |
| Controllers | 32 |
| Roles | 9 |
| Permissions | ~120 |