CTC Baracoal CMS
Enterprise logistics and container management system featuring multi-level BAST approval workflows, Livewire bulk progress updates, and Maatwebsite Excel reporting.
01 — Overview
Overview
a. Industrial Container Management
Coal transport logistics rely on heavy containers that must be transferred between locations, inspected for structural damage, repaired by vendors, and cleared by operations. Performing these handovers on paper leads to lost reports, delayed vendor payments, and operational bottlenecks.
We engineered CTC Baracoal CMS to digitize these logistics. The platform tracks container states from the moment a checker conducts a field inspection, through vendor handovers, to financial sign-offs.
b. System Architecture High-Level
The system runs on Laravel 9 and Livewire. Field operators use mobile-responsive interfaces to log inspections and report daily activities, which are saved in the PostgreSQL database.
Handovers are processed via two core components: BAST to Vendor (delegating repair tasks) and BAST from Vendor (accepting repaired containers). These components feed records into the reporting engine, allowing administrators to audit container histories.
- Architected a multi-level state-machine approval workflow for container handovers (BAST) spanning Checker, Supervisor, Manager, and Finance roles
- Implemented automatic rollback triggers to restore container states when handovers are rejected
- Coded Livewire bulk validation systems to process simultaneous container progress updates in batches
- Designed SQL queries linking BAST details with vendor logs, inspection reports, and repair records
- Configured automated transactional emails triggered by state changes using Laravel Mail and Queue workers
- Built Maatwebsite Excel spreadsheet export modules with dynamic parameter filtering for operations reporting
02 — Problems & Challenges
Problems & Challenges
a. Complex Multi-Level BAST Approval Workflow
In coal logistics, BAST records require approval from multiple departments before vendor payments can be cleared. Checker drafts must be reviewed by Supervisors, confirmed by Managers, and cleared by Finance. Any rejection must return the record to its previous state while restoring the container's operational parameters.
We built a custom state machine inside `ContainerDelegationToVendorRepository.php` to govern these transitions. A Checker posts a draft, changing the status to `POSTED` and notifying the `SUPERVISOR`. Approval by the Supervisor transitions the status to `APPROVE1` and alerts the `MANAGER`. The Manager's sign-off moves it to `APPROVE2` for the `FINANCE` team. If any level rejects the BAST, the system reverts the status (e.g. from `APPROVE2` back to `POSTED`) and resets the container's last maintenance fields.
b. Synchronizing Daily Progress & Inspections
Inspectors and checkers log activities in real time. Ensuring that these updates do not overwrite concurrent changes, and that daily logs sync with active container repair records, is a key system challenge.
We resolved this by writing relation managers that link inspections (`inspections`) and daily logs (`container_daily_activities`) directly to the container lifecycle. When a BAST is posted, the system locks matching repair rows, preventing concurrent edits.
c. Master Data Integrity
Maintaining clean master data for thousands of containers, active vendor contracts, and shipping locations is critical. A change in a vendor contract price must not corrupt historically approved BAST costs.
We solved this by copying active contract prices into the `ContainerDelegationSubDetail` record during sub-detail creation. The system calculates the estimated price (`price_estimation`) as a flat value (`qty` * `unit_price`), preserving historical financials even if contracts change.
03 — Project Goals
Project Goals
a. Streamlining Vendor Handovers
We aimed to reduce the latency of container handovers. By digitizing the BAST flow and triggering notifications automatically at each approval stage, we eliminated paper routing and reduced review times.
b. Real-Time Container Tracking
Our goal was to provide operations managers with immediate visibility into container repair statuses. The dashboard compiles active repairs, inspections, and locations, allowing teams to identify bottlenecks.
04 — Design Process
Design Process
a. Relational Database Modeling for Logistics
We modeled the database structure in PostgreSQL to represent logistics states. The schema links `containers` (storing properties), `locations` (storing areas), `vendors` (mapping service providers), and `container_delegations` (storing BAST headers and details).
This model forms the core of our transaction logs and auditing ledger.
b. Role-Based Access Control UI/UX
We designed distinct dashboard views tailored to user roles. Field Checkers browse simplified grids to submit inspections and activities, while Supervisors and Managers access review pages with approval controls.
Finance users access payment logs and contract lists to verify vendor invoice values against BAST estimates.
05 — Usability Testing
Usability Testing
a. Bulk Progress Update Validation
We validated the system's bulk progress update logic (`ContainerRepairProgress.php`) under high-concurrency scenarios. The Livewire component validates progress inputs in batches, ensuring entries are numeric, range between 0 and 100, and do not fall below previous progress states.
If validation fails on any item, the system collects errors in `$bulkErrors`, cancels the batch update, and alerts the operator.
b. Automated Email Notification Reliability
We tested email notification triggers across the BAST approval lifecycle. Using Mailtrap, we verified that posting a BAST emails Supervisors (`DelegationToVendorEmail`), approvals notify Managers/Finance (`DelegationToVendorApproveEmail`), and rejections alert Checkers (`DelegationToVendorRejectEmail`).
06 — Prototyping & Handoff
Prototyping & Handoff
a. Internal Server Deployment
We packaged the application using Capistrano-like deployment scripts (`deploy.php`) to automate server releases. The script pulls repository updates, executes composer migrations, compiles frontend assets using Webpack Mix, and flushes system caches on the client's internal network.
b. Comprehensive Reporting System
To simplify handoff to operations managers, we built an Excel export engine using Maatwebsite Excel. In `BastReportController.php`, managers filter records by vendor, contract, location, and date range. The controller executes optimized SQL joins across delegation headers and sub-details, downloading spreadsheets instantly.
07 — Key Takeaways
Key Takeaways
a. Architecting Enterprise Logistics Systems
Industrial logistics workflows demand strict state tracking. Building BAST workflows as state machines ensures that records transition through correct approvals, preventing skipped reviews and protecting operational data.
b. Delivering Traceable Industrial Workflows
Complete auditing trails are vital for vendor verification. Storing snapshots of contract prices during BAST creation protects historical financial data, preventing discrepancies between logistics logs and invoice sheets.