ranjith-dev #295
@@ -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) {
|
||||||
|
|||||||
@@ -212,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),
|
||||||
]);
|
]);
|
||||||
@@ -267,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(),
|
||||||
@@ -294,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()
|
||||||
@@ -358,11 +377,15 @@ class InvoiceValidationResource extends Resource
|
|||||||
|
|
||||||
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(function (callable $get) {
|
->directory(function (callable $get) {
|
||||||
@@ -370,7 +393,9 @@ class InvoiceValidationResource extends Resource
|
|||||||
$plantCode = $plant?->code ?? null;
|
$plantCode = $plant?->code ?? null;
|
||||||
|
|
||||||
return "uploads/temp/{$plantCode}";
|
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'];
|
||||||
@@ -385,15 +410,22 @@ class InvoiceValidationResource extends Resource
|
|||||||
// 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/{$plantCode}", $originalName, 'local'); // returns relative path
|
$path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local'); // returns relative path
|
||||||
// uploads/temp/{$plantCode}/3RA0018735.xlsx
|
// uploads/temp/{$plantCode}/3RA0018735.xlsx
|
||||||
|
|
||||||
if ($originalNameOnly && strlen($originalNameOnly) < 8) {
|
if (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Invoice number : '$originalNameOnly' should be greater than or equal to 8 characters!")
|
->title("Serial invoice number : '$originalNameOnly' should contain minimum 8 digit alpha numeric values!")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
@@ -692,8 +724,8 @@ class InvoiceValidationResource extends Resource
|
|||||||
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')))
|
||||||
@@ -702,7 +734,8 @@ class InvoiceValidationResource extends Resource
|
|||||||
$plantCode = $plant?->code ?? null;
|
$plantCode = $plant?->code ?? null;
|
||||||
|
|
||||||
return "uploads/temp/{$plantCode}";
|
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'];
|
||||||
@@ -717,13 +750,20 @@ class InvoiceValidationResource extends Resource
|
|||||||
// 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);
|
||||||
|
|
||||||
|
$originalName = "{$originalNameOnly}.xlsx";
|
||||||
|
|
||||||
$path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local');
|
$path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local');
|
||||||
|
|
||||||
if ($originalNameOnly && strlen($originalNameOnly) < 8) {
|
if (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Invoice number : '$originalNameOnly' should be greater than or equal to 8 characters!")
|
->title("Material invoice number : '$originalNameOnly' should contain minimum 8 digit alpha numeric values!")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -1232,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++;
|
||||||
}
|
}
|
||||||
@@ -1254,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();
|
||||||
@@ -1777,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++;
|
||||||
}
|
}
|
||||||
@@ -1810,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++;
|
||||||
}
|
}
|
||||||
@@ -1841,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++;
|
||||||
}
|
}
|
||||||
@@ -2205,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++;
|
||||||
}
|
}
|
||||||
@@ -2949,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();
|
||||||
|
|
||||||
@@ -2961,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();
|
||||||
|
|
||||||
@@ -2977,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()
|
||||||
@@ -3032,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3400,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()
|
||||||
@@ -3516,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()
|
||||||
@@ -3698,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()
|
||||||
|
|||||||
@@ -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');
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -869,7 +860,7 @@ class InvoiceDataTable extends Component
|
|||||||
return $validation->stickerMaster?->item?->code === $this->currentItemCode;
|
return $validation->stickerMaster?->item?->code === $this->currentItemCode;
|
||||||
});
|
});
|
||||||
|
|
||||||
// dd($matchingValidation);
|
// dd($matchingValidation);
|
||||||
|
|
||||||
if ($matchingValidation) {
|
if ($matchingValidation) {
|
||||||
$hasMotorQr = $matchingValidation->stickerMasterRelation->tube_sticker_motor ?? null;
|
$hasMotorQr = $matchingValidation->stickerMasterRelation->tube_sticker_motor ?? null;
|
||||||
@@ -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',
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user