Compare commits
3 Commits
500a2ae3ca
...
17bca76d06
| Author | SHA1 | Date | |
|---|---|---|---|
| 17bca76d06 | |||
|
|
0938f0955d | ||
|
|
ab70705e5a |
@@ -385,6 +385,11 @@ class InvoiceValidationResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('invoice_serial_number', null);
|
$set('invoice_serial_number', null);
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
|
if (! $plantId) {
|
||||||
|
$set('invoice_serial_number', null);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||||
|
|
||||||
$directory = "uploads/temp/{$plantCode}";
|
$directory = "uploads/temp/{$plantCode}";
|
||||||
@@ -399,7 +404,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->acceptedFileTypes([
|
->acceptedFileTypes([
|
||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
'application/vnd.ms-excel', // Legacy .xls fallback if needed
|
// 'application/vnd.ms-excel', // Legacy .xls fallback if needed
|
||||||
])
|
])
|
||||||
->rules(['mimes:xlsx']) // Laravel validation: extension check
|
->rules(['mimes:xlsx']) // Laravel validation: extension check
|
||||||
->preserveFilenames() // <- this keeps the original filename
|
->preserveFilenames() // <- this keeps the original filename
|
||||||
@@ -729,6 +734,11 @@ class InvoiceValidationResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('invoice_material', null);
|
$set('invoice_material', null);
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
|
if (! $plantId) {
|
||||||
|
$set('invoice_material', null);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||||
|
|
||||||
$directory = "uploads/temp/{$plantCode}";
|
$directory = "uploads/temp/{$plantCode}";
|
||||||
@@ -741,10 +751,15 @@ class InvoiceValidationResource extends Resource
|
|||||||
FileUpload::make('invoice_material')
|
FileUpload::make('invoice_material')
|
||||||
->label('Invoice Material')
|
->label('Invoice Material')
|
||||||
->required()
|
->required()
|
||||||
|
->acceptedFileTypes([
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
// 'application/vnd.ms-excel', // Legacy .xls fallback if needed
|
||||||
|
])
|
||||||
|
->rules(['mimes:xlsx']) // Laravel validation: extension check
|
||||||
->preserveFilenames() // <- this keeps the original filename
|
->preserveFilenames() // <- this keeps the original filename
|
||||||
->reactive()
|
->reactive()
|
||||||
->storeFiles(false) // prevent auto-storing
|
->storeFiles(false) // prevent auto-storing, we will store manually
|
||||||
->disk('local')
|
->disk('local') // 'local' refers to the local storage disk defined in config/filesystems.php, typically pointing to storage/app.
|
||||||
->visible(fn (Get $get) => ! empty($get('plant_id')))
|
->visible(fn (Get $get) => ! empty($get('plant_id')))
|
||||||
->directory(function (callable $get) {
|
->directory(function (callable $get) {
|
||||||
$plant = Plant::find($get('plant_id'));
|
$plant = Plant::find($get('plant_id'));
|
||||||
@@ -752,6 +767,7 @@ class InvoiceValidationResource extends Resource
|
|||||||
|
|
||||||
return "uploads/temp/{$plantCode}";
|
return "uploads/temp/{$plantCode}";
|
||||||
})
|
})
|
||||||
|
->uploadingMessage('Uploading...')
|
||||||
->helperText('Only .xlsx files are allowed (Excel files).'),
|
->helperText('Only .xlsx files are allowed (Excel files).'),
|
||||||
])
|
])
|
||||||
->action(function (array $data) {
|
->action(function (array $data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user