From 7b71f07f3941bd2eafe6652c20296ad48a4fe1da Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 10 Jun 2026 09:22:58 +0530 Subject: [PATCH] changed logic by default loading of of data in table list of asrs --- .../Resources/AsrsItemValidationResource.php | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/app/Filament/Resources/AsrsItemValidationResource.php b/app/Filament/Resources/AsrsItemValidationResource.php index 41a310a..2d700b9 100644 --- a/app/Filament/Resources/AsrsItemValidationResource.php +++ b/app/Filament/Resources/AsrsItemValidationResource.php @@ -285,27 +285,27 @@ class AsrsItemValidationResource extends Resource $status = $data['status'] ?? 'NotUpdated'; // Hide all records initially if no filters are applied - // if (empty($data['Plant']) && empty($data['item_code']) && empty($data['status']) && empty($data['created_from']) && empty($data['created_to'])) { - // // return $query->whereRaw('1 = 0'); - // $query->where('status', 'NotUpdated'); - // } - - if ( - empty($data['Plant']) && - empty($data['item_code']) && - empty($data['uom']) && - empty($data['status']) && - empty($data['created_from']) && - empty($data['created_to']) - ) { + if (empty($data['Plant']) && empty($data['item_code']) && empty($data['uom']) && empty($data['status']) && empty($data['created_from']) && empty($data['created_to'])) { + return $query->whereRaw('1 = 0'); // $query->where('status', 'NotUpdated'); - $query->where(function ($q) { - $q->where('status', 'NotUpdated') - ->orWhereNull('status') - ->orWhere('status', ''); - }); } + // if ( + // empty($data['Plant']) && + // empty($data['item_code']) && + // empty($data['uom']) && + // empty($data['status']) && + // empty($data['created_from']) && + // empty($data['created_to']) + // ) { + // // $query->where('status', 'NotUpdated'); + // $query->where(function ($q) { + // $q->where('status', 'NotUpdated') + // ->orWhereNull('status') + // ->orWhere('status', ''); + // }); + // } + if (! empty($data['Plant'])) { $query->where('plant_id', $data['Plant']); } @@ -387,11 +387,12 @@ class AsrsItemValidationResource extends Resource Tables\Actions\ViewAction::make(), Tables\Actions\EditAction::make(), // ->hidden(function ($record): bool { - // if (auth()->user()?->hasRole('SuperAdmin')) { + // if (auth()->user()?->hasRole('Super Admin')) { // return false; // } - - // return trim(strtolower($record->status)) == 'updated'; + // else{ + // return trim(($record->status)) == 'Updated'; + // } // }), // ->visible(function ($record): bool { // return auth()->user()?->hasRole('SuperAdmin')