Refactor Invoice Validation Logic and Update UI for Serial and Material Invoices

- Improved conditional checks for invoice processing in InvoiceValidationResource on completion (or pending).
- Enhanced notifications for completed scanning processes for both serial and material invoices.
- Updated CreateInvoiceValidation page to pass invoice type to serial and material invoice on completion (or pending).
- Modified InvoiceDataTable to include a new property for serial/material invoice handling.
- Adjusted Blade view to dynamically display the correct title and messages based on invoice type (serial/material).
This commit is contained in:
dhanabalan
2025-08-05 12:00:26 +05:30
parent d6c77bd6c3
commit 197184e2ed
4 changed files with 255 additions and 132 deletions

View File

@@ -19,6 +19,8 @@ class InvoiceDataTable extends Component
public bool $completedInvoice = false;
public bool $isSerial = false;
public bool $emptyInvoice = false;
public bool $hasSearched = false;
@@ -49,11 +51,12 @@ class InvoiceDataTable extends Component
public string $currentSerialNumber = '';
public function loadCompletedData($invoiceNumber, $plantId)
public function loadCompletedData($invoiceNumber, $plantId, $isSerial)
{
$this->plantId = $plantId;
$this->invoiceNumber = $invoiceNumber;
$this->completedInvoice = true;
$this->isSerial = $isSerial;
$this->emptyInvoice = false;
$this->hasSearched = false;
$this->materialInvoice = false;
@@ -64,8 +67,8 @@ class InvoiceDataTable extends Component
{
$this->plantId = $plantId;
$this->invoiceNumber = $invoiceNumber;
$this->emptyInvoice = true;
$this->completedInvoice = false;
$this->emptyInvoice = true;
$this->hasSearched = false;
$this->materialInvoice = false;
// $this->showCapacitorInput = false;
@@ -75,9 +78,10 @@ class InvoiceDataTable extends Component
{
$this->plantId = $plantId;
$this->invoiceNumber = $invoiceNumber;
$this->hasSearched = true;
$this->emptyInvoice = false;
$this->completedInvoice = false;
$this->isSerial = true;
$this->emptyInvoice = false;
$this->hasSearched = true;
$this->materialInvoice = false;
// $this->showCapacitorInput = false;
@@ -113,10 +117,11 @@ class InvoiceDataTable extends Component
{
$this->plantId = $plantId;
$this->invoiceNumber = $invoiceNumber;
$this->materialInvoice = true;
$this->emptyInvoice = false;
$this->completedInvoice = false;
$this->isSerial = false;
$this->emptyInvoice = false;
$this->hasSearched = false;
$this->materialInvoice = true;
// $this->showCapacitorInput = false;
//->where('serial_number', '!=', '')
@@ -171,13 +176,12 @@ class InvoiceDataTable extends Component
$this->currentSerialNumber = $serialNumber;
$this->showCapacitorInput = true;
// $this->capacitorInput = '';
$this->emptyInvoice = false;
$this->completedInvoice = false;
$this->isSerial = true;
$this->emptyInvoice = false;
$this->hasSearched = false;
$this->materialInvoice = false;
$this->dispatch('focus-capacitor-input');
$this->dispatch('focus-capacitor-input');
}
public function cancelCapacitorInput()
@@ -330,7 +334,7 @@ class InvoiceDataTable extends Component
->success()
->seconds(2)
->send();
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id);
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
}
else
{