Three features: labor group headers, status picker, catalog import
- LaborResource: add titlePrefixedWithLabel(false) so group headers show
just the localized category name (not "Categorie: Шины"); remove static
cache from closure to avoid Octane cross-request locale bleed
- WorkOrderDashboard: add changeStatus() Livewire method + Alpine.js
dropdown on the status badge so status can be changed directly from
the dashboard without going to the full edit form
- New artisan command catalog:import-labors {company} that reads
database/data/labor-catalog.json (386 operations, 45 leaf categories)
and upserts labor_categories + labors for the given tenant; supports
--force to update existing records by code
- Add "Status actualizat" translation to ru/en JSON
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -248,6 +248,21 @@ class WorkOrderDashboard extends Page
|
||||
->first(['id', 'number']);
|
||||
}
|
||||
|
||||
public function changeStatus(string $status): void
|
||||
{
|
||||
if (! array_key_exists($status, WorkOrder::STATUSES)) return;
|
||||
$wo = $this->record;
|
||||
$wo->status = $status;
|
||||
if ($status === 'done' && ! $wo->closed_at) {
|
||||
$wo->closed_at = now();
|
||||
}
|
||||
$wo->save();
|
||||
$this->record->refresh();
|
||||
\Filament\Notifications\Notification::make()
|
||||
->title(__('Status actualizat'))
|
||||
->success()->send();
|
||||
}
|
||||
|
||||
public function closeWorkOrder(): void
|
||||
{
|
||||
$wo = $this->record;
|
||||
|
||||
@@ -120,9 +120,9 @@ class LaborResource extends Resource
|
||||
->groups([
|
||||
Tables\Grouping\Group::make('category')
|
||||
->label(__('Categorie'))
|
||||
->titlePrefixedWithLabel(false)
|
||||
->getTitleFromRecordUsing(function ($record) {
|
||||
static $opts = null;
|
||||
$opts ??= \App\Models\Tenant\LaborCategory::optionsForSelect();
|
||||
$opts = \App\Models\Tenant\LaborCategory::optionsForSelect();
|
||||
return $opts[$record->category] ?? $record->category;
|
||||
}),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user