diff --git a/app/Filament/Tenant/Resources/WorkOrderResource/Pages/ListWorkOrders.php b/app/Filament/Tenant/Resources/WorkOrderResource/Pages/ListWorkOrders.php
index 57b10a6..dcf4a83 100644
--- a/app/Filament/Tenant/Resources/WorkOrderResource/Pages/ListWorkOrders.php
+++ b/app/Filament/Tenant/Resources/WorkOrderResource/Pages/ListWorkOrders.php
@@ -42,13 +42,34 @@ class ListWorkOrders extends ListRecords
->color('gray')
->icon('heroicon-o-information-circle')
->modalHeading('Diagnostic fișe de lucru')
- ->modalContent(function () use ($tenantId, $inTenant, $deletedTenant, $otherActive, $otherDeleted, $total) {
+ ->modalContent(function () use ($tenantId, $total) {
+ // All companies with WO counts
+ $companies = DB::table('companies')
+ ->select('companies.id', 'companies.name', 'companies.slug')
+ ->selectRaw('COUNT(wo.id) as active_count')
+ ->selectRaw('SUM(CASE WHEN wo.deleted_at IS NOT NULL THEN 1 ELSE 0 END) as deleted_count')
+ ->leftJoin('work_orders as wo', 'companies.id', '=', 'wo.company_id')
+ ->groupBy('companies.id', 'companies.name', 'companies.slug')
+ ->get();
+
+ $html = "
Companii & fișe
";
+ $html .= "";
+ $html .= "| ID | Slug | Nume | Active | Șterse | Curent? |
";
+ foreach ($companies as $c) {
+ $isCurrent = $c->id === $tenantId;
+ $bg = $isCurrent ? '#dcfce7' : 'white';
+ $html .= "| {$c->id} | {$c->slug} | {$c->name} | {$c->active_count} | {$c->deleted_count} | " . ($isCurrent ? '✓ DA' : '') . " |
";
+ }
+ $html .= "
";
+
+ // All WOs
$rows = DB::table('work_orders')
- ->select('id', 'number', 'company_id', 'master_id', 'status', 'deleted_at')
+ ->select('id', 'number', 'company_id', 'status', 'deleted_at')
->orderBy('id')
->get();
- $html = "";
+ $html .= "Toate fișele ({$total})
";
+ $html .= "";
$html .= "| ID | Nr. | company_id | tenant? | șters? |
";
foreach ($rows as $r) {
$isTenant = $r->company_id === $tenantId;