Merge pull request 'Added customer trade and location in invoice pending reason page' (#213) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #213
This commit was merged in pull request #213.
This commit is contained in:
@@ -53,6 +53,8 @@ class InvoicePendingReason extends Page
|
|||||||
->afterStateUpdated(function ($state, $set, callable $get,$livewire) {
|
->afterStateUpdated(function ($state, $set, callable $get,$livewire) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
$set('document_number', null);
|
$set('document_number', null);
|
||||||
|
$set('customer_trade_name', null);
|
||||||
|
$set('location', null);
|
||||||
})
|
})
|
||||||
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
|
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
@@ -125,14 +127,41 @@ class InvoicePendingReason extends Page
|
|||||||
->toArray();
|
->toArray();
|
||||||
})
|
})
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->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) => [
|
->extraAttributes(fn ($get) => [
|
||||||
'class' => $get('pqBlockError') ? 'border-red-500' : '',
|
'class' => $get('pqBlockError') ? 'border-red-500' : '',
|
||||||
])
|
])
|
||||||
->hint(fn ($get) => $get('pqBlockError') ? $get('pqBlockError') : null)
|
->hint(fn ($get) => $get('pqBlockError') ? $get('pqBlockError') : null)
|
||||||
->hintColor('danger'),
|
->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')
|
->label('Remark')
|
||||||
->reactive()
|
->reactive()
|
||||||
->maxLength(40)
|
->maxLength(40)
|
||||||
|
|||||||
Reference in New Issue
Block a user