Added view rights against plant
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 24s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Larastan / larastan (pull_request) Failing after 3m8s
Laravel Pint / pint (pull_request) Successful in 3m6s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 24s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Larastan / larastan (pull_request) Failing after 3m8s
Laravel Pint / pint (pull_request) Successful in 3m6s
This commit is contained in:
@@ -293,20 +293,18 @@ class ItemResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (
|
||||
empty($data['Plant']) &&
|
||||
empty($data['code']) &&
|
||||
empty($data['description']) &&
|
||||
empty($data['uom']) &&
|
||||
empty($data['category']) &&
|
||||
empty($data['created_from']) &&
|
||||
empty($data['created_to'])
|
||||
) {
|
||||
if (empty($data['Plant']) && empty($data['code']) && empty($data['description']) && empty($data['uom']) && empty($data['category']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['code'])) {
|
||||
@@ -338,6 +336,17 @@ class ItemResource extends Resource
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
// Notification::make()
|
||||
// ->title('Choose plant to filter records.')
|
||||
// ->danger()
|
||||
// ->seconds(1)
|
||||
// ->send();
|
||||
return 'Plant: Choose plant to filter records.';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['code'])) {
|
||||
|
||||
@@ -649,19 +649,18 @@ class StickerMasterResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (
|
||||
empty($data['Plant']) &&
|
||||
empty($data['item_id']) &&
|
||||
empty($data['material_type']) &&
|
||||
empty($data['panel_box_code']) &&
|
||||
empty($data['created_from']) &&
|
||||
empty($data['created_to'])
|
||||
) {
|
||||
if (empty($data['Plant']) && empty($data['item_id']) && empty($data['material_type']) && empty($data['panel_box_code']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['item_id'])) {
|
||||
@@ -690,6 +689,17 @@ class StickerMasterResource extends Resource
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
// Notification::make()
|
||||
// ->title('Choose plant to filter records.')
|
||||
// ->danger()
|
||||
// ->seconds(1)
|
||||
// ->send();
|
||||
return 'Plant: Choose plant to filter records.';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['item_id'])) {
|
||||
@@ -878,9 +888,9 @@ class StickerMasterResource extends Resource
|
||||
$disk->makeDirectory($directory, 0755, true);
|
||||
}
|
||||
|
||||
// $fullPath = Storage::disk('local')->path($directory);
|
||||
// $fullPath = Storage::disk('local')->path($directory);
|
||||
|
||||
// $directory = "uploads/PartValidation/{$plantCode}";
|
||||
// $directory = "uploads/PartValidation/{$plantCode}";
|
||||
|
||||
// $disk = Storage::disk('local');
|
||||
// if (! $disk->exists($directory)) {
|
||||
|
||||
Reference in New Issue
Block a user