Skip to content

Pallet Working Release#4

Open
roncodes wants to merge 17 commits intomainfrom
dev-v0.0.2
Open

Pallet Working Release#4
roncodes wants to merge 17 commits intomainfrom
dev-v0.0.2

Conversation

@roncodes
Copy link
Member

No description provided.

@roncodes roncodes changed the title upgraded dependencies v0.0.2 Jul 19, 2024
roncodes and others added 5 commits October 2, 2024 18:32
This comprehensive refactoring transforms Pallet into a complete enterprise-grade
Warehouse Management System following the Fleetops architecture patterns.

Backend Enhancements:
- Added 11 new models for enterprise WMS features:
  * PickList & PickListItem for warehouse picking operations
  * Wave for wave-based picking management
  * CycleCount & CycleCountItem for inventory accuracy
  * StockTransfer & StockTransferItem for inter-warehouse transfers
  * BinLocation for detailed location tracking
  * WarehouseZone for zone management
  * InventoryReservation for order allocations
  * ProductKitComponent for kit/bundle management

- Enhanced existing models:
  * Product: Added tracking flags, reorder points, shelf life, kit support
  * Inventory: Added lot/serial tracking, multi-UOM, reserved quantities
  * Warehouse: Added zones, bins, capacity tracking, utilization metrics

Frontend Refactoring:
- Refactored Product components to modular Fleetops pattern:
  * product/form.hbs & .js - Comprehensive form component
  * product/details.hbs & .js - Read-only detail view
  * product/panel-header.hbs & .js - Panel header component
  * product/pill.hbs & .js - Compact display component

- Modernized templates:
  * Updated products/index to use Layout::Resource::Tabular
  * Updated products/index/details to use Layout::Resource::Panel
  * Updated products/index/edit to use Layout::Resource::Panel

Database Schema:
- Created comprehensive migration for all new tables and enhanced columns
- Added proper indexes and foreign key constraints
- Supports lot/serial tracking, reservations, and advanced WMS operations

Features Implemented:
✓ Lot/batch and serial number tracking
✓ Inventory reservations (soft/hard)
✓ Pick list management with multiple strategies
✓ Wave-based picking
✓ Cycle counting with variance tracking
✓ Inter-warehouse stock transfers
✓ Bin location and zone management
✓ Kit/bundle product support
✓ Expiry date tracking and alerts
✓ Reorder point management

This establishes the foundation for a complete, scalable, enterprise-grade WMS.
Refactored all remaining resources to follow Fleetops architecture pattern:
- Inventory: form, details, panel-header, pill components
- Warehouse: form, details, panel-header, pill components
- Supplier: form, details, panel-header, pill components
- Purchase Order: form, details, panel-header, pill components
- Sales Order: form, details, panel-header, pill components
- Batch: form, details, panel-header, pill components

Updated all templates to use modern Layout components:
- All index templates now use Layout::Resource::Tabular
- All details templates now use Layout::Resource::Panel with TabNavigation
- All edit templates now use Layout::Resource::Panel with form integration

This completes the frontend modernization across all 7 resources:
✓ Product (previously completed)
✓ Inventory
✓ Warehouse
✓ Supplier
✓ Purchase Order
✓ Sales Order
✓ Batch

Total: 48 new component files + 84 app exports + 18 template updates
Enterprise WMS Refactoring with Fleetops Architecture
@roncodes roncodes changed the title v0.0.2 Working Pallet Release Feb 28, 2026
roncodes and others added 7 commits February 28, 2026 02:37
Backend fixes:
- [B1] Fix WarehouseDockController class name (was WarehouseSectionController)
- [B2] Fix PurchaseOrder resource orde_date_at typo -> order_date_at; add order_number alias for public_id
- [B3] Fix SalesOrder resource orde_date_at typo -> order_date_at; add order_number alias for public_id
- [B4] Rename WarehouesDock.php -> WarehouseDock.php (filename typo fix)
- [B5] Rename SuplierFilter.php -> SupplierFilter.php (filename typo fix)
- [B6] Fix PurchaseOrderController payload key: purchaseOrder -> purchase_order
- [B7] Fix SalesOrderController payload key: salesOrder -> sales_order
- [B8] Fix Audit model User namespace: App\Models\User -> Fleetbase\Models\User
       Add HasPublicId trait, SoftDeletes, align fillable with actual DB schema
- [B9] Add all missing WMS fields to Inventory resource (status, bin_location_uuid,
       zone_uuid, lot_number, serial_number, uom, reserved_quantity, available_quantity,
       max_quantity, reorder_point, unit_cost, received_at, last_counted_at)
- [B10] Fix PalletServiceProvider error messages (Storefront -> Pallet)
- [B11] Fix InventoryController::createRecord - explicitly set batch_uuid on inventory
        record; add received_at timestamp; improve batch_number generation
- [B12] Fix StockAdjustment resource - use incrementing_id; add missing fields
        (inventory_uuid, warehouse_uuid, reason, notes, adjustment_type)
- [B13] Create missing Audit HTTP Resource class

Frontend fixes:
- [F1] Build out Audit model with all attributes, relationships, and computed properties
- [F2] Build out AuditsIndexController with columns, search, queryParams, and tracking
- [F3] Fix routes.js - add index sub-routes to audits, reports, and batch parent routes
- [F4] Build out audits/index.hbs template with Layout::Resource::Tabular
- [F5] Fix inventory model - add all missing WMS fields (bin_location_uuid, zone_uuid,
       lot_number, serial_number, uom, reserved_quantity, available_quantity, max_quantity,
       reorder_point, unit_cost, received_at, last_counted_at, isLowStock, isExpired)
       Fix supplier relationship type (vendor -> supplier)
- [F6] Fix purchase-order model - add order_number, order_date_at, currency, meta attrs
       Fix supplier relationship type (vendor -> supplier)
- [F7] Fix sales-order model - add order_number, currency, meta attrs
       Fix supplier relationship type (vendor -> supplier)
- [F8] Fix inventory-form-panel.hbs - fix @onchange on Supplier ModelSelect
       (was passing string value, now correctly uses fn (mut ...))
- [F9] Fix @isResizeble typo -> @isResizable across ALL form panel components:
       inventory, warehouse, supplier, purchase-order, sales-order, batch,
       product, stock-adjustment, warehouse-editor
- [F10] Create addon/serializers/audit.js
- [F11] Complete translations/en-us.yaml - add all ~120 missing translation keys
        across resource, common, product, inventory, warehouse, supplier,
        purchase-order, sales-order, batch, and audit namespaces
## What changed

### Backend

**Migration (modified, not new)**
- Refactored pallet_audits table: added event_type column (indexed), renamed
  auditable_uuid/type to subject_uuid/subject_type for clarity, added
  scheduled_at/completed_at for time-bounded events, added composite indexes
  on (company_uuid, event_type) and (subject_uuid, subject_type)

**New: AuditEventType constants class**
- Defines all machine-readable event type keys: stock_adjustment, cycle_count,
  po_received, so_fulfilled, stock_transfer, inventory_created, batch_created, etc.

**New: HasOperationalAuditTrail trait**
- Reusable trait any Pallet model can use to call logAuditEvent()
- Automatically captures company_uuid, performed_by_uuid, subject, and meta

**New: AuditService**
- Centralised service for programmatic audit logging from controllers
- Provides log() and logForModel() helpers

**Refactored: Audit model**
- Now immutable (no direct create/update/delete via API)
- Added event_type, subject_uuid/type, scopes (byEventType, bySubject, recent)
- Added SoftDeletes, HasPublicId, correct Fleetbase User namespace

**Refactored: AuditController**
- Now read-only: index() and show() only
- Added eventTypes() endpoint: GET /pallet/v1/audits/event-types
- Filters by event_type, subject_type, performed_by_uuid, date range

**Refactored: Audit HTTP Resource**
- Returns event_type, subject_label, action, reason, meta, performedBy

**Refactored: routes.php**
- Replaced generic fleetbaseRoutes('audits') with explicit read-only routes
- Added GET /pallet/v1/audits/event-types endpoint

**WMS model integrations**
- StockAdjustment: logs STOCK_ADJUSTMENT event on created()
- CycleCount: logs CYCLE_COUNT event on complete() and approve()
- PurchaseOrder: markAsReceived() logs PO_RECEIVED event
- SalesOrder: markAsFulfilled() logs SO_FULFILLED event
- StockTransfer: logs STOCK_TRANSFER event on ship() and receive()

**Spatie LogsActivity added to 8 primary models**
- Product, Inventory, Warehouse, Supplier, Batch, PurchaseOrder, SalesOrder,
  StockAdjustment now all use LogsActivity with logOnly() + logOnlyDirty()
- Consistent with how core-api handles User, Alert, File, etc.

### Frontend

**Audit model**
- Updated to use event_type, subject_uuid/type instead of auditable_uuid/type
- Added eventTypeLabel, subjectLabel, eventTypeBadgeClass computed properties
- Added createdAgo with addSuffix option

**Audits/index controller**
- queryParams updated: event_type + subject_type replace auditable_type
- Columns updated: Event Type, Action, Subject, Subject ID, Reason, Performed By, Date
- Added eventTypeOptions array for dropdown filter
- Added filterByEventType() and clearFilters() actions

**Audits/index template**
- Added event type filter dropdown in subheader slot
- Added clear filters button (shown when any filter is active)
- Set @Cancreate=false and @canDelete=false (immutable trail)

**Audit serializer**
- Removed createdBy embedded relation (no longer in schema)

**Translations**
- Expanded audit section with event-types, filter labels, search placeholder
- Added common.clear_filters and common.no-records keys
Backend:
- Add migration: purchase_order_items and sales_order_items tables
  with full schema: product_uuid, warehouse_uuid, quantity, quantity_received/
  quantity_fulfilled, outstanding_quantity, unit_price, unit_cost, total_price,
  currency, sku, lot_number, serial_number, expiry_date, unit_of_measure,
  status, notes, meta, received_at/fulfilled_at
- Add PurchaseOrderItem model with recalculateTotalPrice(), relationships to
  Product, Warehouse, PurchaseOrder; LogsActivity trait
- Add SalesOrderItem model with recalculateTotalPrice(), relationships to
  Product, Warehouse, Inventory, SalesOrder; LogsActivity trait
- Add hasMany items() + item_count/total_value aggregates to PurchaseOrder model
- Add hasMany items() + item_count/total_value aggregates to SalesOrder model
- Add PurchaseOrderItemController (index, store, update, destroy)
- Add SalesOrderItemController (index, store, update, destroy)
- Add PurchaseOrderItem and SalesOrderItem HTTP Resources
- Update PurchaseOrder resource to include items, item_count, total_value
- Update SalesOrder resource to include items, item_count, total_value
- Add nested item routes: GET/POST/PUT/DELETE for both PO and SO items

Frontend:
- Add purchase-order-item Ember model with all attributes + computed helpers
- Add sales-order-item Ember model with all attributes + computed helpers
- Add hasMany items + item_count/total_value to purchase-order Ember model
- Add hasMany items + item_count/total_value to sales-order Ember model
- Add purchase-order-item and sales-order-item serializers
- Update purchase-order and sales-order serializers to embed items
- Add purchase-order-panel/items tab component (HBS + JS) with:
  - Inline add row with product ModelSelect, SKU, quantity, unit price
  - Inline edit row per item
  - Read-only rows showing product, SKU, qty, qty received, unit price, total
  - Status badge per item
  - Delete per item
  - Disabled when order is received/cancelled
- Add sales-order-panel/items tab component (HBS + JS) with same pattern
  (qty fulfilled instead of qty received)
- Wire Items tab into purchase-order-panel and sales-order-panel components
- Expand translations: purchase-order.line-items.* and sales-order.line-items.*
Backend:
- PurchaseOrderController: full receive() action with DB transaction,
  line-item iteration, inventory create/increment, lot/serial/expiry/bin
  tracking, PO status transition (partial/received), audit trail logging
- SalesOrderController: full fulfill() action with pre-flight stock check,
  FEFO inventory selection, available_quantity deduction, SO item status
  tracking, SO status transition (partial/fulfilled), audit trail logging
- routes.php: POST purchase-orders/{id}/receive and sales-orders/{id}/fulfill

Frontend:
- receive-purchase-order-form-panel: order summary, per-item receipt rows
  with ordered/received/outstanding quantities, lot/expiry/notes inputs,
  submits to API, calls onReceived callback on success
- fulfill-sales-order-form-panel: order summary, FEFO notice, per-item
  fulfillment rows with ordered/fulfilled/outstanding quantities, notes
  input, submits to API, calls onFulfilled callback on success
- context-panel.js: registered receiving intent for purchaseOrder and
  fulfilling intent for salesOrder
- purchase-orders/index.js: receivePurchaseOrder() action, improved columns
- sales-orders/index.js: fulfillSalesOrder() action, improved columns
- translations/en-us.yaml: added receive and fulfill translation keys
…emplates

Both purchase-order-panel/items.hbs and sales-order-panel/items.hbs had
the {{#if (eq this.editingItem.id item.id)}} block incorrectly closed
with {{/each}} instead of {{/if}}, with the {{/each}} for the outer
each loop also missing. This caused a Babel build error:
  'if doesn't match each - 28:23'

Fixed both files:
  - {{/each}} on line 89 replaced with {{/if}}
  - {{/each}} added on line 90 to correctly close the outer each loop
@roncodes roncodes changed the title Working Pallet Release Pallet Working Release Feb 28, 2026
roncodes and others added 4 commits March 1, 2026 15:29
- extension.js: register 'pallet' dashboard via widgetService.registerDashboard()
  and 8 widgets via widgetService.registerWidgets() using correct Widget +
  ExtensionComponent pattern (Widget/ExtensionComponent from @fleetbase/ember-core/contracts)
  Removed unused Hook import. Default widgets: inventory-summary, low-stock,
  po-status, so-status, recent-activity. Optional: stock-value, expiring-stock,
  top-products.

- templates/home.hbs: replaced bare {{outlet}} with <Dashboard> component using
  @defaultDashboardId='pallet', @defaultDashboardName='Pallet Dashboard',
  @extension='pallet' inside <Layout::Section::Body> with overflow scroll.

Frontend widget components (widget/ namespace):
- widget/inventory-summary: 5-KPI banner (SKUs, units, value, warehouses, low-stock)
- widget/low-stock: table of products at/below min_stock_level
- widget/po-status: 4-status badge grid + recent PO list
- widget/so-status: 4-status badge grid + recent SO list
- widget/recent-activity: scrollable audit trail feed with event icons
- widget/stock-value: horizontal bar chart of value per warehouse
- widget/expiring-stock: table of batches expiring within 30 days
- widget/top-products: ranked bar chart of most-moved products

Backend:
- MetricsController: 7 read-only endpoints (inventory-summary, low-stock,
  po-status, so-status, stock-value, expiring-stock, top-products), all scoped
  to session company_uuid
- routes.php: added metrics prefix group with all 7 endpoints under
  fleetbase.protected middleware
PHP fatal error: 'Cannot declare class CreateOrderItemsTables, because the
name is already in use' was caused by a naming conflict with another package
that registers a migration class with the same name.

All 14 named-class migrations have been converted to the anonymous class
pattern (return new class extends Migration { ... };) which is the modern
Laravel standard and completely eliminates cross-package class name conflicts.

The 2024_11_06_create_wms_tables.php and 2024_11_07_create_order_items_tables.php
files were already using the anonymous pattern and were left unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant