Added customer trade and location in invoice pending reason page #213

Merged
jothi merged 1 commits from ranjith-dev into master 2026-01-21 05:55:36 +00:00

View File

@@ -53,6 +53,8 @@ class InvoicePendingReason extends Page
->afterStateUpdated(function ($state, $set, callable $get,$livewire) {
$plantId = $get('plant_id');
$set('document_number', null);
$set('customer_trade_name', null);
$set('location', null);
})
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
->hintColor('danger'),
@@ -125,14 +127,41 @@ class InvoicePendingReason extends Page
->toArray();
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
return [];
}
$documentNumber = $get('document_number');
$customers = InvoiceDataValidation::where('plant_id', $plantId)
->where('document_number', $documentNumber)
->value('customer_trade_name');
$location = InvoiceDataValidation::where('plant_id', $plantId)
->where('document_number', $documentNumber)
->value('location');
$set('customer_trade_name', $customers);
$set('location', $location);
})
->extraAttributes(fn ($get) => [
'class' => $get('pqBlockError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('pqBlockError') ? $get('pqBlockError') : null)
->hintColor('danger'),
TextInput::make('remark')
TextInput::make('customer_trade_name')
->label('Customer Trade Name')
->required()
->readOnly()
->reactive()
->columnSpan(1),
TextInput::make('location')
->label('Location')
->required()
->readOnly()
->reactive()
->columnSpan(1),
TextInput::make('remark')
->label('Remark')
->reactive()
->maxLength(40)