Added location form in resource page in invoice data validations
This commit is contained in:
@@ -60,6 +60,9 @@ class InvoiceDataValidationResource extends Resource
|
||||
Forms\Components\TextInput::make('customer_location')
|
||||
->label('Customer Location')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('location')
|
||||
->label('Location')
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
@@ -116,6 +119,11 @@ class InvoiceDataValidationResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('location')
|
||||
->label('Location')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
@@ -212,6 +220,7 @@ class InvoiceDataValidationResource extends Resource
|
||||
$invalidUser = [];
|
||||
$userNotFound = [];
|
||||
$invalidPlantType = [];
|
||||
$invalidLocation = [];
|
||||
|
||||
$seenPlantDoc = [];
|
||||
//$duplicateEntries = [];
|
||||
@@ -228,6 +237,7 @@ class InvoiceDataValidationResource extends Resource
|
||||
$DocDate = trim($row[7]);
|
||||
$CusTradeName = trim($row[9]);
|
||||
$CusLocation = trim($row[10]);
|
||||
$Location = trim($row[36]);
|
||||
|
||||
// if (empty($plantCode)) $invalidPlantCode[] = "Row {$index}";
|
||||
if (empty($DisChaDesc)){
|
||||
@@ -248,6 +258,10 @@ class InvoiceDataValidationResource extends Resource
|
||||
{
|
||||
$invalidCusLocation[] = "Row {$index}";
|
||||
}
|
||||
if (empty($Location))
|
||||
{
|
||||
$invalidLocation[] = "Row {$index}";
|
||||
}
|
||||
// if (empty($createdBy)) $invalidUser[] = "Row {$index}";
|
||||
|
||||
if (strlen($plantCode) < 4) {
|
||||
@@ -292,6 +306,7 @@ class InvoiceDataValidationResource extends Resource
|
||||
if (!empty($invalidDocDate)) $errorMsg .= 'Missing Document Date in rows: ' . implode(', ', $invalidDocDate) . '<br>';
|
||||
if (!empty($invalidCusTradeName)) $errorMsg .= 'Missing Customer Trade Name in rows: ' . implode(', ', $invalidCusTradeName) . '<br>';
|
||||
if (!empty($invalidCusLocation)) $errorMsg .= 'Missing Customer Location in rows: ' . implode(', ', $invalidCusLocation) . '<br>';
|
||||
if (!empty($invalidLocation)) $errorMsg .= 'Missing Location in rows: ' . implode(', ', $invalidLocation) . '<br>';
|
||||
|
||||
Notification::make()
|
||||
->title('Missing Mandatory Fields')
|
||||
@@ -455,6 +470,7 @@ class InvoiceDataValidationResource extends Resource
|
||||
$DocDate = trim($row[7]);
|
||||
$CusTradeName = trim($row[9]);
|
||||
$CusLocation = trim($row[10]);
|
||||
$Location = trim($row[36]);
|
||||
|
||||
if (empty($DocNo)) {
|
||||
throw new \Exception("Row '{$rowNumber}' Missing QR Code");
|
||||
@@ -491,6 +507,7 @@ class InvoiceDataValidationResource extends Resource
|
||||
'document_date' => $formattedDate,
|
||||
'customer_trade_name' => $CusTradeName,
|
||||
'customer_location' => $CusLocation,
|
||||
'location' => $Location,
|
||||
'updated_by' => $operatorName
|
||||
]);
|
||||
$inserted = $record;
|
||||
@@ -504,6 +521,7 @@ class InvoiceDataValidationResource extends Resource
|
||||
'document_date' => $formattedDate,
|
||||
'customer_trade_name' => $CusTradeName,
|
||||
'customer_location' => $CusLocation,
|
||||
'location' => $Location,
|
||||
'created_by' => $operatorName
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user