Phase 108 complete (v3.2 milestone):
Plan 108-01 — Delivery Status DB & CRUD:
- Tabela delivery_statuses z seedem 11 statusow systemowych
- DeliveryStatusRepository (CRUD + per-request static cache)
- DeliveryStatus::setRepository() — DB fallback dla static final class
- Panel /settings/delivery-statuses (zakladki Statusy + Mapowanie)
- Sidebar przebudowany: Statusy zamowien + Statusy przesylek
Plan 108-02 — Automation Dropdowns z DB + UI Refactor:
- Dropdowny automatyzacji ladowane z DB (warunek shipment_status + akcja update_shipment_status)
- Walidacja przez DeliveryStatus::getAllStatuses()
- Osobna podstrona formularza CRUD (delivery-status-form.php)
- Lista uproszczona: rename Terminal -> Koncowy, usunieta kolumna Typ
- BREAKING: drop backward compat dla starych grupowych kluczy automatyzacji
- Bug fix: path params w DeliveryStatusesController via \$request->input('id')
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
1.8 KiB
Markdown
29 lines
1.8 KiB
Markdown
# ARCHITECTURE
|
|
|
|
> Struktura klas, modulow, przeplywow i zaleznosci w projekcie.
|
|
|
|
## Phase 108 — Delivery Status Management
|
|
|
|
### DeliveryStatusRepository (`src/Modules/Shipments/DeliveryStatusRepository.php`)
|
|
- CRUD dla tabeli `delivery_statuses`
|
|
- Per-request static cache (`private static ?array $cache`)
|
|
- Blokuje edycję/usunięcie statusów systemowych (`is_system=1`)
|
|
- Blokuje usunięcie statusów używanych w `delivery_status_mappings` lub `shipment_packages`
|
|
|
|
### DeliveryStatusesController (`src/Modules/Settings/DeliveryStatusesController.php`)
|
|
- Panel `/settings/delivery-statuses`
|
|
- Dwie zakładki via `?tab=` param: `statuses` (CRUD) i `mapping` (embed mapowania)
|
|
- Wstrzykuje `DeliveryStatusRepository` i `DeliveryStatusMappingRepository`
|
|
|
|
### DeliveryStatus::setRepository() (dynamic loading)
|
|
- Wywoływane raz w `routes/web.php` po bootstrap
|
|
- `label()`, `getAllOptions()`, `getAllStatuses()`, `getColor()` ladują z DB gdy repo ustawione
|
|
- Fallback na hardcoded stałe gdy repo niedostępne
|
|
|
|
### AutomationController + AutomationService (Phase 108 Plan 02)
|
|
- `AutomationController::buildShipmentStatusOptions()` — buduje listę opcji `[key => ['label' => ...]]` z `DeliveryStatus::getAllOptions()` (DB-driven)
|
|
- Walidacja `shipment_status` warunku i `update_shipment_status` akcji w `parseConditionValue()`/`parseActionConfig()` używa `DeliveryStatus::getAllStatuses()`
|
|
- `AutomationService::evaluateShipmentStatusCondition()` — bezpośrednie porównanie kluczy DB (usunięto mapping grupowy `SHIPMENT_STATUS_OPTION_MAP`)
|
|
- `AutomationService::resolveStatusFromActionKey()` — bezpośredni klucz statusu z DB jako target
|
|
- BREAKING: stare reguły z grupowymi kluczami (`registered`, `courier_pickup`, `dropped_at_point`, `unclaimed`, `picked_up_return`) nie matchują się — operator musi je odtworzyć przy użyciu nowych kluczy DB
|