32 Commits

Author SHA1 Message Date
dhanabalan
de11ae3b1f Added ok_quantity and not_ok_quantity parameter (with functionality) in process order get response json
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-05 17:01:55 +05:30
dhanabalan
82b1527d7b Commented panel_box_code invoice table on livewire design
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-05 14:44:55 +05:30
dhanabalan
e7b4214f0c Added lower, middle, upper column to allow only validation
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-05 11:33:18 +05:30
dhanabalan
3f2ef5355e Added allow numeric only on process_order input
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-05 11:25:24 +05:30
dhanabalan
2d7f477263 Added process_order length as 12 digit
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-05 11:21:25 +05:30
dhanabalan
9bba1e2636 Updated default plant load logic and auto focus enabled for invoice number
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 18:00:33 +05:30
dhanabalan
64d7f98f3b Add entry and exit time fields with duration calculation in VehicleEntryResource form
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 15:30:52 +05:30
dhanabalan
091234323d Add route for vehicle entry management using VehicleController
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 15:00:58 +05:30
dhanabalan
e890e01cd3 Add VehicleEntryPolicy for authorization management of VehicleEntry actions
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 14:59:40 +05:30
dhanabalan
b3b046c92c Add VehicleController with storeVehicleEntry method for vehicle entry management
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 14:58:57 +05:30
dhanabalan
01cbfc9391 Add VehicleEntry resource and associated pages for CRUD operations
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 14:57:35 +05:30
dhanabalan
290ad727fa Added vehicle entry model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 14:55:50 +05:30
dhanabalan
9b5d3168de Add migration for vehicle_entries table creation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 14:53:06 +05:30
dhanabalan
268eb143cc Updated report view rights for employee against role
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
2026-02-04 11:40:38 +05:30
dhanabalan
8b34e17096 Commented unused column on view report
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 11:18:26 +05:30
dhanabalan
d21581ea61 Updated report view rights against role
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 10:42:42 +05:30
dhanabalan
b9e62618a0 Updated prunable record report generation daily at 7 o'clock
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 09:35:34 +05:30
dhanabalan
1325b77eb3 testing mail subject
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 09:23:45 +05:30
dhanabalan
0a9d6514cb testing mail subject
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 09:21:25 +05:30
dhanabalan
f2d0d3da8e testing mail subject
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 09:17:23 +05:30
dhanabalan
469b47d2dc Refactored plant selection logic and added 'updated_by' tracking in ProcessOrderResource form
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-04 09:03:51 +05:30
dhanabalan
702dd69c94 Added 'panel_box_code', 'created_by' and 'updated_by' columns on InvoiceValidationExporter page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
2026-02-03 21:31:06 +05:30
dhanabalan
ce65c68125 Added updated_by name on updated invoice for scanned serial numbers
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) 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
25 changed files with 1099 additions and 274 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

@@ -70,7 +70,10 @@ class InvoiceValidationResource extends Resource
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->default(function () {
return optional(InvoiceValidation::latest()->first())->plant_id;
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? $userHas : optional(InvoiceValidation::latest()->first())->plant_id;
// return optional(InvoiceValidation::latest()->first())->plant_id;
})
->disabled(fn (Get $get) => ! empty($get('id')))
// ->afterStateUpdated(fn ($set) => $set('block_id', null) & $set('name', null) & $set('start_time', null) & $set('duration', null) & $set('end_time', null))
@@ -118,8 +121,19 @@ class InvoiceValidationResource extends Resource
// ->afterStateHydrated(function (TextInput $component, string $state) {
// $component->state(ucwords($state));
// })
->autofocus(function ($state, callable $set, callable $get) {
$plantId = $get('plant_id');
$sNo = $get('serial_number');
if (! $plantId || $sNo) {
return false;
} elseif ($plantId && ! $sNo) {
return true;
} else {
return false;
}
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$invNo = $get('invoice_number');
// $invNo = $get('invoice_number');
$set('serial_number', null);
$set('update_invoice', null);
// Session::put('invoice_number', $state);
@@ -212,6 +226,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 +289,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 +318,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 +391,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 +407,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 +424,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 +738,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 +748,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 +764,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();
@@ -1085,11 +1139,11 @@ class InvoiceValidationResource extends Resource
// ])
->options(function () {
$userRights = Filament::auth()->user();
$hasBoth = ($userRights->hasRole(['Super Admin', 'Sales Employee', 'Sales Supervisor Hub', 'Sales Manager']) ?? null);
$hasBoth = ($userRights->hasRole(['Super Admin', 'Sales Employee', 'Sales Supervisor Hub', 'Sales Supervisor Hub Upload', 'Sales Manager']) ?? null);
$hasSerial = ($userRights->hasRole(['Sales Supervisor 1', 'Sales Supervisor Inventory', 'Sales Employee Inventory']) ?? null);
$hasSerial = ($userRights->hasRole(['Sales Employee 1', 'Sales Supervisor 1', 'Sales Supervisor Upload 1']) ?? null); // , 'Sales Supervisor Inventory', 'Sales Supervisor Inventory Upload', 'Sales Employee Inventory'
$hasMaterial = $userRights->hasRole('Sales Supervisor 2') ?? null;
$hasMaterial = ($userRights->hasRole(['Sales Employee 2', 'Sales Supervisor 2', 'Sales Supervisor Upload 2']) ?? null);
$retRes = [
'Serial' => 'Serial',
@@ -1109,11 +1163,11 @@ class InvoiceValidationResource extends Resource
// ->default('Serial')
->default(function () {
$userRights = Filament::auth()->user();
$hasBoth = ($userRights->hasRole(['Super Admin', 'Sales Employee', 'Sales Supervisor Hub', 'Sales Manager']) ?? null);
$hasBoth = ($userRights->hasRole(['Super Admin', 'Sales Employee', 'Sales Supervisor Hub', 'Sales Supervisor Hub Upload', 'Sales Manager']) ?? null);
$hasSerial = ($userRights->hasRole(['Sales Supervisor 1', 'Sales Supervisor Inventory', 'Sales Employee Inventory']) ?? null);
$hasSerial = ($userRights->hasRole(['Sales Employee 1', 'Sales Supervisor 1', 'Sales Supervisor Upload 1']) ?? null); // , 'Sales Supervisor Inventory', 'Sales Supervisor Inventory Upload', 'Sales Employee Inventory'
$hasMaterial = $userRights->hasRole('Sales Supervisor 2') ?? null;
$hasMaterial = ($userRights->hasRole(['Sales Employee 2', 'Sales Supervisor 2', 'Sales Supervisor Upload 2']) ?? null);
if ($hasBoth || $hasSerial) {
return 'Serial';

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

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

View File

@@ -11,6 +11,7 @@ use App\Models\Machine;
use App\Models\Plant;
use App\Models\ProductCharacteristicsMaster;
use App\Models\WorkGroupMaster;
use Closure;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\DateTimePicker;
@@ -45,7 +46,7 @@ class ProductCharacteristicsMasterResource extends Resource
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->required(),
@@ -189,33 +190,45 @@ class ProductCharacteristicsMasterResource extends Resource
// session()->put('temp_result', $state);
// })
// ->hidden(fn (callable $get) => $get('inspection_type') != 'Visual'),
Forms\Components\TextInput::make('upper')
->label('Upper')
->numeric()
->default(0.0)
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
Forms\Components\TextInput::make('lower')
->label('Lower')
->numeric()
->reactive()
->default(0.0)
->minValue(0.0)
->maxValue(fn (Get $get) => $get('upper') ?? PHP_INT_MAX)
->afterStateUpdated(fn ($state, callable $set, callable $get) => $set('middle', ($state + $get('upper')) / 2))
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
Forms\Components\TextInput::make('upper')
->label('Upper')
->numeric()
->reactive()
->default(0.0)
->minValue(fn (Get $get) => $get('lower') ?? 0)
->maxValue(PHP_INT_MAX)
->afterStateUpdated(fn ($state, callable $set, callable $get) => $set('middle', ($get('lower') + $state) / 2))
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
Forms\Components\TextInput::make('middle')
->label('Middle')
->readOnly()
->numeric()
->visible(fn (callable $get) => $get('inspection_type') == 'Value')
->rule(function (callable $get) {
return function (string $attribute, $value, \Closure $fail) use ($get) {
$lower = $get('lower');
$upper = $get('upper');
$middle = $value;
->reactive()
->default(0.0)
// ->rule(function (callable $get) {
// return function (string $attribute, $value, Closure $fail) use ($get) {
// $lower = $get('lower');
// $upper = $get('upper');
// $middle = $value;
if (! is_null($lower) && ! is_null($upper) && ! is_null($middle)) {
if (! ($lower <= $middle && $middle <= $upper)) {
$fail('Middle must be between Lower and Upper (Lower ≤ Middle ≤ Upper).');
}
}
};
}),
// if (! is_null($lower) && ! is_null($upper) && ! is_null($middle)) {
// if ((($lower <= $middle || $middle >= $upper) && $lower != $upper) || (($lower < $middle || $middle > $upper) && $lower == $upper)) {
// $fail('Middle must be between Lower and Upper (Lower ≤ Middle ≤ Upper).');
// }
// }
// };
// })
->dehydrateStateUsing(fn ($state, Get $get) => ($get('lower') + $get('upper')) / 2)
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->default(Filament::auth()->user()?->name),
@@ -330,7 +343,7 @@ class ProductCharacteristicsMasterResource extends Resource
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {

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')
@@ -122,7 +128,8 @@ class UserResource extends Resource
->label('Email Verified At')
->dateTime()
->alignCenter()
->sortable(),
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('roles.name')
->label('Roles')
->alignCenter()
@@ -165,14 +172,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

@@ -0,0 +1,188 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\VehicleEntryResource\Pages;
use App\Filament\Resources\VehicleEntryResource\RelationManagers;
use App\Models\Plant;
use App\Models\VehicleEntry;
use Carbon\Carbon;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class VehicleEntryResource extends Resource
{
protected static ?string $model = VehicleEntry::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->reactive()
->relationship('plant', 'name')
->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();
})
->required(),
Forms\Components\TextInput::make('vehicle_number')
->label('Vehicle Number')
->required(),
Forms\Components\DateTimePicker::make('entry_time')
->label('Entry Time')
->required()
->afterStateUpdated(function ($state, callable $get, callable $set) {
$exitTime = $get('exit_time');
if ($state && $exitTime) {
$duration = Carbon::parse($exitTime)
->diff(Carbon::parse($state))
->format('%H:%I:%S');
$set('duration', $duration);
}
}),
Forms\Components\DateTimePicker::make('exit_time')
->label('Exit Time')
->required()
->reactive()
->afterStateUpdated(function ($state, callable $get, callable $set) {
$entryTime = $get('entry_time');
if ($state && $entryTime) {
$duration = Carbon::parse($state)
->diff(Carbon::parse($entryTime))
->format('%H:%I:%S');
$set('duration', $duration);
}
}),
Forms\Components\TextInput::make('duration')
->label('Duration')
->readOnly()
->required(),
Forms\Components\TextInput::make('type')
->label('Type')
->required(),
Forms\Components\Hidden::make('created_by')
->label('Created By'),
Forms\Components\Hidden::make('updated_by')
->label('Updated By'),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->alignCenter()
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$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')
->label('Plant')
->alignCenter()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('vehicle_number')
->label('Vehicle Number')
->alignCenter()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('entry_time')
->label('Entry Time')
->alignCenter()
->dateTime()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('exit_time')
->label('Exit Time')
->alignCenter()
->dateTime()
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('duration')
->label('Duration')
->alignCenter()
->searchable(),
Tables\Columns\TextColumn::make('type')
->label('Type')
->alignCenter()
->searchable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label('Deleted At')
->alignCenter()
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListVehicleEntries::route('/'),
'create' => Pages\CreateVehicleEntry::route('/create'),
'view' => Pages\ViewVehicleEntry::route('/{record}'),
'edit' => Pages\EditVehicleEntry::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\VehicleEntryResource\Pages;
use App\Filament\Resources\VehicleEntryResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateVehicleEntry extends CreateRecord
{
protected static string $resource = VehicleEntryResource::class;
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\VehicleEntryResource\Pages;
use App\Filament\Resources\VehicleEntryResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditVehicleEntry extends EditRecord
{
protected static string $resource = VehicleEntryResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\VehicleEntryResource\Pages;
use App\Filament\Resources\VehicleEntryResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListVehicleEntries extends ListRecords
{
protected static string $resource = VehicleEntryResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\VehicleEntryResource\Pages;
use App\Filament\Resources\VehicleEntryResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewVehicleEntry extends ViewRecord
{
protected static string $resource = VehicleEntryResource::class;
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Models\CharacteristicValue;
use App\Models\GrMaster;
use App\Models\Item;
use App\Models\Line;
@@ -607,14 +608,20 @@ class PdfController extends Controller
// ], 404);
// }
$okQty = CharacteristicValue::where('plant_id', $plant->id)->where('process_order', $processOrder)->where('status', 'Ok')->get()->count();
$notOkQty = CharacteristicValue::where('plant_id', $plant->id)->where('process_order', $processOrder)->where('status', 'NotOk')->get()->count();
return response()->json([
'item_code' => $item?->code ?? '',
'description' => $item?->description ?? '',
// 'coil_number' => $proOrdAgPlant->coil_number ?? "",
// 'order_quantity' => (string)$proOrdAgPlant->order_quantity ?? "",
'coil_number' => $lastRecord->coil_number ?? '',
'order_quantity' => (string) $lastRecord->order_quantity ?? '',
'received_quantity' => (string) $totalReceivedQty ?? '',
'coil_number' => (string) $lastRecord->coil_number ?? '0',
'order_quantity' => (string) $lastRecord->order_quantity ?? '0.000',
'ok_quantity' => (string) $okQty ?? '0',
'not_ok_quantity' => (string) $notOkQty ?? '0',
'received_quantity' => (string) (($totalReceivedQty == 0) ? '0.000' : $totalReceivedQty) ?? '0.000',
]);
}
@@ -867,15 +874,13 @@ class PdfController extends Controller
], 404);
}
if($rework != 'Yes' && $rework != 'No'){
if ($rework != 'Yes' && $rework != 'No') {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Rework value should be either 'Yes' or 'No'!",
], 404);
}
else if ($rework == 'No')
{
if($scrapQty != 0){
} elseif ($rework == 'No') {
if ($scrapQty != 0) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Scrap Quanity value should be '0'!",
@@ -883,10 +888,8 @@ class PdfController extends Controller
}
}
try
{
if ($rework == 'Yes')
{
try {
if ($rework == 'Yes') {
$updated = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('line_id', $lineNamePlantId)
@@ -894,12 +897,12 @@ class PdfController extends Controller
->update([
// 'order_quantity' => $orderQty,
'received_quantity' => $receivedQty,
'scrap_quantity' => $scrapQty,
'scrap_quantity' => $scrapQty,
// 'sfg_number' => $sfgNo,
// 'machine_name' => $machineId,
'rework_status' => 1,
'updated_by' => $createdBy,
'updated_at' => now(),
'rework_status' => 1,
'updated_by' => $createdBy,
'updated_at' => now(),
]);
if ($updated == 0) {
@@ -907,17 +910,13 @@ class PdfController extends Controller
'status_code' => 'ERROR',
'status_description' => 'No matching record found for rework coil number!',
], 404);
}
else
{
} else {
return response()->json([
'status_code' => 'SUCCESS',
'status_description' => 'Record Updated Successfully (Rework)',
]);
}
}
else
{
} else {
$existing = ProcessOrder::where('plant_id', $plantId)
->where('process_order', $processOrder)
->where('coil_number', $coilNo)
@@ -960,7 +959,8 @@ class PdfController extends Controller
}
}
public function storeLaserPdf(Request $request){
public function storeLaserPdf(Request $request)
{
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
@@ -976,7 +976,7 @@ class PdfController extends Controller
$workflowId = $request->header('work_flow_id');
if (!$workflowId) {
if (! $workflowId) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "work_flow_id can't be empty!",
@@ -999,9 +999,9 @@ class PdfController extends Controller
// 'local'
// );
$filename = $workflowId . '.pdf';
$filename = $workflowId.'.pdf';
$filePath = 'uploads/LaserDocs/' . $filename;
$filePath = 'uploads/LaserDocs/'.$filename;
if (Storage::disk('local')->exists($filePath)) {
Storage::disk('local')->delete($filePath);

View File

@@ -0,0 +1,188 @@
<?php
namespace App\Http\Controllers;
use App\Models\Plant;
use App\Models\VehicleEntry;
use Illuminate\Http\Request;
use Carbon\Carbon;
class VehicleController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
public function storeVehicleEntry(Request $request)
{
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser.':'.$expectedPw;
if ('Bearer '.$expectedToken != $header_auth) {
return response('ERROR: Unauthorized', 403)
->header('Content-Type', 'text/plain');
}
$plantCode = $request->header('plant-code');
if(!$plantCode){
return response()->json([
'status' => 'ERROR',
'status_description' => "Plant code can't be empty!",
], 404);
}
if (!ctype_digit((string) $plantCode)) {
return response()->json([
'status' => 'error',
'status_description' => "plant code must be $plantCode a numeric value",
], 404);
}
$plantCod = Plant::where('code', $plantCode)->first();
if(!$plantCod){
return response()->json([
'status' => 'ERROR',
'status_description' => "Plant code $plantCode not found!",
], 404);
}
$plantId = $plantCod->id;
$data = $request->all();
$vehicleNo = $data['vehicle_number'] ?? '';
$entryTimeRaw = $data['entry_time'] ?? '';
$exitTimeRaw = $data['exit_time'] ?? '';
$duration = $data['duration'] ?? '';
$type = $data['type'] ?? '';
if(!$vehicleNo)
{
return response()->json([
'status' => 'ERROR',
'status_description' => "Vehicle number cant't be empty!",
], 404);
}
else if (strlen($vehicleNo) < 8) {
return response()->json([
'status' => 'ERROR',
'status_description' => "vehicle number '$vehicleNo' must be at least 8 characters long",
], 404);
}
else if(!$entryTimeRaw)
{
return response()->json([
'status' => 'ERROR',
'status_description' => "Entry time cant't be empty!",
], 404);
}
else if(!$exitTimeRaw)
{
return response()->json([
'status' => 'ERROR',
'status_description' => "Exit time cant't be empty!",
], 404);
}
else if(!$duration)
{
return response()->json([
'status' => 'ERROR',
'status_description' => "Duration cant't be empty!",
], 404);
}
else if(!$type)
{
return response()->json([
'status' => 'ERROR',
'status_description' => "type cant't be empty!",
], 404);
}
if ($entryTimeRaw && !Carbon::hasFormat($entryTimeRaw, 'd/m/Y h:i:s A')) {
return response()->json([
'status' => 'ERROR',
'status_description' => "Invalid Entry time format $entryTimeRaw. Expected dd/mm/yyyy hh:mm:ss AM/PM",
], 404);
}
else if ($exitTimeRaw && !Carbon::hasFormat($exitTimeRaw, 'd/m/Y h:i:s A')) {
return response()->json([
'status' => 'ERROR',
'status_description' => "Invalid Exit time format $exitTimeRaw. Expected dd/mm/yyyy hh:mm:ss AM/PM",
], 404);
}
else if ($duration && !preg_match('/^\d{2}:\d{2}:\d{2}$/', $duration)) {
return response()->json([
'status' => 'error',
'status_description' => "Invalid duration format $duration. Expected HH:MM:SS",
], 404);
}
$entryTime = $entryTimeRaw
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
: null;
$exitTime = $exitTimeRaw
? Carbon::createFromFormat('d/m/Y h:i:s A', $exitTimeRaw)
: null;
VehicleEntry::insert([
'plant_id' => $plantId,
'vehicle_number' => $vehicleNo,
'entry_time' => $entryTime,
'exit_time' => $exitTime,
'duration' => $duration,
'type' => $type,
'created_at' => now(),
'updated_at' => now(),
]);
return response()->json([
'status' => 'success',
'status_description' => 'Vehicle entry inserted successfully'
], 200);
}
/**
* 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)
{
//
}
}

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

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class VehicleEntry extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'vehicle_number',
'entry_time',
'exit_time',
'duration',
'type',
'created_at',
'created_by',
'updated_at',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Policies;
use Illuminate\Auth\Access\Response;
use App\Models\VehicleEntry;
use App\Models\User;
class VehicleEntryPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->checkPermissionTo('view-any VehicleEntry');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, VehicleEntry $vehicleentry): bool
{
return $user->checkPermissionTo('view VehicleEntry');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->checkPermissionTo('create VehicleEntry');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, VehicleEntry $vehicleentry): bool
{
return $user->checkPermissionTo('update VehicleEntry');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, VehicleEntry $vehicleentry): bool
{
return $user->checkPermissionTo('delete VehicleEntry');
}
/**
* Determine whether the user can delete any models.
*/
public function deleteAny(User $user): bool
{
return $user->checkPermissionTo('delete-any VehicleEntry');
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, VehicleEntry $vehicleentry): bool
{
return $user->checkPermissionTo('restore VehicleEntry');
}
/**
* Determine whether the user can restore any models.
*/
public function restoreAny(User $user): bool
{
return $user->checkPermissionTo('restore-any VehicleEntry');
}
/**
* Determine whether the user can replicate the model.
*/
public function replicate(User $user, VehicleEntry $vehicleentry): bool
{
return $user->checkPermissionTo('replicate VehicleEntry');
}
/**
* Determine whether the user can reorder the models.
*/
public function reorder(User $user): bool
{
return $user->checkPermissionTo('reorder VehicleEntry');
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, VehicleEntry $vehicleentry): bool
{
return $user->checkPermissionTo('force-delete VehicleEntry');
}
/**
* Determine whether the user can permanently delete any models.
*/
public function forceDeleteAny(User $user): bool
{
return $user->checkPermissionTo('force-delete-any VehicleEntry');
}
}

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

@@ -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
{
$sql = <<<'SQL'
CREATE TABLE vehicle_entries (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
vehicle_number TEXT DEFAULT NULL,
entry_time TIMESTAMP,
exit_time TIMESTAMP,
duration INTERVAL,
type TEXT 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,
FOREIGN KEY (plant_id) REFERENCES plants(id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('vehicle_entries');
}
};

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

@@ -33,6 +33,7 @@ use App\Http\Controllers\StickerMasterController;
// use App\Http\Controllers\TelegramController;
use App\Http\Controllers\TestingPanelController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VehicleController;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
@@ -214,3 +215,5 @@ Route::post('file/store', [SapFileController::class, 'store'])->name('file.store
// Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])
// ->name('print.pallet');
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);

View File

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