Added scan_quantity and pend_quantity fields with respective validations
This commit is contained in:
@@ -65,7 +65,9 @@ class LocatorInvoiceValidationResource extends Resource
|
||||
$set('invoice_number', null);
|
||||
$set('pallet_number', null);
|
||||
$set('serial_number', null);
|
||||
$set('sno_quantity', null);
|
||||
$set('sno_quantity', 0);
|
||||
$set('scan_quantity', 0);
|
||||
$set('pend_quantity', 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -73,7 +75,9 @@ class LocatorInvoiceValidationResource extends Resource
|
||||
$set('invoice_number', null);
|
||||
$set('pallet_number', null);
|
||||
$set('serial_number', null);
|
||||
$set('sno_quantity', null);
|
||||
$set('sno_quantity', 0);
|
||||
$set('scan_quantity', 0);
|
||||
$set('pend_quantity', 0);
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -92,14 +96,28 @@ class LocatorInvoiceValidationResource extends Resource
|
||||
->readOnly(fn (callable $get) => !$get('plant') || $get('pallet_number') || $get('serial_number'))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant');
|
||||
$invNo = $get('invoice_number');
|
||||
$snoCount = 0;
|
||||
$pendingCount = 0;
|
||||
$scannedCount = 0;
|
||||
if (!$plantId) {
|
||||
$set('invoice_number', null);
|
||||
$set('pallet_number', null);
|
||||
}
|
||||
else if ($invNo)
|
||||
{
|
||||
$snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invNo)->count();
|
||||
|
||||
$pendingCount = LocatorInvoiceValidation::where('invoice_number', $invNo)->where('plant_id', $plantId)->whereNull('scanned_status')->orWhere('scanned_status', '=', '')->count();
|
||||
|
||||
$scannedCount = LocatorInvoiceValidation::where('invoice_number', $invNo)->where('plant_id', $plantId)->where('scanned_status', '=', 'Scanned')->count();
|
||||
}
|
||||
$set('update_invoice', null);
|
||||
$set('pallet_number', null);
|
||||
$set('serial_number', null);
|
||||
$set('sno_quantity', $snoCount);
|
||||
$set('scan_quantity', $scannedCount);
|
||||
$set('pend_quantity', $pendingCount);
|
||||
}),
|
||||
Forms\Components\TextInput::make('pallet_number')
|
||||
->label('Scan Pallet No')
|
||||
@@ -180,7 +198,18 @@ class LocatorInvoiceValidationResource extends Resource
|
||||
'x-on:keydown.enter.prevent' => '$wire.processSerialNo()',
|
||||
]),
|
||||
Forms\Components\TextInput::make('sno_quantity')
|
||||
->label('SNo. Quantity')
|
||||
->label('Invoice Quantity')
|
||||
->default(0)
|
||||
->readOnly(),
|
||||
|
||||
Forms\Components\TextInput::make('scan_quantity')
|
||||
->label('Scanned Quantity')
|
||||
->default(0)
|
||||
->readOnly(),
|
||||
|
||||
Forms\Components\TextInput::make('pend_quantity')
|
||||
->label('Pending Quantity')
|
||||
->default(0)
|
||||
->readOnly(),
|
||||
|
||||
//Forms\Components\View::make('forms.components.update-invoice-button'),
|
||||
|
||||
Reference in New Issue
Block a user