Skip to content

v0.3.0 — Products, Activities & Inventory

Choose a tag to compare

@benjaminbowles benjaminbowles released this 27 May 13:09

Products, Activities & Inventory

The third release of Signals Framework adds the Products catalogue, inventory (stock levels and stock transactions), and a CRM Activities module — with product groups, accessories, full REST API coverage, and CRMS-compatible response shapes.

Added

Products Module

  • Product model with ProductType enum (Rental, Sale, Service, Loss & Damage), StockMethod enum (Bulk, Serialised), and HasSchema integration
  • Products list page with type filter chips (Rental/Sale/Service), archive filter (Active/Archived/All), per-type counts, and data table with column sorting, filtering, and bulk selection
  • Product detail page — 3-column layout with description, quick stats, product group, tax & revenue (left), product details, pricing, activity timeline placeholder (center), product image, key attributes, tags (right)
  • Product create and edit forms — 2-column layout with basic info, identification, stock, pricing, tax & revenue, options, and custom fields panel
  • Product merge — select two products, side-by-side comparison modal, migrates stock levels, accessories, attachments, and custom fields to primary; archives secondary
  • Product icon upload on show and edit pages
  • Product tabs — Overview, Stock, Accessories, Custom Fields, Activities, Files
  • Product API endpoints — full CRUD with Ransack filtering, custom view support, and CRMS-compatible response shape
  • Product policies for view, create, edit, and delete permissions
  • Product column registry for custom views with 11 columns and 6 defaults
  • Custom views for products — All Products, Rental Products, Sale Products, Active Products, Inactive Products

Product Groups

  • Product group model with hierarchical structure and product count
  • Product groups list page with data table, search, and product count column
  • Product group detail page — sidebar with group details, main area with products-in-group data table
  • Product group create and edit forms
  • Product group API endpoints — full CRUD with Ransack filtering
  • Product group policy for view, create, edit, and delete permissions
  • Delete product group action with audit trail and webhook dispatch
  • Navigation — mega menu link, command palette commands

Stock Levels

  • Stock level model with StockCategory enum (Bulk, Serialised) and HasSchema integration
  • Stock levels list page with data table and search
  • Stock level detail page — 2-column layout with details, quantities (with available calculation), dates, and transactions panel
  • Stock level tab on product pages — scoped data table showing stock for the product
  • Stock level API endpoints — full CRUD with Ransack filtering and custom view support
  • Stock level policies and column registry
  • Custom views — All Stock Levels, Serialised Stock, Bulk Stock

Stock Transactions

  • Stock transaction model with TransactionType enum — 11 types: Opening Balance, Increase, Decrease, Buy, Find, Write Off, Sell, Return, Make, Transfer Out, Transfer In
  • Signed quantity calculation via quantitySign() — negative for reductions (Decrease, WriteOff, Sell, TransferOut), positive for additions
  • quantity_move accessor on model — signed quantity for display
  • Manual transaction creation restricted to Buy, Find, Write Off, Sell, Make (system types like Opening, Transfer are API-only)
  • Inline transaction form on stock level show page — type selector, quantity, date, description
  • Automatic quantity_held update on stock level when transactions are created
  • Stock transaction API endpoints — CRMS-compatible nested routes (products/{product}/stock_levels/{stock_level}/stock_transactions) with index, show, and store
  • CRMS-compatible response shape with transaction_type, transaction_type_name, quantity, quantity_move, manual flags

Activities (CRM)

  • Activity model with polymorphic regarding relationship (Member, Product, StockLevel), owned_by user, and participants many-to-many with members
  • ActivityType enum — Task (1001), Call (1002), Fax (1003), Email (1004), Meeting (1005), Note (1006), Letter (1007) — mapped to CRMS type_id integer codes
  • ActivityStatus enum — Scheduled (2001), Completed (2002), Cancelled (2003), Held (2004)
  • ActivityPriority enum — Low (0), Normal (1), High (2)
  • TimeStatus enum — Free (0), Busy (1) for calendar blocking
  • Activities list page with type filter chips (Task/Call/Meeting/Email/Note), status filter chips (Scheduled/Completed/Cancelled/Held), per-type and per-status counts
  • Activity detail page with badges (type, status, priority), details panel, regarding link, participants list, quick actions (Complete, Edit, Delete)
  • Activity create and edit forms — 2-column layout with basic info, classification, schedule (left), assignment and entity picker (right)
  • Member activities tab — scoped data table with "New Activity" button pre-filling regarding_type=Member
  • Product activities tab — scoped data table with "New Activity" button pre-filling regarding_type=Product
  • Stock level activities tab — scoped data table with "New Activity" button pre-filling regarding_type=StockLevel
  • Complete activity action — sets status to Completed, completed=true, fires audit event
  • Activity API endpoints — full CRUD plus POST /activities/{id}/complete, Ransack filtering, custom view support
  • CRMS-compatible API responses — type_id, status_id, activity_type_name, activity_status_name, time_status_name, participants array, nested regarding and owner objects
  • Activity permissions — access, view, create, edit, delete, complete — assigned to Admin, Operations Manager, Sales, and Read Only roles
  • Activity column registry for custom views with 11 columns and 7 defaults
  • Custom views — All Activities, Scheduled Activities, Completed Activities
  • CRMS type mapping via Activity::resolveRegardingType() and Activity::shortRegardingType() — stores full class names in DB, exposes short names (Member, Product, StockLevel) in API responses

Accessories

  • Accessory model linking products to other products with quantity
  • Accessories tab on product pages
  • Accessories API endpoints — index, store, destroy nested under products

Navigation & Search

  • Activities mega menu link under CRM > Engagement with active state
  • Product Groups mega menu link under Resources with active state
  • Command palette — Activities, Product Groups, Stock Levels navigation commands; New Activity, New Product, New Product Group create commands
  • Global search — activities searchable by subject (permission-gated), results displayed in command palette with calendar icon
  • Search results for products, stock levels, and product groups in command palette

Schema & Services

  • Schema definitions registered on 14 Phase 1 models (Address, Country, Currency, ExchangeRate, Email, Phone, Link, Attachment, User, ActionLog, Webhook, CustomView, TaxRate, TaxRule)
  • Two-tier caching on SchemaRegistry — L1 in-memory + L2 Redis with tag-based invalidation
  • Schema Discovery API — GET /api/v1/schema and GET /api/v1/schema/{model} for introspecting field metadata
  • VisibilityRuleEvaluator — 11 operators (equals, not_equals, contains, in, gt, lt, etc.) with AND logic
  • AutoNumberService — atomic increment, preview, and reset for custom field auto-numbering
  • Formatter::money() and moneyDecimal() — brick/money string-based formatting without float conversion
  • EnforceSessionTimeout middleware — settings-driven idle session expiry

Security

  • SecuritySettings enforcement for login rate limiting (max_login_attempts, lockout_duration)
  • FileService hardened — S3 path changed to entity-organised structure, scan_status default changed to pending, Storage::put() failure checks added
  • Icon thumbnail size corrected from 400px to 150px

Changed

  • Member activities tab replaced placeholder with scoped data table and action buttons
  • Custom view description column added to custom_views table
  • Attachment scan_status default changed from clean to pending
  • AppServiceProvider cleanup — removed unused Relation import after morph map evaluation
  • Search controller expanded to cover products, stock levels, product groups, and activities alongside members
  • Command palette expanded from 22 to 30+ static commands with product, activity, and product group entries

Quality

  • 227 new/modified files, 17,200+ lines of code added
  • 130+ new tests across enums, models, policies, actions, API controllers, column registries, Livewire components, and search
  • PHPStan level 6 — zero errors across all new code
  • Pint formatting enforced on all changes
  • Documentation pages for Activities (platform + API)