Added location form in resource page in invoice data validations

This commit is contained in:
dhanabalan
2025-11-14 18:55:45 +05:30
parent 39bf9c3baa
commit 3e81effde4

View File

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