21 Commits

Author SHA1 Message Date
dhanabalan
b9e62618a0 Updated prunable record report generation daily at 7 o'clock
Some checks are pending
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Waiting to run
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
2026-02-04 09:35:34 +05:30
dhanabalan
1325b77eb3 testing mail subject
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-04 09:23:45 +05:30
dhanabalan
0a9d6514cb testing mail subject
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-04 09:21:25 +05:30
dhanabalan
f2d0d3da8e testing mail subject
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-04 09:17:23 +05:30
dhanabalan
469b47d2dc Refactored plant selection logic and added 'updated_by' tracking in ProcessOrderResource form
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-04 09:03:51 +05:30
dhanabalan
702dd69c94 Added 'panel_box_code', 'created_by' and 'updated_by' columns on InvoiceValidationExporter page
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 21:31:06 +05:30
dhanabalan
ce65c68125 Added updated_by name on updated invoice for scanned serial numbers
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 21:15:13 +05:30
dhanabalan
92f3352f6b Updated clear panel box QR if cancel button clicked and Added panel_box_code update logic on livewire page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 20:57:39 +05:30
dhanabalan
a14cf0aef6 Added 'created_by' and 'updated_by' columns on record creation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 20:53:00 +05:30
dhanabalan
bdd8e9dfc3 Added 'created_by' and 'updated_by' columns to InvoiceValidationResource table and updated file upload validation for .xlsx file (serial / material invoice)
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 20:51:12 +05:30
dhanabalan
951a69b85e Added panel_box_code, created_by, updated_by columns in InvoiceValidation model
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 19:47:52 +05:30
dhanabalan
dc6fd87c7b Added migration file to create panel_box_code, created_by, updated_by columns in invoice_validations table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 19:46:19 +05:30
dhanabalan
f464facd56 Added panel_box_code, created_by, updated_by columns in invoice_validations migration table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 19:44:48 +05:30
dhanabalan
21d009ee1c Added approver_type column to characteristic_approver_masters table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 17:13:30 +05:30
dhanabalan
8e7030b80b Added dynamic plant options in user form based on authenticated user's plant ID
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 17:01:56 +05:30
dhanabalan
1931412511 Added skip plant if not exist on user importer page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 16:12:59 +05:30
dhanabalan
0fef7b27bf Updated Final API lists
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 13:16:13 +05:30
dhanabalan
115fe43428 Commented FileUploadController logic and Added request characteristics mail approve logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 13:13:28 +05:30
dhanabalan
5eb067899b Added invoice upload directory creation logic while choosing plant on resource page
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 12:32:06 +05:30
dhanabalan
8a2dac9982 Added invoice upload directory creation file store logic on resource and create page
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 12:28:22 +05:30
dhanabalan
79f09236ab Added invoice upload directory creation logic
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 12:19:25 +05:30
16 changed files with 491 additions and 244 deletions

View File

@@ -44,6 +44,8 @@ class InvoiceValidationExporter extends Exporter
->label('CAPACITOR SCANNED STATUS'), ->label('CAPACITOR SCANNED STATUS'),
ExportColumn::make('scanned_status') ExportColumn::make('scanned_status')
->label('SCANNED STATUS'), ->label('SCANNED STATUS'),
ExportColumn::make('panel_box_code')
->label('PANEL BOX CODE'),
ExportColumn::make('panel_box_supplier') ExportColumn::make('panel_box_supplier')
->label('PANEL BOX SUPPLIER'), ->label('PANEL BOX SUPPLIER'),
ExportColumn::make('panel_box_serial_number') ExportColumn::make('panel_box_serial_number')
@@ -61,9 +63,13 @@ class InvoiceValidationExporter extends Exporter
ExportColumn::make('created_at') ExportColumn::make('created_at')
->label('CREATED AT'), ->label('CREATED AT'),
// ->dateTimeFormat('d-m-Y H:i:s'), // ->dateTimeFormat('d-m-Y H:i:s'),
ExportColumn::make('created_by')
->label('CREATED BY'),
ExportColumn::make('updated_at') ExportColumn::make('updated_at')
->label('UPDATED AT'), ->label('UPDATED AT'),
// ->dateTimeFormat('d-m-Y H:i:s'), // ->dateTimeFormat('d-m-Y H:i:s'),
ExportColumn::make('updated_by')
->label('UPDATED BY'),
ExportColumn::make('deleted_at') ExportColumn::make('deleted_at')
->enabledByDefault(false) ->enabledByDefault(false)
->label('DELETED AT'), ->label('DELETED AT'),

View File

@@ -18,7 +18,7 @@ class UserImporter extends Importer
public static function getColumns(): array public static function getColumns(): array
{ {
return [ return [
ImportColumn::make('plant') ImportColumn::make('plant_id')
->requiredMapping() ->requiredMapping()
->exampleHeader('Plant Code') ->exampleHeader('Plant Code')
->example('1000') ->example('1000')
@@ -54,10 +54,13 @@ class UserImporter extends Importer
public function resolveRecord(): ?User public function resolveRecord(): ?User
{ {
$warnMsg = []; $warnMsg = [];
$plantCod = $this->data['plant']; $plantCod = $this->data['plant_id'];
$plant = null; $plant = null;
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) { if (Str::length($plantCod) > 0 && (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod))) {
$warnMsg[] = 'Invalid plant code found!'; $warnMsg[] = 'Invalid plant code found!';
} elseif (Str::length($plantCod) <= 0) {
$plant = null;
$plantCod = null;
} else { } else {
$plant = Plant::where('code', $plantCod)->first(); $plant = Plant::where('code', $plantCod)->first();
if (! $plant) { if (! $plant) {

View File

@@ -67,7 +67,7 @@ class InvoiceValidationResource extends Resource
->options(function (callable $get) { ->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id; $userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
}) })
->default(function () { ->default(function () {
return optional(InvoiceValidation::latest()->first())->plant_id; return optional(InvoiceValidation::latest()->first())->plant_id;
@@ -77,7 +77,7 @@ class InvoiceValidationResource extends Resource
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$plantId = $get('plant_id'); $plantId = $get('plant_id');
$set('update_invoice', null); $set('update_invoice', null);
// Ensure `linestop_id` is not cleared
if (! $plantId) { if (! $plantId) {
$set('invoice_number', null); $set('invoice_number', null);
$set('serial_number', null); $set('serial_number', null);
@@ -87,6 +87,11 @@ class InvoiceValidationResource extends Resource
return; return;
} else { } else {
$plantCode = Plant::find($plantId)?->code ?? null;
$directory = "uploads/temp/{$plantCode}";
if (! Storage::disk('local')->exists($directory)) {
Storage::disk('local')->makeDirectory($directory);
}
$set('ivPlantError', null); $set('ivPlantError', null);
} }
}) })
@@ -207,6 +212,14 @@ class InvoiceValidationResource extends Resource
Forms\Components\TextInput::make('id') Forms\Components\TextInput::make('id')
->hidden() ->hidden()
->readOnly(true), ->readOnly(true),
// Forms\Components\Hidden::make('created_by')
// ->label('Created By')
// ->default(Filament::auth()->user()?->name)
// ->reactive(),
// Forms\Components\Hidden::make('updated_by')
// ->label('Updated By')
// ->default(Filament::auth()->user()?->name)
// ->reactive(),
]) ])
->columns(5), ->columns(5),
]); ]);
@@ -262,9 +275,11 @@ class InvoiceValidationResource extends Resource
Tables\Columns\TextColumn::make('scanned_status') Tables\Columns\TextColumn::make('scanned_status')
->label('Scanned Status') ->label('Scanned Status')
->alignCenter(), ->alignCenter(),
// Tables\Columns\TextColumn::make('stickerMaster.panel_box_code') Tables\Columns\TextColumn::make('panel_box_code')// stickerMaster.panel_box_code
// ->label('Panel Box Code') ->label('Panel Box Code')
// ->alignCenter(), ->alignCenter()
->sortable(), // ->searchable()
// ->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('panel_box_supplier') Tables\Columns\TextColumn::make('panel_box_supplier')
->label('Panel Box Supplier') ->label('Panel Box Supplier')
->alignCenter(), ->alignCenter(),
@@ -289,11 +304,20 @@ class InvoiceValidationResource extends Resource
->label('Plant') ->label('Plant')
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('created_by')
->label('Created By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_at') Tables\Columns\TextColumn::make('created_at')
->label('Created At') ->label('Created At')
->dateTime() ->dateTime()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at') Tables\Columns\TextColumn::make('updated_at')
->label('Updated At') ->label('Updated At')
->dateTime() ->dateTime()
@@ -332,7 +356,7 @@ class InvoiceValidationResource extends Resource
->options(function (callable $get) { ->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id; $userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
}) })
->label('Select Plant') ->label('Select Plant')
->required() ->required()
@@ -341,19 +365,37 @@ class InvoiceValidationResource extends Resource
}) })
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('invoice_serial_number', null); $set('invoice_serial_number', null);
$plantId = $get('plant_id');
$plantCode = Plant::find($plantId)?->code ?? null;
$directory = "uploads/temp/{$plantCode}";
if ($plantId && ! Storage::disk('local')->exists($directory)) {
Storage::disk('local')->makeDirectory($directory);
}
}) })
->reactive(), ->reactive(),
FileUpload::make('invoice_serial_number') FileUpload::make('invoice_serial_number')
->label('Invoice Serial Number') ->label('Invoice Serial Number')
// ->required()
->preserveFilenames() // <- this keeps the original filename
->storeFiles(false) // prevent auto-storing, we will store manually
->reactive()
->required() ->required()
->acceptedFileTypes([
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel', // Legacy .xls fallback if needed
])
->rules(['mimes:xlsx']) // Laravel validation: extension check
->preserveFilenames() // <- this keeps the original filename
->reactive()
->storeFiles(false) // prevent auto-storing, we will store manually
->disk('local') // 'local' refers to the local storage disk defined in config/filesystems.php, typically pointing to storage/app. ->disk('local') // 'local' refers to the local storage disk defined in config/filesystems.php, typically pointing to storage/app.
->visible(fn (Get $get) => ! empty($get('plant_id'))) ->visible(fn (Get $get) => ! empty($get('plant_id')))
->directory('uploads/temp'), ->directory(function (callable $get) {
$plant = Plant::find($get('plant_id'));
$plantCode = $plant?->code ?? null;
return "uploads/temp/{$plantCode}";
})
->uploadingMessage('Uploading...')
->helperText('Only .xlsx files are allowed (Excel files).'),
]) ])
->action(function (array $data) { ->action(function (array $data) {
$uploadedFile = $data['invoice_serial_number']; $uploadedFile = $data['invoice_serial_number'];
@@ -362,17 +404,40 @@ class InvoiceValidationResource extends Resource
$plantId = $data['plant_id']; $plantId = $data['plant_id'];
$plant = Plant::find($plantId);
$plantCode = $plant?->code ?? null;
// Get original filename // Get original filename
$originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx $originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
$extension = strtolower(pathinfo($originalName, PATHINFO_EXTENSION));
if ($extension !== 'xlsx') {
throw new \Exception('Only .xlsx files allowed.');
}
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME); $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
$originalName = "{$originalNameOnly}.xlsx";
// Store manually using storeAs to keep original name // Store manually using storeAs to keep original name
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path $path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local'); // returns relative path
// uploads/temp/3RA0018735.xlsx // uploads/temp/{$plantCode}/3RA0018735.xlsx
if (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
Notification::make()
->title("Serial invoice number : '$originalNameOnly' should contain minimum 8 digit alpha numeric values!")
->danger()
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
$fullPath = Storage::disk('local')->path($path); $fullPath = Storage::disk('local')->path($path);
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx // /home/iot-dev/projects/pds/storage/app/private/uploads/temp/{$plantCode}/3RA0018735.xlsx
$totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->count(); $totQuan = InvoiceValidation::where('invoice_number', $originalNameOnly)->count();
if ($totQuan > 0) { if ($totQuan > 0) {
@@ -637,7 +702,7 @@ class InvoiceValidationResource extends Resource
->options(function (callable $get) { ->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id; $userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
}) })
->label('Select Plant') ->label('Select Plant')
->required() ->required()
@@ -646,32 +711,68 @@ class InvoiceValidationResource extends Resource
}) })
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('invoice_material', null); $set('invoice_material', null);
$plantId = $get('plant_id');
$plantCode = Plant::find($plantId)?->code ?? null;
$directory = "uploads/temp/{$plantCode}";
if ($plantId && ! Storage::disk('local')->exists($directory)) {
Storage::disk('local')->makeDirectory($directory);
}
}) })
->reactive(), ->reactive(),
FileUpload::make('invoice_material') FileUpload::make('invoice_material')
->label('Invoice Material') ->label('Invoice Material')
->required() ->required()
->preserveFilenames() ->preserveFilenames() // <- this keeps the original filename
->reactive() // <- this keeps the original filename ->reactive()
->storeFiles(false) // prevent auto-storing ->storeFiles(false) // prevent auto-storing
->disk('local') ->disk('local')
->visible(fn (Get $get) => ! empty($get('plant_id'))) ->visible(fn (Get $get) => ! empty($get('plant_id')))
->directory('uploads/temp'), ->directory(function (callable $get) {
$plant = Plant::find($get('plant_id'));
$plantCode = $plant?->code ?? null;
return "uploads/temp/{$plantCode}";
})
->helperText('Only .xlsx files are allowed (Excel files).'),
]) ])
->action(function (array $data) { ->action(function (array $data) {
$uploadedFile = $data['invoice_material']; $uploadedFile = $data['invoice_material'];
$plantId = $data['plant_id']; // Access the selected plant_id $plantId = $data['plant_id']; // Access the selected plant_id
$plant = Plant::find($plantId);
$plantCode = $plant?->code ?? null;
$disk = Storage::disk('local'); $disk = Storage::disk('local');
// Get original filename // Get original filename
$originalName = $uploadedFile->getClientOriginalName(); $originalName = $uploadedFile->getClientOriginalName();
$extension = strtolower(pathinfo($originalName, PATHINFO_EXTENSION));
if ($extension !== 'xlsx') {
throw new \Exception('Only .xlsx files allowed.');
}
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME); $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); $originalName = "{$originalNameOnly}.xlsx";
$path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local');
if (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
Notification::make()
->title("Material invoice number : '$originalNameOnly' should contain minimum 8 digit alpha numeric values!")
->danger()
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
}
$fullPath = Storage::disk('local')->path($path); $fullPath = Storage::disk('local')->path($path);
@@ -1073,7 +1174,7 @@ class InvoiceValidationResource extends Resource
->options(function (callable $get) { ->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id; $userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
}) })
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void { ->afterStateUpdated(function ($state, callable $set, callable $get): void {

View File

@@ -117,8 +117,8 @@ class CreateInvoiceValidation extends CreateRecord
$this->plantId = $plantId; $this->plantId = $plantId;
// $plant = Plant::find($plantId); $plant = Plant::find($plantId);
// $plantCode = $plant ? $plant->code : null; $plantCode = $plant?->code ?? null;
// ..GET SERIAL INVOICE API // ..GET SERIAL INVOICE API
@@ -233,7 +233,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
// $fullPath = null; // $fullPath = null;
@@ -266,7 +266,7 @@ class CreateInvoiceValidation extends CreateRecord
if ($updateStatus == '1') { if ($updateStatus == '1') {
// 'Material invoice update in progress...'; // 'Material invoice update in progress...';
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
$fullPath = $disk->path($filePath); $fullPath = $disk->path($filePath);
@@ -613,6 +613,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'quantity' => 1, 'quantity' => 1,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -653,6 +655,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'quantity' => $bundleQty, 'quantity' => $bundleQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -716,6 +720,7 @@ class CreateInvoiceValidation extends CreateRecord
$existEmpRecQty->update([ $existEmpRecQty->update([
'quantity' => $newInsQty, 'quantity' => $newInsQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'updated_by' => $operatorName,
'updated_at' => now(), 'updated_at' => now(),
]); ]);
$newQuan--; $newQuan--;
@@ -727,6 +732,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'quantity' => $newInsQty, 'quantity' => $newInsQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -746,6 +753,7 @@ class CreateInvoiceValidation extends CreateRecord
$existEmpRecQty->update([ $existEmpRecQty->update([
'quantity' => $newInsQty, 'quantity' => $newInsQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'updated_by' => $operatorName,
'updated_at' => now(), 'updated_at' => now(),
]); ]);
$newQuan--; $newQuan--;
@@ -757,6 +765,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'quantity' => $newInsQty, 'quantity' => $newInsQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -780,6 +790,8 @@ class CreateInvoiceValidation extends CreateRecord
->send(); ->send();
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->update(['updated_by' => $operatorName]); // 'updated_at' => now(),
// Update total quantity in the form // Update total quantity in the form
$totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count(); $totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count(); $scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
@@ -877,7 +889,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
// $fullPath = null; // $fullPath = null;
@@ -907,16 +919,15 @@ class CreateInvoiceValidation extends CreateRecord
if ($updateStatus == '1') { if ($updateStatus == '1') {
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
$fullPath = $disk->path($filePath); $fullPath = $disk->path($filePath);
// Check if file exists //if ($disk->exists($filePath)) // Check if file exists //if ($disk->exists($filePath))
if ($fullPath && file_exists($fullPath)) { if ($fullPath && file_exists($fullPath)) {
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx // /home/iot-dev/projects/pds/storage/app/private/uploads/temp/{$plantCode}/3RA0018735.xlsx
// 'Serial invoice update in progress...' // 'Serial invoice update in progress...'
// Now you can read/process the file here // Now you can read/process the file here
$rows = Excel::toArray(null, $fullPath)[0]; $rows = Excel::toArray(null, $fullPath)[0];
@@ -1233,6 +1244,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'serial_number' => $serialNumber, 'serial_number' => $serialNumber,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -1255,6 +1268,8 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->update(['updated_by' => $operatorName]); // 'updated_at' => now(),
// Update total quantity in the form // Update total quantity in the form
$totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count(); $totalQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
$scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count(); $scannedQuantity = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
@@ -1337,7 +1352,7 @@ class CreateInvoiceValidation extends CreateRecord
} }
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
$fullPath = null; // $fullPath = $disk->path($filePath); $fullPath = null; // $fullPath = $disk->path($filePath);
@@ -1778,6 +1793,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'quantity' => 1, 'quantity' => 1,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -1811,6 +1828,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'quantity' => $bundleQty, 'quantity' => $bundleQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -1842,6 +1861,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'quantity' => $totalExcelQty, 'quantity' => $totalExcelQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -2206,6 +2227,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'serial_number' => $serialNumber, 'serial_number' => $serialNumber,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
@@ -2358,6 +2381,9 @@ class CreateInvoiceValidation extends CreateRecord
$invoiceNumber = $this->form->getState()['invoice_number']; $invoiceNumber = $this->form->getState()['invoice_number'];
$this->invoiceNumber = $invoiceNumber; $this->invoiceNumber = $invoiceNumber;
$plant = Plant::find($plantId);
$plantCode = $plant?->code ?? null;
$totQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count(); $totQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
$scanSQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count(); $scanSQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
$totMQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('quantity')->where('plant_id', $plantId)->count(); // ->where('quantity', '!=', '') $totMQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->whereNotNull('quantity')->where('plant_id', $plantId)->count(); // ->where('quantity', '!=', '')
@@ -2395,7 +2421,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
// $fullPath = null; // $fullPath = null;
@@ -2947,6 +2973,7 @@ class CreateInvoiceValidation extends CreateRecord
if ($curExistQty > $curScanQty) { // 5 > 2 if ($curExistQty > $curScanQty) { // 5 > 2
$record->quantity = $curExistQty - $curScanQty; // 5 - 2 $record->quantity = $curExistQty - $curScanQty; // 5 - 2
$record->operator_id = $operatorName; $record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
// $record->updated_at = now(); // $record->updated_at = now();
$record->save(); $record->save();
@@ -2959,12 +2986,15 @@ class CreateInvoiceValidation extends CreateRecord
'quantity' => $curScanQty, 'quantity' => $curScanQty,
'created_at' => $createdDt, 'created_at' => $createdDt,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]); ]);
} elseif ($curExistQty == $curScanQty) { // 2 = 2 } elseif ($curExistQty == $curScanQty) { // 2 = 2
// $record->delete(); // $record->delete();
$record->serial_number = $serialNumber; $record->serial_number = $serialNumber;
$record->batch_number = $batchNumber; $record->batch_number = $batchNumber;
$record->operator_id = $operatorName; $record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
// $record->updated_at = now(); // $record->updated_at = now();
$record->save(); $record->save();
@@ -2975,6 +3005,8 @@ class CreateInvoiceValidation extends CreateRecord
// 'quantity' => $curScanQty, // 'quantity' => $curScanQty,
// 'created_at' => $createdDt, // 'created_at' => $createdDt,
// 'operator_id'=> $operatorName, // 'operator_id'=> $operatorName,
// 'created_by' => $operatorName,
// 'updated_by' => $operatorName,
// ]); // ]);
} else { } else {
Notification::make() Notification::make()
@@ -3030,6 +3062,7 @@ class CreateInvoiceValidation extends CreateRecord
$record->batch_number = $batchNumber; $record->batch_number = $batchNumber;
// $record->updated_at = now(); // $record->updated_at = now();
$record->operator_id = $operatorName; $record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
$record->save(); $record->save();
} }
@@ -3055,7 +3088,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
// $fullPath = null; // $fullPath = null;
@@ -3099,7 +3132,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
// $fullPath = null; // $fullPath = null;
@@ -3398,6 +3431,7 @@ class CreateInvoiceValidation extends CreateRecord
$record->scanned_status = 'Scanned'; $record->scanned_status = 'Scanned';
} }
$record->operator_id = $operatorName; $record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
$record->save(); $record->save();
// Notification::make() // Notification::make()
@@ -3427,7 +3461,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
// $fullPath = null; // $fullPath = null;
@@ -3514,6 +3548,7 @@ class CreateInvoiceValidation extends CreateRecord
$record->scanned_status = 'Scanned'; $record->scanned_status = 'Scanned';
} }
$record->operator_id = $operatorName; $record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
$record->save(); $record->save();
// Notification::make() // Notification::make()
@@ -3544,7 +3579,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
// $fullPath = null; // $fullPath = null;
@@ -3696,6 +3731,7 @@ class CreateInvoiceValidation extends CreateRecord
$record->scanned_status = 'Scanned'; $record->scanned_status = 'Scanned';
} }
$record->operator_id = $operatorName; $record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
$record->save(); $record->save();
// Notification::make() // Notification::make()
@@ -3740,7 +3776,7 @@ class CreateInvoiceValidation extends CreateRecord
// } // }
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = "uploads/temp/{$plantCode}";
$disk = Storage::disk('local'); $disk = Storage::disk('local');
$filePath = $directory.'/'.$filename; $filePath = $directory.'/'.$filename;
// $fullPath = null; // $fullPath = null;

View File

@@ -48,13 +48,13 @@ class ProcessOrderResource extends Resource
->schema([ ->schema([
Forms\Components\Select::make('plant_id') Forms\Components\Select::make('plant_id')
->label('Plant') ->label('Plant')
->reactive()
->relationship('plant', 'name') ->relationship('plant', 'name')
->options(function (callable $get) { ->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id; $userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
}) })
->reactive()
->afterStateUpdated(function ($state, $set, callable $get, $livewire) { ->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
$plantId = $get('plant_id'); $plantId = $get('plant_id');
$set('coil_number', null); $set('coil_number', null);
@@ -65,6 +65,7 @@ class ProcessOrderResource extends Resource
$set('coilNumberError', null); $set('coilNumberError', null);
$set('sfgNumberError', null); $set('sfgNumberError', null);
} }
$set('updated_by', Filament::auth()->user()?->name);
}) })
->extraAttributes(fn ($get) => [ ->extraAttributes(fn ($get) => [
'class' => $get('poPlantError') ? 'border-red-500' : '', 'class' => $get('poPlantError') ? 'border-red-500' : '',
@@ -74,7 +75,6 @@ class ProcessOrderResource extends Resource
->required(), ->required(),
Forms\Components\Select::make('line_id') Forms\Components\Select::make('line_id')
->label('Line') ->label('Line')
->reactive()
->options(function (callable $get) { ->options(function (callable $get) {
$plantId = $get('plant_id'); $plantId = $get('plant_id');
if (empty($plantId)) { if (empty($plantId)) {
@@ -83,6 +83,7 @@ class ProcessOrderResource extends Resource
return Line::where('plant_id', $plantId)->pluck('name', 'id'); return Line::where('plant_id', $plantId)->pluck('name', 'id');
}) })
->reactive()
->afterStateUpdated(function (callable $set, callable $get, ?string $state) { ->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('item_id', null); $set('item_id', null);
$set('item_description', null); $set('item_description', null);
@@ -92,13 +93,13 @@ class ProcessOrderResource extends Resource
$set('received_quantity', null); $set('received_quantity', null);
$set('sfg_number', null); $set('sfg_number', null);
$set('machine_name', null); $set('machine_name', null);
$set('updated_by', Filament::auth()->user()?->name);
}) })
->required(), ->required(),
Forms\Components\Select::make('item_id') Forms\Components\Select::make('item_id')
->label('Item Code') ->label('Item Code')
// ->relationship('item', 'id') // ->relationship('item', 'id')
// ->required(), // ->required(),
->reactive()
->searchable() ->searchable()
->options(function (callable $get) { ->options(function (callable $get) {
$plantId = $get('plant_id'); $plantId = $get('plant_id');
@@ -108,6 +109,7 @@ class ProcessOrderResource extends Resource
return Item::where('plant_id', $plantId)->pluck('code', 'id'); return Item::where('plant_id', $plantId)->pluck('code', 'id');
}) })
->reactive()
->afterStateUpdated(function (callable $set, callable $get, ?string $state) { ->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$plantId = $get('plant_id'); $plantId = $get('plant_id');
$itemId = $get('item_id'); $itemId = $get('item_id');
@@ -133,6 +135,7 @@ class ProcessOrderResource extends Resource
$set('item_description', null); $set('item_description', null);
$set('item_uom', null); $set('item_uom', null);
} }
$set('updated_by', Filament::auth()->user()?->name);
}) })
->required(), ->required(),
@@ -150,8 +153,10 @@ class ProcessOrderResource extends Resource
$set('item_description', null); $set('item_description', null);
} }
} }
})
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('updated_by', Filament::auth()->user()?->name);
}), }),
Forms\Components\TextInput::make('item_uom') Forms\Components\TextInput::make('item_uom')
->label('UOM') ->label('UOM')
->readOnly() ->readOnly()
@@ -167,13 +172,10 @@ class ProcessOrderResource extends Resource
$set('item_uom', null); $set('item_uom', null);
} }
} }
})
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('updated_by', Filament::auth()->user()?->name);
}), }),
Forms\Components\TextInput::make('id')
->hidden()
->readOnly(),
// ->readOnly(true),
Forms\Components\TextInput::make('process_order') Forms\Components\TextInput::make('process_order')
->label('Process Order') ->label('Process Order')
->reactive() ->reactive()
@@ -188,6 +190,7 @@ class ProcessOrderResource extends Resource
$set('coilNumberError', null); $set('coilNumberError', null);
$set('sfgNumberError', null); $set('sfgNumberError', null);
} }
$set('updated_by', Filament::auth()->user()?->name);
}) })
->rule(function (callable $get) { ->rule(function (callable $get) {
return function (string $attribute, $value, \Closure $fail) use ($get) { return function (string $attribute, $value, \Closure $fail) use ($get) {
@@ -255,6 +258,7 @@ class ProcessOrderResource extends Resource
$set('coilNumberError', null); $set('coilNumberError', null);
} }
} }
$set('updated_by', Filament::auth()->user()?->name);
}) })
->extraAttributes(fn ($get) => [ ->extraAttributes(fn ($get) => [
'class' => $get('coilNumberError') ? 'border-red-500' : '', 'class' => $get('coilNumberError') ? 'border-red-500' : '',
@@ -264,13 +268,27 @@ class ProcessOrderResource extends Resource
->required(), ->required(),
Forms\Components\TextInput::make('order_quantity') Forms\Components\TextInput::make('order_quantity')
->label('Order Quantity') ->label('Order Quantity')
->required(), ->default('1.000')
->required()
->reactive()
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('received_quantity') Forms\Components\TextInput::make('received_quantity')
->label('Received Quantity') ->label('Received Quantity')
->default('0') ->default('0.000')
->required(), ->required()
->reactive()
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('scrap_quantity') Forms\Components\TextInput::make('scrap_quantity')
->label('Scrap Quantity'), ->label('Scrap Quantity')
->default('0.000')
->reactive()
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('sfg_number') Forms\Components\TextInput::make('sfg_number')
->label('SFG Number') ->label('SFG Number')
->reactive() ->reactive()
@@ -297,6 +315,7 @@ class ProcessOrderResource extends Resource
$set('sfgNumberError', null); $set('sfgNumberError', null);
} }
} }
$set('updated_by', Filament::auth()->user()?->name);
}) })
->extraAttributes(fn ($get) => [ ->extraAttributes(fn ($get) => [
'class' => $get('sfgNumberError') ? 'border-red-500' : '', 'class' => $get('sfgNumberError') ? 'border-red-500' : '',
@@ -304,10 +323,27 @@ class ProcessOrderResource extends Resource
->hint(fn ($get) => $get('sfgNumberError') ? $get('sfgNumberError') : null) ->hint(fn ($get) => $get('sfgNumberError') ? $get('sfgNumberError') : null)
->hintColor('danger'), ->hintColor('danger'),
Forms\Components\TextInput::make('machine_name') Forms\Components\TextInput::make('machine_name')
->label('Machine ID'), ->label('Machine ID')
Forms\Components\TextInput::make('rework_status') ->reactive()
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\Select::make('rework_status')
->label('Rework Status') ->label('Rework Status')
->default(0), ->default(0)
->reactive()
->options([0 => 'No', 1 => 'Yes'])
->reactive()
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
// if ($get('id') && $get('rework_status') == 1) {
// $set('rework_status', 1);
// }
$set('updated_by', Filament::auth()->user()?->name);
})
->visible(function () {
return Filament::auth()->user()->hasRole('Super Admin'); // || Filament::auth()->user()->can('update process order rework status')
})
->required(),
Forms\Components\FileUpload::make('attachment') Forms\Components\FileUpload::make('attachment')
->label('PDF Upload') ->label('PDF Upload')
->acceptedFileTypes(['application/pdf']) ->acceptedFileTypes(['application/pdf'])
@@ -327,6 +363,7 @@ class ProcessOrderResource extends Resource
}) })
->action(function ($get, callable $set) { ->action(function ($get, callable $set) {
$uploadedFiles = $get('attachment'); $uploadedFiles = $get('attachment');
$set('updated_by', Filament::auth()->user()?->name);
if (is_array($uploadedFiles) && count($uploadedFiles) > 0) { if (is_array($uploadedFiles) && count($uploadedFiles) > 0) {
$uploaded = reset($uploadedFiles); $uploaded = reset($uploadedFiles);
@@ -415,8 +452,9 @@ class ProcessOrderResource extends Resource
->visible(function () { ->visible(function () {
return Filament::auth()->user()->can('view process order packing slip'); return Filament::auth()->user()->can('view process order packing slip');
}) })
->action(function ($get) { ->action(function ($get, callable $set) {
$equipmentNumber = $get('process_order'); $equipmentNumber = $get('process_order');
$set('updated_by', Filament::auth()->user()?->name);
if (! $equipmentNumber) { if (! $equipmentNumber) {
Notification::make() Notification::make()
@@ -448,54 +486,16 @@ class ProcessOrderResource extends Resource
return response()->download(Storage::disk('local')->path($fileToDownload)); return response()->download(Storage::disk('local')->path($fileToDownload));
}), }),
// Action::make('removeAttachment')
// ->label('Remove PDF')
// ->action(function ($get) {
// $equipmentNumber = $get('process_order');
// if (!$equipmentNumber) {
// Notification::make()
// ->title('No process order entered')
// ->danger()
// ->send();
// return;
// }
// // Get all files from uploads/temp
// $files = Storage::disk('local')->files('uploads/ProcessOrder');
// $fileToDelete = null;
// foreach ($files as $file) {
// if (str_contains($file, $equipmentNumber)) {
// $fileToDelete = $file;
// break;
// }
// }
// if (!$fileToDelete) {
// Notification::make()
// ->title('PDF not found for this process order')
// ->danger()
// ->send();
// return;
// }
// // Delete the matched file
// Storage::disk('local')->delete($fileToDelete);
// Notification::make()
// ->title('PDF removed successfully')
// ->body("File for process order {$equipmentNumber} has been deleted.")
// ->success()
// ->send();
// }),
]), ]),
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),
Forms\Components\Hidden::make('updated_by') Forms\Components\Hidden::make('updated_by')
->label('Updated By')
->default(Filament::auth()->user()?->name), ->default(Filament::auth()->user()?->name),
Forms\Components\TextInput::make('id')
->hidden()
->readOnly(),
]); ]);
} }
@@ -616,7 +616,7 @@ class ProcessOrderResource extends Resource
->options(function (callable $get) { ->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id; $userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
}) })
->reactive() ->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
@@ -765,7 +765,7 @@ class ProcessOrderResource extends Resource
->options(function (callable $get) { ->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id; $userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
}) })
->required() ->required()
->reactive() ->reactive()

View File

@@ -52,7 +52,15 @@ class TestingTempResource extends Resource
$set('attachment', null); $set('attachment', null);
if (! $plantId) { if (! $plantId) {
$set('ivPlantError', 'Please select a plant first.'); $set('ivPlantError', 'Please select a plant first.');
} else {
$plantCode = Plant::find($plantId)?->code ?? null;
$directory = "uploads/temp/{$plantCode}";
if (! Storage::disk('local')->exists($directory)) {
Storage::disk('local')->makeDirectory($directory);
} }
}
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}) })
->extraAttributes(fn ($get) => [ ->extraAttributes(fn ($get) => [

View File

@@ -5,7 +5,7 @@ namespace App\Filament\Resources;
use App\Filament\Exports\UserExporter; use App\Filament\Exports\UserExporter;
use App\Filament\Imports\UserImporter; use App\Filament\Imports\UserImporter;
use App\Filament\Resources\UserResource\Pages; use App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource\RelationManagers; use App\Models\Plant;
use App\Models\User; use App\Models\User;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Forms; use Filament\Forms;
@@ -36,16 +36,21 @@ class UserResource extends Resource
->relationship('plant', 'name') ->relationship('plant', 'name')
->nullable() ->nullable()
->reactive() ->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->default(function () { ->default(function () {
return optional(User::latest()->first())->plant_id; return optional(User::latest()->first())->plant_id;
}), }),
Forms\Components\TextInput::make('name') Forms\Components\TextInput::make('name')
->required() ->required()
->autofocus() ->autofocus()
//->reactive() // ->reactive()
->live(debounce: 600) ->live(debounce: 600)
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('email', $state . '@cripumps.com'); $set('email', $state.'@cripumps.com');
}) })
->maxLength(255), ->maxLength(255),
Forms\Components\TextInput::make('email') Forms\Components\TextInput::make('email')
@@ -58,7 +63,7 @@ class UserResource extends Resource
// ->ignore($get('id')); // Ignore current record during updates // ->ignore($get('id')); // Ignore current record during updates
// }) // })
->reactive() ->reactive()
//->prefix(fn ($get) => $get('name') ?? null) // ->prefix(fn ($get) => $get('name') ?? null)
// ->suffix('@cripumps.com') // ->suffix('@cripumps.com')
->maxLength(255), ->maxLength(255),
Forms\Components\DateTimePicker::make('email_verified_at'), Forms\Components\DateTimePicker::make('email_verified_at'),
@@ -73,7 +78,7 @@ class UserResource extends Resource
// ->relationship('roles', 'name'), // ->relationship('roles', 'name'),
Forms\Components\Select::make('roles') Forms\Components\Select::make('roles')
->relationship('roles', 'name') ->relationship('roles', 'name')
//->relationship(name: 'roles', titleAttribute: 'name') // ->relationship(name: 'roles', titleAttribute: 'name')
// ->saveRelationshipsUsing(function (Model $record, $state) { // ->saveRelationshipsUsing(function (Model $record, $state) {
// $record->roles()->syncWithPivotValues($state, [config('permission.column_names.team_foreign_key') => getPermissionsTeamId()]); // $record->roles()->syncWithPivotValues($state, [config('permission.column_names.team_foreign_key') => getPermissionsTeamId()]);
// }) // })
@@ -101,6 +106,7 @@ class UserResource extends Resource
$paginator = $livewire->getTableRecords(); $paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10; $perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1; $currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration; return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}), }),
Tables\Columns\TextColumn::make('plant.name') Tables\Columns\TextColumn::make('plant.name')
@@ -165,14 +171,14 @@ class UserResource extends Resource
->label('Import Users') ->label('Import Users')
->color('warning') ->color('warning')
->importer(UserImporter::class) ->importer(UserImporter::class)
->visible(function() { ->visible(function () {
return Filament::auth()->user()->can('view import user'); return Filament::auth()->user()->can('view import user');
}), }),
ExportAction::make() ExportAction::make()
->label('Export Users') ->label('Export Users')
->color('warning') ->color('warning')
->exporter(UserExporter::class) ->exporter(UserExporter::class)
->visible(function() { ->visible(function () {
return Filament::auth()->user()->can('view export user'); return Filament::auth()->user()->can('view export user');
}), }),
]); ]);

View File

@@ -6,17 +6,17 @@ use App\Models\InvoiceValidation;
use App\Models\StickerMaster; use App\Models\StickerMaster;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Livewire\Component;
use Str;
use Livewire\Attributes\On; use Livewire\Attributes\On;
use Livewire\Component;
use Livewire\WithPagination; use Livewire\WithPagination;
use Str;
class InvoiceDataTable extends Component class InvoiceDataTable extends Component
{ {
use WithPagination; use WithPagination;
protected $paginationTheme = 'tailwind'; protected $paginationTheme = 'tailwind';
public $invoiceData = []; public $invoiceData = [];
// public $invoiceRecords; // public $invoiceRecords;
@@ -25,7 +25,6 @@ class InvoiceDataTable extends Component
public $package = []; public $package = [];
public $packageCount = 0; public $packageCount = 0;
public string $invoiceNumber = ''; public string $invoiceNumber = '';
@@ -58,7 +57,7 @@ class InvoiceDataTable extends Component
public $panel_box_supplier; public $panel_box_supplier;
public $panel_box_item_code; public $panel_box_code;
public $panel_box_serial_number; public $panel_box_serial_number;
@@ -187,126 +186,124 @@ class InvoiceDataTable extends Component
// } // }
// } // }
// public function loadData($invoiceNumber, $plantId, $onCapFocus = false) // public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
// { // {
// $this->invoiceNumber = $invoiceNumber; // $this->invoiceNumber = $invoiceNumber;
// $this->plantId = $plantId; // $this->plantId = $plantId;
// $this->completedInvoice = false; // $this->completedInvoice = false;
// $this->isSerial = true; // $this->isSerial = true;
// $this->onCapFocus = $onCapFocus; // $this->onCapFocus = $onCapFocus;
// $this->emptyInvoice = false; // $this->emptyInvoice = false;
// $this->hasSearched = true; // $this->hasSearched = true;
// $this->materialInvoice = false; // $this->materialInvoice = false;
// $this->resetPage(); // $this->resetPage();
// $this->packageCount = 0; // $this->packageCount = 0;
// // IMPORTANT: keep scanned rows, otherwise count will not update // // IMPORTANT: keep scanned rows, otherwise count will not update
// $this->invoiceRecords = InvoiceValidation::with('stickerMasterRelation') // $this->invoiceRecords = InvoiceValidation::with('stickerMasterRelation')
// ->where('invoice_number', $this->invoiceNumber) // ->where('invoice_number', $this->invoiceNumber)
// ->where('plant_id', $this->plantId) // ->where('plant_id', $this->plantId)
// ->get(); // ->get();
// foreach ($this->invoiceRecords as &$row) { // foreach ($this->invoiceRecords as &$row) {
// $stickCount = 0; // $stickCount = 0;
// $scannedCount = 0; // $scannedCount = 0;
// // Get item code // // Get item code
// $row['code'] = StickerMaster::with('item') // $row['code'] = StickerMaster::with('item')
// ->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A'; // ->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
// $curStick = StickerMaster::find($row['sticker_master_id']); // $curStick = StickerMaster::find($row['sticker_master_id']);
// if ($curStick) { // if ($curStick) {
// /** ---------------- REQUIRED STICKERS ---------------- */ // /** ---------------- REQUIRED STICKERS ---------------- */
// // PANEL BOX (capacitor) // // PANEL BOX (capacitor)
// if (!empty($curStick->panel_box_code)) { // if (!empty($curStick->panel_box_code)) {
// $stickCount++; // $stickCount++;
// // Panel box scan = capacitor_scanned_status // // Panel box scan = capacitor_scanned_status
// if ($row['capacitor_scanned_status'] == 1) { // if ($row['capacitor_scanned_status'] == 1) {
// $scannedCount++; // $scannedCount++;
// } // }
// } // }
// // Tube stickers // // Tube stickers
// if ( // if (
// $curStick->tube_sticker_motor == 1 || // $curStick->tube_sticker_motor == 1 ||
// $curStick->tube_sticker_pump == 1 || // $curStick->tube_sticker_pump == 1 ||
// $curStick->tube_sticker_pumpset == 1 // $curStick->tube_sticker_pumpset == 1
// ) { // ) {
// if ($curStick->tube_sticker_motor == 1) { // if ($curStick->tube_sticker_motor == 1) {
// $stickCount++; // $stickCount++;
// if ($row['motor_scanned_status'] == 1) { // if ($row['motor_scanned_status'] == 1) {
// $scannedCount++; // $scannedCount++;
// } // }
// } // }
// if ( // if (
// $curStick->tube_sticker_pump == 1 || // $curStick->tube_sticker_pump == 1 ||
// ($curStick->tube_sticker_pumpset != 1 && // ($curStick->tube_sticker_pumpset != 1 &&
// $curStick->tube_sticker_pump != 1 && // $curStick->tube_sticker_pump != 1 &&
// $curStick->pack_slip_pump == 1) // $curStick->pack_slip_pump == 1)
// ) { // ) {
// $stickCount++; // $stickCount++;
// if ($row['pump_scanned_status'] == 1) { // if ($row['pump_scanned_status'] == 1) {
// $scannedCount++; // $scannedCount++;
// } // }
// } // }
// if ($curStick->tube_sticker_pumpset == 1) { // if ($curStick->tube_sticker_pumpset == 1) {
// $stickCount++; // $stickCount++;
// if ($row['scanned_status_set'] == 1) { // if ($row['scanned_status_set'] == 1) {
// $scannedCount++; // $scannedCount++;
// } // }
// } // }
// } // }
// // Pack slips (only if no tube stickers) // // Pack slips (only if no tube stickers)
// elseif ( // elseif (
// $curStick->pack_slip_motor == 1 || // $curStick->pack_slip_motor == 1 ||
// $curStick->pack_slip_pump == 1 || // $curStick->pack_slip_pump == 1 ||
// $curStick->pack_slip_pumpset == 1 // $curStick->pack_slip_pumpset == 1
// ) { // ) {
// if ($curStick->pack_slip_motor == 1) { // if ($curStick->pack_slip_motor == 1) {
// $stickCount++; // $stickCount++;
// if ($row['motor_scanned_status'] == 1) { // if ($row['motor_scanned_status'] == 1) {
// $scannedCount++; // $scannedCount++;
// } // }
// } // }
// if ($curStick->pack_slip_pump == 1) { // if ($curStick->pack_slip_pump == 1) {
// $stickCount++; // $stickCount++;
// if ($row['pump_scanned_status'] == 1) { // if ($row['pump_scanned_status'] == 1) {
// $scannedCount++; // $scannedCount++;
// } // }
// } // }
// if ($curStick->pack_slip_pumpset == 1) { // if ($curStick->pack_slip_pumpset == 1) {
// $stickCount++; // $stickCount++;
// if ($row['scanned_status_set'] == 1) { // if ($row['scanned_status_set'] == 1) {
// $scannedCount++; // $scannedCount++;
// } // }
// } // }
// } // }
// } // }
// // SAFETY: never go negative // // SAFETY: never go negative
// $this->packageCount += max($stickCount - $scannedCount, 0); // $this->packageCount += max($stickCount - $scannedCount, 0);
// } // }
// $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
// }
// $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
// }
// #[On('refreshInvoiceData')] // #[On('refreshInvoiceData')]
// public function loadData($invoiceNumber, $plantId, $onCapFocus = false) // public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
// { // {
// $this->invoiceNumber = $invoiceNumber; // $this->invoiceNumber = $invoiceNumber;
@@ -371,7 +368,6 @@ class InvoiceDataTable extends Component
// $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number'); // $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
// } // }
public function loadData($invoiceNumber, $plantId, $onCapFocus = false) public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
{ {
$this->invoiceNumber = $invoiceNumber; $this->invoiceNumber = $invoiceNumber;
@@ -396,24 +392,23 @@ class InvoiceDataTable extends Component
$sm = $record->stickerMasterRelation; $sm = $record->stickerMasterRelation;
if (!$sm) { if (! $sm) {
return 0; return 0;
} }
$stickCount = 0; $stickCount = 0;
$scannedCount = 0; $scannedCount = 0;
if (!empty($sm->panel_box_code)) { if (! empty($sm->panel_box_code)) {
$stickCount++; $stickCount++;
if ($record->capacitor_scanned_status == 1) { if ($record->capacitor_scanned_status == 1) {
$scannedCount++; $scannedCount++;
} }
} }
if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1){ if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1) {
if ($sm->tube_sticker_motor == 1) if ($sm->tube_sticker_motor == 1) {
{
$stickCount++; $stickCount++;
if ($record->motor_scanned_status == 1) { if ($record->motor_scanned_status == 1) {
$scannedCount++; $scannedCount++;
@@ -438,9 +433,7 @@ class InvoiceDataTable extends Component
$scannedCount++; $scannedCount++;
} }
} }
} } elseif ($sm->pack_slip_motor == 1 || $sm->pack_slip_pump == 1 || $sm->pack_slip_pumpset == 1) {
elseif ($sm->pack_slip_motor == 1 || $sm->pack_slip_pump == 1 || $sm->pack_slip_pumpset == 1)
{
if ($sm->pack_slip_motor == 1) { if ($sm->pack_slip_motor == 1) {
$stickCount++; $stickCount++;
if ($record->motor_scanned_status == 1) { if ($record->motor_scanned_status == 1) {
@@ -488,7 +481,6 @@ class InvoiceDataTable extends Component
->paginate(6); ->paginate(6);
} }
// public function loadData($invoiceNumber, $plantId, $onCapFocus = false) // public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
// { // {
// $this->plantId = $plantId; // $this->plantId = $plantId;
@@ -571,7 +563,6 @@ class InvoiceDataTable extends Component
// } // }
// } // }
public function loadMaterialData($invoiceNumber, $plantId) public function loadMaterialData($invoiceNumber, $plantId)
{ {
$this->plantId = $plantId; $this->plantId = $plantId;
@@ -636,6 +627,7 @@ class InvoiceDataTable extends Component
public function cancelCapacitorInput() public function cancelCapacitorInput()
{ {
$this->capacitorInput = null;
$this->showCapacitorInput = false; $this->showCapacitorInput = false;
$this->dispatch('focus-serial-number'); $this->dispatch('focus-serial-number');
} }
@@ -689,7 +681,7 @@ class InvoiceDataTable extends Component
// if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) { // if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
// $row['panel_box_supplier'] = $supplier; // $row['panel_box_supplier'] = $supplier;
// $row['panel_box_item_code'] = $itemCode; // $row['panel_box_code'] = $itemCode;
// $row['panel_box_serial_number'] = $serialNumber; // $row['panel_box_serial_number'] = $serialNumber;
// $row['capacitor_scanned_status'] = 1; // $row['capacitor_scanned_status'] = 1;
// // $row['scanned_status_set'] = true; // // $row['scanned_status_set'] = true;
@@ -730,7 +722,7 @@ class InvoiceDataTable extends Component
// if ($packCnt === $scanCnt) { // if ($packCnt === $scanCnt) {
// $matchingValidation->update([ // $matchingValidation->update([
// 'panel_box_supplier' => $supplier, // 'panel_box_supplier' => $supplier,
// 'panel_box_item_code' => $itemCode, // 'panel_box_code' => $itemCode,
// 'panel_box_serial_number' => $serialNumber, // 'panel_box_serial_number' => $serialNumber,
// 'capacitor_scanned_status' => 1, // 'capacitor_scanned_status' => 1,
// 'scanned_status' => 'Scanned', // 'scanned_status' => 'Scanned',
@@ -739,7 +731,7 @@ class InvoiceDataTable extends Component
// } else { // } else {
// $matchingValidation->update([ // $matchingValidation->update([
// 'panel_box_supplier' => $supplier, // 'panel_box_supplier' => $supplier,
// 'panel_box_item_code' => $itemCode, // 'panel_box_code' => $itemCode,
// 'panel_box_serial_number' => $serialNumber, // 'panel_box_serial_number' => $serialNumber,
// 'capacitor_scanned_status' => 1, // 'capacitor_scanned_status' => 1,
// 'operator_id' => $operatorName, // 'operator_id' => $operatorName,
@@ -748,7 +740,7 @@ class InvoiceDataTable extends Component
// } else { // } else {
// $matchingValidation->update([ // $matchingValidation->update([
// 'panel_box_supplier' => $supplier, // 'panel_box_supplier' => $supplier,
// 'panel_box_item_code' => $itemCode, // 'panel_box_code' => $itemCode,
// 'panel_box_serial_number' => $serialNumber, // 'panel_box_serial_number' => $serialNumber,
// 'capacitor_scanned_status' => 1, // 'capacitor_scanned_status' => 1,
// 'scanned_status' => 'Scanned', // 'scanned_status' => 'Scanned',
@@ -797,8 +789,6 @@ class InvoiceDataTable extends Component
// $this->dispatch('focus-serial-number'); // $this->dispatch('focus-serial-number');
// } // }
public function processCapacitorInput() public function processCapacitorInput()
{ {
$user = Filament::auth()->user(); $user = Filament::auth()->user();
@@ -818,6 +808,7 @@ class InvoiceDataTable extends Component
->send(); ->send();
$this->capacitorInput = ''; $this->capacitorInput = '';
return; return;
} }
@@ -856,7 +847,7 @@ class InvoiceDataTable extends Component
if ($stickerCode === $this->currentItemCode && $serialNo === $this->currentSerialNumber) { if ($stickerCode === $this->currentItemCode && $serialNo === $this->currentSerialNumber) {
$row['panel_box_supplier'] = $supplier; $row['panel_box_supplier'] = $supplier;
$row['panel_box_item_code'] = $itemCode; $row['panel_box_code'] = $itemCode;
$row['panel_box_serial_number'] = $serialNumber; $row['panel_box_serial_number'] = $serialNumber;
$row['capacitor_scanned_status'] = 1; $row['capacitor_scanned_status'] = 1;
// $row['scanned_status_set'] = true; // $row['scanned_status_set'] = true;
@@ -897,7 +888,7 @@ class InvoiceDataTable extends Component
if ($packCnt === $scanCnt) { if ($packCnt === $scanCnt) {
$matchingValidation->update([ $matchingValidation->update([
'panel_box_supplier' => $supplier, 'panel_box_supplier' => $supplier,
'panel_box_item_code' => $itemCode, 'panel_box_code' => $itemCode,
'panel_box_serial_number' => $serialNumber, 'panel_box_serial_number' => $serialNumber,
'capacitor_scanned_status' => 1, 'capacitor_scanned_status' => 1,
'scanned_status' => 'Scanned', 'scanned_status' => 'Scanned',
@@ -906,7 +897,7 @@ class InvoiceDataTable extends Component
} else { } else {
$matchingValidation->update([ $matchingValidation->update([
'panel_box_supplier' => $supplier, 'panel_box_supplier' => $supplier,
'panel_box_item_code' => $itemCode, 'panel_box_code' => $itemCode,
'panel_box_serial_number' => $serialNumber, 'panel_box_serial_number' => $serialNumber,
'capacitor_scanned_status' => 1, 'capacitor_scanned_status' => 1,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
@@ -915,7 +906,7 @@ class InvoiceDataTable extends Component
} else { } else {
$matchingValidation->update([ $matchingValidation->update([
'panel_box_supplier' => $supplier, 'panel_box_supplier' => $supplier,
'panel_box_item_code' => $itemCode, 'panel_box_code' => $itemCode,
'panel_box_serial_number' => $serialNumber, 'panel_box_serial_number' => $serialNumber,
'capacitor_scanned_status' => 1, 'capacitor_scanned_status' => 1,
'scanned_status' => 'Scanned', 'scanned_status' => 'Scanned',

View File

@@ -23,6 +23,7 @@ class InvoiceValidation extends Model
'capacitor_scanned_status', 'capacitor_scanned_status',
'scanned_status_set', 'scanned_status_set',
'scanned_status', 'scanned_status',
'panel_box_code',
'panel_box_supplier', 'panel_box_supplier',
'panel_box_serial_number', 'panel_box_serial_number',
'load_rate', 'load_rate',
@@ -30,6 +31,8 @@ class InvoiceValidation extends Model
'batch_number', 'batch_number',
'quantity', 'quantity',
'operator_id', 'operator_id',
'created_by',
'updated_by',
]; ];
public function plant(): BelongsTo public function plant(): BelongsTo

View File

@@ -1,7 +1,6 @@
<?php <?php
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
@@ -27,19 +26,20 @@ return new class extends Migration
scanned_status_set TEXT DEFAULT NULL, scanned_status_set TEXT DEFAULT NULL,
scanned_status TEXT DEFAULT NULL, scanned_status TEXT DEFAULT NULL,
panel_box_code TEXT DEFAULT NULL,
panel_box_supplier TEXT DEFAULT NULL, panel_box_supplier TEXT DEFAULT NULL,
panel_box_serial_number TEXT DEFAULT NULL, panel_box_serial_number TEXT DEFAULT NULL,
load_rate INT NOT NULL DEFAULT (0), load_rate INT NOT NULL DEFAULT (0),
upload_status TEXT NOT NULL DEFAULT 'N', upload_status TEXT NOT NULL DEFAULT 'N',
batch_number TEXT DEFAULT NULL, batch_number TEXT DEFAULT NULL,
quantity INT DEFAULT NULL, quantity INT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(), created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(), updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
created_by TEXT DEFAULT NULL,
updated_by TEXT DEFAULT NULL,
deleted_at TIMESTAMP, deleted_at TIMESTAMP,
UNIQUE (plant_id, serial_number), UNIQUE (plant_id, serial_number),
@@ -48,7 +48,7 @@ return new class extends Migration
); );
SQL; SQL;
DB::statement($sql); DB::statement($sql);
} }
/** /**

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql1 = <<<'SQL'
ALTER TABLE characteristic_approver_masters
ADD COLUMN approver_type TEXT DEFAULT NULL
SQL;
DB::statement($sql1);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('characteristic_approver_masters', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql1 = <<<'SQL'
ALTER TABLE invoice_validations
ADD COLUMN panel_box_code TEXT DEFAULT NULL
SQL;
DB::statement($sql1);
$sql2 = <<<'SQL'
ALTER TABLE invoice_validations
ADD COLUMN created_by TEXT DEFAULT NULL
SQL;
DB::statement($sql2);
$sql3 = <<<'SQL'
ALTER TABLE invoice_validations
ADD COLUMN updated_by TEXT DEFAULT NULL
SQL;
DB::statement($sql3);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('invoice_validations', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -81,6 +81,7 @@
<th class="border px-4 py-2">Scanned Status</th> <th class="border px-4 py-2">Scanned Status</th>
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th> <th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
<th class="border px-4 py-2">Operator ID</th> <th class="border px-4 py-2">Operator ID</th>
<th class="border px-4 py-2">Panel Box Code</th>
<th class="border px-4 py-2">Panel Box Supplier</th> <th class="border px-4 py-2">Panel Box Supplier</th>
<th class="border px-4 py-2">Panel Box Serial Number</th> <th class="border px-4 py-2">Panel Box Serial Number</th>
</tr> </tr>
@@ -98,6 +99,7 @@
<td class="border px-4 py-2">{{ $row['scanned_status'] ?? '' }}</td> <td class="border px-4 py-2">{{ $row['scanned_status'] ?? '' }}</td>
<td class="border px-4 py-2">{{ $row['created_at'] ?? '' }}</td> <td class="border px-4 py-2">{{ $row['created_at'] ?? '' }}</td>
<td class="border px-4 py-2">{{ $row['operator_id'] ?? '' }}</td> <td class="border px-4 py-2">{{ $row['operator_id'] ?? '' }}</td>
<td class="border px-4 py-2">{{ $row['panel_box_code'] ?? '' }}</td>
<td class="border px-4 py-2">{{ $row['panel_box_supplier'] ?? '' }}</td> <td class="border px-4 py-2">{{ $row['panel_box_supplier'] ?? '' }}</td>
<td class="border px-4 py-2">{{ $row['panel_box_serial_number'] ?? '' }}</td> <td class="border px-4 py-2">{{ $row['panel_box_serial_number'] ?? '' }}</td>
</tr> </tr>
@@ -130,6 +132,7 @@
<th class="border px-4 py-2">Scanned Status</th> <th class="border px-4 py-2">Scanned Status</th>
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th> <th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
<th class="border px-4 py-2">Operator ID</th> <th class="border px-4 py-2">Operator ID</th>
<th class="border px-4 py-2">Panel Box Code</th>
<th class="border px-4 py-2">Panel Box Supplier</th> <th class="border px-4 py-2">Panel Box Supplier</th>
<th class="border px-4 py-2">Panel Box Serial Number</th> <th class="border px-4 py-2">Panel Box Serial Number</th>
</tr> </tr>
@@ -148,6 +151,7 @@
<td class="border px-2 py-2">{{ $record->scanned_status ?? '' }}</td> <td class="border px-2 py-2">{{ $record->scanned_status ?? '' }}</td>
<td class="border px-2 py-2 whitespace-nowrap">{{ optional($record->created_at)->format('d-m-Y H:i:s') }}</td> <td class="border px-2 py-2 whitespace-nowrap">{{ optional($record->created_at)->format('d-m-Y H:i:s') }}</td>
<td class="border px-2 py-2">{{ $record->operator_id ?? '' }}</td> <td class="border px-2 py-2">{{ $record->operator_id ?? '' }}</td>
<td class="border px-2 py-2">{{ $record->panel_box_code ?? '' }}</td>
<td class="border px-2 py-2">{{ $record->panel_box_supplier ?? '' }}</td> <td class="border px-2 py-2">{{ $record->panel_box_supplier ?? '' }}</td>
<td class="border px-2 py-2">{{ $record->panel_box_serial_number ?? '' }}</td> <td class="border px-2 py-2">{{ $record->panel_box_serial_number ?? '' }}</td>
</tr> </tr>

View File

@@ -24,6 +24,7 @@ use App\Http\Controllers\ModuleProductionLineStopController;
use App\Http\Controllers\ModuleProductionOrderDataController; use App\Http\Controllers\ModuleProductionOrderDataController;
use App\Http\Controllers\ObdController; use App\Http\Controllers\ObdController;
use App\Http\Controllers\PalletController; use App\Http\Controllers\PalletController;
// use App\Http\Controllers\PalletPrintController;
use App\Http\Controllers\PdfController; use App\Http\Controllers\PdfController;
use App\Http\Controllers\PlantController; use App\Http\Controllers\PlantController;
use App\Http\Controllers\ProductionStickerReprintController; use App\Http\Controllers\ProductionStickerReprintController;
@@ -204,11 +205,12 @@ Route::post('grmaster-sno-update', [PdfController::class, 'updateGR']);
Route::post('file/store', [SapFileController::class, 'store'])->name('file.store'); Route::post('file/store', [SapFileController::class, 'store'])->name('file.store');
// routes/api.php // routes/api.php
// Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave']); // Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave']);
// Route::post('send-telegram', [TelegramController::class, 'sendMessage']); // Route::post('send-telegram', [TelegramController::class, 'sendMessage']);
// Route::post('invoice-exit', [InvoiceValidationController::class, 'handle']); // Route::post('invoice-exit', [InvoiceValidationController::class, 'handle']);
// Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave']) // Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])
// ->name('characteristic.hold.save'); // ->name('print.pallet');

View File

@@ -12,9 +12,9 @@ Artisan::command('auto:scheduler', function () {
})->everyMinute()->withoutOverlapping(); })->everyMinute()->withoutOverlapping();
Schedule::command('model:prune --pretend')// , ['--model' => WeightValidation::class] Schedule::command('model:prune --pretend')// , ['--model' => WeightValidation::class]
->description('Deletable Old Records From Database') ->description('Deletable Old Records From Server ('.env('APP_URL').')')
->dailyAt('07:00') ->dailyAt('07:00')
->emailOutputTo('digitalmanufacturingiiot@gmail.com'); ->emailOutputTo(['digitalmanufacturingiiot@gmail.com', 'jothikumar.padmanaban@cripumps.com'], true);
// app()->booted(function () { // app()->booted(function () {
// $schedule = app(Schedule::class); // $schedule = app(Schedule::class);

View File

@@ -1,7 +1,7 @@
<?php <?php
use App\Http\Controllers\CharacteristicApprovalController; use App\Http\Controllers\CharacteristicApprovalController;
use App\Http\Controllers\FileUploadController; // use App\Http\Controllers\FileUploadController;
use App\Models\EquipmentMaster; use App\Models\EquipmentMaster;
use App\Models\User; use App\Models\User;
use Filament\Facades\Filament; use Filament\Facades\Filament;
@@ -41,11 +41,22 @@ Route::get('/approval/reject-success', function () {
return view('approval.reject-success'); return view('approval.reject-success');
})->name('approval.reject.success'); })->name('approval.reject.success');
Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve']) Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approveForm'])
->name('characteristic.approve') ->name('characteristic.approve')
->middleware('signed'); ->middleware('signed');
Route::post('/file-upload', [FileUploadController::class, 'upload'])->name('file.upload'); Route::post('/characteristic/approve-save', [CharacteristicApprovalController::class, 'approveSave'])
->name('characteristic.approve.save');
Route::get('/approval/approve-success', function () {
return view('approval.approve-success');
})->name('approval.approve.success');
// Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
// ->name('characteristic.approve')
// ->middleware('signed');
// Route::post('/file-upload', [FileUploadController::class, 'upload'])->name('file.upload');
// Route::get('/characteristic/hold', [CharacteristicApprovalController::class, 'hold']) // Route::get('/characteristic/hold', [CharacteristicApprovalController::class, 'hold'])
// ->name('characteristic.hold') // ->name('characteristic.hold')