fix: store opened_at and closed_at as DATETIME (not DATE)

DATE columns lose time information, causing timeline to show 00:00 for
car reception and WO closure. Migrated both columns to DATETIME and
updated: model casts (date → datetime), form pickers (DatePicker →
DateTimePicker with seconds:false), default to now() instead of today(),
and cleaned up defensive Carbon::parse() in getTimeline().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-11 04:52:03 +00:00
parent ce9f082612
commit 5a3275c2cf
4 changed files with 29 additions and 6 deletions
@@ -80,7 +80,7 @@ class WorkOrderResource extends Resource
->columns(4)
->schema([
Forms\Components\TextInput::make('number')->label(__('Nr.'))->disabled()->dehydrated(false)->placeholder('auto'),
Forms\Components\DatePicker::make('opened_at')->label(__('Deschis'))->default(today())->required(),
Forms\Components\DateTimePicker::make('opened_at')->label(__('Deschis'))->default(now())->seconds(false)->required(),
Forms\Components\Select::make('status')->options(\App\Support\I18n::opts(WorkOrder::STATUSES))->default('new')->required(),
Forms\Components\Select::make('urgency')->label(__('Urgență'))
->options(\App\Support\I18n::opts(\App\Models\Tenant\PricingCoefficient::URGENCY))->default('normal')->required(),
@@ -192,7 +192,7 @@ class WorkOrderResource extends Resource
'style' => 'font-weight:600;color:' . ($record && $record->paidAmount() >= (float)$record->total ? '#16a34a' : '#dc2626'),
]),
Forms\Components\Toggle::make('approved')->label(__('Aprobat de client')),
Forms\Components\DatePicker::make('closed_at')->label(__('Închis')),
Forms\Components\DateTimePicker::make('closed_at')->label(__('Închis'))->seconds(false),
]),
]);
}