13 Commits

Author SHA1 Message Date
dhanabalan
702dd69c94 Added 'panel_box_code', 'created_by' and 'updated_by' columns on InvoiceValidationExporter page
Some checks are pending
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Waiting to run
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
2026-02-03 21:31:06 +05:30
dhanabalan
ce65c68125 Added updated_by name on updated invoice for scanned serial numbers
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 21:15:13 +05:30
dhanabalan
92f3352f6b Updated clear panel box QR if cancel button clicked and Added panel_box_code update logic on livewire page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 20:57:39 +05:30
dhanabalan
a14cf0aef6 Added 'created_by' and 'updated_by' columns on record creation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 20:53:00 +05:30
dhanabalan
bdd8e9dfc3 Added 'created_by' and 'updated_by' columns to InvoiceValidationResource table and updated file upload validation for .xlsx file (serial / material invoice)
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 20:51:12 +05:30
dhanabalan
951a69b85e Added panel_box_code, created_by, updated_by columns in InvoiceValidation model
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 19:47:52 +05:30
dhanabalan
dc6fd87c7b Added migration file to create panel_box_code, created_by, updated_by columns in invoice_validations table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 19:46:19 +05:30
dhanabalan
f464facd56 Added panel_box_code, created_by, updated_by columns in invoice_validations migration table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 19:44:48 +05:30
dhanabalan
21d009ee1c Added approver_type column to characteristic_approver_masters table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 17:13:30 +05:30
dhanabalan
8e7030b80b Added dynamic plant options in user form based on authenticated user's plant ID
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 17:01:56 +05:30
dhanabalan
1931412511 Added skip plant if not exist on user importer page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 16:12:59 +05:30
dhanabalan
0fef7b27bf Updated Final API lists
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 13:16:13 +05:30
dhanabalan
115fe43428 Commented FileUploadController logic and Added request characteristics mail approve logic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-03 13:13:28 +05:30
13 changed files with 335 additions and 159 deletions

View File

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

View File

@@ -18,7 +18,7 @@ class UserImporter extends Importer
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
ImportColumn::make('plant_id')
->requiredMapping()
->exampleHeader('Plant Code')
->example('1000')
@@ -54,10 +54,13 @@ class UserImporter extends Importer
public function resolveRecord(): ?User
{
$warnMsg = [];
$plantCod = $this->data['plant'];
$plantCod = $this->data['plant_id'];
$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!';
} elseif (Str::length($plantCod) <= 0) {
$plant = null;
$plantCod = null;
} else {
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {

View File

@@ -212,6 +212,14 @@ class InvoiceValidationResource extends Resource
Forms\Components\TextInput::make('id')
->hidden()
->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),
]);
@@ -267,9 +275,11 @@ class InvoiceValidationResource extends Resource
Tables\Columns\TextColumn::make('scanned_status')
->label('Scanned Status')
->alignCenter(),
// Tables\Columns\TextColumn::make('stickerMaster.panel_box_code')
// ->label('Panel Box Code')
// ->alignCenter(),
Tables\Columns\TextColumn::make('panel_box_code')// stickerMaster.panel_box_code
->label('Panel Box Code')
->alignCenter()
->sortable(), // ->searchable()
// ->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('panel_box_supplier')
->label('Panel Box Supplier')
->alignCenter(),
@@ -294,11 +304,20 @@ class InvoiceValidationResource extends Resource
->label('Plant')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_by')
->label('Created By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->dateTime()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->dateTime()
@@ -358,11 +377,15 @@ class InvoiceValidationResource extends Resource
FileUpload::make('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()
->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.
->visible(fn (Get $get) => ! empty($get('plant_id')))
->directory(function (callable $get) {
@@ -370,7 +393,9 @@ class InvoiceValidationResource extends Resource
$plantCode = $plant?->code ?? null;
return "uploads/temp/{$plantCode}";
}),
})
->uploadingMessage('Uploading...')
->helperText('Only .xlsx files are allowed (Excel files).'),
])
->action(function (array $data) {
$uploadedFile = $data['invoice_serial_number'];
@@ -385,15 +410,22 @@ class InvoiceValidationResource extends Resource
// Get original filename
$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);
$originalName = "{$originalNameOnly}.xlsx";
// Store manually using storeAs to keep original name
$path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local'); // returns relative path
// uploads/temp/{$plantCode}/3RA0018735.xlsx
if ($originalNameOnly && strlen($originalNameOnly) < 8) {
if (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
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()
->send();
@@ -692,8 +724,8 @@ class InvoiceValidationResource extends Resource
FileUpload::make('invoice_material')
->label('Invoice Material')
->required()
->preserveFilenames()
->reactive() // <- this keeps the original filename
->preserveFilenames() // <- this keeps the original filename
->reactive()
->storeFiles(false) // prevent auto-storing
->disk('local')
->visible(fn (Get $get) => ! empty($get('plant_id')))
@@ -702,7 +734,8 @@ class InvoiceValidationResource extends Resource
$plantCode = $plant?->code ?? null;
return "uploads/temp/{$plantCode}";
}),
})
->helperText('Only .xlsx files are allowed (Excel files).'),
])
->action(function (array $data) {
$uploadedFile = $data['invoice_material'];
@@ -717,13 +750,20 @@ class InvoiceValidationResource extends Resource
// Get original filename
$originalName = $uploadedFile->getClientOriginalName();
$extension = strtolower(pathinfo($originalName, PATHINFO_EXTENSION));
if ($extension !== 'xlsx') {
throw new \Exception('Only .xlsx files allowed.');
}
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
$originalName = "{$originalNameOnly}.xlsx";
$path = $uploadedFile->storeAs("uploads/temp/{$plantCode}", $originalName, 'local');
if ($originalNameOnly && strlen($originalNameOnly) < 8) {
if (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
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()
->send();

View File

@@ -613,6 +613,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'quantity' => 1,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -653,6 +655,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'quantity' => $bundleQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -716,6 +720,7 @@ class CreateInvoiceValidation extends CreateRecord
$existEmpRecQty->update([
'quantity' => $newInsQty,
'operator_id' => $operatorName,
'updated_by' => $operatorName,
'updated_at' => now(),
]);
$newQuan--;
@@ -727,6 +732,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'quantity' => $newInsQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -746,6 +753,7 @@ class CreateInvoiceValidation extends CreateRecord
$existEmpRecQty->update([
'quantity' => $newInsQty,
'operator_id' => $operatorName,
'updated_by' => $operatorName,
'updated_at' => now(),
]);
$newQuan--;
@@ -757,6 +765,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'quantity' => $newInsQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -780,6 +790,8 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$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
$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();
@@ -1232,6 +1244,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => $serialNumber,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -1254,6 +1268,8 @@ class CreateInvoiceValidation extends CreateRecord
$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
$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();
@@ -1777,6 +1793,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'quantity' => 1,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -1810,6 +1828,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'quantity' => $bundleQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -1841,6 +1861,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'quantity' => $totalExcelQty,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -2205,6 +2227,8 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber,
'serial_number' => $serialNumber,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
$inserted++;
}
@@ -2949,6 +2973,7 @@ class CreateInvoiceValidation extends CreateRecord
if ($curExistQty > $curScanQty) { // 5 > 2
$record->quantity = $curExistQty - $curScanQty; // 5 - 2
$record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
// $record->updated_at = now();
$record->save();
@@ -2961,12 +2986,15 @@ class CreateInvoiceValidation extends CreateRecord
'quantity' => $curScanQty,
'created_at' => $createdDt,
'operator_id' => $operatorName,
'created_by' => $operatorName,
'updated_by' => $operatorName,
]);
} elseif ($curExistQty == $curScanQty) { // 2 = 2
// $record->delete();
$record->serial_number = $serialNumber;
$record->batch_number = $batchNumber;
$record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
// $record->updated_at = now();
$record->save();
@@ -2977,6 +3005,8 @@ class CreateInvoiceValidation extends CreateRecord
// 'quantity' => $curScanQty,
// 'created_at' => $createdDt,
// 'operator_id'=> $operatorName,
// 'created_by' => $operatorName,
// 'updated_by' => $operatorName,
// ]);
} else {
Notification::make()
@@ -3032,6 +3062,7 @@ class CreateInvoiceValidation extends CreateRecord
$record->batch_number = $batchNumber;
// $record->updated_at = now();
$record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
$record->save();
}
@@ -3400,6 +3431,7 @@ class CreateInvoiceValidation extends CreateRecord
$record->scanned_status = 'Scanned';
}
$record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
$record->save();
// Notification::make()
@@ -3516,6 +3548,7 @@ class CreateInvoiceValidation extends CreateRecord
$record->scanned_status = 'Scanned';
}
$record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
$record->save();
// Notification::make()
@@ -3698,6 +3731,7 @@ class CreateInvoiceValidation extends CreateRecord
$record->scanned_status = 'Scanned';
}
$record->operator_id = $operatorName;
// $record->updated_by = $operatorName;
$record->save();
// Notification::make()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -81,6 +81,7 @@
<th class="border px-4 py-2">Scanned Status</th>
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</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 Serial Number</th>
</tr>
@@ -98,6 +99,7 @@
<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['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_serial_number'] ?? '' }}</td>
</tr>
@@ -130,6 +132,7 @@
<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">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 Serial Number</th>
</tr>
@@ -148,6 +151,7 @@
<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">{{ $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_serial_number ?? '' }}</td>
</tr>

View File

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

View File

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