added logic for created at and updated at in item characteristic #1480

Merged
jothi merged 1 commits from ranjith-dev into master 2026-11-19 06:55:52 +00:00

View File

@@ -8,6 +8,7 @@ use App\Models\Plant;
use Filament\Actions\Imports\ImportColumn; use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer; use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import; use Filament\Actions\Imports\Models\Import;
use Filament\Facades\Filament;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@@ -568,22 +569,22 @@ class ItemCharacteristicImporter extends Importer
->label('ZMM MRP') ->label('ZMM MRP')
->exampleHeader('ZMM MRP') ->exampleHeader('ZMM MRP')
->example(''), ->example(''),
ImportColumn::make('created_at') // ImportColumn::make('created_at')
->label('CREATED AT') // ->label('CREATED AT')
->exampleHeader('CREATED AT') // ->exampleHeader('CREATED AT')
->example('01-01-2026 00:08:00'), // ->example('01-01-2026 00:08:00'),
ImportColumn::make('created_by') // ImportColumn::make('created_by')
->label('CREATED BY') // ->label('CREATED BY')
->exampleHeader('CREATED BY') // ->exampleHeader('CREATED BY')
->example('TEST001'), // ->example('TEST001'),
ImportColumn::make('updated_at') // ImportColumn::make('updated_at')
->label('UPDATED AT') // ->label('UPDATED AT')
->exampleHeader('UPDATED AT') // ->exampleHeader('UPDATED AT')
->example('01-01-2026 00:08:00'), // ->example('01-01-2026 00:08:00'),
ImportColumn::make('updated_by') // ImportColumn::make('updated_by')
->label('UPDATED BY') // ->label('UPDATED BY')
->exampleHeader('UPDATED BY') // ->exampleHeader('UPDATED BY')
->example('TEST001'), // ->example('TEST001'),
]; ];
} }
@@ -728,6 +729,7 @@ class ItemCharacteristicImporter extends Importer
$zmmOperTemp = $this->data['zmm_operating_temperature']; $zmmOperTemp = $this->data['zmm_operating_temperature'];
$zmmAxialForce = $this->data['zmm_axial_force']; $zmmAxialForce = $this->data['zmm_axial_force'];
$zmmMrp = $this->data['zmm_mrp']; $zmmMrp = $this->data['zmm_mrp'];
$userName = Filament::auth()->user()->name;
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) { if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found'; $warnMsg[] = 'Invalid plant code found';
@@ -889,16 +891,19 @@ class ItemCharacteristicImporter extends Importer
'zmm_operating_temperature' => $this->data['zmm_operating_temperature'], 'zmm_operating_temperature' => $this->data['zmm_operating_temperature'],
'zmm_axial_force' => $this->data['zmm_axial_force'], 'zmm_axial_force' => $this->data['zmm_axial_force'],
'zmm_mrp' => $this->data['zmm_mrp'], 'zmm_mrp' => $this->data['zmm_mrp'],
'created_by' => $userName,
'updated_at' => now(),
'updated_by' => $userName,
] ]
); );
if($itemCharacteristic){ // if($itemCharacteristic){
Notification::make() // Notification::make()
->title('Success') // ->title('Success')
->body('Item characteristic saved successfully.') // ->body('Item characteristic saved successfully.')
->success() // ->success()
->send(); // ->send();
} // }
return $itemCharacteristic; return $itemCharacteristic;
} }