Added dynamic plant selection based on user permissions and updated file upload path for invoices
This commit is contained in:
@@ -37,6 +37,11 @@ class InvoiceDataValidationResource extends Resource
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->relationship('plant', 'name')
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('distribution_channel_desc')
|
||||
->label('Distribution Channel Description')
|
||||
@@ -206,7 +211,7 @@ class InvoiceDataValidationResource extends Resource
|
||||
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
|
||||
// Store manually using storeAs to keep original name
|
||||
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
|
||||
$path = $uploadedFile->storeAs('uploads/InvoiceOut', $originalName, 'local'); // returns relative path
|
||||
|
||||
$fullPath = Storage::disk('local')->path($path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user