Files
autocrm/app/Filament/Tenant/Resources/WorkOrderResource/Pages/CreateWorkOrder.php
T
Vasyka 1b8ccb116f feat(work-orders): dashboard becomes single hub — list/create/edit funnel through it
- WO list row click now opens /work-orders/{id}/dashboard instead of
  /edit (via ->recordUrl on the table). Edit remains reachable from
  the per-row Filament EditAction.
- CreateWorkOrder redirects to the dashboard after save instead of
  the edit page.
- Dashboard top bar exposes: "Listă" (back to WO list), "+ Nou"
  (create), and "Editare completă" (full edit form) so users don't
  have to hop through the sidebar to move between related WO screens.

The old /work-orders, /create, and /{id}/edit routes stay intact —
just the default navigation flow now converges on the dashboard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-08-10 19:20:36 +00:00

27 lines
800 B
PHP

<?php
namespace App\Filament\Tenant\Resources\WorkOrderResource\Pages;
use App\Filament\Tenant\Resources\WorkOrderResource;
use App\Models\Tenant\WorkOrder;
use App\Tenancy\TenantManager;
use Filament\Resources\Pages\CreateRecord;
class CreateWorkOrder extends CreateRecord
{
protected static string $resource = WorkOrderResource::class;
protected function mutateFormDataBeforeCreate(array $data): array
{
$companyId = app(TenantManager::class)->currentId();
$data['number'] = WorkOrder::generateNumber($companyId);
return $data;
}
/** After create, land on the dashboard (single hub) instead of the raw edit. */
protected function getRedirectUrl(): string
{
return url('/app/work-orders/' . $this->record->id . '/dashboard');
}
}