- Implemented the customer portal workflow progress component with detailed service progress tracking, including current status, workflow steps, and contact information. - Developed a management workflow analytics dashboard featuring key performance indicators, charts for revenue by branch, labor utilization, and recent quality issues. - Created tests for admin-only middleware to ensure proper access control for admin routes. - Added tests for customer portal view rendering and workflow integration, ensuring the workflow service operates correctly through various stages. - Introduced a .gitignore file for the debugbar storage directory to prevent unnecessary files from being tracked.
6.8 KiB
6.8 KiB
Car Repairs Shop — AI agent working notes
This repo is a Laravel 12 app with Livewire (Volt + Flux UI), Tailwind, and Vite. The UI is primarily Livewire pages; a few classic controllers exist for resource routes. Tests use in-memory SQLite.
Architecture map
- Workflow-driven design: The app implements an 11-step automotive repair workflow from vehicle reception to delivery with status tracking, inspections, estimates, and customer notifications.
- Core domains live in
app/Livewire/**andapp/Models/**(Customers, Vehicles, Inventory, JobCards, Estimates, Diagnosis, WorkOrders, Timesheets, Users, Reports, CustomerPortal). - WorkflowService (
app/Services/WorkflowService.php) orchestrates the complete repair process with methods for each workflow step. - InspectionChecklistService (
app/Services/InspectionChecklistService.php) manages standardized vehicle inspections and comparison logic. - Routes are in
routes/web.php:- Root decides destination based on
auth()->user()->isCustomer()→ customers go to/customer-portal, admins/staff to/dashboard, guests to/login. - Admin/staff area uses
admin.only+permission:*middleware. Customer portal usesauthonly. - Volt pages registered via
Volt::route('settings/...', 'settings.something').
- Root decides destination based on
- Middleware aliases are registered in
bootstrap/app.php:admin.only,role,permissionpoint to custom classes inapp/Http/Middleware. Routepermission:strings are the canonical auth gates in this app.
- Settings use Spatie Laravel Settings (
app/Settings/**,config/settings.php), e.g.,app(\App\Settings\GeneralSettings::class)for shop phone/email in views. - Blade components: anonymous components live under
resources/views/components/**. Example:<x-layouts.customer-portal />is backed byresources/views/components/layouts/customer-portal.blade.php.
11-Step Workflow Implementation
The system follows a structured automotive repair workflow:
- Vehicle Reception →
JobCard::STATUS_RECEIVED- Basic data capture, unique sequence numbers by branch (ACC/00212,KSI/00212) - Initial Inspection →
JobCard::STATUS_INSPECTED- Standardized checklist viaInspectionChecklistService - Service Assignment →
JobCard::STATUS_ASSIGNED_FOR_DIAGNOSIS- Assign to Service Coordinator - Diagnosis →
JobCard::STATUS_IN_DIAGNOSIS- Full diagnostic with timesheet tracking - Estimate →
JobCard::STATUS_ESTIMATE_SENT- Detailed estimate with email/SMS notifications - Approval →
JobCard::STATUS_APPROVED- Customer approval triggers team notifications - Parts Procurement →
JobCard::STATUS_PARTS_PROCUREMENT- Inventory management and sourcing - Repairs →
JobCard::STATUS_IN_PROGRESS- Work execution with timesheet tracking - Final Inspection →
JobCard::STATUS_COMPLETED- Outgoing inspection with discrepancy detection - Delivery →
JobCard::STATUS_DELIVERED- Customer pickup and satisfaction tracking - Archival - Document archiving and job closure
Conventions and patterns
- Status-driven workflow: Use
JobCard::getStatusOptions()for consistent status handling. Each status corresponds to a workflow step. - Role hierarchy: Service Supervisor → Service Coordinator → Technician. Use role helper methods like
$user->isServiceCoordinator(). - Livewire pages reside under
app/Livewire/{Area}/{Page}.phpwith views underresources/views/{area}/{page}.blade.php(Volt routes may point directly to views). - Authorization:
- Use
admin.onlyto gate admin/staff routes. - Use
permission:domain.actionstrings on routes (e.g.,permission:customers.view,inventory.create). Keep naming consistent with existing routes.
- Use
- Branch-specific operations: All job cards have
branch_code. UseJobCard::byBranch($code)scope for filtering. - Customer Portal layout requires a
jobCardprop. When using<x-layouts.customer-portal>, pass it explicitly:- Example:
<x-layouts.customer-portal :job-card="$jobCard"> ... </x-layouts.customer-portal>
- Example:
- Inspection system: Use
InspectionChecklistServicefor standardized checklists. Incoming vs outgoing inspections are compared automatically.
Developer workflows
- Install & run (common):
- PHP deps:
composer install - Node deps:
npm install - Generate key & migrate:
php artisan key:generate && php artisan migrate --seed - Dev loop (servers + queue + logs + Vite):
composer dev(runs: serve, queue:listen, pail, vite) - Asset build:
npm run build
- PHP deps:
- Testing:
- Run tests:
./vendor/bin/phpunit(uses in-memory SQLite perphpunit.xml) - Alternative:
composer test(clears config and runsartisan test)
- Run tests:
- Debugging:
- Logs via Laravel Pail are included in
composer dev. Otherwise:php artisan pail.
- Logs via Laravel Pail are included in
Routing and modules (examples)
Data Flow and State Management
- Status-Driven Design: Each workflow step corresponds to a specific JobCard status. Always use status constants from the model.
- Service Dependencies: WorkflowService orchestrates the complete flow, InspectionChecklistService handles standardized vehicle inspections.
- Customer Communication: Auto-notifications at each step keep customers informed of progress.
- Quality Control: Built-in inspection comparisons and quality alerts ensure consistent service delivery.
- Admin resources (with permissions):
Route::resource('customers', CustomerController::class)->middleware('permission:customers.view');
- Inventory area pages are Livewire classes under
app/Livewire/Inventory/**and grouped underRoute::prefix('inventory')withpermission:inventory.*. - Customer portal routes:
Route::prefix('customer-portal')->middleware(['auth'])->group(function () { Route::get('/status/{jobCard}', \\App\\Livewire\\CustomerPortal\\JobStatus::class)->name('customer-portal.status'); });
Testing notes (project-specific)
- Tests use in-memory SQLite; avoid relying on factories that don’t exist. Prefer lightweight stubs or create the minimal model records needed.
- For Blade/Livewire views using a layout slot, render the page view (not the layout)
and pass required data. Example:
View::make('livewire.customer-portal.job-status', ['jobCard' => $jobCard])->render();
Guardrails for agents
- When adding new admin routes, wire
admin.onlyand appropriatepermission:*middleware, and register Volt pages viaVolt::routewhen applicable. - Keep anonymous Blade components under
resources/views/components/**and pass required props explicitly. - Use
app(\App\Settings\GeneralSettings::class)for shop metadata instead of hardcoding. - Follow existing permission key patterns (
domain.action).
If anything above is unclear or you need deeper details (e.g., settings schema, specific Livewire page conventions), propose a short diff or ask for a quick pointer to the relevant file.