feat: Identification of logistics operators / forklift drivers on phy…#197
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds logistics-operator identification to workers and introduces a pallet movement workflow. Operators can move eligible pallets through a terminal, movements are transactionally recorded with attribution and history, and admins can view movement records. ChangesPallet movement workflow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant MovePallet
participant PalletMovementController
participant PalletMovementService
participant PalletMovement
Operator->>MovePallet: Select operator, pallet, and destination
MovePallet->>PalletMovementController: Submit movement
PalletMovementController->>PalletMovementService: Record movement
PalletMovementService->>PalletMovement: Persist attribution and locations
PalletMovementService-->>MovePallet: Redirect with success message
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
backend/app/Http/Requests/StorePalletMovementRequest.php (1)
1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMissing AGPL-3.0 license header.
As per coding guidelines, files in
backend/app/**/*.phpshould keep license headers consistent with AGPL-3.0. Please add the standard license header to this new file.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/app/Http/Requests/StorePalletMovementRequest.php` at line 1, Add the repository’s standard AGPL-3.0 license header at the top of StorePalletMovementRequest.php, before the PHP opening tag, matching the formatting used by other files under backend/app.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/app/Http/Controllers/Web/Logistics/PalletMovementController.php`:
- Around line 53-67: Replace the unbounded operatorNames and palletNumbers
preload in the Inertia render flow with server-side pagination for pallet
movement history, or dynamic paginated lookup loading for operator and pallet
labels. Ensure the initial props do not query every distinct ID referenced by
PalletMovement, while preserving label resolution for displayed rows.
In `@backend/resources/js/Pages/admin/pallet-movements/Index.jsx`:
- Line 12: The Index component currently depends on unbounded operatorNames and
palletNumbers Inertia lookup maps; replace this full-history payload approach
with bounded or local label resolution. Prefer resolving labels from locally
synced pallets and workers data, or constrain movement and lookup data to a
defined recent window, while preserving ID fallbacks for unavailable or
soft-deleted records.
In `@backend/resources/js/Pages/logistics/MovePallet.jsx`:
- Around line 103-110: Replace outline-none with outline-hidden in the className
strings for both the to_location input and the related textarea in
MovePallet.jsx, covering the anchor site at
backend/resources/js/Pages/logistics/MovePallet.jsx lines 103-110 and sibling
site at lines 117-123. Leave the existing custom focus:ring styling unchanged.
---
Nitpick comments:
In `@backend/app/Http/Requests/StorePalletMovementRequest.php`:
- Line 1: Add the repository’s standard AGPL-3.0 license header at the top of
StorePalletMovementRequest.php, before the PHP opening tag, matching the
formatting used by other files under backend/app.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f6b56197-e741-4f79-ab1f-d506f61775bc
📒 Files selected for processing (25)
backend/app/Http/Controllers/Web/Admin/WorkerController.phpbackend/app/Http/Controllers/Web/Logistics/PalletMovementController.phpbackend/app/Http/Requests/StorePalletMovementRequest.phpbackend/app/Http/Requests/StoreWorkerRequest.phpbackend/app/Http/Requests/UpdateWorkerRequest.phpbackend/app/Models/PalletMovement.phpbackend/app/Models/Worker.phpbackend/app/Services/Logistics/PalletMovementService.phpbackend/app/Support/TabRegistry.phpbackend/app/Sync/CollectionBroadcaster.phpbackend/app/Sync/ShapeRegistry.phpbackend/database/factories/PalletMovementFactory.phpbackend/database/factories/WorkerFactory.phpbackend/database/migrations/2026_07_19_100000_add_is_logistics_to_workers_table.phpbackend/database/migrations/2026_07_19_100001_create_pallet_movements_table.phpbackend/lang/en.jsonbackend/lang/pl.jsonbackend/resources/js/Pages/admin/pallet-movements/Index.jsxbackend/resources/js/Pages/admin/workers/Create.jsxbackend/resources/js/Pages/admin/workers/Edit.jsxbackend/resources/js/Pages/admin/workers/WorkerForm.jsxbackend/resources/js/Pages/logistics/MovePallet.jsxbackend/resources/js/layouts/adminNav.jsbackend/routes/web.phpbackend/tests/Feature/Web/Logistics/PalletMovementTest.php
|
@jakub.przepiora ready to review |
Summary
Adds attribution of physical pallet movements to the logistics operator / forklift
driver who performed them (#103).
Introduces a lightweight shop-floor Move Pallet terminal where an operator
identifies themselves (badge-style tap picker), selects a pallet, enters its new
location and confirms — recording an immutable, attributable movement. An admin
Pallet Movements history surfaces who moved which pallet, from where, to where
and when.
Key changes:
is_logisticsflag onWorker(+logistics()scope) marking operatorseligible to move pallets; toggle added to the worker form.
pallet_movementsledger (worker_id= who performed the move,performed_by= terminal account that recorded it,from_location→to_location,moved_at,notes).PalletMovementServiceatomically snapshots the pallet's current location as themove origin, updates the pallet, and appends the movement row under a
lockForUpdate()transaction (safe under concurrent moves of the same pallet).StorePalletMovementRequest— only active logistics workers andlive, non-shipped, non-deleted pallets are accepted (stale ids → 422, not 404).
pallet_movementsElectric shape (registered inShapeRegistry+CollectionBroadcaster);is_logisticsadded to theworkersshape.
role:Operator|Supervisor|Admin; nav +TabRegistryupdated;full en/pl i18n parity.
Type of change
Related issue
Closes #103
Testing
Feature test suite
tests/Feature/Web/Logistics/PalletMovementTest.php(9 tests,48 assertions) — covers movement attribution + from→to capture, pallet location
follow-through,
to_locationrequired (422), operator must be active & logistics,shipped pallets rejected, soft-deleted operator/pallet rejected with 422 (not 404),
guest blocked, role-gating on the terminal, terminal lists only eligible operators,
and admin history renders.
php artisan testpassesChecklist
.envsecrets committed$fillableupdated if new model columns addedcomposer auditcleanSummary by CodeRabbit