Refactor code structure for improved readability and maintainability and Commented imported invoice logic on warning

This commit is contained in:
dhanabalan
2025-11-15 20:04:30 +05:30
parent 43ee1a3502
commit 3e41bad7f1
2 changed files with 445 additions and 436 deletions

View File

@@ -269,8 +269,7 @@ class SerialValidationResource extends Resource
->alignCenter()
->sortable(),
])
->headerActions([
->headerActions([
// Action::make('plant_id')
// ->label('Select Plant')
// ->form([
@@ -470,10 +469,10 @@ class SerialValidationResource extends Resource
if (!empty($uniqueInvalidCodes)) {
Notification::make()
->title('Invalid Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>' . implode(', ', $uniqueInvalidCodes))
->danger()
->send();
->title('Invalid Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>' . implode(', ', $uniqueInvalidCodes))
->danger()
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
@@ -492,10 +491,10 @@ class SerialValidationResource extends Resource
}
else if (!empty($uniqueSerialCodes)) {
Notification::make()
->title('Invalid Serial Number')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->send();
->title('Invalid Serial Number')
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>' . implode(', ', $uniqueSerialCodes))
->danger()
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
@@ -503,10 +502,10 @@ class SerialValidationResource extends Resource
}
else if (!empty($duplicateSerialCodes)) {
Notification::make()
->title('Duplicate Serial Numbers')
->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
->danger()
->send();
->title('Duplicate Serial Numbers')
->body('The following serial numbers are already exist in imported excel:<br>' . implode(', ', $duplicateSerialCodes))
->danger()
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
@@ -519,9 +518,9 @@ class SerialValidationResource extends Resource
->danger() // This makes the notification red to indicate an error
->body('Uploaded Excel sheet is empty or<br>contains no valid data.')
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
@@ -589,7 +588,7 @@ class SerialValidationResource extends Resource
}
else
{
// Save full file path to session
// Save full file path to session
session(['uploaded_invoice_path' => $fullPath]);
Notification::make()
->title('Serial invoice imported successfully.')