Compare commits
25 Commits
690a6f8026
...
102d9af638
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
102d9af638 | ||
|
|
b20bff9003 | ||
|
|
c8ad6f3dda | ||
|
|
062ab6d8a1 | ||
|
|
4d4414ffa7 | ||
|
|
4f87a0d318 | ||
|
|
33f787c6ad | ||
|
|
bf6874fe96 | ||
|
|
3406dbc1c7 | ||
|
|
e20ebfe667 | ||
|
|
3012dd61bb | ||
|
|
cdc8a5ce54 | ||
|
|
f3a4aa7411 | ||
|
|
2ae71b9bb8 | ||
|
|
58fc922f24 | ||
|
|
68c5c88fc8 | ||
|
|
c4b4993e1d | ||
|
|
fd3ef4656c | ||
|
|
6e7b847e89 | ||
|
|
0fbe279bf9 | ||
|
|
8188cd6cef | ||
|
|
bdbfc8e024 | ||
|
|
c3f9c9f2c4 | ||
|
|
5cb2842954 | ||
|
|
6a0f5b57a6 |
98
app/Filament/Imports/PalletValidationImporter.php
Normal file
98
app/Filament/Imports/PalletValidationImporter.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\PalletValidation;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class PalletValidationImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = PalletValidation::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('pallet_number')
|
||||
->requiredMapping()
|
||||
->label('Pallet Number')
|
||||
->example('EP-2505001'),
|
||||
ImportColumn::make('serial_number')
|
||||
->requiredMapping()
|
||||
->example('12345678901234')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('pallet_status')
|
||||
->requiredMapping()
|
||||
->label('Pallet Status')
|
||||
->example('Completed'),
|
||||
ImportColumn::make('locator_number')
|
||||
->requiredMapping()
|
||||
->label('Locator Number')
|
||||
->example('W05-D1B'),
|
||||
ImportColumn::make('locator_quantity')
|
||||
->label('Locator Quantity')
|
||||
->requiredMapping()
|
||||
->numeric()
|
||||
->example(1)
|
||||
->rules(['required', 'integer']),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->requiredMapping()
|
||||
->example('01-01-2025 08:00:00')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->requiredMapping()
|
||||
->example('01-01-2025 08:00:00')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('scanned_at')
|
||||
->label('Scanned At')
|
||||
->requiredMapping()
|
||||
->example('01-01-2025 08:00:00')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->requiredMapping()
|
||||
->example('Jothi')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('scanned_by')
|
||||
->label('Scanned By')
|
||||
->requiredMapping()
|
||||
->example('Jothi')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->example('Jothi')
|
||||
->requiredMapping(),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?PalletValidation
|
||||
{
|
||||
// return PalletValidation::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new PalletValidation();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your pallet validation import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,6 @@ class PlantImporter extends Importer
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->rules(['required']), //, 'integer'
|
||||
ImportColumn::make('company')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Company Name')
|
||||
->example('C.R.I. Pumps Private Limited')
|
||||
->label('Company Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
@@ -43,6 +36,13 @@ class PlantImporter extends Importer
|
||||
->example('7/51-A, Keeranatham Road, Saravanampatty, Coimbatore - 641035')
|
||||
->label('Plant Address')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('company')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Company Name')
|
||||
->example('C.R.I. Pumps Private Limited')
|
||||
->label('Company Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -30,20 +30,6 @@ class QualityValidationImporter extends Importer
|
||||
->example('12-02-2025 15:51:00')
|
||||
->label('Created DateTime')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Line Name')
|
||||
->example('4 inch pump line')
|
||||
->label('Line Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker_master_id_code') // stickerMaster.item
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
@@ -165,6 +151,20 @@ class QualityValidationImporter extends Importer
|
||||
->exampleHeader('Unit of Measure')
|
||||
->example('EA')
|
||||
->label('Unit of Measure'),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Line Name')
|
||||
->example('4 inch pump line')
|
||||
->label('Line Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_at')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Updated DateTime')
|
||||
|
||||
110
app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php
Normal file
110
app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\ReworkLocatorInvoiceValidation;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class ReworkLocatorInvoiceValidationImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = ReworkLocatorInvoiceValidation::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('invoice_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Invoice Number')
|
||||
->example('3RA002514')
|
||||
->label('Invoice Number')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('serial_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Serial Number')
|
||||
->example('25145441154545')
|
||||
->label('Serial Number')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('pallet_number')
|
||||
->exampleHeader('Pallet Number')
|
||||
->example('')
|
||||
->label('Pallet Number'),
|
||||
ImportColumn::make('locator_number')
|
||||
->exampleHeader('Locator Number')
|
||||
->example('')
|
||||
->label('Locator Number'),
|
||||
ImportColumn::make('scanned_status')
|
||||
->exampleHeader('Scanned Status')
|
||||
->example('')
|
||||
->label('Scanned Status'),
|
||||
ImportColumn::make('upload_status')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Upload Status')
|
||||
->example('Y')
|
||||
->label('Upload Status')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created By')
|
||||
->example('admin')
|
||||
->label('Created By')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('scanned_by')
|
||||
->exampleHeader('Scanned By')
|
||||
->example('admin')
|
||||
->label('Scanned By'),
|
||||
ImportColumn::make('updated_by')
|
||||
->exampleHeader('Updated By')
|
||||
->example('admin')
|
||||
->label('Updated By'),
|
||||
ImportColumn::make('reworked_by')
|
||||
->exampleHeader('Reworked By')
|
||||
->example('admin')
|
||||
->label('Reworked By'),
|
||||
ImportColumn::make('created_at')
|
||||
->exampleHeader('Created At')
|
||||
->example('2025-06-17 08:42:16')
|
||||
->label('Created At')
|
||||
->rules(['date_format:Y-m-d H:i:s']),
|
||||
ImportColumn::make('scanned_at')
|
||||
->exampleHeader('Scanned At')
|
||||
->example('2025-06-17 08:42:16')
|
||||
->label('Scanned At')
|
||||
->rules(['date_format:Y-m-d H:i:s']),
|
||||
ImportColumn::make('reworked_at')
|
||||
->exampleHeader('Reworked At')
|
||||
->example('2025-06-17 08:42:16')
|
||||
->label('Reworked At')
|
||||
->rules(['date_format:Y-m-d H:i:s']),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?ReworkLocatorInvoiceValidation
|
||||
{
|
||||
// return ReworkLocatorInvoiceValidation::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new ReworkLocatorInvoiceValidation();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your rework locator invoice validation import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -24,20 +24,6 @@ class ShiftImporter extends Importer
|
||||
->example('Day')
|
||||
->label('Shift Name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('block')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Block Name')
|
||||
->example('Block A')
|
||||
->label('Block Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('start_time')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Start Time')
|
||||
@@ -57,6 +43,20 @@ class ShiftImporter extends Importer
|
||||
->example('19:30:00')
|
||||
->label('End Time')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('block')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Block Name')
|
||||
->example('Block A')
|
||||
->label('Block Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('status')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Active Status')
|
||||
|
||||
@@ -26,14 +26,6 @@ class StickerMasterImporter extends Importer
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('PLANT NAME')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
|
||||
ImportColumn::make('serial_number_motor')
|
||||
// ->requiredMapping()
|
||||
->exampleHeader('Serial Number Motor')
|
||||
@@ -155,7 +147,7 @@ class StickerMasterImporter extends Importer
|
||||
|
||||
|
||||
ImportColumn::make('load_rate')
|
||||
// ->requiredMapping()
|
||||
->requiredMapping()
|
||||
->integer()
|
||||
->exampleHeader('Load Rate')
|
||||
->label('LOAD RATE')
|
||||
@@ -177,6 +169,13 @@ class StickerMasterImporter extends Importer
|
||||
->label('MATERIAL TYPE')
|
||||
->example(''),
|
||||
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('PLANT NAME')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,6 @@ class TestingPanelReadingImporter extends Importer
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
@@ -85,6 +77,14 @@ class TestingPanelReadingImporter extends Importer
|
||||
->rules(['required']),
|
||||
ImportColumn::make('pds_status'),
|
||||
ImportColumn::make('pds_description'),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('tested_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
ImportColumn::make('scanned_at')
|
||||
|
||||
@@ -46,18 +46,18 @@ class InvoiceDashboard extends Page
|
||||
$this->dispatch('invoiceChart');
|
||||
}),
|
||||
Select::make('invoice')
|
||||
->options([
|
||||
'serial_invoice' => 'Serial Invoice',
|
||||
'individual_material' => 'Individual Material Invoice',
|
||||
'bundle_material' => 'Bundle Material Invoice',
|
||||
])
|
||||
->label('Select Invoice')
|
||||
->reactive()
|
||||
->default(0)
|
||||
->afterStateUpdated(function ($state) {
|
||||
session(['select_invoice' => $state]);
|
||||
$this->dispatch('invoiceChart');
|
||||
})
|
||||
->options([
|
||||
'serial_invoice' => 'Serial Invoice',
|
||||
'individual_material' => 'Individual Material Invoice',
|
||||
'bundle_material' => 'Bundle Material Invoice',
|
||||
])
|
||||
->label('Select Invoice')
|
||||
->reactive()
|
||||
->default(0)
|
||||
->afterStateUpdated(function ($state) {
|
||||
session(['select_invoice' => $state]);
|
||||
$this->dispatch('invoiceChart');
|
||||
})
|
||||
])
|
||||
->columns(2);
|
||||
}
|
||||
|
||||
@@ -72,14 +72,14 @@ class LocatorValidation extends Page implements HasForms
|
||||
->label('Scan Pallet No')
|
||||
->reactive()
|
||||
// ->readonly(fn () => $this->disablePalletNo)
|
||||
->readOnly(fn (callable $get) => !empty($get('scan_serial_no')) || !empty($get('scan_locator_no')))
|
||||
->readOnly(fn (callable $get) => !$get('plant_id') || !empty($get('scan_serial_no')) || !empty($get('scan_locator_no')))
|
||||
->extraAttributes([
|
||||
'wire:keydown.enter' => 'processPalletNo($event.target.value)',
|
||||
]),
|
||||
TextInput::make('scan_serial_no')
|
||||
->label('Scan Serial No')
|
||||
// ->readOnly(fn () => $this->disableSerialNo)
|
||||
->readOnly(fn (callable $get) => !empty($get('scan_pallet_no')) || !empty($get('scan_locator_no')))
|
||||
->readOnly(fn (callable $get) => !$get('plant_id') || !empty($get('scan_pallet_no')) || !empty($get('scan_locator_no')))
|
||||
->reactive()
|
||||
->extraAttributes([
|
||||
'wire:keydown.enter' => 'processSerialNo($event.target.value)',
|
||||
@@ -87,7 +87,7 @@ class LocatorValidation extends Page implements HasForms
|
||||
TextInput::make('scan_locator_no')
|
||||
->label('Scan Locator No')
|
||||
->reactive()
|
||||
// ->readOnly(fn ($get) => filled($get('scan_locator_no')))
|
||||
->readOnly(fn (callable $get) => !$get('plant_id') || (!$get('scan_pallet_no') && !$get('scan_serial_no')))
|
||||
->extraAttributes([
|
||||
'id' => 'scan_locator_no',
|
||||
'wire:keydown.enter' => 'processLocatorNo($event.target.value)',
|
||||
|
||||
@@ -376,7 +376,7 @@ class InvoiceValidationResource extends Resource
|
||||
}
|
||||
|
||||
$invalidMatCodes = [];
|
||||
$invalidSerialCodes=[];
|
||||
$invalidSerialCodes = [];
|
||||
$materialCodes = [];
|
||||
$missingSerials = [];
|
||||
$duplicateSerials = [];
|
||||
@@ -806,6 +806,7 @@ class InvoiceValidationResource extends Resource
|
||||
|
||||
if (count($invalidCodes) > 10)
|
||||
{
|
||||
$invalidCodes = array_unique($invalidCodes);
|
||||
Notification::make()
|
||||
->title('Invalid item codes found')
|
||||
->body('' . count($invalidCodes) . 'invalid item codes found have serial number.')
|
||||
@@ -819,6 +820,7 @@ class InvoiceValidationResource extends Resource
|
||||
}
|
||||
else if(count($invalidCodes) > 0)
|
||||
{
|
||||
$invalidCodes = array_unique($invalidCodes);
|
||||
Notification::make()
|
||||
->title('Invalid item codes found')
|
||||
->body('Serial invoice Item Codes found : ' . implode(', ', $invalidCodes))
|
||||
@@ -881,6 +883,10 @@ class InvoiceValidationResource extends Resource
|
||||
->send();
|
||||
};
|
||||
|
||||
$nonNumericQtyCodes = array_unique($nonNumericQtyCodes);
|
||||
$zeroQtyCodes = array_unique($zeroQtyCodes);
|
||||
$notDivisibleCodes = array_unique($notDivisibleCodes);
|
||||
|
||||
$showValidationNotification($nonNumericQtyCodes, "The following item codes contains invalid bundle quantity:");
|
||||
$showValidationNotification($zeroQtyCodes, "The following item codes quantity should be greater than '0':");
|
||||
$showValidationNotification($notDivisibleCodes, "The following item codes quantity is not divisible by bundle quantity.");
|
||||
@@ -964,74 +970,73 @@ class InvoiceValidationResource extends Resource
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['sticker_master_id'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if (!empty($data['Plant'])) { //$plant = $data['Plant'] ?? null
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
}
|
||||
|
||||
if (!empty($data['invoice_number'])) {
|
||||
$query->where('invoice_number', 'like', '%' . $data['invoice_number'] . '%');
|
||||
}
|
||||
|
||||
if (!empty($data['serial_number'])) {
|
||||
$query->where('serial_number', 'like', '%' . $data['serial_number'] . '%');
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (!empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
if (!empty($data['sticker_master_id'])) {
|
||||
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
if (!empty($stickerMasterIds)) {
|
||||
$query->whereIn('sticker_master_id', $stickerMasterIds);
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['sticker_master_id'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (!empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant: ' . Plant::where('id', $data['Plant'])->value('name');
|
||||
}
|
||||
if (!empty($data['Plant'])) { //$plant = $data['Plant'] ?? null
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
}
|
||||
|
||||
if (!empty($data['invoice_number'])) {
|
||||
$indicators[] = 'Invoice Number: ' . $data['invoice_number'];
|
||||
}
|
||||
if (!empty($data['invoice_number'])) {
|
||||
$query->where('invoice_number', 'like', '%' . $data['invoice_number'] . '%');
|
||||
}
|
||||
|
||||
if (!empty($data['serial_number'])) {
|
||||
$indicators[] = 'Serial Number: ' . $data['serial_number'];
|
||||
}
|
||||
if (!empty($data['serial_number'])) {
|
||||
$query->where('serial_number', 'like', '%' . $data['serial_number'] . '%');
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$indicators[] = 'From: ' . $data['created_from'];
|
||||
}
|
||||
if (!empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (!empty($data['created_to'])) {
|
||||
$indicators[] = 'To: ' . $data['created_to'];
|
||||
}
|
||||
if (!empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
if (!empty($data['sticker_master_id'])) {
|
||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Item Code: ' . $itemCode;
|
||||
}
|
||||
if (!empty($data['sticker_master_id'])) {
|
||||
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
return $indicators;
|
||||
})
|
||||
if (!empty($stickerMasterIds)) {
|
||||
$query->whereIn('sticker_master_id', $stickerMasterIds);
|
||||
}
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (!empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant: ' . Plant::where('id', $data['Plant'])->value('name');
|
||||
}
|
||||
|
||||
if (!empty($data['invoice_number'])) {
|
||||
$indicators[] = 'Invoice Number: ' . $data['invoice_number'];
|
||||
}
|
||||
|
||||
if (!empty($data['serial_number'])) {
|
||||
$indicators[] = 'Serial Number: ' . $data['serial_number'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$indicators[] = 'From: ' . $data['created_from'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_to'])) {
|
||||
$indicators[] = 'To: ' . $data['created_to'];
|
||||
}
|
||||
|
||||
if (!empty($data['sticker_master_id'])) {
|
||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Item Code: ' . $itemCode;
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
})
|
||||
])
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
|
||||
@@ -177,8 +177,8 @@ class ItemResource extends Resource
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('code')
|
||||
->label('Item Code')
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
@@ -187,6 +187,11 @@ class ItemResource extends Resource
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('description')
|
||||
->label('Description')
|
||||
->alignCenter()
|
||||
@@ -201,11 +206,6 @@ class ItemResource extends Resource
|
||||
->label('Unit of Measure')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
|
||||
@@ -395,36 +395,29 @@ class LocatorInvoiceValidationResource extends Resource
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('invoice_number')
|
||||
->label('Invoice Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pallet_number')
|
||||
->label('Pallet Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('locator_number')
|
||||
->label('Locator Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('scanned_status')
|
||||
->label('Scanned Status')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('upload_status')
|
||||
->label('Upload Status')
|
||||
->searchable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
|
||||
@@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class MotorTestingMasterResource extends Resource
|
||||
{
|
||||
@@ -62,6 +63,7 @@ class MotorTestingMasterResource extends Resource
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item Code')
|
||||
//->relationship('item', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (!$plantId) {
|
||||
@@ -74,7 +76,12 @@ class MotorTestingMasterResource extends Resource
|
||||
})
|
||||
->required()
|
||||
->searchable()
|
||||
->reactive(),
|
||||
->reactive()
|
||||
->rule(function (callable $get) {
|
||||
return Rule::unique('motor_testing_masters', 'item_id')
|
||||
->where('plant_id', $get('plant_id'))
|
||||
->ignore($get('id')); // Ignore current record during updates
|
||||
}),
|
||||
Forms\Components\TimePicker::make('routine_test_time')
|
||||
->label('Routine Test Time')
|
||||
->default('00:40:00')
|
||||
|
||||
@@ -196,27 +196,22 @@ class PalletValidationResource extends Resource
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pallet_number')
|
||||
->label('Pallet Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pallet_status')
|
||||
->label('Pallet Status')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('locator_number')
|
||||
->label('Locator Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('locator_quantity')
|
||||
|
||||
@@ -268,6 +268,7 @@ class ProductionLineStopResource extends Resource
|
||||
Forms\Components\DateTimePicker::make('from_datetime')
|
||||
->label('From DateTime')
|
||||
->required()
|
||||
->before('to_datetime')
|
||||
->reactive()
|
||||
// ->closeOnDateSelection()
|
||||
->afterStateUpdated(fn ($state, callable $set, callable $get) =>
|
||||
|
||||
@@ -372,7 +372,6 @@ class ReworkLocatorInvoiceValidationResource extends Resource
|
||||
TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->placeholder(placeholder: 'Enter Serial Number'),
|
||||
|
||||
Select::make('pallet_number')
|
||||
->label('Pallet Number')
|
||||
->options(function (callable $get) {
|
||||
|
||||
@@ -42,7 +42,6 @@ class TestingPanelReadingResource extends Resource
|
||||
|
||||
protected static ?string $navigationGroup = 'Testing Panel';
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
@@ -14,7 +14,6 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserResource extends Resource
|
||||
{
|
||||
protected static ?string $model = User::class;
|
||||
@@ -29,6 +28,7 @@ class UserResource extends Resource
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->required()
|
||||
->autofocus()
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('email', $state . '@cripumps.com');
|
||||
@@ -36,8 +36,13 @@ class UserResource extends Resource
|
||||
->maxLength(255),
|
||||
Forms\Components\TextInput::make('email')
|
||||
// ->email()
|
||||
->unique(ignoreRecord: true)
|
||||
->required()
|
||||
->readOnly()
|
||||
// ->rule(function (callable $get) {
|
||||
// return Rule::unique('users', 'email')
|
||||
// ->ignore($get('id')); // Ignore current record during updates
|
||||
// })
|
||||
->reactive()
|
||||
//->prefix(fn ($get) => $get('name') ?? null)
|
||||
// ->suffix('@cripumps.com')
|
||||
@@ -61,6 +66,9 @@ class UserResource extends Resource
|
||||
->multiple()
|
||||
->preload()
|
||||
->searchable(),
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,18 @@ use App\Filament\Imports\WeightValidationImporter;
|
||||
use App\Filament\Resources\WeightValidationResource\Pages;
|
||||
use App\Filament\Resources\WeightValidationResource\RelationManagers;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\Plant;
|
||||
use App\Models\QualityValidation;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Models\WeightValidation;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Notifications\Notification;
|
||||
@@ -28,6 +33,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Str;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
|
||||
class WeightValidationResource extends Resource
|
||||
{
|
||||
@@ -147,9 +153,209 @@ class WeightValidationResource extends Resource
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
// ->filters([
|
||||
// Tables\Filters\TrashedFilter::make(),
|
||||
// ])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Select::make('Plant')
|
||||
->label('Select Plant')
|
||||
->nullable()
|
||||
->options(function () {
|
||||
return Plant::pluck('name', 'id');
|
||||
})
|
||||
->reactive(),
|
||||
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
// $set('sticker_master_id', null);
|
||||
// $set('sap_msg_status', null);
|
||||
// }),
|
||||
Select::make('Item Code')
|
||||
->label('Search by Item Code')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (!$plantId) {
|
||||
return [];
|
||||
}
|
||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
TextInput::make('Obd Number')
|
||||
->label('OBD Number')
|
||||
->placeholder('Enter OBD Number'),
|
||||
|
||||
Select::make('Line')
|
||||
->label('Line')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
if (!$plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Get unique line_numbers for the selected plant_id
|
||||
return WeightValidation::where('plant_id', $plantId)
|
||||
->distinct()
|
||||
->orderBy('line_number')
|
||||
->pluck('line_number', 'line_number')
|
||||
->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
|
||||
TextInput::make('Batch')
|
||||
->label('Batch Number')
|
||||
->placeholder('Enter Batch Number'),
|
||||
|
||||
TextInput::make('Actual Weight')
|
||||
->label('Actual Weight')
|
||||
->placeholder('Enter Actual Weight'),
|
||||
|
||||
TextInput::make('Vehicle Number')
|
||||
->label('Vehicle Number')
|
||||
->placeholder('Enter Vehicle Number'),
|
||||
|
||||
TextInput::make('Heat Number')
|
||||
->label('Heat Number')
|
||||
->placeholder('Enter Heat Number'),
|
||||
|
||||
TextInput::make('Bundle Number')
|
||||
->label('Bundle Number')
|
||||
->placeholder('Enter Bundle Number'),
|
||||
|
||||
TextInput::make('Scanned By')
|
||||
->label('Scanned By')
|
||||
->placeholder('Enter Scanned By'),
|
||||
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
//Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Item Code']) && empty($data['Line']) && empty($data['Obd Number']) && empty($data['Batch']) && empty($data['Actual Weight']) && empty($data['Vehicle Number']) && empty($data['Heat Number']) && empty($data['Bundle Number']) && empty($data['Scanned By']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if (!empty($data['Plant'])) {
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
}
|
||||
|
||||
if (!empty($data['Item Code'])) {
|
||||
$query->where('item_id', $data['Item Code']);
|
||||
}
|
||||
|
||||
if (!empty($data['Line'])) {
|
||||
$query->where('line_number', $data['Line']);
|
||||
}
|
||||
|
||||
if (!empty($data['Obd Number'])) {
|
||||
$query->where('obd_number', $data['Obd Number']);
|
||||
}
|
||||
|
||||
if (!empty($data['Batch'])) {
|
||||
$query->where('batch_number', $data['Batch']);
|
||||
}
|
||||
|
||||
if (!empty($data['Actual Weight'])) {
|
||||
$query->where('actual_weight', $data['Actual Weight']);
|
||||
}
|
||||
|
||||
if (!empty($data['Vehicle Number'])) {
|
||||
$query->where('vehicle_number',$data['Vehicle Number']);
|
||||
}
|
||||
|
||||
if (!empty($data['Heat Number'])) {
|
||||
$query->where('heat_number',$data['Heat Number']);
|
||||
}
|
||||
|
||||
if (!empty($data['Bundle Number'])) {
|
||||
$query->where('bundle_number',$data['Bundle Number']);
|
||||
}
|
||||
|
||||
if (!empty($data['Scanned By'])) {
|
||||
$query->where('scanned_by', $data['Scanned By']);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (!empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (!empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant: ' . Plant::where('id', $data['Plant'])->value('name');
|
||||
}
|
||||
|
||||
if (!empty($data['Item Code'])) {
|
||||
$indicators[] = 'Item Code: ' . $data['Item Code'];
|
||||
}
|
||||
|
||||
if (!empty($data['Line'])) {
|
||||
$indicators[] = 'Line: ' . $data['Line'];
|
||||
}
|
||||
|
||||
if (!empty($data['Obd Number'])) {
|
||||
$indicators[] = 'OBD Number: ' . $data['Obd Number'];
|
||||
}
|
||||
|
||||
if (!empty($data['Batch'])) {
|
||||
$indicators[] = 'Batch Number: ' . $data['Batch'];
|
||||
}
|
||||
|
||||
if (!empty($data['Actual Weight'])) {
|
||||
$indicators[] = 'Actual Weight: ' . $data['Actual Weight'];
|
||||
}
|
||||
|
||||
if (!empty($data['Vehicle Number'])) {
|
||||
$indicators[] = 'Vehicle Number: ' . $data['Vehicle Number'];
|
||||
}
|
||||
|
||||
if (!empty($data['Heat Number'])) {
|
||||
$indicators[] = 'Heat Number: ' . $data['Heat Number'];
|
||||
}
|
||||
|
||||
if (!empty($data['Bundle Number'])) {
|
||||
$indicators[] = 'Bundle Number: ' . $data['Bundle Number'];
|
||||
}
|
||||
|
||||
if (!empty($data['Scanned By'])) {
|
||||
$indicators[] = 'Scanned By: ' . $data['Scanned By'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$indicators[] = 'From: ' . $data['created_from'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_to'])) {
|
||||
$indicators[] = 'To: ' . $data['created_to'];
|
||||
}
|
||||
|
||||
if (!empty($data['sticker_master_id'])) {
|
||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Item Codes: ' . $itemCode;
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
})
|
||||
])
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
|
||||
99
app/Http/Controllers/PalletController.php
Normal file
99
app/Http/Controllers/PalletController.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Mpdf\Mpdf;
|
||||
use Mpdf\QrCode\Output;
|
||||
use Mpdf\QrCode\QrCode;
|
||||
|
||||
class PalletController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function downloadQrPdf($palletNo)
|
||||
{
|
||||
$qrCode = new QrCode($palletNo);
|
||||
$output = new Output\Png();
|
||||
$qrBinary = $output->output($qrCode, 100);
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
$html = '
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; padding: 0; width: 60mm; height: 14mm; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
||||
.sticker-table { width: 60mm; height: 14mm; border-collapse: collapse; }
|
||||
.qr-cell { width: 14mm; text-align: left; vertical-align: middle; padding-left: 5mm; padding-top: 2mm; }
|
||||
.text-cell { text-align: left; vertical-align: middle; font-size: 12pt; padding-left: 7mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
||||
img.qr { width: 10mm; height: 10mm; display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="sticker-table">
|
||||
<tr>
|
||||
<td class="qr-cell">
|
||||
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
||||
</td>
|
||||
<td class="text-cell">
|
||||
' . htmlspecialchars($palletNo) . '
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
$mpdf = new Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => [60, 14],
|
||||
'margin_left' => 0,
|
||||
'margin_right' => 0,
|
||||
'margin_top' => 0,
|
||||
'margin_bottom' => 0,
|
||||
//'tempDir' => '/var/www/storage/mpdf-tmp',
|
||||
]);
|
||||
|
||||
$mpdf->WriteHTML($html);
|
||||
$mpdf->Output('qr-label.pdf', 'I');
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -24,278 +24,6 @@ class TestingPanelController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
public function downloadQrPdf($palletNo)
|
||||
{
|
||||
// Generate QR code as PNG binary (adjust size as needed)
|
||||
$qrCode = new QrCode($palletNo);
|
||||
$output = new Output\Png();
|
||||
$qrBinary = $output->output($qrCode, 100); // 100px size
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
// Prepare HTML with embedded QR code
|
||||
$html = '
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; padding: 0; width: 60mm; height: 14mm; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
||||
.sticker-table { width: 60mm; height: 14mm; border-collapse: collapse; }
|
||||
.qr-cell { width: 14mm; text-align: left; vertical-align: middle; padding-left: 5mm; padding-top: 2mm; }
|
||||
.text-cell { text-align: left; vertical-align: middle; font-size: 12pt; padding-left: 7mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
||||
img.qr { width: 10mm; height: 10mm; display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="sticker-table">
|
||||
<tr>
|
||||
<td class="qr-cell">
|
||||
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
||||
</td>
|
||||
<td class="text-cell">
|
||||
' . htmlspecialchars($palletNo) . '
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
$mpdf = new Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => [60, 14],
|
||||
'margin_left' => 0,
|
||||
'margin_right' => 0,
|
||||
'margin_top' => 0,
|
||||
'margin_bottom' => 0,
|
||||
'tempDir' => '/var/www/storage/mpdf-tmp',
|
||||
]);
|
||||
|
||||
$mpdf->WriteHTML($html);
|
||||
$mpdf->Output('qr-label.pdf', 'I');
|
||||
exit;
|
||||
}
|
||||
|
||||
// public function downloadQrPdf($palletNo)
|
||||
// {
|
||||
// $qrBinary = QrCode::format('png')->size(70)->generate($palletNo); // Adjust size as needed
|
||||
// $qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
// $html = '
|
||||
// <html>
|
||||
// <head>
|
||||
// <style>
|
||||
// body {
|
||||
// margin: 0;
|
||||
// padding: 0;
|
||||
// width: 60mm;
|
||||
// height: 14mm;
|
||||
// font-size: 10pt;
|
||||
// font-family: DejaVu Sans, sans-serif;
|
||||
// }
|
||||
// .sticker-table {
|
||||
// width: 60mm;
|
||||
// height: 14mm;
|
||||
// border-collapse: collapse;
|
||||
// }
|
||||
// .qr-cell {
|
||||
// width: 14mm;
|
||||
// text-align: left;
|
||||
// vertical-align: middle;
|
||||
// padding-left: 5mm;
|
||||
// padding-top: 2mm;
|
||||
// }
|
||||
// .text-cell {
|
||||
// text-align: left;
|
||||
// vertical-align: middle;
|
||||
// font-size: 12pt;
|
||||
// padding-left: 7mm;
|
||||
// padding-top: 2mm;
|
||||
// white-space: nowrap;
|
||||
// overflow: hidden;
|
||||
// text-overflow: ellipsis;
|
||||
// font-weight: bold;
|
||||
// }
|
||||
// img.qr {
|
||||
// width: 10mm;
|
||||
// height: 10mm;
|
||||
// display: block;
|
||||
// }
|
||||
// </style>
|
||||
// </head>
|
||||
// <body>
|
||||
// <table class="sticker-table">
|
||||
// <tr>
|
||||
// <td class="qr-cell">
|
||||
// <img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
||||
// </td>
|
||||
// <td class="text-cell">
|
||||
// ' . htmlspecialchars($palletNo) . '
|
||||
// </td>
|
||||
// </tr>
|
||||
// </table>
|
||||
// </body>
|
||||
// </html>
|
||||
// ';
|
||||
|
||||
// $mpdf = new Mpdf([
|
||||
// 'mode' => 'utf-8',
|
||||
// 'format' => [60, 14],
|
||||
// 'margin_left' => 0,
|
||||
// 'margin_right' => 0,
|
||||
// 'margin_top' => 0,
|
||||
// 'margin_bottom' => 0,
|
||||
// ]);
|
||||
|
||||
// $mpdf->WriteHTML($html);
|
||||
// $mpdf->Output(); // This directly flushes output as PDF
|
||||
// exit;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// public function downloadQrPdf($palletNo)
|
||||
// {
|
||||
// // 1. Generate TSPL commands
|
||||
// $labelContent = <<<EOT
|
||||
// SIZE 60 mm,14 mm
|
||||
// GAP 2 mm,0 mm
|
||||
// DIRECTION 1
|
||||
// CLS
|
||||
// QRCODE 20,20,L,5,A,0,"$palletNo"
|
||||
// TEXT 160,30,"0",0,12,12,"$palletNo"
|
||||
// PRINT 1
|
||||
// EOT;
|
||||
|
||||
// $filePath = '/tmp/labelprint.txt';
|
||||
// file_put_contents($filePath, $labelContent);
|
||||
|
||||
// //$printerShare = '//LASER-STANDBY/TSC TTP';
|
||||
// $tempFile = '/tmp/labelprint.txt';
|
||||
// $printerIp = '172.31.31.250'; // Printer server IP
|
||||
// $username = 'admin'; // SMB username
|
||||
// $password = 'admin'; // SMB password (can be empty, but better with password)
|
||||
// $printerShare = "//$printerIp/TSC_TTP_244 Pro"; // SMB share path
|
||||
|
||||
|
||||
// $tempFile = $filePath;
|
||||
|
||||
// $command = "smbclient \"$printerShare\" -U \"$username%$password\" -c \"put $tempFile labelprint.txt\"";
|
||||
// exec($command, $output, $status);
|
||||
// // $tempFile = '/tmp/labelprint.txt';
|
||||
// // $printerName = 'TSC_TTP_244_Pro'; // Replace with your actual CUPS printer queue name
|
||||
|
||||
// // $command = "lp -d $printerName -o raw $tempFile";
|
||||
// // exec($command, $output, $status);
|
||||
|
||||
// if ($status === 0) {
|
||||
// return response("Print sent to printer.");
|
||||
// } else {
|
||||
// return response("Print failed. Output: " . implode("\n", $output));
|
||||
// }
|
||||
// }
|
||||
// public function downloadQrPdf($palletNo)
|
||||
// {
|
||||
// $tspl = <<<EOT
|
||||
// SIZE 40 mm,30 mm
|
||||
// GAP 2 mm,0 mm
|
||||
// CLS
|
||||
// TEXT 50,50,"0",0,1,1,"Hello, TSC!"
|
||||
// PRINT 1
|
||||
// EOT;
|
||||
|
||||
// // Save TSPL to a temporary file
|
||||
// $tmpFile = tempnam(sys_get_temp_dir(), 'tsc_') . '.tspl';
|
||||
// file_put_contents($tmpFile, $tspl);
|
||||
|
||||
// // Print using CUPS (replace with your actual printer name)
|
||||
// $printerName = "TSC TTP-244 Pro"; // Example, use the exact name from CUPS
|
||||
|
||||
// $command = "lp -d \"$printerName\" \"$tmpFile\" 2>&1";
|
||||
|
||||
// exec($command, $output, $return_var);
|
||||
// $outputStr = implode("\n", $output);
|
||||
|
||||
// unlink($tmpFile);
|
||||
|
||||
// if ($return_var === 0) {
|
||||
// return "Label sent to printer!";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return "Failed to send label to printer. Error: " . $outputStr;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public function downloadQrPdf($palletNo)
|
||||
// {
|
||||
// // TSPL commands for test label
|
||||
// $labelContent = <<<EOT
|
||||
// SIZE 60 mm,14 mm
|
||||
// GAP 3 mm,0 mm
|
||||
// OFFSET 0 mm
|
||||
// DIRECTION 1
|
||||
// CLS
|
||||
// QRCODE 35,21,L,4,A,0,"$palletNo"
|
||||
// TEXT 180,50,"4",0,1,1,"$palletNo"
|
||||
// PRINT 1
|
||||
// EOT;
|
||||
|
||||
// //A : error correction level:
|
||||
|
||||
// $escapedContent = escapeshellarg($labelContent);
|
||||
|
||||
// $printerName = '4';
|
||||
|
||||
// $command = "echo $escapedContent | lp -d \"$printerName\" -o raw";
|
||||
|
||||
// exec($command, $output, $status);
|
||||
|
||||
// if ($status === 0) {
|
||||
// return response("Test print sent to printer successfully.");
|
||||
// } else {
|
||||
// return response("Print failed. Output: " . implode("\n", $output));
|
||||
// }
|
||||
// }
|
||||
|
||||
// public function downloadQrPdf($palletNo)
|
||||
// {
|
||||
// // TSPL label content (no indentation in heredoc)
|
||||
// $labelContent = <<<EOT
|
||||
// SIZE 60 mm,14 mm
|
||||
// GAP 2 mm,0 mm
|
||||
// DIRECTION 1
|
||||
// CLS
|
||||
// TEXT 10,10,"1",0,6,6,"Test"
|
||||
// PRINT 1
|
||||
// EOT;
|
||||
|
||||
|
||||
// $printerName = '4';
|
||||
|
||||
// //TEXT x, y, font, rotation, x_multiplication, y_multiplication, "text"
|
||||
|
||||
// // $command = "echo \"$labelContent\" | lp -d \"$printerName\" -o raw";
|
||||
|
||||
// // exec($command, $output, $status);
|
||||
|
||||
// // Save label content to a temp file
|
||||
// $tempFile = sys_get_temp_dir() . '/label.txt';
|
||||
// file_put_contents($tempFile, $labelContent);
|
||||
|
||||
// // Send the temp file to the printer
|
||||
// $command = "cat " . escapeshellarg($tempFile) . " | lp -d " . escapeshellarg($printerName) . " -o raw";
|
||||
|
||||
// exec($command, $output, $status);
|
||||
|
||||
// // Delete the temp file
|
||||
// unlink($tempFile);
|
||||
|
||||
// if ($status === 0) {
|
||||
// return response("TSPL command sent to printer.");
|
||||
// } else {
|
||||
// return response("TSPL print failed. Output: " . implode("\n", $output));
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
|
||||
14
resources/views/filament/pages/invoice-rework.blade.php
Normal file
14
resources/views/filament/pages/invoice-rework.blade.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<x-filament-panels::page>
|
||||
|
||||
<div class="space-y-4">
|
||||
{{-- Render the Select form fields --}}
|
||||
<div class="space-y-4">
|
||||
{{ $this->form }}
|
||||
</div>
|
||||
|
||||
<div class="bg-white shadow rounded-xl p-4 mt-6">
|
||||
<livewire:invoice-rework-data-table />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</x-filament-panels::page>
|
||||
@@ -61,7 +61,7 @@
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="10" class="text-center py-4 text-gray-500">
|
||||
<td colspan="12" class="text-center py-4 text-gray-500">
|
||||
No data found for invoice number <strong>{{ $invoiceNumber }}</strong>.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
// use App\Http\Controllers\MachineController;
|
||||
use App\Http\Controllers\MachineController;
|
||||
use App\Http\Controllers\ObdController;
|
||||
// use App\Http\Controllers\PlantController;
|
||||
// use App\Http\Controllers\StickerMasterController;
|
||||
use App\Http\Controllers\PalletController;
|
||||
use App\Http\Controllers\PlantController;
|
||||
use App\Http\Controllers\StickerMasterController;
|
||||
use App\Http\Controllers\TestingPanelController;
|
||||
// use App\Http\Controllers\UserController;
|
||||
// use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
// use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\UserController;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// Route::get('/user', function (Request $request) {
|
||||
@@ -58,3 +59,6 @@ Route::get('testing/item/get-master-data', [TestingPanelController::class, 'get_
|
||||
// Route::get('machine/get-all-data', [MachineController::class, 'get_all_data']);
|
||||
|
||||
// Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
|
||||
|
||||
Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf');
|
||||
|
||||
|
||||
@@ -1,36 +1,65 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\TestingPanelController;
|
||||
use App\Mail\test;
|
||||
use App\Models\InvoiceValidation;
|
||||
use App\Models\Plant;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
Route::get('/', function () {
|
||||
return redirect('/admin');
|
||||
});
|
||||
|
||||
// Route::get('/test_mail', function () {
|
||||
// Mail::to('jothikumar.padmanaban@cripumps.com')->send(
|
||||
// new test()
|
||||
// );
|
||||
// // $tableData = InvoiceValidation::select('id as no', 'plant_id as plant', 'invoice_number as TotalInvoice')
|
||||
// // ->orderBy('plant', 'asc')
|
||||
// // ->get()
|
||||
// // ->unique('invoice')
|
||||
// // ->values()
|
||||
// // ->toArray();
|
||||
|
||||
// $plants = InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id');
|
||||
|
||||
// $tableData = [];
|
||||
// $no = 1;
|
||||
|
||||
// foreach ($plants as $plantId) {
|
||||
|
||||
// $plant = Plant::find($plantId);
|
||||
|
||||
// $plantName = $plant ? $plant->name : $plantId;
|
||||
|
||||
// $totalInvoice = InvoiceValidation::where('plant_id', $plantId)
|
||||
// ->distinct('invoice_number')
|
||||
// ->count('invoice_number');
|
||||
|
||||
// $startDate = now()->setTime(8, 0, 0);
|
||||
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
|
||||
// $scannedInvoice = InvoiceValidation::select('invoice_number')
|
||||
// ->where('plant_id', $plantId)
|
||||
// ->whereNull('quantity')
|
||||
// ->whereBetween('updated_at', [$startDate, $endDate])
|
||||
// ->groupBy('invoice_number')
|
||||
// ->havingRaw("COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)")
|
||||
// ->count();
|
||||
|
||||
// $tableData[] = [
|
||||
// 'no' => $no++,
|
||||
// 'plant' => $plantName,
|
||||
// 'totalInvoice' => $totalInvoice,
|
||||
// 'scannedInvoice' => $scannedInvoice,
|
||||
// ];
|
||||
// }
|
||||
|
||||
// Mail::to('jothikumar.padmanaban@cripumps.com')->send(
|
||||
// new test($tableData)
|
||||
// );
|
||||
// // Mail::to([
|
||||
// // 'jothikumar.padmanaban@cripumps.com',
|
||||
// // 'tamilselvan.selvaraj@cripumps.com',
|
||||
// // 'dineshkumar.kaliyappan@cripumps.com'
|
||||
// // ])->send(new test($tableData));
|
||||
|
||||
// return "Mail sent!";
|
||||
// });
|
||||
|
||||
// Route::get('/qr-pdf-test', function () {
|
||||
// $qrBinary = QrCode::format('png')->size(200)->generate('Test');
|
||||
// $qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
// $html = '<img src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />';
|
||||
// $mpdf = new Mpdf(['mode' => 'utf-8']);
|
||||
// $mpdf->WriteHTML($html);
|
||||
// return response($mpdf->Output('qr-code.pdf', 'S'), 200, [
|
||||
// 'Content-Type' => 'application/pdf',
|
||||
// 'Content-Disposition' => 'attachment; filename="qr-code.pdf"'
|
||||
// ]);
|
||||
// });
|
||||
|
||||
//Route::get('/download-qr-pdf', [TestingPanelController::class, 'downloadQrPdf'])->name('download-qr-pdf');
|
||||
|
||||
Route::get('/download-qr-pdf/{palletNo}', [TestingPanelController::class, 'downloadQrPdf'])->name('download-qr-pdf');
|
||||
|
||||
Reference in New Issue
Block a user