From 1af5a7d0b62fb403df8f165302c6727835d1d9ad Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 20 May 2025 09:31:34 +0530 Subject: [PATCH] Report table column order changed and Added passing invoice name without extension while import to check status on database --- .../Resources/InvoiceValidationResource.php | 54 +++++++++++-------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/app/Filament/Resources/InvoiceValidationResource.php b/app/Filament/Resources/InvoiceValidationResource.php index bc3ff8b..6538c8f 100644 --- a/app/Filament/Resources/InvoiceValidationResource.php +++ b/app/Filament/Resources/InvoiceValidationResource.php @@ -204,68 +204,76 @@ class InvoiceValidationResource extends Resource ->sortable(), Tables\Columns\TextColumn::make('invoice_number') ->label('Invoice Number') + ->alignCenter() ->sortable(), //->searchable() Tables\Columns\TextColumn::make('stickerMaster.item.code') - ->label('Material Code') + ->label('Item Code') + ->alignCenter() ->sortable(), //->searchable() Tables\Columns\TextColumn::make('serial_number') ->label('Serial Number') + ->alignCenter() ->sortable(), //->searchable() Tables\Columns\TextColumn::make('motor_scanned_status') ->label('Motor Scanned Status') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('pump_scanned_status') ->label('Pump Scanned Status') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('scanned_status_set') ->label('Pump Set Scanned Status') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('capacitor_scanned_status') ->label('Capacitor Scanned Status') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('scanned_status') ->label('Scanned Status') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('panel_box_supplier') ->label('Panel Box Supplier') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('panel_box_serial_number') ->label('Panel Box Serial Number') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('load_rate') ->label('Load Rate') ->numeric() - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('upload_status') ->label('Upload Status') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('batch_number') ->label('Batch Number') - ->sortable(), + ->alignCenter(), Tables\Columns\TextColumn::make('quantity') - ->label('Quantity') - ->numeric() - ->sortable(), - Tables\Columns\TextColumn::make('operator_id') - ->label('Operator ID') - ->sortable(), + ->label('Quantity') + ->alignCenter() + ->numeric(), Tables\Columns\TextColumn::make('plant.name') ->label('Plant') + ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('created_at') ->label('Created At') ->dateTime() + ->alignCenter() ->sortable(), Tables\Columns\TextColumn::make('updated_at') ->label('Updated At') ->dateTime() + ->alignCenter() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('deleted_at') ->label('Deleted At') ->dateTime() + ->alignCenter() ->sortable() ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('operator_id') + ->label('Operator ID') + ->alignCenter() + ->sortable(), ]) ->headerActions([ @@ -316,6 +324,8 @@ class InvoiceValidationResource extends Resource // Get original filename $originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx + $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME); + // Store manually using storeAs to keep original name $path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path // uploads/temp/3RA0018735.xlsx @@ -323,8 +333,8 @@ class InvoiceValidationResource extends Resource $fullPath = Storage::disk('local')->path($path); // /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx - $totQuan = InvoiceValidation::where('invoice_number', $originalName)->where('plant_id', $plantId)->count(); - $scanSQuan = InvoiceValidation::where('invoice_number', $originalName)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count(); + $totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('plant_id', $plantId)->count(); + $scanSQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count(); if($totQuan == $scanSQuan && $totQuan > 0) { @@ -594,12 +604,14 @@ class InvoiceValidationResource extends Resource // Get original filename $originalName = $uploadedFile->getClientOriginalName(); + $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME); + $path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); $fullPath = Storage::disk('local')->path($path); - $totQuan = InvoiceValidation::where('invoice_number', $originalName)->where('plant_id', $plantId)->count(); - $scanMQuan = InvoiceValidation::where('invoice_number', $originalName)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count(); + $totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->where('plant_id', $plantId)->count(); + $scanMQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count(); if($totQuan == $scanMQuan && $totQuan > 0) {