Commit Graph

5 Commits

Author SHA1 Message Date
Kazem Alghasi
09b511808d feat(notifications): customer notifications on approve/request-changes + WP tab + badge + timezone Iran 2026-10-02 19:08:41 +03:30
Kazem Alghasi
8213ee7ee1 fix(shipment): ensure pending review existence during status transitions
Add logic to automatically create a pending shipment review if one
does not exist when transitioning shipment statuses. This ensures
the review lifecycle remains intact for shipments created through
paths that bypass initial review generation.

Also include migrations to make `user_id` and `status` nullable on
`shipment_checklists` to support unassigned or incomplete checklists.
2026-09-30 19:01:27 +03:30
Kazem Alghasi
b9b83ffecf feat(shipment): implement checklist templating and automated instantiation
Introduce a template-based system for shipment checklists to automate
the creation of required inspection items upon shipment approval.

- Add `ShipmentChecklistTemplate` model and migration to define reusable
  checklist structures.
- Extend `ShipmentChecklist` schema to support item titles, requirement
  flags, sorting, and attachment paths.
- Implement `instantiateChecklist` in `ShipmentReviewService` to
  automatically generate checklist items from active templates based on
  shipment direction (import/export).
- Refactor `ShipmentChecklistResource` and `ChecklistsRelationManager`
  in Filament to support the new data structure and improved UI.
- Update `ShipmentChecklist` model with helper methods for completion
  tracking and improved relationship handling.
2026-09-30 18:35:25 +03:30
Kazem Alghasi
7faa778e22 refactor(api): update shipment review logic to update existing reviews
Refactor `ShipmentReviewService` to update the existing pending review
instead of creating a new `ShipmentReview` record during the approval
and rejection processes. This ensures that the review lifecycle
correctly finalizes the current pending revision.

- Implement `getPendingReview` to retrieve the active pending review
- Update `approve` to modify the existing review record
- Update `reject` to modify the existing review record
- Add documentation clarifying when new revisions are created versus
  when existing ones are finalized
2026-09-29 04:37:55 +03:30
Kazem Alghasi
61a2643dd0 feat(api): implement shipment review and resubmission workflow
Introduces a complete shipment review system allowing staff to request
changes to customer orders and customers to resubmit corrected orders.

- Add `ReviewState` enum and `ShipmentReview` model to track review history.
- Implement `ShipmentReviewService` to handle approval and change
  request logic.
- Add `resubmit` endpoint for customers to update orders when
  `changes_requested` state is active.
- Add `request-changes` endpoint for staff to flag orders for correction.
- Update `ShipmentResource` in Filament to display review states and
  manage approvals.
- Implement WordPress bridge support for fetching and resubmitting
  orders via AJAX.
- Add database migrations for `shipment_reviews` table and `review_state`
  column on shipments.
- Add `StaffApiMiddleware` to secure staff-specific API routes.
2026-09-27 01:00:26 +03:30