1
0
forked from poc/pds

Updated success and failure messages and notifications display seconds

This commit is contained in:
dhanabalan
2025-07-02 15:03:50 +05:30
parent 017088c380
commit a33c73c2f2

View File

@@ -139,6 +139,7 @@ class PalletFromLocator extends Page implements HasForms
Notification::make()
->title('Press enter on "Scan Serial Number" field to proceed..!')
->danger()
->seconds(2)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -156,6 +157,7 @@ class PalletFromLocator extends Page implements HasForms
Notification::make()
->title('Press enter on "Remove Serial Number" field to proceed..!')
->danger()
->seconds(2)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -172,9 +174,10 @@ class PalletFromLocator extends Page implements HasForms
if ($locatorNo == null || $locatorNo == '')
{
Notification::make()
->title('Unknown: Locator')
->title('Invalid: Locator Number')
->body("Locator number can't be empty!")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -187,11 +190,13 @@ class PalletFromLocator extends Page implements HasForms
]);
return;
}
if (strlen($locatorNo) < 7)
else if (strlen($locatorNo) < 7)
{
Notification::make()
->title("Locator number '$locatorNo' must be at least 7 digits.")
->title('Invalid: Locator Number')
->body("Locator number '$locatorNo' must be at least 7 digits.")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -212,8 +217,10 @@ class PalletFromLocator extends Page implements HasForms
if (!$exists)
{
Notification::make()
->title("Locator number '$locatorNo' does not exist in the master.")
->title('Unknown: Locator Number')
->body("Locator number '$locatorNo' does not exist in the master.")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -228,23 +235,24 @@ class PalletFromLocator extends Page implements HasForms
}
$serialLocator = PalletValidation::query()
->where('plant_id', $plantId)
->where('locator_number', $locatorNo)
->where(function($query) {
$query->whereNull('pallet_number')
->orWhere('pallet_number', '');
})
->get();
->where('plant_id', $plantId)
->where('locator_number', $locatorNo)
->where(function($query) {
$query->whereNull('pallet_number')
->orWhere('pallet_number', '');
})
->get();
//$locatorSno = $serialLocator->pluck('serial_number')->toArray();
if ($serialLocator->count() <= 0)
{
Notification::make()
->title('Serial Locator Number Not Found')
->title('Unknown: Serial Locator Number')
->body("Scanned locator number '$locatorNo' does not have any locator serial numbers to store into the pallet.<br>
Please scan a valid stored locator number to proceed.")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -338,15 +346,15 @@ class PalletFromLocator extends Page implements HasForms
$this->records = array_merge($this->records, $newRecords);
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
'scan_locator_number' => $locatorNo,
'scan_serial_number' => null,
'scan_remove_sno' => null,
'sno_quantity' => count($this->records),
]);
// $this->dispatch('loadData', $this->records, $plantId);
// $this->form->fill([
// 'plant_id' => $plantId,
// 'plant' => $plantId,
// 'scan_locator_number' => $locatorNo,
// 'scan_serial_number' => null,
// 'scan_remove_sno' => null,
// 'sno_quantity' => count($this->records),
// ]);
}
else if ($serialNo != null && $serialNo != '')
{
@@ -377,10 +385,9 @@ class PalletFromLocator extends Page implements HasForms
Notification::make()
->title('Add: Locator Serial Number')
->body(
"Scanned locator serial number '$serialNo' successfully added into 'PALLET DATA' table."
)
->body("Scanned locator serial number '$serialNo' successfully added into 'PALLET DATA' table.")
->success()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
@@ -401,10 +408,9 @@ class PalletFromLocator extends Page implements HasForms
Notification::make()
->title('Remove: Locator Serial Number')
->body(
"Scanned locator serial number '$removeserial' removed successfully from 'PALLET DATA' table."
)
->body("Scanned locator serial number '$removeserial' removed successfully from 'PALLET DATA' table.")
->success()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
@@ -430,13 +436,12 @@ class PalletFromLocator extends Page implements HasForms
->where('plant_id', $plantId)
->where('locator_number', $locatorNo)
->where(function($query) {
$query->whereNull('pallet_number')
->orWhere('pallet_number', '');
$query->whereNull('pallet_number')->orWhere('pallet_number', '');
})
->get()
->count();
$this->loadlocatorData($locatorNo, $serial, $removeSno, $plantId);
$this->loadlocatorData($locatorNo, '', '', $plantId);
$this->dispatch('close-modal', id: 'confirm-process-modal');
@@ -444,6 +449,7 @@ class PalletFromLocator extends Page implements HasForms
->title('Add: Locator Serial Numbers')
->body("Scanned locator number '$locatorNo' has '$serialLocator' locator serial numbers!<br>Successfully added into 'PALLET DATA' table.")
->success()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -460,8 +466,10 @@ class PalletFromLocator extends Page implements HasForms
{
$plantId = $this->form->getState()['plant'];
Notification::make()
->title('Scan the new locator number to proceed..!')
->title('Skipped: Locator Number')
->body('Scan the new locator number to proceed..!')
->info()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -491,6 +499,7 @@ class PalletFromLocator extends Page implements HasForms
Notification::make()
->title('Press enter on "Scan Locator Number" field to proceed..!')
->danger()
->seconds(2)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -508,6 +517,7 @@ class PalletFromLocator extends Page implements HasForms
Notification::make()
->title('Press enter on "Remove Serial Number" field to proceed..!')
->danger()
->seconds(2)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -524,9 +534,11 @@ class PalletFromLocator extends Page implements HasForms
if ($serialNo == '' || $serialNo == null)
{
Notification::make()
->title("Serial number can't be empty!")
->danger()
->send();
->title('Invalid: Serial Number')
->body("Serial number can't be empty!")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -541,9 +553,11 @@ class PalletFromLocator extends Page implements HasForms
else if (strlen($serialNo) < 13)
{
Notification::make()
->title("Serial number '$serialNo' must be at least 13 digits.")
->danger()
->send();
->title('Invalid: Serial Number')
->body("Serial number '$serialNo' must be at least 13 digits.")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -558,9 +572,11 @@ class PalletFromLocator extends Page implements HasForms
else if (!ctype_alnum($serialNo))
{
Notification::make()
->title("Serial number '$serialNo' must contain alpha-numeric values only.")
->danger()
->send();
->title('Invalid: Serial Number')
->body("Serial number '$serialNo' must contain alpha-numeric values only.")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -585,9 +601,10 @@ class PalletFromLocator extends Page implements HasForms
if ($serialLocator == '' || $serialLocator == null)
{
Notification::make()
->title('UNKNOWN SERIAL NUMBER')
->body("Scanned serial number: '$serialNo' doesn't exist in database!<br>Scan the valid exist locator-serial number to proceed...")
->title('Unknown: Serial Number')
->body("Scanned serial number: '$serialNo' doesn't exist in pallet table.<br>Scan the valid exist locator-serial number to proceed..!")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -603,9 +620,10 @@ class PalletFromLocator extends Page implements HasForms
elseif ($serialLocator->pallet_number != '' && $serialLocator->pallet_number != null)
{
Notification::make()
->title('INVALID SERIAL NUMBER')
->body("Scanned serial number: '$serialNo' already exist in pallet number '$serialLocator->pallet_number'!<br>Scan the valid locator-serial number to proceed...")
->title('Invalid: Serial Number')
->body("Scanned serial number: '$serialNo' already exist in pallet number '".$serialLocator->pallet_number."'.<br>Scan the valid locator-serial number to proceed..!")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -666,6 +684,7 @@ class PalletFromLocator extends Page implements HasForms
->title('Locator Serials Not Found')
->body("Add some locator serial numbers to proceed generate pallet..!")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -731,6 +750,7 @@ class PalletFromLocator extends Page implements HasForms
->title('Success: Pallet Generated')
->body("Pallet number '$newPalletNumber' completed the master packing successfully!")
->success()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -750,6 +770,7 @@ class PalletFromLocator extends Page implements HasForms
->title('Failed: Pallet Generated')
->body("No locator serial number records found to generate pallet..!")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -807,6 +828,7 @@ class PalletFromLocator extends Page implements HasForms
Notification::make()
->title('Press enter on "Scan Locator Number" field to proceed..!')
->danger()
->seconds(2)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -824,6 +846,7 @@ class PalletFromLocator extends Page implements HasForms
Notification::make()
->title('Press enter on "Scan Serial Number" field to proceed..!')
->danger()
->seconds(2)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
@@ -837,13 +860,14 @@ class PalletFromLocator extends Page implements HasForms
return;
}
if ($removeSno == '' || $removeSno == null)
{
Notification::make()
->title("Serial number can't be empty!")
->danger()
->send();
->title('Invalid: Serial Number')
->body("Serial number can't be empty!")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -858,9 +882,11 @@ class PalletFromLocator extends Page implements HasForms
else if (strlen($removeSno) < 13)
{
Notification::make()
->title("Serial number '$removeSno' must be at least 13 digits.")
->danger()
->send();
->title('Invalid: Serial Number')
->body("Serial number '$removeSno' must be at least 13 digits.")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -875,9 +901,11 @@ class PalletFromLocator extends Page implements HasForms
else if (!ctype_alnum($removeSno))
{
Notification::make()
->title("Serial number '$removeSno' must contain alpha-numeric values only.")
->danger()
->send();
->title('Invalid: Serial Number')
->body("Serial number '$removeSno' must contain alpha-numeric values only.")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([
'plant_id' => $plantId,
@@ -905,9 +933,10 @@ class PalletFromLocator extends Page implements HasForms
if (!$exists)
{
Notification::make()
->title('UNKNOWN SERIAL NUMBER')
->body("Scanned serial number: '$removeSno' doesn't exist in 'PALLET DATA' table!<br>Scan the valid exist locator-serial number to proceed...")
->title('Unknown: Serial Number')
->body("Scanned serial number: '$removeSno' doesn't exist in 'PALLET DATA' table.<br>Scan the valid exist locator-serial number to proceed..!")
->danger()
->seconds(3)
->send();
$this->dispatch('loadData', $this->records, $plantId);
$this->form->fill([