Compare commits
81 Commits
99d0b394ef
...
renovate/b
| Author | SHA1 | Date | |
|---|---|---|---|
| 2599963006 | |||
| 3bbf6d9e2f | |||
|
|
337d16f120 | ||
| ed17645a6e | |||
|
|
4de4f35220 | ||
|
|
688674aa40 | ||
| 5383bc5d15 | |||
|
|
aafdfe3148 | ||
|
|
4fe5793c1b | ||
| b94fed9f51 | |||
|
|
9b10ff0069 | ||
|
|
6bc14a347a | ||
| 8697f72e15 | |||
|
|
03826e4168 | ||
| 4e228fe2d5 | |||
|
|
32c5e7bec6 | ||
| 254ae49cfd | |||
|
|
3bce7a1b0a | ||
|
|
f082587ef4 | ||
| 964d857b12 | |||
|
|
37bfc4ae7e | ||
| a1a0ca2da9 | |||
|
|
051cfc39ee | ||
|
|
db428a93e3 | ||
|
|
f8cf15ba6e | ||
|
|
b6c7b6e68d | ||
| 00d7275e26 | |||
|
|
330edeccaa | ||
| 4b33ef5323 | |||
|
|
dae87a6fba | ||
| 76fd4461f9 | |||
|
|
d10bf9d4af | ||
| 8cd0a310b3 | |||
|
|
b582a18a14 | ||
| 0abdf02e9d | |||
|
|
9337865501 | ||
|
|
8afafb52cd | ||
|
|
7984207dfc | ||
| 935c3ab120 | |||
|
|
cdcbcc62b1 | ||
| 2dea2ddf9b | |||
|
|
f9ac2e19dc | ||
| ccf6ca6aef | |||
|
|
3f0e286f8a | ||
| 474fced913 | |||
|
|
dc0eed1bac | ||
| 24f5c220ba | |||
|
|
e749b5dca4 | ||
| 6ca6ae501a | |||
|
|
f8777db5c7 | ||
| 3fc6fb8d5b | |||
|
|
2ae495473a | ||
|
|
472d2e6943 | ||
|
|
095e010dea | ||
| 0541e7ca92 | |||
|
|
b83f005512 | ||
| d00f5d8681 | |||
|
|
207d52a443 | ||
| e2acfdc53e | |||
|
|
82e5c43a23 | ||
|
|
b323ad0e3d | ||
| 4f73605f10 | |||
|
|
9799a391a4 | ||
| 16d7689642 | |||
|
|
02352aeb32 | ||
| 49e8cd646a | |||
|
|
7d40f50821 | ||
| b7aca6808e | |||
|
|
5531160860 | ||
| 823b6e87dc | |||
|
|
0a635f129d | ||
|
|
79e0c00e4b | ||
| 8d03793d43 | |||
|
|
4ecef99002 | ||
| 87c73495a8 | |||
|
|
d9f0201710 | ||
|
|
72b90abb66 | ||
| 5f9cc4f207 | |||
|
|
d12faa7e4d | ||
| 0606346685 | |||
|
|
66329fad13 |
@@ -84,6 +84,8 @@ class SendImportTransit extends Command
|
||||
'bill_number',
|
||||
'bill_received_date',
|
||||
'vessel_number',
|
||||
'remark',
|
||||
'is_transit_identified',
|
||||
])
|
||||
->where('status', '!=', 'Delivered')
|
||||
->get();
|
||||
|
||||
@@ -51,6 +51,8 @@ class AxnExporter extends Exporter
|
||||
|
||||
return substr($sn, $offset);
|
||||
}),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -298,6 +298,8 @@ class ClassCharacteristicExporter extends Exporter
|
||||
->label('ZMM MOTOR SPEED'),
|
||||
ExportColumn::make('zqmm_qty')
|
||||
->label('ZQMM QTY'),
|
||||
ExportColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE'),
|
||||
ExportColumn::make('mark_status')
|
||||
->label('MARKED STATUS'),
|
||||
ExportColumn::make('marked_datetime')
|
||||
|
||||
@@ -29,8 +29,8 @@ class EmployeeMasterExporter extends Exporter
|
||||
->label('CODE'),
|
||||
ExportColumn::make('department')
|
||||
->label('DEPARTMENT'),
|
||||
ExportColumn::make('designation')
|
||||
->label('DESIGNATION'),
|
||||
// ExportColumn::make('designation')
|
||||
// ->label('DESIGNATION'),
|
||||
ExportColumn::make('email')
|
||||
->label('EMAIL'),
|
||||
ExportColumn::make('mobile_number')
|
||||
|
||||
@@ -297,6 +297,8 @@ class TempClassCharacteristicExporter extends Exporter
|
||||
->label('ZMM MOTOR SPEED'),
|
||||
ExportColumn::make('zqmm_qty')
|
||||
->label('ZQMM QTY'),
|
||||
ExportColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE'),
|
||||
ExportColumn::make('winded_serial_number')
|
||||
->label('WINDED SERIAL NUMBER'),
|
||||
ExportColumn::make('model_type')
|
||||
|
||||
72
app/Filament/Exports/VisitorEntryExporter.php
Normal file
72
app/Filament/Exports/VisitorEntryExporter.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\VisitorEntry;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class VisitorEntryExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = VisitorEntry::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('register_id')
|
||||
->label('REGISTER ID'),
|
||||
ExportColumn::make('employeeMaster.name')
|
||||
->label('EMPLOYEE NAME'),
|
||||
ExportColumn::make('mobile_number')
|
||||
->label('MOBILE NUMBER'),
|
||||
ExportColumn::make('name')
|
||||
->label('VISITOR NAME'),
|
||||
ExportColumn::make('company')
|
||||
->label('COMPANY'),
|
||||
ExportColumn::make('purpose_of_visit')
|
||||
->label('PURPOSE OF VISIT'),
|
||||
ExportColumn::make('type')
|
||||
->label('TYPE'),
|
||||
ExportColumn::make('photo')
|
||||
->label('PHOTO')
|
||||
->enabledByDefault(false),
|
||||
ExportColumn::make('number_of_person')
|
||||
->label('NUMBER OF PERSON'),
|
||||
ExportColumn::make('in_time')
|
||||
->label('IN TIME'),
|
||||
ExportColumn::make('out_time')
|
||||
->label('OUT TIME'),
|
||||
ExportColumn::make('valid_upto')
|
||||
->label('VALID UPTO'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your visitor entry export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -575,6 +575,10 @@ class ClassCharacteristicImporter extends Importer
|
||||
->label('ZQMM QTY')
|
||||
->exampleHeader('ZQMM QTY')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE')
|
||||
->exampleHeader('ZMM OPERATING TEMPERATURE')
|
||||
->example(''),
|
||||
ImportColumn::make('mark_status')
|
||||
->label('MARKED STATUS')
|
||||
->exampleHeader('MARKED STATUS')
|
||||
|
||||
@@ -38,10 +38,10 @@ class EmployeeMasterImporter extends Importer
|
||||
->exampleHeader('DEPARTMENT')
|
||||
->example('HR')
|
||||
->label('DEPARTMENT'),
|
||||
ImportColumn::make('designation')
|
||||
->exampleHeader('DESIGNATION')
|
||||
->example('Manager')
|
||||
->label('DESIGNATION'),
|
||||
// ImportColumn::make('designation')
|
||||
// ->exampleHeader('DESIGNATION')
|
||||
// ->example('Manager')
|
||||
// ->label('DESIGNATION'),
|
||||
ImportColumn::make('email')
|
||||
->exampleHeader('EMAIL')
|
||||
->example('john.doe@example.com')
|
||||
@@ -60,7 +60,7 @@ class EmployeeMasterImporter extends Importer
|
||||
$employeeName = trim($this->data['name']) ?? '';
|
||||
$employeeCode = trim($this->data['code']) ?? '';
|
||||
$employeeDepartment = trim($this->data['department']) ?? '';
|
||||
$employeeDesignation = trim($this->data['designation']) ?? '';
|
||||
// $employeeDesignation = trim($this->data['designation']) ?? '';
|
||||
$employeeEmail = trim($this->data['email']) ?? '';
|
||||
$employeeMobile = trim($this->data['mobile_number']) ?? '';
|
||||
$createdBy = Filament::auth()->user()?->name ?? '';
|
||||
@@ -124,7 +124,7 @@ class EmployeeMasterImporter extends Importer
|
||||
'email' => $employeeEmail ?? null,
|
||||
'mobile_number' => $employeeMobile ?? null,
|
||||
'department' => $employeeDepartment ?? null,
|
||||
'designation' => $employeeDesignation ?? null,
|
||||
// 'designation' => $employeeDesignation ?? null,
|
||||
'created_by' => $createdBy ?? null,
|
||||
'updated_by' => $updatedBy ?? null,
|
||||
]
|
||||
|
||||
264
app/Filament/Imports/ImportTransitImporter.php
Normal file
264
app/Filament/Imports/ImportTransitImporter.php
Normal file
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\ImportTransit;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ImportTransitImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = ImportTransit::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('cri_rfq_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('CRI RFQ Number')
|
||||
->example('RFQ-IMP-C.R.I-2025-A')
|
||||
->label('CRI RFQ Number')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('mail_received_date')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail Received Date')
|
||||
->example('2024-01-01')
|
||||
->label('Mail Received Date'),
|
||||
ImportColumn::make('pricol_ref_number')
|
||||
->exampleHeader('Pricol Ref Number')
|
||||
->example('ENQ-1649')
|
||||
->label('Pricol Ref Number'),
|
||||
ImportColumn::make('requester')
|
||||
->exampleHeader('Requester')
|
||||
->example('Mr.Sathish.K')
|
||||
->label('Requester'),
|
||||
ImportColumn::make('shipper')
|
||||
->exampleHeader('Shipper')
|
||||
->example('Zhejiang shenneng technology co.,ltd')
|
||||
->label('Shipper'),
|
||||
ImportColumn::make('shipper_location')
|
||||
->exampleHeader('Shipper Location')
|
||||
->example('China')
|
||||
->label('Shipper Location'),
|
||||
ImportColumn::make('shipper_invoice')
|
||||
->exampleHeader('Shipper Invoice')
|
||||
->example('SNINDIA250618')
|
||||
->label('Shipper Invoice'),
|
||||
ImportColumn::make('shipper_invoice_date')
|
||||
->exampleHeader('Shipper Invoice Date')
|
||||
->example('2024-01-02')
|
||||
->label('Shipper Invoice Date'),
|
||||
ImportColumn::make('inv_value')
|
||||
->exampleHeader('Inv Value')
|
||||
->example('10000')
|
||||
->label('Inv Value'),
|
||||
ImportColumn::make('freight_charge')
|
||||
->exampleHeader('Freight Charge')
|
||||
->example('500')
|
||||
->label('Freight Charge'),
|
||||
ImportColumn::make('customs_agent_name')
|
||||
->exampleHeader('Customs Agent Name')
|
||||
->example('Pricol Logistics')
|
||||
->label('Customs Agent Name'),
|
||||
ImportColumn::make('eta_date')
|
||||
->exampleHeader('ETA Date')
|
||||
->example('2024-01-10')
|
||||
->label('ETA Date'),
|
||||
ImportColumn::make('status')
|
||||
->exampleHeader('Status')
|
||||
->example('Receipted')
|
||||
->label('Status'),
|
||||
ImportColumn::make('insurance_status')
|
||||
->exampleHeader('Insurance Status')
|
||||
->example('Receipted')
|
||||
->label('Insurance Status'),
|
||||
ImportColumn::make('delivery_location')
|
||||
->exampleHeader('Delivery Location')
|
||||
->example('Arasur Hub')
|
||||
->label('Delivery Location'),
|
||||
ImportColumn::make('etd_date')
|
||||
->exampleHeader('ETD Date')
|
||||
->example('2024-01-05')
|
||||
->label('ETD Date'),
|
||||
ImportColumn::make('mode')
|
||||
->exampleHeader('Mode')
|
||||
->example('LCL')
|
||||
->label('Mode'),
|
||||
ImportColumn::make('inco_terms')
|
||||
->exampleHeader('Inco Terms')
|
||||
->example('FOB')
|
||||
->label('Inco Terms'),
|
||||
ImportColumn::make('port_of_loading')
|
||||
->exampleHeader('Port of Loading')
|
||||
->example('NINGBO')
|
||||
->label('Port of Loading'),
|
||||
ImportColumn::make('port_of_discharge')
|
||||
->exampleHeader('Port of Discharge')
|
||||
->example('CHENNAI')
|
||||
->label('Port of Discharge'),
|
||||
ImportColumn::make('delivery_city')
|
||||
->exampleHeader('Delivery City')
|
||||
->example('COIMBATORE')
|
||||
->label('Delivery City'),
|
||||
ImportColumn::make('packages')
|
||||
->exampleHeader('Packages')
|
||||
->example('450')
|
||||
->label('Packages'),
|
||||
ImportColumn::make('type_of_package')
|
||||
->exampleHeader('Type of Package')
|
||||
->example('PKG')
|
||||
->label('Type of Package'),
|
||||
ImportColumn::make('gross_weight')
|
||||
->exampleHeader('Gross Weight')
|
||||
->example('5000')
|
||||
->label('Gross Weight'),
|
||||
ImportColumn::make('volume')
|
||||
->exampleHeader('Volume')
|
||||
->example('50')
|
||||
->label('Volume'),
|
||||
ImportColumn::make('bill_number')
|
||||
->exampleHeader('Bill Number')
|
||||
->example('BL12345')
|
||||
->label('Bill Number'),
|
||||
ImportColumn::make('bill_received_date')
|
||||
->exampleHeader('Bill Received Date')
|
||||
->example('2024-01-15')
|
||||
->label('Bill Received Date'),
|
||||
ImportColumn::make('vessel_number')
|
||||
->exampleHeader('Vessel Number')
|
||||
->example('XIN WEN ZHOU')
|
||||
->label('Vessel Number'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?ImportTransit
|
||||
{
|
||||
$warnMsg = [];
|
||||
$criRfqNumber = trim($this->data['cri_rfq_number']) ?? '';
|
||||
$mailRecDate = trim($this->data['mail_received_date']) ?? '';
|
||||
$pricolRefNumber = trim($this->data['pricol_ref_number']) ?? '';
|
||||
$requester = trim($this->data['requester']) ?? '';
|
||||
$shipper = trim($this->data['shipper']) ?? '';
|
||||
$shipperLocation = trim($this->data['shipper_location']) ?? '';
|
||||
$shipperInvoice = trim($this->data['shipper_invoice']) ?? '';
|
||||
$shipperInvoiceDt = trim($this->data['shipper_invoice_date']) ?? '';
|
||||
$invValue = trim($this->data['inv_value']) ?? '';
|
||||
$freightCharge = trim($this->data['freight_charge']) ?? '';
|
||||
$customsAgentname = trim($this->data['customs_agent_name']) ?? '';
|
||||
$etaDate = trim($this->data['eta_date']) ?? '';
|
||||
$status = trim($this->data['status']) ?? '';
|
||||
$deliveryLocation = trim($this->data['delivery_location']) ?? '';
|
||||
$etdDate = trim($this->data['etd_date']) ?? '';
|
||||
$mode = trim($this->data['mode']) ?? '';
|
||||
$incoTerms = trim($this->data['inco_terms']) ?? '';
|
||||
$portOfLoading = trim($this->data['port_of_loading']) ?? '';
|
||||
$portOfDischarge = trim($this->data['port_of_discharge']) ?? '';
|
||||
$deliveryCity = trim($this->data['delivery_city']) ?? '';
|
||||
$packages = trim($this->data['packages']) ?? '';
|
||||
$typeOfPackage = trim($this->data['type_of_package']) ?? '';
|
||||
$grossWeight = trim($this->data['gross_weight']) ?? '';
|
||||
$volume = trim($this->data['volume']) ?? '';
|
||||
$billNo = trim($this->data['bill_number']) ?? '';
|
||||
$billReceivedDate = trim($this->data['bill_received_date']) ?? '';
|
||||
$vesselNumber = trim($this->data['vessel_number']) ?? '';
|
||||
|
||||
$createdBy = Filament::auth()->user()?->name ?? '';
|
||||
$updatedBy = $createdBy;
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return ImportTransit::updateOrCreate([
|
||||
'cri_rfq_number' => $criRfqNumber,
|
||||
],
|
||||
[
|
||||
'mail_received_date' => $this->formatDate($mailRecDate),
|
||||
'shipper_invoice_date' => $this->formatDate($shipperInvoiceDt),
|
||||
'eta_date' => $this->formatDate($etaDate),
|
||||
'etd_date' => $this->formatDate($etdDate),
|
||||
'bill_received_date' => $this->formatDate($billReceivedDate),
|
||||
'pricol_ref_number' => $pricolRefNumber,
|
||||
'requester' => $requester,
|
||||
'shipper' => $shipper,
|
||||
'shipper_location' => $shipperLocation,
|
||||
'shipper_invoice' => $shipperInvoice,
|
||||
'inv_value' => $invValue,
|
||||
'freight_charge' => $freightCharge,
|
||||
'custom_agent_name' => $customsAgentname,
|
||||
'status' => $status,
|
||||
'delivery_location' => $deliveryLocation,
|
||||
'mode' => $mode,
|
||||
'inco_terms' => $incoTerms,
|
||||
'port_of_loading' => $portOfLoading,
|
||||
'port_of_discharge' => $portOfDischarge,
|
||||
'delivery_city' => $deliveryCity,
|
||||
'packages' => $packages,
|
||||
'type_of_package' => $typeOfPackage,
|
||||
'gross_weight' => $grossWeight,
|
||||
'volume' => $volume,
|
||||
'bill_number' => $billNo,
|
||||
'vessel_number' => $vesselNumber,
|
||||
// 'created_at' => $createdAt ?? null,
|
||||
// 'updated_at' => $updatedAt ?? null,
|
||||
'created_by' => $createdBy ?? null,
|
||||
'updated_by' => $updatedBy ?? null,
|
||||
]
|
||||
);
|
||||
// return new ImportTransit();
|
||||
}
|
||||
|
||||
private function formatDate($date): ?string
|
||||
{
|
||||
if (blank($date)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!preg_match('/\d/', $date)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$date = trim($date);
|
||||
|
||||
// Excel numeric date (e.g. 46000)
|
||||
if (is_numeric($date)) {
|
||||
return Carbon::instance(
|
||||
\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject((float)$date)
|
||||
)->format('Y-m-d');
|
||||
}
|
||||
|
||||
// Try common formats explicitly
|
||||
$formats = ['d-m-Y', 'd/m/Y', 'Y-m-d', 'm/d/Y', 'd.m.Y'];
|
||||
|
||||
foreach ($formats as $format) {
|
||||
try {
|
||||
return Carbon::createFromFormat($format, $date)->format('Y-m-d');
|
||||
} catch (\Exception $e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your import transit import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -30,9 +30,9 @@ class MotorTestingMasterImporter extends Importer
|
||||
->rules(['required']),
|
||||
ImportColumn::make('subassembly_code')
|
||||
->requiredMapping()
|
||||
->exampleHeader('SubAssembly Code')
|
||||
->exampleHeader('Subassembly Code')
|
||||
->example(['123456'])
|
||||
->label('SubAssembly Code')
|
||||
->label('Subassembly Code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('isi_model')
|
||||
->requiredMapping()
|
||||
@@ -216,18 +216,18 @@ class MotorTestingMasterImporter extends Importer
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created By')
|
||||
->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||
->label('Created By')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Updated By')
|
||||
->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||
->label('Updated By')
|
||||
->rules(['required']),
|
||||
// ImportColumn::make('created_by')
|
||||
// ->requiredMapping()
|
||||
// ->exampleHeader('Created By')
|
||||
// ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||
// ->label('Created By')
|
||||
// ->rules(['required']),
|
||||
// ImportColumn::make('updated_by')
|
||||
// ->requiredMapping()
|
||||
// ->exampleHeader('Updated By')
|
||||
// ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||
// ->label('Updated By')
|
||||
// ->rules(['required']),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ class MotorTestingMasterImporter extends Importer
|
||||
$plantCod = trim($this->data['plant']);
|
||||
$iCode = trim($this->data['item']);
|
||||
$sCode = trim($this->data['subassembly_code']);
|
||||
$isiModel = (trim($this->data['isi_model']) == '1') ? true : false;
|
||||
$isiModel = trim($this->data['isi_model']);
|
||||
$phase = trim($this->data['phase']);
|
||||
$kw = trim($this->data['kw']);
|
||||
$hp = trim($this->data['hp']);
|
||||
@@ -266,15 +266,15 @@ class MotorTestingMasterImporter extends Importer
|
||||
$noloadPowUl = trim($this->data['noload_pow_ul']);
|
||||
$noloadSpdLl = trim($this->data['noload_spd_ll']);
|
||||
$noloadSpdUl = trim($this->data['noload_spd_ul']);
|
||||
$createdBy = trim($this->data['created_by']);
|
||||
$updatedBy = trim($this->data['updated_by']);
|
||||
$createdBy = Filament::auth()->user()->name;
|
||||
$updatedBy = Filament::auth()->user()->name;
|
||||
|
||||
$plant = null;
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found';
|
||||
} elseif (Str::length($sCode) < 6 || ! ctype_alnum($sCode)) {
|
||||
} elseif (Str::length($sCode) > 0 && (Str::length($sCode) < 6 || ! ctype_alnum($sCode))) {
|
||||
$warnMsg[] = 'Invalid sub-assembly code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
@@ -289,13 +289,8 @@ class MotorTestingMasterImporter extends Importer
|
||||
} elseif (! $iCode) {
|
||||
$warnMsg[] = 'Item code not found for choosed plant';
|
||||
} else {
|
||||
// if (Str::length($isiModel) <= 0 || $isiModel == "0" || $isiModel == "1") {
|
||||
// $warnMsg[] = "Invalid ISI Model found";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $isiModel = ($isiModel == "1");
|
||||
// }
|
||||
$isiModel = (Str::length($isiModel) == 1 && ctype_alnum($isiModel) && ($isiModel == '1' || $isiModel == 'Y' || $isiModel == 'y')) ? true : false;
|
||||
|
||||
if (Str::length($phase) <= 0 || ($phase != 'Single' && $phase != 'Three')) {// !is_string($phase) ||
|
||||
$warnMsg[] = 'Invalid phase found';
|
||||
}
|
||||
@@ -387,19 +382,8 @@ class MotorTestingMasterImporter extends Importer
|
||||
$created = $oldCode->created_by ? User::where('name', $oldCode->created_by)->first() : null;
|
||||
if (! $created) {
|
||||
$warnMsg[] = 'Created by not found on update';
|
||||
}
|
||||
$updated = User::where('name', $updatedBy)->first();
|
||||
if (! $updated) {
|
||||
$warnMsg[] = 'Updated by not found on update';
|
||||
}
|
||||
} else {
|
||||
$created = User::where('name', $createdBy)->first();
|
||||
if (! $created) {
|
||||
$warnMsg[] = 'Created by not found';
|
||||
}
|
||||
$updated = User::where('name', $updatedBy)->first();
|
||||
if (! $updated) {
|
||||
$warnMsg[] = 'Updated by not found';
|
||||
} else {
|
||||
$createdBy = $created->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -444,8 +428,8 @@ class MotorTestingMasterImporter extends Importer
|
||||
'noload_pow_ul' => $noloadPowUl,
|
||||
'noload_spd_ll' => $noloadSpdLl,
|
||||
'noload_spd_ul' => $noloadSpdUl,
|
||||
'created_by' => $created->name,
|
||||
'updated_by' => $updated->name,
|
||||
'created_by' => $createdBy,
|
||||
'updated_by' => $updatedBy,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
@@ -575,6 +575,10 @@ class TempClassCharacteristicImporter extends Importer
|
||||
->label('ZQMM QTY')
|
||||
->exampleHeader('ZQMM QTY')
|
||||
->example(''),
|
||||
ImportColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE')
|
||||
->exampleHeader('ZMM OPERATING TEMPERATURE')
|
||||
->example(''),
|
||||
ImportColumn::make('winded_serial_number')
|
||||
->label('WINDed SERIAL NUMBER')
|
||||
->exampleHeader('WINDED SERIAL NUMBER')
|
||||
|
||||
65
app/Filament/Imports/VisitorEntryImporter.php
Normal file
65
app/Filament/Imports/VisitorEntryImporter.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\VisitorEntry;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class VisitorEntryImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = VisitorEntry::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('employeeMaster')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('mobile_number')
|
||||
->requiredMapping()
|
||||
->numeric()
|
||||
->rules(['required', 'integer']),
|
||||
ImportColumn::make('name'),
|
||||
ImportColumn::make('company'),
|
||||
ImportColumn::make('purpose_of_visit'),
|
||||
ImportColumn::make('type'),
|
||||
ImportColumn::make('photo'),
|
||||
ImportColumn::make('number_of_person')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('in_time')
|
||||
->rules(['datetime']),
|
||||
ImportColumn::make('out_time')
|
||||
->rules(['datetime']),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
ImportColumn::make('register_id'),
|
||||
ImportColumn::make('valid_upto')
|
||||
->rules(['datetime']),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?VisitorEntry
|
||||
{
|
||||
// return VisitorEntry::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new VisitorEntry();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your visitor entry import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -968,6 +968,12 @@ class ClassCharacteristicResource extends Resource
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE')
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('mark_status')
|
||||
->label('MARKED STATUS')
|
||||
->reactive()
|
||||
@@ -1804,6 +1810,10 @@ class ClassCharacteristicResource extends Resource
|
||||
->label('ZQMM QTY')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mark_status')
|
||||
->label('MARKED STATUS')
|
||||
->alignCenter()
|
||||
|
||||
@@ -25,6 +25,8 @@ class EmployeeMasterResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Gate Entry';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
@@ -56,11 +58,11 @@ class EmployeeMasterResource extends Resource
|
||||
Forms\Components\TextInput::make('department')
|
||||
->label('Department')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('designation')
|
||||
->label('Designation')
|
||||
->extraInputAttributes([
|
||||
'oninput' => 'this.value = this.value.replace(/[^a-zA-Z\s]/g, "")',])
|
||||
->required(),
|
||||
// Forms\Components\TextInput::make('designation')
|
||||
// ->label('Designation')
|
||||
// ->extraInputAttributes([
|
||||
// 'oninput' => 'this.value = this.value.replace(/[^a-zA-Z\s]/g, "")',])
|
||||
// ->required(),
|
||||
Forms\Components\TextInput::make('email')
|
||||
->label('Email')
|
||||
->email()
|
||||
@@ -123,11 +125,11 @@ class EmployeeMasterResource extends Resource
|
||||
->sortable()
|
||||
->alignCenter()
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('designation')
|
||||
->label('Designation')
|
||||
->sortable()
|
||||
->alignCenter()
|
||||
->searchable(),
|
||||
// Tables\Columns\TextColumn::make('designation')
|
||||
// ->label('Designation')
|
||||
// ->sortable()
|
||||
// ->alignCenter()
|
||||
// ->searchable(),
|
||||
Tables\Columns\TextColumn::make('email')
|
||||
->label('Email')
|
||||
->sortable()
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\ImportTransitExporter;
|
||||
use App\Filament\Imports\ImportTransitImporter;
|
||||
use App\Filament\Resources\ImportTransitResource\Pages;
|
||||
use App\Filament\Resources\ImportTransitResource\RelationManagers;
|
||||
use App\Models\ImportTransit;
|
||||
@@ -22,6 +23,7 @@ use Filament\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
// use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
class ImportTransitResource extends Resource
|
||||
@@ -73,6 +75,16 @@ class ImportTransitResource extends Resource
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\DatePicker::make('inv_value')
|
||||
->label('Inv Value')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('freight_charge')
|
||||
->label('Freight Charge')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('customs_agent_name')
|
||||
->label('Customs Agent Name')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
@@ -97,6 +109,11 @@ class ImportTransitResource extends Resource
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('insurance_status')
|
||||
->label('Insurance Status')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('delivery_location')
|
||||
->label('Delivery Location')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
@@ -167,6 +184,17 @@ class ImportTransitResource extends Resource
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('remark')
|
||||
->label('Remark')
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('is_transit_identified')
|
||||
->label('Is Transit Identified')
|
||||
->default(0)
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
@@ -221,6 +249,16 @@ class ImportTransitResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('shipper_invoice_date')
|
||||
->label('Shipper Invoice Date')
|
||||
->date()
|
||||
->formatStateUsing(fn ($state) => $state?->format('Y-m-d'))
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('inv_value')
|
||||
->label('Inv Value')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('freight_charge')
|
||||
->label('Freight Charge')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('customs_agent_name')
|
||||
@@ -229,18 +267,24 @@ class ImportTransitResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('eta_date')
|
||||
->label('ETA Date')
|
||||
->date()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('insurance_status')
|
||||
->label('Insurance Status')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('delivery_location')
|
||||
->label('Delivery Location')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('etd_date')
|
||||
->label('ETD Date')
|
||||
->date()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mode')
|
||||
@@ -292,6 +336,14 @@ class ImportTransitResource extends Resource
|
||||
->label('Vessel Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('remark')
|
||||
->label('Remark')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('is_transit_identified')
|
||||
->label('Is Transit Identified')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
@@ -333,297 +385,304 @@ class ImportTransitResource extends Resource
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\Action::make('Import Transit')
|
||||
// Tables\Actions\Action::make('Import Transit')
|
||||
// ->label('Import Transit')
|
||||
// ->form([
|
||||
// FileUpload::make('import_transit_file')
|
||||
// ->label('Import Transit')
|
||||
// // ->required()
|
||||
// ->preserveFilenames()
|
||||
// ->storeFiles(false)
|
||||
// ->reactive()
|
||||
// ->required()
|
||||
// ->disk('local')
|
||||
// // ->visible(fn (Get $get) => !empty($get('plant_id')))
|
||||
// ->directory('uploads/ImportTransit'),
|
||||
// ])
|
||||
// ->action(function (array $data) {
|
||||
// $uploadedFile = $data['import_transit_file'];
|
||||
|
||||
// $disk = Storage::disk('local');
|
||||
|
||||
// $user = Filament::auth()->user();
|
||||
|
||||
// $operatorName = $user->name;
|
||||
|
||||
// // Get original filename
|
||||
// $originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
|
||||
|
||||
// $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
|
||||
// // Store manually using storeAs to keep original name
|
||||
// $path = $uploadedFile->storeAs('uploads/ImportTransit', $originalName, 'local'); // returns relative path
|
||||
|
||||
// $fullPath = Storage::disk('local')->path($path);
|
||||
|
||||
// if ($fullPath && file_exists($fullPath)) {
|
||||
// $rows = Excel::toArray(null, $fullPath)[0];
|
||||
|
||||
// if ((count($rows) - 1) <= 0) {
|
||||
// Notification::make()
|
||||
// ->title('Records Not Found')
|
||||
// ->body("Import the valid 'Import Transit' file to proceed..!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path))
|
||||
// {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// $invalidCriNo = [];
|
||||
|
||||
// foreach ($rows as $index => $row)
|
||||
// {
|
||||
// if ($index == 0) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// $rowNumber = $index + 1;
|
||||
|
||||
// $criRfqNo = trim($row[1] ?? '');
|
||||
// $mailRcvdDate = trim($row[2] ?? '');
|
||||
// $pricolRefNo = trim($row[3] ?? '');
|
||||
// $requester = trim($row[4] ?? '');
|
||||
// $shipper = trim($row[5] ?? '');
|
||||
// $shipperLocation = trim($row[6] ?? '');
|
||||
// $shipperInv = trim($row[7] ?? '');
|
||||
// $shipperInvDate = trim($row[8] ?? '');
|
||||
// $cha = trim($row[9] ?? '');
|
||||
// $eta = trim($row[10] ?? '');
|
||||
// $status = trim($row[11] ?? '');
|
||||
// $dlyLoc = trim($row[12] ?? '');
|
||||
// $etd = trim($row[13] ?? '');
|
||||
// $mode = trim($row[14] ?? '');
|
||||
// $incoTerms = trim($row[15] ?? '');
|
||||
// $portOfLoading = trim($row[16] ?? '');
|
||||
// $portOfDischarge = trim($row[17] ?? '');
|
||||
// $deliveryCity = trim($row[18] ?? '');
|
||||
// $packages = trim($row[19] ?? '');
|
||||
// $typeOfPkg = trim($row[20] ?? '');
|
||||
// $grossWeight = trim($row[21] ?? '');
|
||||
// $volumeWeight = trim($row[22] ?? '');
|
||||
// $blNo = trim($row[23] ?? '');
|
||||
// $blRcvdDate = trim($row[24] ?? '');
|
||||
// $vesselNo = trim($row[25] ?? '');
|
||||
|
||||
// if (empty($criRfqNo)) {
|
||||
// $invalidCriNo[] = $rowNumber;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (! empty($invalidCriNo)){
|
||||
|
||||
// $errorMsg = '';
|
||||
|
||||
// if (! empty($invalidCriNo)) {
|
||||
// $errorMsg .= 'Missing CRI Rfq No in rows: '.implode(', ', $invalidCriNo).'<br>';
|
||||
// }
|
||||
|
||||
// Notification::make()
|
||||
// ->title('Missing Mandatory Fields')
|
||||
// ->body($errorMsg)
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
|
||||
// }
|
||||
|
||||
// // $spreadsheet = IOFactory::load($fullPath);
|
||||
|
||||
// // foreach ($spreadsheet->getAllSheets() as $sheet) {
|
||||
// // $state = $sheet->getSheetState();
|
||||
// // if ($state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN ||
|
||||
// // $state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN) {
|
||||
// // Notification::make()
|
||||
// // ->title('Import Failed')
|
||||
// // ->body("Hidden sheet found: \"{$sheet->getTitle()}\". Please remove all hidden sheets and try again.")
|
||||
// // ->danger()
|
||||
// // ->send();
|
||||
// // return;
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// try
|
||||
// {
|
||||
// foreach ($rows as $index => $row)
|
||||
// {
|
||||
// if ($index == 0) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// $rowNumber = $index + 1;
|
||||
|
||||
// try
|
||||
// {
|
||||
|
||||
// $formattedDate = null;
|
||||
// $formattedShipperDate = null;
|
||||
// $etaDate = null;
|
||||
// $etdDate = null;
|
||||
// $formattedBlRcvdDate = null;
|
||||
|
||||
// $criRfqNo = trim($row[1] ?? '');
|
||||
// $mailRcvdDate = trim($row[2] ?? '');
|
||||
// $pricolRefNo = trim($row[3] ?? '');
|
||||
// $requester = trim($row[4] ?? '');
|
||||
// $shipper = trim($row[5] ?? '');
|
||||
// $shipperLocation = trim($row[6] ?? '');
|
||||
// $shipperInv = trim($row[7] ?? '');
|
||||
// $shipperInvDate = trim($row[8] ?? '');
|
||||
// $cha = trim($row[9] ?? '');
|
||||
// $eta = trim($row[10] ?? '');
|
||||
// $status = trim($row[11] ?? '');
|
||||
// $dlyLoc = trim($row[12] ?? '');
|
||||
// $etd = trim($row[13] ?? '');
|
||||
// $mode = trim($row[14] ?? '');
|
||||
// $incoTerms = trim($row[15] ?? '');
|
||||
// $portOfLoading = trim($row[16] ?? '');
|
||||
// $portOfDischarge = trim($row[17] ?? '');
|
||||
// $deliveryCity = trim($row[18] ?? '');
|
||||
// $packages = trim($row[19] ?? '');
|
||||
// $typeOfPkg = trim($row[20] ?? '');
|
||||
// $grossWeight = trim($row[21] ?? '');
|
||||
// $volumeWeight = trim($row[22] ?? '');
|
||||
// $blNo = trim($row[23] ?? '');
|
||||
// $blRcvdDate = trim($row[24] ?? '');
|
||||
// $vesselNo = trim($row[25] ?? '');
|
||||
|
||||
|
||||
// if (! empty($mailRcvdDate)) {
|
||||
// if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $mailRcvdDate)) {
|
||||
// [$day, $month, $year] = preg_split('/[-\/]/', $mailRcvdDate);
|
||||
// $formattedDate = "{$year}-{$month}-{$day}";
|
||||
// } elseif (is_numeric($mailRcvdDate)) {
|
||||
// $formattedDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($mailRcvdDate)->format('Y-m-d');
|
||||
// } else {
|
||||
// $formattedDate = date('Y-m-d', strtotime($mailRcvdDate));
|
||||
// }
|
||||
// }
|
||||
// if (! empty($shipperInvDate)) {
|
||||
// if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $shipperInvDate)) {
|
||||
// [$day, $month, $year] = preg_split('/[-\/]/', $shipperInvDate);
|
||||
// $formattedShipperDate = "{$year}-{$month}-{$day}";
|
||||
// } elseif (is_numeric($shipperInvDate)) {
|
||||
// $formattedShipperDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($shipperInvDate)->format('Y-m-d');
|
||||
// } else {
|
||||
// $formattedShipperDate = date('Y-m-d', strtotime($shipperInvDate));
|
||||
// }
|
||||
// }
|
||||
// if (! empty($eta)) {
|
||||
// if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $eta)) {
|
||||
// [$day, $month, $year] = preg_split('/[-\/]/', $eta);
|
||||
// $etaDate = "{$year}-{$month}-{$day}";
|
||||
// } elseif (is_numeric($eta)) {
|
||||
// $etaDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($eta)->format('Y-m-d');
|
||||
// } else {
|
||||
// $etaDate = date('Y-m-d', strtotime($eta));
|
||||
// }
|
||||
// }
|
||||
// if (! empty($etd)) {
|
||||
// if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $etd)) {
|
||||
// [$day, $month, $year] = preg_split('/[-\/]/', $etd);
|
||||
// $etdDate = "{$year}-{$month}-{$day}";
|
||||
// } elseif (is_numeric($etd)) {
|
||||
// $etdDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($etd)->format('Y-m-d');
|
||||
// } else {
|
||||
// $etdDate = date('Y-m-d', strtotime($etd));
|
||||
// }
|
||||
// }
|
||||
// if (! empty($blRcvdDate)) {
|
||||
// if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $blRcvdDate)) {
|
||||
// [$day, $month, $year] = preg_split('/[-\/]/', $blRcvdDate);
|
||||
// $formattedBlRcvdDate = "{$year}-{$month}-{$day}";
|
||||
// } elseif (is_numeric($blRcvdDate)) {
|
||||
// $formattedBlRcvdDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($blRcvdDate)->format('Y-m-d');
|
||||
// } else {
|
||||
// $formattedBlRcvdDate = date('Y-m-d', strtotime($blRcvdDate));
|
||||
// }
|
||||
// }
|
||||
|
||||
// $inserted = ImportTransit::updateOrCreate(
|
||||
// [
|
||||
// 'cri_rfq_number' => $criRfqNo,
|
||||
// ],
|
||||
// [
|
||||
// 'mail_received_date' => $formattedDate ?? null,
|
||||
// 'pricol_ref_number' => $pricolRefNo ?? null,
|
||||
// 'requester' => $requester ?? null,
|
||||
// 'shipper' => $shipper ?? null,
|
||||
// 'shipper_location' => $shipperLocation ?? null,
|
||||
// 'shipper_invoice' => $shipperInv ?? null,
|
||||
// 'shipper_invoice_date' => $formattedShipperDate ?? null,
|
||||
// 'customs_agent_name' => $cha ?? null,
|
||||
// 'eta_date' => $etaDate ?? null,
|
||||
// 'status' => $status ?? null,
|
||||
// 'delivery_location' => $dlyLoc ?? null,
|
||||
// 'etd_date' => $etdDate ?? null,
|
||||
// 'mode' => $mode ?? null,
|
||||
// 'inco_terms' => $incoTerms ?? null,
|
||||
// 'port_of_loading' => $portOfLoading ?? null,
|
||||
// 'port_of_discharge' => $portOfDischarge ?? null,
|
||||
// 'delivery_city' => $deliveryCity ?? null,
|
||||
// 'packages' => $packages ?? null,
|
||||
// 'type_of_package' => $typeOfPkg ?? null,
|
||||
// 'gross_weight' => $grossWeight ?? null,
|
||||
// 'volume' => $volumeWeight ?? null,
|
||||
// 'bill_number' => $blNo ?? null,
|
||||
// 'bill_received_date' => $formattedBlRcvdDate ?? null,
|
||||
// 'vessel_number' => $vesselNo ?? null,
|
||||
// 'created_by' => $operatorName,
|
||||
// ]
|
||||
// );
|
||||
// }
|
||||
// catch (\Exception $e) {
|
||||
// Notification::make()
|
||||
// ->title('Import Failed')
|
||||
// ->body("Error occurred while processing row. Error : {$e->getMessage()}")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// }
|
||||
// }
|
||||
// if (! $inserted) {
|
||||
// Notification::make()
|
||||
// ->title('Failed')
|
||||
// ->body("Records insertion failed!")
|
||||
// ->success()
|
||||
// ->send();
|
||||
// }
|
||||
// else{
|
||||
// Notification::make()
|
||||
// ->title('Success')
|
||||
// ->body("Records inserted successfully!")
|
||||
// ->success()
|
||||
// ->send();
|
||||
// }
|
||||
// }
|
||||
// catch (\Exception $e) {
|
||||
// Notification::make()
|
||||
// ->title('Import Failed')
|
||||
// ->body("No records were inserted. Error : {$e->getMessage()}")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// ->visible(function () {
|
||||
// return Filament::auth()->user()->can('view import transit');
|
||||
// }),
|
||||
ImportAction::make()
|
||||
->label('Import Transit')
|
||||
->form([
|
||||
FileUpload::make('import_transit_file')
|
||||
->label('Import Transit')
|
||||
// ->required()
|
||||
->preserveFilenames()
|
||||
->storeFiles(false)
|
||||
->reactive()
|
||||
->required()
|
||||
->disk('local')
|
||||
// ->visible(fn (Get $get) => !empty($get('plant_id')))
|
||||
->directory('uploads/ImportTransit'),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$uploadedFile = $data['import_transit_file'];
|
||||
|
||||
$disk = Storage::disk('local');
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
// Get original filename
|
||||
$originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
|
||||
|
||||
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
|
||||
// Store manually using storeAs to keep original name
|
||||
$path = $uploadedFile->storeAs('uploads/ImportTransit', $originalName, 'local'); // returns relative path
|
||||
|
||||
$fullPath = Storage::disk('local')->path($path);
|
||||
|
||||
if ($fullPath && file_exists($fullPath)) {
|
||||
$rows = Excel::toArray(null, $fullPath)[0];
|
||||
|
||||
if ((count($rows) - 1) <= 0) {
|
||||
Notification::make()
|
||||
->title('Records Not Found')
|
||||
->body("Import the valid 'Import Transit' file to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path))
|
||||
{
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$invalidCriNo = [];
|
||||
|
||||
foreach ($rows as $index => $row)
|
||||
{
|
||||
if ($index == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowNumber = $index + 1;
|
||||
|
||||
$criRfqNo = trim($row[1] ?? '');
|
||||
$mailRcvdDate = trim($row[2] ?? '');
|
||||
$pricolRefNo = trim($row[3] ?? '');
|
||||
$requester = trim($row[4] ?? '');
|
||||
$shipper = trim($row[5] ?? '');
|
||||
$shipperLocation = trim($row[6] ?? '');
|
||||
$shipperInv = trim($row[7] ?? '');
|
||||
$shipperInvDate = trim($row[8] ?? '');
|
||||
$cha = trim($row[9] ?? '');
|
||||
$eta = trim($row[10] ?? '');
|
||||
$status = trim($row[11] ?? '');
|
||||
$dlyLoc = trim($row[12] ?? '');
|
||||
$etd = trim($row[13] ?? '');
|
||||
$mode = trim($row[14] ?? '');
|
||||
$incoTerms = trim($row[15] ?? '');
|
||||
$portOfLoading = trim($row[16] ?? '');
|
||||
$portOfDischarge = trim($row[17] ?? '');
|
||||
$deliveryCity = trim($row[18] ?? '');
|
||||
$packages = trim($row[19] ?? '');
|
||||
$typeOfPkg = trim($row[20] ?? '');
|
||||
$grossWeight = trim($row[21] ?? '');
|
||||
$volumeWeight = trim($row[22] ?? '');
|
||||
$blNo = trim($row[23] ?? '');
|
||||
$blRcvdDate = trim($row[24] ?? '');
|
||||
$vesselNo = trim($row[25] ?? '');
|
||||
|
||||
if (empty($criRfqNo)) {
|
||||
$invalidCriNo[] = $rowNumber;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($invalidCriNo)){
|
||||
|
||||
$errorMsg = '';
|
||||
|
||||
if (! empty($invalidCriNo)) {
|
||||
$errorMsg .= 'Missing CRI Rfq No in rows: '.implode(', ', $invalidCriNo).'<br>';
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Missing Mandatory Fields')
|
||||
->body($errorMsg)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// $spreadsheet = IOFactory::load($fullPath);
|
||||
|
||||
// foreach ($spreadsheet->getAllSheets() as $sheet) {
|
||||
// $state = $sheet->getSheetState();
|
||||
// if ($state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN ||
|
||||
// $state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN) {
|
||||
// Notification::make()
|
||||
// ->title('Import Failed')
|
||||
// ->body("Hidden sheet found: \"{$sheet->getTitle()}\". Please remove all hidden sheets and try again.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
try
|
||||
{
|
||||
foreach ($rows as $index => $row)
|
||||
{
|
||||
if ($index == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$rowNumber = $index + 1;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
$formattedDate = null;
|
||||
$formattedShipperDate = null;
|
||||
$etaDate = null;
|
||||
$etdDate = null;
|
||||
$formattedBlRcvdDate = null;
|
||||
|
||||
$criRfqNo = trim($row[1] ?? '');
|
||||
$mailRcvdDate = trim($row[2] ?? '');
|
||||
$pricolRefNo = trim($row[3] ?? '');
|
||||
$requester = trim($row[4] ?? '');
|
||||
$shipper = trim($row[5] ?? '');
|
||||
$shipperLocation = trim($row[6] ?? '');
|
||||
$shipperInv = trim($row[7] ?? '');
|
||||
$shipperInvDate = trim($row[8] ?? '');
|
||||
$cha = trim($row[9] ?? '');
|
||||
$eta = trim($row[10] ?? '');
|
||||
$status = trim($row[11] ?? '');
|
||||
$dlyLoc = trim($row[12] ?? '');
|
||||
$etd = trim($row[13] ?? '');
|
||||
$mode = trim($row[14] ?? '');
|
||||
$incoTerms = trim($row[15] ?? '');
|
||||
$portOfLoading = trim($row[16] ?? '');
|
||||
$portOfDischarge = trim($row[17] ?? '');
|
||||
$deliveryCity = trim($row[18] ?? '');
|
||||
$packages = trim($row[19] ?? '');
|
||||
$typeOfPkg = trim($row[20] ?? '');
|
||||
$grossWeight = trim($row[21] ?? '');
|
||||
$volumeWeight = trim($row[22] ?? '');
|
||||
$blNo = trim($row[23] ?? '');
|
||||
$blRcvdDate = trim($row[24] ?? '');
|
||||
$vesselNo = trim($row[25] ?? '');
|
||||
|
||||
|
||||
if (! empty($mailRcvdDate)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $mailRcvdDate)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $mailRcvdDate);
|
||||
$formattedDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($mailRcvdDate)) {
|
||||
$formattedDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($mailRcvdDate)->format('Y-m-d');
|
||||
} else {
|
||||
$formattedDate = date('Y-m-d', strtotime($mailRcvdDate));
|
||||
}
|
||||
}
|
||||
if (! empty($shipperInvDate)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $shipperInvDate)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $shipperInvDate);
|
||||
$formattedShipperDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($shipperInvDate)) {
|
||||
$formattedShipperDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($shipperInvDate)->format('Y-m-d');
|
||||
} else {
|
||||
$formattedShipperDate = date('Y-m-d', strtotime($shipperInvDate));
|
||||
}
|
||||
}
|
||||
if (! empty($eta)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $eta)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $eta);
|
||||
$etaDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($eta)) {
|
||||
$etaDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($eta)->format('Y-m-d');
|
||||
} else {
|
||||
$etaDate = date('Y-m-d', strtotime($eta));
|
||||
}
|
||||
}
|
||||
if (! empty($etd)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $etd)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $etd);
|
||||
$etdDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($etd)) {
|
||||
$etdDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($etd)->format('Y-m-d');
|
||||
} else {
|
||||
$etdDate = date('Y-m-d', strtotime($etd));
|
||||
}
|
||||
}
|
||||
if (! empty($blRcvdDate)) {
|
||||
if (preg_match('/^\d{2}[-\/]\d{2}[-\/]\d{4}$/', $blRcvdDate)) {
|
||||
[$day, $month, $year] = preg_split('/[-\/]/', $blRcvdDate);
|
||||
$formattedBlRcvdDate = "{$year}-{$month}-{$day}";
|
||||
} elseif (is_numeric($blRcvdDate)) {
|
||||
$formattedBlRcvdDate = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($blRcvdDate)->format('Y-m-d');
|
||||
} else {
|
||||
$formattedBlRcvdDate = date('Y-m-d', strtotime($blRcvdDate));
|
||||
}
|
||||
}
|
||||
|
||||
$inserted = ImportTransit::updateOrCreate(
|
||||
[
|
||||
'cri_rfq_number' => $criRfqNo,
|
||||
],
|
||||
[
|
||||
'mail_received_date' => $formattedDate ?? null,
|
||||
'pricol_ref_number' => $pricolRefNo ?? null,
|
||||
'requester' => $requester ?? null,
|
||||
'shipper' => $shipper ?? null,
|
||||
'shipper_location' => $shipperLocation ?? null,
|
||||
'shipper_invoice' => $shipperInv ?? null,
|
||||
'shipper_invoice_date' => $formattedShipperDate ?? null,
|
||||
'customs_agent_name' => $cha ?? null,
|
||||
'eta_date' => $etaDate ?? null,
|
||||
'status' => $status ?? null,
|
||||
'delivery_location' => $dlyLoc ?? null,
|
||||
'etd_date' => $etdDate ?? null,
|
||||
'mode' => $mode ?? null,
|
||||
'inco_terms' => $incoTerms ?? null,
|
||||
'port_of_loading' => $portOfLoading ?? null,
|
||||
'port_of_discharge' => $portOfDischarge ?? null,
|
||||
'delivery_city' => $deliveryCity ?? null,
|
||||
'packages' => $packages ?? null,
|
||||
'type_of_package' => $typeOfPkg ?? null,
|
||||
'gross_weight' => $grossWeight ?? null,
|
||||
'volume' => $volumeWeight ?? null,
|
||||
'bill_number' => $blNo ?? null,
|
||||
'bill_received_date' => $formattedBlRcvdDate ?? null,
|
||||
'vessel_number' => $vesselNo ?? null,
|
||||
'created_by' => $operatorName,
|
||||
]
|
||||
);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Import Failed')
|
||||
->body("Error occurred while processing row. Error : {$e->getMessage()}")
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
if (! $inserted) {
|
||||
Notification::make()
|
||||
->title('Failed')
|
||||
->body("Records insertion failed!")
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
else{
|
||||
Notification::make()
|
||||
->title('Success')
|
||||
->body("Records inserted successfully!")
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Import Failed')
|
||||
->body("No records were inserted. Error : {$e->getMessage()}")
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
})
|
||||
->color('warning')
|
||||
->importer(ImportTransitImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import transit');
|
||||
}),
|
||||
|
||||
@@ -75,7 +75,7 @@ class MachineResource extends Resource
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('line_id')
|
||||
->label('Line Name')
|
||||
->relationship('line', 'name')
|
||||
// ->relationship('line', 'name')
|
||||
->searchable()
|
||||
->required()
|
||||
->columnSpan(1)
|
||||
@@ -116,7 +116,7 @@ class MachineResource extends Resource
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('work_group_master_id')
|
||||
->label('Group Work Center')
|
||||
->relationship('workGroupMaster', 'name')
|
||||
// ->relationship('workGroupMaster', 'name')
|
||||
->searchable()
|
||||
->required()
|
||||
->columnSpan(1)
|
||||
|
||||
@@ -119,7 +119,7 @@ class MotorTestingMasterResource extends Resource
|
||||
Forms\Components\TextInput::make('subassembly_code')
|
||||
->label('Subassembly Code')
|
||||
// ->required()
|
||||
->placeholder('Scan the valid code')
|
||||
->placeholder('Scan the subassembly code')
|
||||
->reactive()
|
||||
->alphaNum()
|
||||
->minLength(6)
|
||||
@@ -195,42 +195,49 @@ class MotorTestingMasterResource extends Resource
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('hp')
|
||||
->label('HP')
|
||||
->placeholder('Scan the HP')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('kw')
|
||||
->label('KW')
|
||||
->placeholder('Scan the KW')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('volt')
|
||||
->label('Volt')
|
||||
->placeholder('Scan the volt')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('current')
|
||||
->label('Current')
|
||||
->placeholder('Scan the current')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('rpm')
|
||||
->label('RPM')
|
||||
->placeholder('Scan the RPM')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('torque')
|
||||
->label('Torque')
|
||||
->placeholder('Scan the torque')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('frequency')
|
||||
->label('Frequency')
|
||||
->placeholder('Scan the frequency')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
@@ -265,12 +272,14 @@ class MotorTestingMasterResource extends Resource
|
||||
->reactive(),
|
||||
Forms\Components\TextInput::make('ins_res_limit')
|
||||
->label('Insulation Resistance Limit')
|
||||
->placeholder('Scan the insulation resistance limit')
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\Select::make('ins_res_type')
|
||||
->label('Insulation Resistance Type')
|
||||
->placeholder('Scan the insulation resistance type')
|
||||
->default('O')
|
||||
->selectablePlaceholder(false)
|
||||
->options(function (callable $get) {
|
||||
@@ -294,96 +303,112 @@ class MotorTestingMasterResource extends Resource
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_ry_ll')
|
||||
->label('Resistance RY LL')
|
||||
->placeholder('Scan the resistance RY LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_ry_ul')
|
||||
->label('Resistance RY UL')
|
||||
->placeholder('Scan the resistance RY UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_yb_ll')
|
||||
->label('Resistance YB LL')
|
||||
->placeholder('Scan the resistance YB LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_yb_ul')
|
||||
->label('Resistance YB UL')
|
||||
->placeholder('Scan the resistance YB UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_br_ll')
|
||||
->label('Resistance BR LL')
|
||||
->placeholder('Scan the resistance BR LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('res_br_ul')
|
||||
->label('Resistance BR UL')
|
||||
->placeholder('Scan the resistance BR UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('lock_volt_limit')
|
||||
->label('Lock Volt Limit')
|
||||
->placeholder('Scan the lock volt limit')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('leak_cur_limit')
|
||||
->label('Leakage Current Limit')
|
||||
->placeholder('Scan the leakage current limit')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('lock_cur_ll')
|
||||
->label('Lock Current LL')
|
||||
->placeholder('Scan the lock current LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('lock_cur_ul')
|
||||
->label('Lock Current UL')
|
||||
->placeholder('Scan the lock current UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_cur_ll')
|
||||
->label('No Load Current LL')
|
||||
->placeholder('Scan the no load current LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_cur_ul')
|
||||
->label('No Load Current UL')
|
||||
->placeholder('Scan the no load current UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_pow_ll')
|
||||
->label('No Load Power LL')
|
||||
->placeholder('Scan the no load power LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_pow_ul')
|
||||
->label('No Load Power UL')
|
||||
->placeholder('Scan the no load power UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_spd_ll')
|
||||
->label('No Load Speed LL')
|
||||
->placeholder('Scan the no load speed LL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('noload_spd_ul')
|
||||
->label('No Load Speed UL')
|
||||
->placeholder('Scan the no load speed UL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
@@ -420,6 +445,7 @@ class MotorTestingMasterResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.category')
|
||||
->label('Category')
|
||||
->default('-')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
@@ -430,6 +456,7 @@ class MotorTestingMasterResource extends Resource
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('subassembly_code')
|
||||
->label('Subassembly Code')
|
||||
->default('-')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
@@ -593,17 +620,34 @@ class MotorTestingMasterResource extends Resource
|
||||
->options(function (callable $get) {
|
||||
$pId = $get('Plant');
|
||||
|
||||
return Item::whereHas('motorTestingMasters', function ($query) use ($pId) {
|
||||
if ($pId) {
|
||||
$query->where('plant_id', $pId);
|
||||
}
|
||||
})->pluck('code', 'id');
|
||||
if (! $pId) {
|
||||
return [];
|
||||
} else {
|
||||
return Item::whereHas('motorTestingMasters', function ($query) use ($pId) {
|
||||
if ($pId) {
|
||||
$query->where('plant_id', $pId);
|
||||
}
|
||||
})->pluck('code', 'id');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
Select::make('subassembly_code')
|
||||
->label('Search by Subassembly Code')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
} else {
|
||||
return MotorTestingMaster::where('plant_id', $plantId)->whereNotNull('subassembly_code')->select('subassembly_code')->distinct()->pluck('subassembly_code', 'subassembly_code');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
TextInput::make('description')
|
||||
->label('Description')
|
||||
->placeholder('Enter Description'),
|
||||
->label('Model')
|
||||
->placeholder('Enter Model'),
|
||||
Radio::make('isi_type')
|
||||
->label('ISI Model ?')
|
||||
->boolean()
|
||||
@@ -714,7 +758,7 @@ class MotorTestingMasterResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Item']) && empty($data['description']) && empty($data['isi_type']) && empty($data['phase_type']) && empty($data['connection_type']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {// || $data['isi_type'] == 'All')
|
||||
if (empty($data['Plant']) && empty($data['Item']) && empty($data['subassembly_code']) && empty($data['description']) && empty($data['isi_type']) && empty($data['phase_type']) && empty($data['connection_type']) && empty($data['created_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {// || $data['isi_type'] == 'All')
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -738,6 +782,10 @@ class MotorTestingMasterResource extends Resource
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$query->where('subassembly_code', $data['subassembly_code']);
|
||||
}
|
||||
|
||||
if (! empty($data['description'])) {
|
||||
$pId = $data['Plant'] ?? null;
|
||||
$descIds = Item::where('description', 'like', '%'.$data['description'].'%')->whereHas('motorTestingMasters', function ($query) use ($pId) {
|
||||
@@ -807,8 +855,12 @@ class MotorTestingMasterResource extends Resource
|
||||
$indicators[] = 'Item Codes: '.$itemCode;
|
||||
}
|
||||
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$indicators[] = 'Subassembly Code: '.$data['subassembly_code'];
|
||||
}
|
||||
|
||||
if (! empty($data['description'])) {
|
||||
$indicators[] = 'Description: '.$data['description'];
|
||||
$indicators[] = 'Model: '.$data['description'];
|
||||
}
|
||||
|
||||
if ($data['isi_type'] == 'Y') {
|
||||
|
||||
@@ -267,6 +267,9 @@ class SerialValidationResource extends Resource
|
||||
Tables\Columns\TextColumn::make('scanned_status')
|
||||
->label('Scanned Status')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('panel_box_code')
|
||||
->label('Panel Box Code')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||
->label('Panel Box Supplier')
|
||||
->alignCenter(),
|
||||
@@ -296,12 +299,25 @@ class SerialValidationResource extends Resource
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('operator_id')
|
||||
->label('Operator ID')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->alignCenter()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
@@ -324,65 +340,392 @@ class SerialValidationResource extends Resource
|
||||
// ->reactive()
|
||||
// ]),
|
||||
|
||||
// Tables\Actions\Action::make('Import Serial Number')
|
||||
// ->label('Import Serial Invoice')
|
||||
// ->form([
|
||||
// Select::make('plant_id')
|
||||
// // ->options(Plant::pluck('name', 'id')->toArray()) // Fetch plant names and IDs
|
||||
// ->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();
|
||||
// })
|
||||
// ->label('Select Plant')
|
||||
// ->required()
|
||||
// ->default(function () {
|
||||
// return optional(SerialValidation::latest()->first())->plant_id;
|
||||
// })
|
||||
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
// $set('invoice_serial_number', null);
|
||||
// })
|
||||
// ->reactive(),
|
||||
|
||||
// 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()
|
||||
// ->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('uploads/temp'),
|
||||
// ])
|
||||
// ->action(function (array $data) {
|
||||
// $uploadedFile = $data['invoice_serial_number'];
|
||||
|
||||
// $disk = Storage::disk('local');
|
||||
|
||||
// $plantId = $data['plant_id'];
|
||||
|
||||
// // Get original filename
|
||||
// $originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
|
||||
|
||||
// $originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
|
||||
// // Store manually using storeAs to keep original name
|
||||
// $path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
|
||||
// // uploads/temp/3RA0018735.xlsx
|
||||
|
||||
// $fullPath = Storage::disk('local')->path($path);
|
||||
// // /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx
|
||||
|
||||
// $totQuan = SerialValidation::where('invoice_number', $originalNameOnly)->count();
|
||||
// if ($totQuan > 0) {
|
||||
// $scanSQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->count();
|
||||
// if ($totQuan == $scanSQuan) {
|
||||
// $invoiceFirst = SerialValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||
// $plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||
|
||||
// Notification::make()
|
||||
// ->title("Serial invoice number : '$originalNameOnly' already completed the scanning process for plant : '$plantName'.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// } else {
|
||||
// $invoiceFirst = SerialValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||
// // $plantCode = $invoiceFirst ? (String)$invoiceFirst->plant->code : null;
|
||||
// $plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||
// $invoicePlantId = $invoiceFirst->plant_id;
|
||||
// if ($plantId != $invoicePlantId) {
|
||||
// Notification::make()
|
||||
// ->title("Serial invoice number : '$originalNameOnly' already exists for plant : '$plantName'.<br>Choose the valid 'Plant' to proceed!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// $totQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('plant_id', $plantId)->count();
|
||||
// $scanSQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
|
||||
|
||||
// if ($totQuan > 0 && $totQuan == $scanSQuan) {
|
||||
// Notification::make()
|
||||
// ->title('Serial invoice already completed the scanning process for selected plant.')
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if ($fullPath && file_exists($fullPath)) {
|
||||
// $rows = Excel::toArray(null, $fullPath)[0];
|
||||
|
||||
// if ((count($rows) - 1) <= 0) {
|
||||
// Notification::make()
|
||||
// ->title('Records Not Found')
|
||||
// ->body("Import the valid 'Serial Invoice' file to proceed..!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// $invalidMatCodes = [];
|
||||
// $invalidSerialCodes = [];
|
||||
// $materialCodes = [];
|
||||
// $missingSerials = [];
|
||||
// $duplicateSerials = [];
|
||||
// $seenSerialNumbers = [];
|
||||
// $validRowsFound = false;
|
||||
|
||||
// foreach ($rows as $index => $row) {
|
||||
// if ($index == 0) {
|
||||
// continue;
|
||||
// } // Skip header
|
||||
|
||||
// $materialCode = trim($row[0]);
|
||||
// $serialNumber = trim($row[1]);
|
||||
|
||||
// if (empty($materialCode) && empty($serialNumber)) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// if (! empty($materialCode)) {
|
||||
// if (Str::length($materialCode) < 6 || ! ctype_alnum($materialCode)) {
|
||||
// $invalidMatCodes[] = $materialCode;
|
||||
// } else {
|
||||
// if (empty($serialNumber)) {
|
||||
// $missingSerials[] = $materialCode;
|
||||
|
||||
// } elseif (Str::length($serialNumber) < 9 || ! ctype_alnum($serialNumber)) {
|
||||
// $invalidSerialCodes[] = $serialNumber;
|
||||
// } else {
|
||||
// if (in_array($serialNumber, $seenSerialNumbers)) {
|
||||
// $duplicateSerials[] = $serialNumber;
|
||||
// } else {
|
||||
// $seenSerialNumbers[] = $serialNumber;
|
||||
// $materialCodes[] = $materialCode;
|
||||
// $validRowsFound = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $uniqueInvalidCodes = array_unique($invalidMatCodes);
|
||||
|
||||
// $uniqueMissingSerials = array_unique($missingSerials);
|
||||
|
||||
// $uniqueSerialCodes = array_unique($invalidSerialCodes);
|
||||
|
||||
// $duplicateSerialCodes = array_unique($duplicateSerials);
|
||||
|
||||
// if (! empty($uniqueInvalidCodes)) {
|
||||
// Notification::make()
|
||||
// ->title('Invalid Item Codes')
|
||||
// ->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>'.implode(', ', $uniqueInvalidCodes))
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// } elseif (! empty($uniqueMissingSerials)) {
|
||||
// Notification::make()
|
||||
// ->title('Missing Serial Numbers')
|
||||
// ->body("The following item codes doesn't have valid serial number:<br>".implode(', ', $uniqueMissingSerials))
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// } elseif (! empty($uniqueSerialCodes)) {
|
||||
// Notification::make()
|
||||
// ->title('Invalid Serial Number')
|
||||
// ->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>'.implode(', ', $uniqueSerialCodes))
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// } elseif (! empty($duplicateSerialCodes)) {
|
||||
// Notification::make()
|
||||
// ->title('Duplicate Serial Numbers')
|
||||
// ->body('The following serial numbers are already exist in imported excel:<br>'.implode(', ', $duplicateSerialCodes))
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (! $validRowsFound) {
|
||||
// Notification::make()
|
||||
// ->title('Invalid Serial Invoice')
|
||||
// ->danger() // This makes the notification red to indicate an error
|
||||
// ->body('Uploaded Excel sheet is empty or<br>contains no valid data.')
|
||||
// ->send();
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// $uniqueCodes = array_unique($materialCodes);
|
||||
|
||||
// $matchedItems = StickerMaster::with('item')
|
||||
// ->whereHas('item', function ($query) use ($uniqueCodes) {
|
||||
// $query->whereIn('code', $uniqueCodes);
|
||||
// })
|
||||
// ->get();
|
||||
|
||||
// $matchedCodes = $matchedItems->pluck('item.code')->toArray();
|
||||
|
||||
// $missingCodes = array_diff($uniqueCodes, $matchedCodes);
|
||||
|
||||
// if (! empty($missingCodes)) {
|
||||
// $missingCount = count($missingCodes);
|
||||
|
||||
// $message = $missingCount > 10 ? "'$missingCount' item codes are not found in database." : 'The following item codes are not found in database:<br>'.implode(', ', $missingCodes);
|
||||
|
||||
// Notification::make()
|
||||
// ->title('Unknown Item Codes')
|
||||
// ->body($message)
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // Check which codes have a material_type set (not null)
|
||||
// $invalidCodes = $matchedItems
|
||||
// ->filter(fn ($sticker) => ! empty($sticker->material_type)) // filter invalid
|
||||
// ->pluck('item.code')
|
||||
// ->toArray();
|
||||
|
||||
// if (count($invalidCodes) > 10) {
|
||||
// Notification::make()
|
||||
// ->title('Invalid item codes found')
|
||||
// ->body(''.count($invalidCodes).'item codes found have material type.')
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// } elseif (count($invalidCodes) > 0) {
|
||||
// Notification::make()
|
||||
// ->title('Invalid item codes found')
|
||||
// ->body('Material invoice Item Codes found : '.implode(', ', $invalidCodes))
|
||||
// ->danger()
|
||||
// ->send();
|
||||
|
||||
// if ($disk->exists($path)) {
|
||||
// $disk->delete($path);
|
||||
// }
|
||||
|
||||
// return;
|
||||
// } else {
|
||||
// // Save full file path to session
|
||||
// session(['uploaded_invoice_path' => $fullPath]);
|
||||
// Notification::make()
|
||||
// ->title('Serial invoice imported successfully.')
|
||||
// ->success()
|
||||
// ->send();
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
Tables\Actions\Action::make('Import Serial Number')
|
||||
->label('Import Serial Invoice')
|
||||
->form([
|
||||
Select::make('plant_id')
|
||||
// ->options(Plant::pluck('name', 'id')->toArray()) // Fetch plant names and IDs
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
->label('Import Serial Invoice')
|
||||
->form([
|
||||
Select::make('plant_id')
|
||||
// ->options(Plant::pluck('name', 'id')->toArray()) // Fetch plant names and IDs
|
||||
->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();
|
||||
})
|
||||
->label('Select Plant')
|
||||
->required()
|
||||
->default(function () {
|
||||
return optional(SerialValidation::latest()->first())->plant_id;
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('invoice_serial_number', null);
|
||||
})
|
||||
->reactive(),
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->searchable()
|
||||
->label('Search by Plant Name')
|
||||
->required()
|
||||
->default(function () {
|
||||
return optional(SerialValidation::latest()->first())->plant_id;
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('invoice_serial_number', null);
|
||||
$plantId = $get('plant_id');
|
||||
if (! $plantId) {
|
||||
$set('invoice_serial_number', null);
|
||||
|
||||
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()
|
||||
->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('uploads/temp'),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$uploadedFile = $data['invoice_serial_number'];
|
||||
return;
|
||||
}
|
||||
$plantCode = Plant::find($plantId)?->code ?? null;
|
||||
|
||||
$disk = Storage::disk('local');
|
||||
$directory = "uploads/temp/{$plantCode}";
|
||||
if ($plantId && ! Storage::disk('local')->exists($directory)) {
|
||||
Storage::disk('local')->makeDirectory($directory);
|
||||
}
|
||||
})
|
||||
->reactive(),
|
||||
|
||||
$plantId = $data['plant_id'];
|
||||
FileUpload::make('invoice_serial_number')
|
||||
->label('Choose Serial Invoice')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
// 'application/vnd.ms-excel', // Legacy .xls fallback if needed
|
||||
])
|
||||
->rules(['mimes:xlsx', 'max:50']) // Laravel validation: extension check
|
||||
->maxSize(50)
|
||||
->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) {
|
||||
$plant = Plant::find($get('plant_id'));
|
||||
$plantCode = $plant?->code ?? null;
|
||||
|
||||
// Get original filename
|
||||
$originalName = $uploadedFile->getClientOriginalName(); // e.g. 3RA0018732.xlsx
|
||||
return "uploads/temp/{$plantCode}";
|
||||
})
|
||||
->uploadingMessage('Uploading...')
|
||||
->helperText('Only .xlsx files are allowed (Excel files).'),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$uploadedFile = $data['invoice_serial_number'];
|
||||
|
||||
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
|
||||
$disk = Storage::disk('local');
|
||||
|
||||
// Store manually using storeAs to keep original name
|
||||
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
|
||||
// uploads/temp/3RA0018735.xlsx
|
||||
$plantId = $data['plant_id'];
|
||||
|
||||
$fullPath = Storage::disk('local')->path($path);
|
||||
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/3RA0018735.xlsx
|
||||
$plant = Plant::find($plantId);
|
||||
$plantCode = $plant?->code ?? null;
|
||||
|
||||
$totQuan = SerialValidation::where('invoice_number', $originalNameOnly)->count();
|
||||
if ($totQuan > 0) {
|
||||
$scanSQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->count();
|
||||
if ($totQuan == $scanSQuan) {
|
||||
$invoiceFirst = SerialValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||
$plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||
// 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 = strtoupper(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 (strlen($originalNameOnly) < 8 || ! ctype_alnum($originalNameOnly)) {
|
||||
Notification::make()
|
||||
->title("Serial invoice number : '$originalNameOnly' already completed the scanning process for plant : '$plantName'.")
|
||||
->title("Serial invoice number : '$originalNameOnly' should contain minimum 8 digit alpha numeric values!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
@@ -391,14 +734,71 @@ class SerialValidationResource extends Resource
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
$invoiceFirst = SerialValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||
// $plantCode = $invoiceFirst ? (String)$invoiceFirst->plant->code : null;
|
||||
$plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||
$invoicePlantId = $invoiceFirst->plant_id;
|
||||
if ($plantId != $invoicePlantId) {
|
||||
}
|
||||
|
||||
$fullPath = Storage::disk('local')->path($path);
|
||||
// /home/iot-dev/projects/pds/storage/app/private/uploads/temp/{$plantCode}/3RA0018735.xlsx
|
||||
|
||||
$totQuan = SerialValidation::where('invoice_number', $originalNameOnly)->count();
|
||||
if ($totQuan > 0) {
|
||||
$scanSQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->count();
|
||||
if ($totQuan == $scanSQuan) {
|
||||
$invoiceFirst = SerialValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||
$plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||
|
||||
Notification::make()
|
||||
->title("Serial invoice number : '$originalNameOnly' already exists for plant : '$plantName'.<br>Choose the valid 'Plant' to proceed!")
|
||||
->title("Serial invoice number : '$originalNameOnly' already completed the scanning process for plant : '$plantName'.")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
$invoiceFirst = SerialValidation::with('plant')->where('invoice_number', $originalNameOnly)->first();
|
||||
// $plantCode = $invoiceFirst ? (String)$invoiceFirst->plant->code : null;
|
||||
$plantName = $invoiceFirst ? (string) $invoiceFirst->plant->name : null;
|
||||
$invoicePlantId = $invoiceFirst->plant_id;
|
||||
if ($plantId != $invoicePlantId) {
|
||||
Notification::make()
|
||||
->title("Serial invoice number : '$originalNameOnly' already exists for plant : '$plantName'.<br>Choose the valid 'Plant' to proceed!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$totQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('plant_id', $plantId)->count();
|
||||
$scanSQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
|
||||
|
||||
if ($totQuan > 0 && $totQuan == $scanSQuan) {
|
||||
Notification::make()
|
||||
->title('Serial invoice already completed the scanning process for selected plant.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($fullPath && file_exists($fullPath)) {
|
||||
$rows = Excel::toArray(null, $fullPath)[0];
|
||||
|
||||
if ((count($rows) - 1) <= 0) {
|
||||
Notification::make()
|
||||
->title('Records Not Found')
|
||||
->body("Import the valid 'Serial Invoice' file to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
@@ -408,223 +808,186 @@ class SerialValidationResource extends Resource
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$totQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('plant_id', $plantId)->count();
|
||||
$scanSQuan = SerialValidation::where('invoice_number', $originalNameOnly)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
|
||||
$invalidMatCodes = [];
|
||||
$invalidSerialCodes = [];
|
||||
$materialCodes = [];
|
||||
$missingSerials = [];
|
||||
$duplicateSerials = [];
|
||||
$seenSerialNumbers = [];
|
||||
$validRowsFound = false;
|
||||
|
||||
if ($totQuan > 0 && $totQuan == $scanSQuan) {
|
||||
Notification::make()
|
||||
->title('Serial invoice already completed the scanning process for selected plant.')
|
||||
->danger()
|
||||
->send();
|
||||
foreach ($rows as $index => $row) {
|
||||
if ($index == 0) {
|
||||
continue;
|
||||
} // Skip header
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
$materialCode = trim($row[0]);
|
||||
$serialNumber = trim($row[1]);
|
||||
|
||||
return;
|
||||
}
|
||||
if (empty($materialCode) && empty($serialNumber)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($fullPath && file_exists($fullPath)) {
|
||||
$rows = Excel::toArray(null, $fullPath)[0];
|
||||
|
||||
if ((count($rows) - 1) <= 0) {
|
||||
Notification::make()
|
||||
->title('Records Not Found')
|
||||
->body("Import the valid 'Serial Invoice' file to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$invalidMatCodes = [];
|
||||
$invalidSerialCodes = [];
|
||||
$materialCodes = [];
|
||||
$missingSerials = [];
|
||||
$duplicateSerials = [];
|
||||
$seenSerialNumbers = [];
|
||||
$validRowsFound = false;
|
||||
|
||||
foreach ($rows as $index => $row) {
|
||||
if ($index == 0) {
|
||||
continue;
|
||||
} // Skip header
|
||||
|
||||
$materialCode = trim($row[0]);
|
||||
$serialNumber = trim($row[1]);
|
||||
|
||||
if (empty($materialCode) && empty($serialNumber)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! empty($materialCode)) {
|
||||
if (Str::length($materialCode) < 6 || ! ctype_alnum($materialCode)) {
|
||||
$invalidMatCodes[] = $materialCode;
|
||||
} else {
|
||||
if (empty($serialNumber)) {
|
||||
$missingSerials[] = $materialCode;
|
||||
|
||||
} elseif (Str::length($serialNumber) < 9 || ! ctype_alnum($serialNumber)) {
|
||||
$invalidSerialCodes[] = $serialNumber;
|
||||
if (! empty($materialCode)) {
|
||||
if (Str::length($materialCode) < 6 || ! ctype_alnum($materialCode)) {
|
||||
$invalidMatCodes[] = $materialCode;
|
||||
} else {
|
||||
if (in_array($serialNumber, $seenSerialNumbers)) {
|
||||
$duplicateSerials[] = $serialNumber;
|
||||
if (empty($serialNumber)) {
|
||||
$missingSerials[] = $materialCode;
|
||||
|
||||
} elseif (Str::length($serialNumber) < 9 || ! ctype_alnum($serialNumber)) {
|
||||
$invalidSerialCodes[] = $serialNumber;
|
||||
} else {
|
||||
$seenSerialNumbers[] = $serialNumber;
|
||||
$materialCodes[] = $materialCode;
|
||||
$validRowsFound = true;
|
||||
if (in_array($serialNumber, $seenSerialNumbers)) {
|
||||
$duplicateSerials[] = $serialNumber;
|
||||
} else {
|
||||
$seenSerialNumbers[] = $serialNumber;
|
||||
$materialCodes[] = $materialCode;
|
||||
$validRowsFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$uniqueInvalidCodes = array_unique($invalidMatCodes);
|
||||
|
||||
$uniqueMissingSerials = array_unique($missingSerials);
|
||||
|
||||
$uniqueSerialCodes = array_unique($invalidSerialCodes);
|
||||
|
||||
$duplicateSerialCodes = array_unique($duplicateSerials);
|
||||
|
||||
if (! empty($uniqueInvalidCodes)) {
|
||||
Notification::make()
|
||||
->title('Invalid Item Codes')
|
||||
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>'.implode(', ', $uniqueInvalidCodes))
|
||||
->danger()
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (! empty($uniqueMissingSerials)) {
|
||||
Notification::make()
|
||||
->title('Missing Serial Numbers')
|
||||
->body("The following item codes doesn't have valid serial number:<br>".implode(', ', $uniqueMissingSerials))
|
||||
->danger()
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (! empty($uniqueSerialCodes)) {
|
||||
Notification::make()
|
||||
->title('Invalid Serial Number')
|
||||
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>'.implode(', ', $uniqueSerialCodes))
|
||||
->danger()
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (! empty($duplicateSerialCodes)) {
|
||||
Notification::make()
|
||||
->title('Duplicate Serial Numbers')
|
||||
->body('The following serial numbers are already exist in imported excel:<br>'.implode(', ', $duplicateSerialCodes))
|
||||
->danger()
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (! $validRowsFound) {
|
||||
Notification::make()
|
||||
->title('Invalid Serial Invoice')
|
||||
->danger() // This makes the notification red to indicate an error
|
||||
->body('Uploaded Excel sheet is empty or<br>contains no valid data.')
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$uniqueCodes = array_unique($materialCodes);
|
||||
|
||||
$matchedItems = StickerMaster::with('item')->where('plant_id', $plantId)
|
||||
->whereHas('item', function ($query) use ($uniqueCodes, $plantId) {
|
||||
$query->whereIn('code', $uniqueCodes)->where('plant_id', $plantId);
|
||||
})
|
||||
->get();
|
||||
|
||||
$matchedCodes = $matchedItems->pluck('item.code')->toArray();
|
||||
|
||||
$missingCodes = array_diff($uniqueCodes, $matchedCodes);
|
||||
|
||||
if (! empty($missingCodes)) {
|
||||
$missingCount = count($missingCodes);
|
||||
|
||||
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in sticker master." : 'The following item codes are not found in sticker master:<br>'.implode(', ', $missingCodes);
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Item Codes')
|
||||
->body($message)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Check which codes have a material_type set (not null)
|
||||
$invalidCodes = $matchedItems
|
||||
->filter(fn ($sticker) => ! empty($sticker->material_type)) // filter invalid
|
||||
->pluck('item.code')
|
||||
->toArray();
|
||||
|
||||
if (count($invalidCodes) > 10) {
|
||||
Notification::make()
|
||||
->title('Invalid item codes found')
|
||||
->body(''.count($invalidCodes).' item codes have material type.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (count($invalidCodes) > 0) {
|
||||
Notification::make()
|
||||
->title('Invalid item codes found')
|
||||
->body('Material invoice Item Codes found : '.implode(', ', $invalidCodes))
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
continue;
|
||||
// Save full file path to session
|
||||
session(['uploaded_invoice_path' => $fullPath]);
|
||||
Notification::make()
|
||||
->title('Serial invoice imported successfully.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
|
||||
$uniqueInvalidCodes = array_unique($invalidMatCodes);
|
||||
|
||||
$uniqueMissingSerials = array_unique($missingSerials);
|
||||
|
||||
$uniqueSerialCodes = array_unique($invalidSerialCodes);
|
||||
|
||||
$duplicateSerialCodes = array_unique($duplicateSerials);
|
||||
|
||||
if (! empty($uniqueInvalidCodes)) {
|
||||
Notification::make()
|
||||
->title('Invalid Item Codes')
|
||||
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>'.implode(', ', $uniqueInvalidCodes))
|
||||
->danger()
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (! empty($uniqueMissingSerials)) {
|
||||
Notification::make()
|
||||
->title('Missing Serial Numbers')
|
||||
->body("The following item codes doesn't have valid serial number:<br>".implode(', ', $uniqueMissingSerials))
|
||||
->danger()
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (! empty($uniqueSerialCodes)) {
|
||||
Notification::make()
|
||||
->title('Invalid Serial Number')
|
||||
->body('The following serial numbers should contain minimum 9 digit alpha numeric values:<br>'.implode(', ', $uniqueSerialCodes))
|
||||
->danger()
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (! empty($duplicateSerialCodes)) {
|
||||
Notification::make()
|
||||
->title('Duplicate Serial Numbers')
|
||||
->body('The following serial numbers are already exist in imported excel:<br>'.implode(', ', $duplicateSerialCodes))
|
||||
->danger()
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! $validRowsFound) {
|
||||
Notification::make()
|
||||
->title('Invalid Serial Invoice')
|
||||
->danger() // This makes the notification red to indicate an error
|
||||
->body('Uploaded Excel sheet is empty or<br>contains no valid data.')
|
||||
->send();
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$uniqueCodes = array_unique($materialCodes);
|
||||
|
||||
$matchedItems = StickerMaster::with('item')
|
||||
->whereHas('item', function ($query) use ($uniqueCodes) {
|
||||
$query->whereIn('code', $uniqueCodes);
|
||||
})
|
||||
->get();
|
||||
|
||||
$matchedCodes = $matchedItems->pluck('item.code')->toArray();
|
||||
|
||||
$missingCodes = array_diff($uniqueCodes, $matchedCodes);
|
||||
|
||||
if (! empty($missingCodes)) {
|
||||
$missingCount = count($missingCodes);
|
||||
|
||||
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in database." : 'The following item codes are not found in database:<br>'.implode(', ', $missingCodes);
|
||||
|
||||
Notification::make()
|
||||
->title('Unknown Item Codes')
|
||||
->body($message)
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Check which codes have a material_type set (not null)
|
||||
$invalidCodes = $matchedItems
|
||||
->filter(fn ($sticker) => ! empty($sticker->material_type)) // filter invalid
|
||||
->pluck('item.code')
|
||||
->toArray();
|
||||
|
||||
if (count($invalidCodes) > 10) {
|
||||
Notification::make()
|
||||
->title('Invalid item codes found')
|
||||
->body(''.count($invalidCodes).'item codes found have material type.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} elseif (count($invalidCodes) > 0) {
|
||||
Notification::make()
|
||||
->title('Invalid item codes found')
|
||||
->body('Material invoice Item Codes found : '.implode(', ', $invalidCodes))
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
if ($disk->exists($path)) {
|
||||
$disk->delete($path);
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
// Save full file path to session
|
||||
session(['uploaded_invoice_path' => $fullPath]);
|
||||
Notification::make()
|
||||
->title('Serial invoice imported successfully.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import serial validation invoice');
|
||||
}),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -967,6 +967,12 @@ class TempClassCharacteristicResource extends Resource
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE')
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('winded_serial_number')
|
||||
->label('WINDED SERIAL NUMBER')
|
||||
->reactive()
|
||||
@@ -1574,6 +1580,10 @@ class TempClassCharacteristicResource extends Resource
|
||||
->label('ZQMM QTY')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_operating_temperature')
|
||||
->label('ZMM OPERATING TEMPERATURE')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('winded_serial_number')
|
||||
->label('WINDED SERIAL NUMBER')
|
||||
->alignCenter()
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Models\MotorTestingMaster;
|
||||
use App\Models\Plant;
|
||||
use App\Models\TestingPanelReading;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Closure;
|
||||
// use Barryvdh\Reflection\DocBlock\Type\Collection;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
@@ -36,6 +37,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
// use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
||||
use Illuminate\Support\Str;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
// use App\Exports\TestingPanelReadingExport;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory; // For loading Excel file
|
||||
@@ -95,7 +97,7 @@ class TestingPanelReadingResource extends Resource
|
||||
->hintColor('danger'),
|
||||
Forms\Components\Select::make('line_id')
|
||||
->label('Line Name')
|
||||
->relationship('line', 'name')
|
||||
// ->relationship('line', 'name')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
@@ -115,11 +117,12 @@ class TestingPanelReadingResource extends Resource
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('motor_testing_master_id', null);
|
||||
$set('machine_id', null);
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
->relationship('machine', 'work_center')
|
||||
// ->relationship('machine', 'work_center')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$lineId = $get('line_id');
|
||||
@@ -183,17 +186,92 @@ class TestingPanelReadingResource extends Resource
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->rule(function (callable $get) {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$lineId = $get('line_id');
|
||||
$machineId = $get('machine_id');
|
||||
$itemId = $get('motor_testing_master_id');
|
||||
$output = trim($value);
|
||||
// $currentId = $get('id'); // current editing record id
|
||||
|
||||
if (! $plantId || ! $lineId || ! $machineId || ! $itemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($output == null || $output == '' || ! $output) {
|
||||
$fail("Output can't be empty!"); // Output1 - Output99
|
||||
} elseif (Str::length($output) < 7) {
|
||||
$fail('Output must be at least 7 characters long!');
|
||||
} elseif (Str::length($output) > 8) {
|
||||
$fail('Output must be at most 8 characters long!');
|
||||
} elseif (! ctype_alnum($output)) {
|
||||
$fail('Output should contain only alpha-numeric values!');
|
||||
} elseif (! preg_match('/^Output([1-9]|[1-9][0-9])$/', $output)) {
|
||||
$fail("Output should be between 'Output1' and 'Output99'!");
|
||||
}
|
||||
};
|
||||
}),
|
||||
Forms\Components\TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->rule(function (callable $get) {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$lineId = $get('line_id');
|
||||
$machineId = $get('machine_id');
|
||||
$itemId = $get('motor_testing_master_id');
|
||||
$serialNumber = trim($value);
|
||||
// $currentId = $get('id'); // current editing record id
|
||||
|
||||
if (! $plantId || ! $lineId || ! $machineId || ! $itemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($serialNumber == null || $serialNumber == '' || ! $serialNumber) {
|
||||
$fail("Serial number can't be empty!");
|
||||
} elseif (Str::length($serialNumber) < 9) {
|
||||
$fail('Serial number should contain minimum 9 digits!');
|
||||
} elseif (! ctype_alnum($serialNumber)) {
|
||||
$fail('Serial number should contain only alpha-numeric values!');
|
||||
} elseif (! preg_match('/^[1-9][a-zA-Z0-9]{8,}$/', $serialNumber)) {
|
||||
$fail("Serial number should not begin with '0' or letter!");
|
||||
}
|
||||
};
|
||||
}),
|
||||
Forms\Components\TextInput::make('winded_serial_number')
|
||||
->label('Winded Serial Number')
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
})
|
||||
->rule(function (callable $get) {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
|
||||
$plantId = $get('plant_id');
|
||||
$lineId = $get('line_id');
|
||||
$machineId = $get('machine_id');
|
||||
$itemId = $get('motor_testing_master_id');
|
||||
$serialNumber = trim($value);
|
||||
// $currentId = $get('id'); // current editing record id
|
||||
|
||||
if (! $plantId || ! $lineId || ! $machineId || ! $itemId || ! $serialNumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Str::length($serialNumber) > 0 && Str::length($serialNumber) < 9) {
|
||||
$fail('Winded serial number should contain minimum 9 digits!');
|
||||
} elseif (! ctype_alnum($serialNumber)) {
|
||||
$fail('Winded serial number should contain only alpha-numeric values!');
|
||||
} elseif (! preg_match('/^[1-9][a-zA-Z0-9]{8,}$/', $serialNumber)) {
|
||||
$fail("Winded serial number should not begin with '0' or letter!");
|
||||
}
|
||||
};
|
||||
}),
|
||||
Forms\Components\TextInput::make('before_fr_volt')
|
||||
->label('Before FR Volt')
|
||||
@@ -350,24 +428,40 @@ class TestingPanelReadingResource extends Resource
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('hv_test')
|
||||
Forms\Components\Select::make('hv_test')
|
||||
->label('High Voltage Test')
|
||||
->options([
|
||||
'With Stood' => 'With Stood',
|
||||
'Not With Stood' => 'Not With Stood',
|
||||
])
|
||||
->selectablePlaceholder(false)
|
||||
->default('Not With Stood')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('batch_number')
|
||||
->label('Batch Number')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('batch_count')
|
||||
->label('Batch Count')
|
||||
->default('0')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('result')
|
||||
Forms\Components\Select::make('result')
|
||||
->label('Result')
|
||||
->options([
|
||||
'PASS' => 'PASS', // Not With Stood
|
||||
'FAIL' => 'FAIL',
|
||||
])
|
||||
->selectablePlaceholder(false)
|
||||
->default('FAIL')
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
@@ -379,27 +473,28 @@ class TestingPanelReadingResource extends Resource
|
||||
Forms\Components\TextInput::make('rework_count')
|
||||
->label('Rework Count')
|
||||
->default('0')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('update_count')
|
||||
->label('Update Count')
|
||||
->default('0')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('output_flag')
|
||||
->label('Output Flag')
|
||||
->default('0')
|
||||
->readOnly(fn (callable $get) => ! $get('id'))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('tested_by')
|
||||
->label('Tested By')
|
||||
Forms\Components\Hidden::make('tested_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('updated_by')
|
||||
->label('Updated By')
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->default(fn () => Filament::auth()->user()?->name)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('id')
|
||||
@@ -665,6 +760,24 @@ class TestingPanelReadingResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_code', null);
|
||||
}),
|
||||
Select::make('machine_name')
|
||||
->label('Search by Work Center')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
$lineId = $get('Line');
|
||||
|
||||
if (! $plantId || ! $lineId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)
|
||||
->where('line_id', $lineId)
|
||||
->pluck('work_center', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
Select::make('item_code')
|
||||
->label('Search by Item Code')
|
||||
->searchable()
|
||||
@@ -687,30 +800,37 @@ class TestingPanelReadingResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_description', null);
|
||||
}),
|
||||
Select::make('machine_name')
|
||||
->label('Search by Work Center')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
$lineId = $get('Line');
|
||||
|
||||
if (! $plantId || ! $lineId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)
|
||||
->where('line_id', $lineId)
|
||||
->pluck('work_center', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->placeholder('Enter Serial Number'),
|
||||
Select::make('subassembly_code')
|
||||
->label('Search by Subassembly Code')
|
||||
->searchable()
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if ($plantId) {
|
||||
return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
||||
} else {
|
||||
return [];
|
||||
// return Item::whereHas('motorTestingMasters')
|
||||
// ->pluck('code', 'id')
|
||||
// ->toArray();
|
||||
}
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('item_description', null);
|
||||
}),
|
||||
TextInput::make('winded_serial_number')
|
||||
->label('Winded Serial Number')
|
||||
->reactive()
|
||||
->placeholder('Enter Winded Serial Number'),
|
||||
Select::make('item_description')
|
||||
->label('Model')
|
||||
->label('Search by Model')
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
@@ -739,13 +859,12 @@ class TestingPanelReadingResource extends Resource
|
||||
$set('item_code', null);
|
||||
}),
|
||||
Select::make('output')
|
||||
->label('Output')
|
||||
->label('Search by Output')
|
||||
->searchable()
|
||||
->options(function () {
|
||||
return TestingPanelReading::query()
|
||||
return TestingPanelReading::whereNotNull('output')
|
||||
->select('output')
|
||||
->distinct()
|
||||
->whereNotNull('output')
|
||||
->orderBy('output')
|
||||
->pluck('output', 'output') // key and label are both the output value
|
||||
->toArray();
|
||||
@@ -781,6 +900,7 @@ class TestingPanelReadingResource extends Resource
|
||||
// })
|
||||
// ->reactive(),
|
||||
// ...
|
||||
|
||||
Select::make('connection')
|
||||
->label('Connection')
|
||||
->required()
|
||||
@@ -805,13 +925,14 @@ class TestingPanelReadingResource extends Resource
|
||||
// ..
|
||||
TextInput::make('remark')
|
||||
->label('Remark')
|
||||
->reactive(),
|
||||
->reactive()
|
||||
->placeholder(placeholder: 'Enter Remark'),
|
||||
TextInput::make('batch_number')
|
||||
->label('Batch Number')
|
||||
->reactive()
|
||||
->placeholder(placeholder: 'Enter Batch Number'),
|
||||
Select::make('result')
|
||||
->label('Result')
|
||||
->label('Search by Result')
|
||||
->searchable()
|
||||
->options(function () {
|
||||
return TestingPanelReading::query()
|
||||
@@ -823,7 +944,19 @@ class TestingPanelReadingResource extends Resource
|
||||
->toArray();
|
||||
})
|
||||
->reactive(),
|
||||
|
||||
Select::make('tested_by')
|
||||
->label('Tested By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return TestingPanelReading::whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
||||
} else {
|
||||
return TestingPanelReading::where('plant_id', $plantId)->whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
@@ -834,12 +967,35 @@ class TestingPanelReadingResource extends Resource
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
Select::make('updated_by')
|
||||
->label('Updated By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return TestingPanelReading::whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
} else {
|
||||
return TestingPanelReading::where('plant_id', $plantId)->whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'updated_from')
|
||||
->label('Updated From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('updated_to')
|
||||
->label('Updated To')
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
|
||||
// dd($data);
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['item_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['output']) && empty($data['phase']) && empty($data['connection']) && empty($data['remark']) && empty($data['batch_no']) && empty($data['result']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['item_code']) && empty($data['subassembly_code']) && empty($data['machine_name']) && empty($data['item_description']) && empty($data['serial_number']) && empty($data['winded_serial_number']) && empty($data['output']) && empty($data['phase']) && empty($data['connection']) && empty($data['remark']) && empty($data['batch_no']) && empty($data['result']) && empty($data['tested_by']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['updated_from']) && empty($data['updated_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -868,12 +1024,20 @@ class TestingPanelReadingResource extends Resource
|
||||
});
|
||||
}
|
||||
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$query->where('motor_testing_master_id', $data['subassembly_code']);
|
||||
}
|
||||
|
||||
if (! empty($data['machine_name'])) {
|
||||
$query->where('machine_id', $data['machine_name']);
|
||||
}
|
||||
|
||||
if (! empty($data['serial_number'])) {
|
||||
$query->where('serial_number', $data['serial_number']);
|
||||
$query->where('serial_number', 'like', '%'.$data['serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['winded_serial_number'])) {
|
||||
$query->where('winded_serial_number', 'like', '%'.$data['winded_serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['item_description'])) {
|
||||
@@ -919,11 +1083,11 @@ class TestingPanelReadingResource extends Resource
|
||||
}
|
||||
|
||||
if (! empty($data['remark'])) {
|
||||
$query->where('remark', $data['remark']);
|
||||
$query->where('remark', 'like', '%'.$data['remark'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['batch_number'])) {
|
||||
$query->where('batch_number', $data['batch_number']);
|
||||
$query->where('batch_number', 'like', '%'.$data['batch_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['result'])) {
|
||||
@@ -937,6 +1101,22 @@ class TestingPanelReadingResource extends Resource
|
||||
if (! empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
if (! empty($data['tested_by'])) {
|
||||
$query->where('tested_by', $data['tested_by']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_from'])) {
|
||||
$query->where('updated_at', '>=', $data['updated_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_to'])) {
|
||||
$query->where('updated_at', '<=', $data['updated_to']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$query->where('updated_by', $data['updated_by']);
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
@@ -953,11 +1133,14 @@ class TestingPanelReadingResource extends Resource
|
||||
if (! empty($data['Line'])) {
|
||||
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
|
||||
}
|
||||
if (! empty($data['machine_name'])) {
|
||||
$indicators[] = 'Work Center: '.Machine::where('id', $data['machine_name'])->value('work_center');
|
||||
}
|
||||
if (! empty($data['item_code'])) {
|
||||
$indicators[] = 'Item Code: '.Item::where('id', $data['item_code'])->value('code');
|
||||
}
|
||||
if (! empty($data['machine_name'])) {
|
||||
$indicators[] = 'Work Center: '.Machine::where('id', $data['machine_name'])->value('work_center');
|
||||
if (! empty($data['subassembly_code'])) {
|
||||
$indicators[] = 'Subassembly Code: '.MotorTestingMaster::where('id', $data['subassembly_code'])->value('subassembly_code');
|
||||
}
|
||||
if (! empty($data['output'])) {
|
||||
$indicators[] = 'Output: '.$data['output'];
|
||||
@@ -986,6 +1169,10 @@ class TestingPanelReadingResource extends Resource
|
||||
$indicators[] = 'Serial Number: '.$data['serial_number'];
|
||||
}
|
||||
|
||||
if (! empty($data['tested_by'])) {
|
||||
$indicators[] = 'Tested By: '.$data['tested_by'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'From: '.$data['created_from'];
|
||||
}
|
||||
@@ -994,6 +1181,18 @@ class TestingPanelReadingResource extends Resource
|
||||
$indicators[] = 'To: '.$data['created_to'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$indicators[] = 'Updated By: '.$data['updated_by'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_from'])) {
|
||||
$indicators[] = 'Updated From: '.$data['updated_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['updated_to'])) {
|
||||
$indicators[] = 'Updated To: '.$data['updated_to'];
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
])
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\VisitorEntryExporter;
|
||||
use App\Filament\Imports\VisitorEntryImporter;
|
||||
use App\Filament\Resources\VisitorEntryResource\Pages;
|
||||
use App\Filament\Resources\VisitorEntryResource\RelationManagers;
|
||||
use App\Models\VisitorEntry;
|
||||
use App\Models\EmployeeMaster;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
@@ -18,6 +21,12 @@ use Filament\Infolists\Components\ImageEntry;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Infolists\Components\Section;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
|
||||
class VisitorEntryResource extends Resource
|
||||
{
|
||||
@@ -82,7 +91,12 @@ class VisitorEntryResource extends Resource
|
||||
->options([
|
||||
'Student' => 'Student',
|
||||
'Consultant' => 'Consultant',
|
||||
'Vendor' => 'Vendor',
|
||||
'Supplier' => 'Supplier',
|
||||
'InterviewCandidates' => 'Interview Candidates',
|
||||
'Customers/Dealers' => 'Customers/Dealers',
|
||||
'Bankers' => 'Bankers',
|
||||
'ServiceProviders' => 'Service Providers',
|
||||
'GovermentOfficials' => 'Government Officials',
|
||||
'Other' => 'Other',
|
||||
])
|
||||
->required()
|
||||
@@ -103,9 +117,11 @@ class VisitorEntryResource extends Resource
|
||||
Forms\Components\Select::make('department')
|
||||
->label('Employee Department')
|
||||
->options(
|
||||
\App\Models\EmployeeMaster::distinct()
|
||||
EmployeeMaster::distinct()
|
||||
->orderBy('department')
|
||||
->pluck('department', 'department')
|
||||
)
|
||||
->searchable()
|
||||
->required()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set) {
|
||||
@@ -142,17 +158,22 @@ class VisitorEntryResource extends Resource
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$department = $get('department');
|
||||
|
||||
if (!$department) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Always load ALL employees, filter by department if set
|
||||
if ($department) {
|
||||
return \App\Models\EmployeeMaster::where('department', $department)
|
||||
return EmployeeMaster::where('department', $department)
|
||||
->pluck('name', 'id');
|
||||
}
|
||||
// Fallback: load all so fill() can always match the ID
|
||||
return \App\Models\EmployeeMaster::pluck('name', 'id');
|
||||
return EmployeeMaster::pluck('name', 'id');
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, ?string $state) {
|
||||
$employee = \App\Models\EmployeeMaster::find($state);
|
||||
$employee = EmployeeMaster::find($state);
|
||||
$set('code', $employee?->code ?? '');
|
||||
}),
|
||||
|
||||
@@ -216,10 +237,12 @@ class VisitorEntryResource extends Resource
|
||||
Tables\Columns\TextColumn::make('register_id')
|
||||
->label('Register ID')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('type')
|
||||
->label('Visitor Type')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('Visitor Name')
|
||||
@@ -229,14 +252,18 @@ class VisitorEntryResource extends Resource
|
||||
Tables\Columns\TextColumn::make('mobile_number')
|
||||
->label('Visitor Mobile Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('employeeMaster.name')
|
||||
->label('Recipient Name')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('employeeMaster.code')
|
||||
->label('Receipient ID')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('employeeMaster.department')
|
||||
->label('Receipient Department')
|
||||
@@ -245,20 +272,24 @@ class VisitorEntryResource extends Resource
|
||||
Tables\Columns\TextColumn::make('number_of_person')
|
||||
->label('Number of Person')
|
||||
->numeric()
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('in_time')
|
||||
->label('In Time')
|
||||
->searchable()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('out_time')
|
||||
->label('Out Time')
|
||||
->searchable()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('valid_upto')
|
||||
->label('Valid Upto')
|
||||
->searchable()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->alignCenter()
|
||||
@@ -287,7 +318,179 @@ class VisitorEntryResource extends Resource
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
TextInput::make('register_id')
|
||||
->label('Register ID')
|
||||
->reactive()
|
||||
->placeholder('Enter Register ID')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('type', null);
|
||||
}),
|
||||
Select::make('type')
|
||||
->label('Type')
|
||||
->reactive()
|
||||
->options([
|
||||
'Student' => 'Student',
|
||||
'Consultant' => 'Consultant',
|
||||
'Supplier' => 'Supplier',
|
||||
'InterviewCandidates' => 'Interview Candidates',
|
||||
'Customers/Dealers' => 'Customers/Dealers',
|
||||
'Bankers' => 'Bankers',
|
||||
'ServiceProviders' => 'Service Providers',
|
||||
'GovermentOfficials' => 'Government Officials',
|
||||
'Other' => 'Other',
|
||||
])
|
||||
->placeholder('Choose Type')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('name', null);
|
||||
}),
|
||||
TextInput::make('other_type')
|
||||
->label('Specify Type')
|
||||
->placeholder('Enter Type')
|
||||
->visible(fn (callable $get) => $get('type') == 'Other')
|
||||
->required(fn (callable $get) => $get('type') == 'Other'),
|
||||
TextInput::make('name')
|
||||
->label('Visitor Name')
|
||||
->reactive()
|
||||
->placeholder('Enter Visitor Name')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('company', null);
|
||||
}),
|
||||
TextInput::make('company')
|
||||
->label('Visitor Company')
|
||||
->reactive()
|
||||
->placeholder('Enter Visitor Company')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('employee_master_id', null);
|
||||
}),
|
||||
Select::make('employee_department')
|
||||
->label('Employee Department')
|
||||
->options(function () {
|
||||
return EmployeeMaster::query()
|
||||
->whereNotNull('department')
|
||||
->distinct()
|
||||
->orderBy('department')
|
||||
->pluck('department', 'department')
|
||||
->toArray();
|
||||
})
|
||||
->searchable()
|
||||
->preload()
|
||||
->reactive()
|
||||
->placeholder('Select Department')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('employee_master_id', null);
|
||||
}),
|
||||
Select::make('employee_master_id')
|
||||
->label('Employee Name')
|
||||
->relationship('employeeMaster', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
->reactive()
|
||||
->placeholder('Select Employee')
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Rework', null);
|
||||
}),
|
||||
DateTimePicker::make('created_from')
|
||||
->label('Created From')
|
||||
->placeholder('Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->placeholder('Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['register_id']) && empty($data['type']) && empty($data['name']) && empty($data['company']) && empty($data['employee_master_id']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
$query->where(function ($q) {
|
||||
});
|
||||
}
|
||||
|
||||
if (! empty($data['register_id'])) {
|
||||
$query->where('register_id', $data['register_id']);
|
||||
}
|
||||
|
||||
if (! empty($data['type'])) {
|
||||
if ($data['type'] == 'Other') {
|
||||
$query->where('type', 'like', '%'.$data['other_type'].'%');
|
||||
}
|
||||
else{
|
||||
$query->where('type', $data['type']);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['name'])) {
|
||||
$query->where('name', 'like', '%'.$data['name'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['company'])) {
|
||||
$query->where('company', 'like', '%'.$data['company'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['employee_department'])) {
|
||||
$query->where('department', $data['employee_department']);
|
||||
}
|
||||
|
||||
if (! empty($data['employee_master_id'])) {
|
||||
$query->where('employee_master_id', $data['employee_master_id']);
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
// $query->orderBy('created_at', 'asc');
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (! empty($data['register_id'])) {
|
||||
$indicators[] = 'Register ID: '.$data['register_id'];
|
||||
}
|
||||
|
||||
if (! empty($data['type'])) {
|
||||
$indicators[] = 'Type: '.$data['type'];
|
||||
}
|
||||
|
||||
if (! empty($data['other_type'])) {
|
||||
$indicators[] = 'Specify Type: '.$data['other_type'];
|
||||
}
|
||||
|
||||
if (! empty($data['name'])) {
|
||||
$indicators[] = 'Name: '.$data['name'];
|
||||
}
|
||||
|
||||
if (! empty($data['company'])) {
|
||||
$indicators[] = 'Company: '.$data['company'];
|
||||
}
|
||||
|
||||
if (! empty($data['employee_department'])) {
|
||||
$indicators[] = 'Employee Department: '.$data['employee_department'];
|
||||
}
|
||||
|
||||
if (! empty($data['employee_master_id'])) {
|
||||
$indicators[] = 'Employee Name: '.EmployeeMaster::where('id', $data['employee_master_id'])->value('name');
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'From: '.$data['created_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$indicators[] = 'To: '.$data['created_to'];
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
])
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
@@ -298,6 +501,18 @@ class VisitorEntryResource extends Resource
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(VisitorEntryImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import visitor entries');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(VisitorEntryExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export visitor entries');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -323,6 +538,8 @@ class VisitorEntryResource extends Resource
|
||||
// ── Visitor Details ──
|
||||
Section::make('Visitor Details')
|
||||
->schema([
|
||||
TextEntry::make('register_id')
|
||||
->label('Register ID'),
|
||||
TextEntry::make('name')
|
||||
->label('Visitor Name'),
|
||||
TextEntry::make('mobile_number')
|
||||
|
||||
@@ -10,6 +10,8 @@ use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Attributes\On;
|
||||
use App\Mail\VisitorMail;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class CreateVisitorEntry extends CreateRecord
|
||||
{
|
||||
@@ -118,6 +120,21 @@ class CreateVisitorEntry extends CreateRecord
|
||||
];
|
||||
}
|
||||
|
||||
protected function afterCreate(): void
|
||||
{
|
||||
$visitor = $this->record;
|
||||
|
||||
$employee = EmployeeMaster::find($visitor->employee_master_id);
|
||||
|
||||
if ($employee && !empty($employee->email)) {
|
||||
Mail::to($employee->email)
|
||||
->send(new VisitorMail($visitor)); // or ->send()
|
||||
}
|
||||
else{
|
||||
\Log::warning('No email found for employee ID: ' . $visitor->employee_master_id);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('view', ['record' => $this->record]);
|
||||
|
||||
@@ -1288,7 +1288,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$machineId = $machine->id;
|
||||
|
||||
$availFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_pf', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_pf', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_motoridentification', 'zmm_packtype', 'zmm_panel', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_type', 'zmm_usp', 'marked_datetime', 'marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'pending_released_status', 'has_work_flow_id']; // 'mark_status','marked_physical_count', 'marked_expected_time', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'winded_serial_number', 'part_validation_1', 'part_validation_2', 'samlight_logged_name',
|
||||
$availFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_pf', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_pf', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_motoridentification', 'zmm_packtype', 'zmm_panel', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_type', 'zmm_usp', 'marked_datetime', 'marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'pending_released_status', 'has_work_flow_id']; // 'mark_status','marked_physical_count', 'marked_expected_time', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'winded_serial_number', 'part_validation_1', 'part_validation_2', 'samlight_logged_name'
|
||||
|
||||
if ($itemCode != '' && $itemCode != null && $itemCode && Str::length($itemCode) > 0) {
|
||||
$existingJobNo = ClassCharacteristic::where('aufnr', $jobNo)->first(); // ->where('machine_id', $machineId)->where('plant_id', $plantId)
|
||||
@@ -1845,7 +1845,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$masterFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'pending_released_status'];
|
||||
$masterFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature', 'pending_released_status'];
|
||||
|
||||
$isInsertOrUpdate = false;
|
||||
|
||||
@@ -2175,7 +2175,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id'];
|
||||
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty'];
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature'];
|
||||
|
||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get();
|
||||
|
||||
@@ -2709,7 +2709,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
// $columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id'];
|
||||
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty'];
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature'];
|
||||
|
||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get();
|
||||
|
||||
@@ -2951,7 +2951,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
// $columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id'];
|
||||
|
||||
// $characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zqmm_qty'];
|
||||
// $characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zqmm_qty', 'zmm_operating_temperature'];
|
||||
|
||||
// $characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get();
|
||||
|
||||
|
||||
@@ -102,13 +102,20 @@ class ProductionOrderController extends Controller
|
||||
$itemDes = $order->item->description ?? '';
|
||||
$now = Carbon::now();
|
||||
$year = $now->format('y');
|
||||
$month = $now->format('m');
|
||||
// $month = $now->format('m');
|
||||
// $month = $now->format('m');
|
||||
|
||||
$stickers = [];
|
||||
|
||||
for ($i = $fromSerial; $i <= $toSerial; $i++)
|
||||
{
|
||||
|
||||
$currentSerial = (string) $i;
|
||||
|
||||
$year = substr($currentSerial, -10, 2);
|
||||
|
||||
$month = substr($currentSerial, -8, 2);
|
||||
|
||||
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
|
||||
$serialCount = substr(str_pad($i, 6, '0', STR_PAD_LEFT), -6);
|
||||
|
||||
@@ -130,7 +137,7 @@ class ProductionOrderController extends Controller
|
||||
}
|
||||
|
||||
$pdf = Pdf::loadView('production-orders.printpanel', compact('stickers'))
|
||||
->setPaper([0, 0, 113.39, 113.39]);
|
||||
->setPaper([0, 0, 113.39, 113.39]);
|
||||
|
||||
return $pdf->stream('stickers.pdf');
|
||||
}
|
||||
|
||||
@@ -498,39 +498,47 @@ class TestingPanelController extends Controller
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
'status_response' => (object) [],
|
||||
], 403);
|
||||
}
|
||||
|
||||
$plantCode = $request->header('plant-code') ?? null;
|
||||
$serialNumbers = $request->header('serial-numbers') ?? null;
|
||||
// $description = $item ? $item->description : '';
|
||||
$plantCode = trim($request->header('plant-code')) ?? null;
|
||||
// $serialNumbers = $request->header('serial-numbers') ?? null;
|
||||
$data = $request->all();
|
||||
$serialNumbers = $data['serial_numbers'] ?? '';
|
||||
// $serialNumbers = $request->input('serial_numbers', []);
|
||||
|
||||
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
'status_response' => (object) [],
|
||||
], 404);
|
||||
} elseif (! is_numeric($plantCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code '{$plantCode}' should contain only numeric values!",
|
||||
'status_response' => (object) [],
|
||||
], 404);
|
||||
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code '{$plantCode}' must be between 4 and 7 digits only!",
|
||||
'status_response' => (object) [],
|
||||
], 404);
|
||||
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Invalid plant code '{$plantCode}' found!",
|
||||
'status_response' => (object) [],
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($serialNumbers == null || $serialNumbers == '' || ! $serialNumbers) {
|
||||
if (empty($serialNumbers) || ! is_array($serialNumbers) || count($serialNumbers) == 0) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Serial numbers can't be empty!",
|
||||
'status_description' => 'Serial numbers is required and must be a non-empty array.',
|
||||
'status_response' => (object) [],
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -540,18 +548,25 @@ class TestingPanelController extends Controller
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code '{$plantCode}' not found!",
|
||||
], 400);
|
||||
'status_response' => (object) [],
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
|
||||
$serialArray = array_map('trim', explode(',', $serialNumbers));
|
||||
// $serialNumber = 'SNO-'.Str::random(5).'-'.time(); // Default random serial number if not provided
|
||||
// $serialArray = array_map('trim', explode(',', $serialNumbers));
|
||||
// // $serialNumber = 'SNO-'.Str::random(5).'-'.time(); // Default random serial number if not provided
|
||||
|
||||
$serialArray = $serialNumbers;
|
||||
|
||||
// Remove null, empty string, or falsy values from $serialArray
|
||||
$serialArray = array_filter($serialArray, function ($serial) {
|
||||
return $serial != null && $serial != '' && $serial;
|
||||
});
|
||||
// $serialArray = array_filter($serialArray, function ($serial) {
|
||||
// return $serial != null && $serial != '' && $serial;
|
||||
// });
|
||||
// Remove null/empty/falsy and reindex the array
|
||||
$serialArray = array_values(array_filter($serialNumbers, function ($serial) {
|
||||
return $serial != null && $serial != '' && is_string($serial) && trim($serial) != '';
|
||||
}));
|
||||
|
||||
$serialStatus = [];
|
||||
$validSerials = [];
|
||||
@@ -586,7 +601,8 @@ class TestingPanelController extends Controller
|
||||
if ($validSerials == null || empty($validSerials)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_descriptions' => $serialStatus,
|
||||
'status_description' => 'Has pending leak test!',
|
||||
'status_response' => [$serialStatus],
|
||||
], 404);
|
||||
} else {
|
||||
$serialArray = $validSerials; // nonExistingSerials
|
||||
@@ -604,7 +620,8 @@ class TestingPanelController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_descriptions' => $mergedResult,
|
||||
'status_description' => 'Has pending leak test!',
|
||||
'status_response' => [$mergedResult],
|
||||
], 404);
|
||||
}
|
||||
|
||||
@@ -629,14 +646,16 @@ class TestingPanelController extends Controller
|
||||
|
||||
return response()->json([
|
||||
'status_code' => $hasFail ? 'ERROR' : 'SUCCESS',
|
||||
'status_descriptions' => $mergedResult,
|
||||
'status_description' => $hasFail ? 'Has pending leak test!' : 'Each serial number has passed the leak test!',
|
||||
'status_response' => [$mergedResult],
|
||||
], $hasFail ? 404 : 200);
|
||||
} else {
|
||||
$mergedResult = $serialStatus + $nonExistingSerials + $existingSerials; // nonExistingSerials
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_descriptions' => $mergedResult,
|
||||
'status_description' => 'Has pending leak test!',
|
||||
'status_response' => [$mergedResult],
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,24 @@
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\SerialValidation;
|
||||
use App\Models\StickerMaster;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Livewire\Component;
|
||||
use App\Models\SerialValidation;
|
||||
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class SerialValidationData extends Component
|
||||
{
|
||||
|
||||
use WithPagination;
|
||||
|
||||
public $invoiceData = [];
|
||||
|
||||
public $plantId = 0;
|
||||
|
||||
public string $invoiceNumber = '';
|
||||
|
||||
public string $serialNumber = '';
|
||||
|
||||
public bool $completedInvoice = false;
|
||||
@@ -30,22 +34,22 @@ class SerialValidationData extends Component
|
||||
|
||||
public bool $showCapacitorInput = false;
|
||||
|
||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||
|
||||
protected $listeners = [
|
||||
'refreshCompletedInvoice' => 'loadCompletedData',
|
||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||
'refreshInvoiceData' => 'loadData',
|
||||
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
||||
'focusCapacitor' => 'focusCapacitorInput'
|
||||
//'openCapacitorModal' => 'showCapacitorInputBox',
|
||||
'focusCapacitor' => 'focusCapacitorInput',
|
||||
// 'openCapacitorModal' => 'showCapacitorInputBox',
|
||||
];
|
||||
|
||||
public $capacitorInput = '';
|
||||
|
||||
public $panel_box_supplier;
|
||||
|
||||
public $panel_box_item_code;
|
||||
public $panel_box_code;
|
||||
|
||||
public $panel_box_serial_number;
|
||||
|
||||
@@ -96,43 +100,155 @@ class SerialValidationData extends Component
|
||||
// $this->showCapacitorInput = false;
|
||||
}
|
||||
|
||||
public function loadData($invoiceNumber, $plantId)
|
||||
// public function loadData($invoiceNumber, $plantId)
|
||||
// {
|
||||
// $this->plantId = $plantId;
|
||||
// $this->invoiceNumber = $invoiceNumber;
|
||||
// $this->completedInvoice = false;
|
||||
// $this->isSerial = true;
|
||||
// $this->emptyInvoice = false;
|
||||
// $this->hasSearched = true;
|
||||
// $this->materialInvoice = false;
|
||||
// // $this->showCapacitorInput = false;
|
||||
|
||||
// // ->where('serial_number', '!=', '')
|
||||
// $this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)
|
||||
// ->where('plant_id', $plantId)->where('scanned_status', null)
|
||||
// ->get()
|
||||
// ->map(function ($record) {
|
||||
// return [
|
||||
// 'sticker_master_id' => $record->sticker_master_id,
|
||||
// 'serial_number' => $record->serial_number,
|
||||
// 'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||
// 'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||
// 'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||
// 'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||
// 'scanned_status' => $record->scanned_status ?? '', //
|
||||
// 'panel_box_code' => $record->panel_box_code ?? '',
|
||||
// 'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||
// 'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||
// 'created_at' => $record->created_at,
|
||||
// 'operator_id' => $record->operator_id,
|
||||
// ];
|
||||
// })
|
||||
// ->toArray();
|
||||
|
||||
// // Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
// foreach ($this->invoiceData as &$row) {
|
||||
// // $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
// $row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
// }
|
||||
// }
|
||||
|
||||
public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||
{
|
||||
$this->plantId = $plantId;
|
||||
$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->showCapacitorInput = false;
|
||||
|
||||
//->where('serial_number', '!=', '')
|
||||
$this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $plantId)->where('scanned_status', null)
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
'serial_number' => $record->serial_number,
|
||||
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||
'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||
'scanned_status' => $record->scanned_status ?? '',
|
||||
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
$this->resetPage();
|
||||
$this->packageCount = 0;
|
||||
|
||||
//Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
foreach ($this->invoiceData as &$row) {
|
||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
}
|
||||
$records = SerialValidation::with('stickerMasterRelation')
|
||||
->where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $this->plantId)
|
||||
->get();
|
||||
|
||||
$this->packageCount = $records->sum(function ($record) {
|
||||
|
||||
$sm = $record->stickerMasterRelation;
|
||||
|
||||
if (! $sm) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$stickCount = 0;
|
||||
$scannedCount = 0;
|
||||
|
||||
if (! empty($sm->panel_box_code)) {
|
||||
$stickCount++;
|
||||
|
||||
if ($record->capacitor_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// $sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1
|
||||
if (! empty($sm->tube_sticker_motor) || ! empty($sm->tube_sticker_pump) || ! empty($sm->tube_sticker_pumpset)) {
|
||||
|
||||
if (! empty($sm->tube_sticker_motor)) {
|
||||
$stickCount++;
|
||||
if ($record->motor_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// ($sm->tube_sticker_pumpset != 1 && $sm->tube_sticker_pump != 1 && $sm->pack_slip_pump == 1)
|
||||
if (! empty($sm->tube_sticker_pump) || (empty($sm->tube_sticker_pumpset) && empty($sm->tube_sticker_pump) && ! empty($sm->pack_slip_pump))) {
|
||||
$stickCount++;
|
||||
if ($record->pump_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($sm->tube_sticker_pumpset)) {
|
||||
$stickCount++;
|
||||
if ($record->scanned_status_set == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
} elseif (! empty($sm->pack_slip_motor) || ! empty($sm->pack_slip_pump) || ! empty($sm->pack_slip_pumpset)) {
|
||||
if (! empty($sm->pack_slip_motor)) {
|
||||
$stickCount++;
|
||||
if ($record->motor_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($sm->pack_slip_pump)) {
|
||||
$stickCount++;
|
||||
if ($record->pump_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($sm->pack_slip_pumpset)) {
|
||||
$stickCount++;
|
||||
if ($record->scanned_status_set == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max($stickCount - $scannedCount, 0);
|
||||
});
|
||||
|
||||
$this->dispatch(
|
||||
$onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number'
|
||||
);
|
||||
}
|
||||
|
||||
public function getInvoiceRecordsProperty()
|
||||
{
|
||||
return SerialValidation::with('stickerMasterRelation.item')
|
||||
->where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $this->plantId)
|
||||
->where(function ($query) {
|
||||
$query->whereNull('scanned_status')
|
||||
->orWhere('scanned_status', '');
|
||||
})
|
||||
// ->when($this->hasSearched, function ($query) {
|
||||
// $query->where('invoice_number', $this->invoiceNumber)
|
||||
// ->where('plant_id', $this->plantId)
|
||||
// ->where('scanned_status', '=', '');
|
||||
// })
|
||||
->paginate(6);
|
||||
}
|
||||
|
||||
public function loadMaterialData($invoiceNumber, $plantId)
|
||||
@@ -146,43 +262,36 @@ class SerialValidationData extends Component
|
||||
$this->materialInvoice = true;
|
||||
// $this->showCapacitorInput = false;
|
||||
|
||||
//->where('serial_number', '!=', '')
|
||||
// ->where('serial_number', '!=', '')
|
||||
$this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $plantId)->where('serial_number', null)
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||
'quantity' => $record->quantity ?? '',
|
||||
'serial_number' => $record->serial_number ?? '',
|
||||
'batch_number' => $record->batch_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||
'quantity' => $record->quantity ?? '',
|
||||
'serial_number' => $record->serial_number ?? '',
|
||||
'batch_number' => $record->batch_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
|
||||
//Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
// Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
foreach ($this->invoiceData as &$row) {
|
||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||
if($matType === 1)
|
||||
{
|
||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||
if ($matType === 1) {
|
||||
$row['material_type'] = 'Individual';
|
||||
}
|
||||
else if($matType === 2)
|
||||
{
|
||||
} elseif ($matType === 2) {
|
||||
$row['material_type'] = 'Bundle';
|
||||
}
|
||||
else if($matType === 3)
|
||||
{
|
||||
} elseif ($matType === 3) {
|
||||
$row['material_type'] = 'Quantity';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$row['material_type'] = 'N/A';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,11 +325,11 @@ class SerialValidationData extends Component
|
||||
$user = Filament::auth()->user();
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (!$this->capacitorInput) {
|
||||
if (! $this->capacitorInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||
if (! preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||
Notification::make()
|
||||
->title('Invalid Panel Box QR Format:')
|
||||
->body('Scan the valid panel box QR code to proceed!')
|
||||
@@ -228,6 +337,7 @@ class SerialValidationData extends Component
|
||||
// ->duration(3000)
|
||||
->seconds(2)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -239,9 +349,9 @@ class SerialValidationData extends Component
|
||||
$existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
||||
$query->where('code', $this->currentItemCode);
|
||||
})
|
||||
->exists();
|
||||
->exists();
|
||||
|
||||
if (!$existsInStickerMaster) {
|
||||
if (! $existsInStickerMaster) {
|
||||
Notification::make()
|
||||
->title('Unknown: Panel Box Code')
|
||||
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
||||
@@ -250,6 +360,7 @@ class SerialValidationData extends Component
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->capacitorInput = '';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -259,7 +370,7 @@ class SerialValidationData extends Component
|
||||
($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;
|
||||
@@ -286,47 +397,41 @@ class SerialValidationData extends Component
|
||||
$packCnt = 1;
|
||||
$scanCnt = 1;
|
||||
// if($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||
if($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
|
||||
{
|
||||
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||
|
||||
$scanCnt = $hadMotorQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadPumpQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadMotorQr ? $scanCnt + 1 : $scanCnt;
|
||||
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||
|
||||
if($packCnt === $scanCnt)
|
||||
{
|
||||
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',
|
||||
'operator_id'=> $operatorName,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} 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,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} 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',
|
||||
'operator_id'=> $operatorName,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -341,15 +446,14 @@ class SerialValidationData extends Component
|
||||
$totalQuantity = SerialValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->count();
|
||||
$scannedQuantity = SerialValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
||||
// $this->form->fill([
|
||||
// 'plant_id' => $matchingValidation->plant_id,
|
||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||
// 'serial_number' => null,
|
||||
// 'total_quantity' => $totalQuantity,
|
||||
// 'scanned_quantity'=> $scannedQuantity,
|
||||
// ]);
|
||||
// 'plant_id' => $matchingValidation->plant_id,
|
||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||
// 'serial_number' => null,
|
||||
// 'total_quantity' => $totalQuantity,
|
||||
// 'scanned_quantity'=> $scannedQuantity,
|
||||
// ]);
|
||||
|
||||
if($totalQuantity === $scannedQuantity)
|
||||
{
|
||||
if ($totalQuantity === $scannedQuantity) {
|
||||
Notification::make()
|
||||
->title('Completed: Serial Invoice')
|
||||
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
||||
@@ -357,9 +461,7 @@ class SerialValidationData extends Component
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id);
|
||||
}
|
||||
}
|
||||
@@ -373,7 +475,8 @@ class SerialValidationData extends Component
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.serial-validation-data');
|
||||
return view('livewire.serial-validation-data', [
|
||||
'records' => $this->invoiceRecords,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
62
app/Mail/VisitorMail.php
Normal file
62
app/Mail/VisitorMail.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class VisitorMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $visitor;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($visitor)
|
||||
{
|
||||
$this->visitor = $visitor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Visitor Arrival Notification',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = '<b>Dear Sir</b>';
|
||||
|
||||
return new Content(
|
||||
view: 'mail.visitor-arrival',
|
||||
with: [
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -152,6 +152,7 @@ class ClassCharacteristic extends Model
|
||||
'zmm_motor_heading',
|
||||
'zmm_motor_speed',
|
||||
'zqmm_qty',
|
||||
'zmm_operating_temperature',
|
||||
'mark_status',
|
||||
'marked_datetime',
|
||||
'marked_physical_count',
|
||||
|
||||
@@ -10,6 +10,14 @@ class ImportTransit extends Model
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $casts = [
|
||||
'mail_received_date' => 'date',
|
||||
'shipper_invoice_date' => 'date',
|
||||
'eta_date' => 'date',
|
||||
'etd_date' => 'date',
|
||||
'bill_received_date' => 'date',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'cri_rfq_number',
|
||||
'mail_received_date',
|
||||
@@ -22,6 +30,7 @@ class ImportTransit extends Model
|
||||
'customs_agent_name',
|
||||
'eta_date',
|
||||
'status',
|
||||
'insurance_status',
|
||||
'delivery_location',
|
||||
'etd_date',
|
||||
'mode',
|
||||
@@ -36,6 +45,10 @@ class ImportTransit extends Model
|
||||
'bill_number',
|
||||
'bill_received_date',
|
||||
'vessel_number',
|
||||
'remark',
|
||||
'is_transit_identified',
|
||||
'inv_value',
|
||||
'freight_charge',
|
||||
'created_at',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
|
||||
@@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SerialValidation extends Model
|
||||
{
|
||||
use Prunable;
|
||||
// use Prunable;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
@@ -30,6 +30,9 @@ class SerialValidation extends Model
|
||||
'batch_number',
|
||||
'quantity',
|
||||
'operator_id',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'panel_box_code',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
@@ -47,8 +50,8 @@ class SerialValidation extends Model
|
||||
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
|
||||
}
|
||||
|
||||
public function prunable(): Builder
|
||||
{
|
||||
return static::where('created_at', '<=', now()->subMonthsNoOverflow(6));
|
||||
}
|
||||
// public function prunable(): Builder
|
||||
// {
|
||||
// return static::where('created_at', '<=', now()->subMonthsNoOverflow(6));
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -149,6 +149,7 @@ class TempClassCharacteristic extends Model
|
||||
'zmm_motor_heading',
|
||||
'zmm_motor_speed',
|
||||
'zqmm_qty',
|
||||
'zmm_operating_temperature',
|
||||
'winded_serial_number',
|
||||
'model_type',
|
||||
'has_work_flow_id',
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"tpetry/laravel-postgresql-enhanced": "^2.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.15",
|
||||
"barryvdh/laravel-debugbar": "^4.0",
|
||||
"barryvdh/laravel-ide-helper": "^3.5",
|
||||
"beyondcode/laravel-dump-server": "^2.1",
|
||||
"fakerphp/faker": "^1.23",
|
||||
|
||||
@@ -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 class_characteristics
|
||||
ADD COLUMN zmm_operating_temperature TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('class_characteristics', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -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 temp_class_characteristics
|
||||
ADD COLUMN zmm_operating_temperature TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('temp_class_characteristics', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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 import_transits
|
||||
ADD COLUMN remark TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE import_transits
|
||||
ADD COLUMN is_transit_identified INT DEFAULT 0
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('import_transits', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE import_transits
|
||||
ADD COLUMN inv_value TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE import_transits
|
||||
ADD COLUMN freight_charge TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
|
||||
$sql3 = <<<'SQL'
|
||||
ALTER TABLE import_transits
|
||||
ADD COLUMN insurance_status TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('import_transits', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE serial_validations
|
||||
ADD COLUMN panel_box_code TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE serial_validations
|
||||
ADD COLUMN created_by TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
|
||||
$sql3 = <<<'SQL'
|
||||
ALTER TABLE serial_validations
|
||||
ADD COLUMN updated_by TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('serial_validations', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -45,52 +45,57 @@
|
||||
|
||||
{{-- Modal for serial invoice--}}
|
||||
@if ($hasSearched)
|
||||
<div class="overflow-x-auto overflow-y-visible" style="height: 385px;">
|
||||
{{-- <table class="min-w-[1500px] text-sm text-center border border-gray-300"> --}}
|
||||
{{-- <table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300"> --}}
|
||||
<table class="min-w-full text-sm text-center border border-gray-300">
|
||||
<div class="overflow-x-auto" style="height: 385px;">
|
||||
<table class="min-w-full text-sm text-center border border-gray-300">
|
||||
<table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300">
|
||||
<thead class="bg-gray-100 font-bold">
|
||||
<tr>
|
||||
<th class="border px-4 py-2">No</th>
|
||||
<th class="border px-4 py-2">Material Code</th>
|
||||
<th class="border px-4 py-2">Serial Number</th>
|
||||
<th class="border px-4 py-2">Motor Scanned Status</th>
|
||||
<th class="border px-4 py-2">Pump Scanned Status</th>
|
||||
<th class="border px-4 py-2">Capacitor Scanned Status</th>
|
||||
<th class="border px-4 py-2">Scanned Status Set</th>
|
||||
<th class="border px-4 py-2">Scanned Status</th>
|
||||
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
||||
<th class="border px-4 py-2">Operator ID</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>
|
||||
<th class="border px-4 py-2">No</th>
|
||||
<th class="border px-4 py-2">Material Code</th>
|
||||
<th class="border px-4 py-2">Serial Number</th>
|
||||
<th class="border px-4 py-2">Motor Scanned Status</th>
|
||||
<th class="border px-4 py-2">Pump Scanned Status</th>
|
||||
<th class="border px-4 py-2">Capacitor Scanned Status</th>
|
||||
<th class="border px-4 py-2">Scanned Status Set</th>
|
||||
<th class="border px-4 py-2">Scanned Status</th>
|
||||
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
||||
<th class="border px-4 py-2">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>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@forelse ($records as $index => $record)
|
||||
<tr wire:key="inv-{{ $record->id }}" class="border-t">
|
||||
<td class="border px-2 py-2">{{ $records->firstItem() + $index }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->stickerMasterRelation?->item?->code ?? 'N/A' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->serial_number ?? 'N/A' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->motor_scanned_status ? '1' : '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->pump_scanned_status ? '1' : '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->capacitor_scanned_status ? '1' : '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->scanned_status_set ? '1' : '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->scanned_status ?? '' }}</td>
|
||||
<td class="border px-2 py-2 whitespace-nowrap">{{ optional($record->created_at)->format('d-m-Y H:i:s') }}</td>
|
||||
<td class="border px-2 py-2">{{ $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>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($invoiceData as $index => $row)
|
||||
<tr class="border-t">
|
||||
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['code'] ?? 'N/A' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['motor_scanned_status'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['pump_scanned_status'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['capacitor_scanned_status'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['scanned_status_set'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['scanned_status'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['created_at'] ?? '' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['operator_id'] ?? '' }}</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>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="12" class="text-center py-4 text-gray-500">
|
||||
No data found for the invoice number <strong>{{ $invoiceNumber }}</strong>.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="12" class="py-4 text-gray-500">
|
||||
No data found for invoice <strong>{{ $invoiceNumber }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="mt-3 flex justify-center">
|
||||
{{ $records->onEachSide(3)->links() }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Modal for Capacitor Input --}}
|
||||
|
||||
@@ -64,62 +64,56 @@
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>CRI RFQ Number</th>
|
||||
<th>Mail Received Date</th>
|
||||
<th>Pricol Ref Number</th>
|
||||
<th>Ref Number</th>
|
||||
<th>Requestor</th>
|
||||
<th>Shipper</th>
|
||||
<th>Shipper Location</th>
|
||||
<th>Shipper Invoice</th>
|
||||
<th>Shipper Invoice Date</th>
|
||||
<th>Custom Agent Name</th>
|
||||
<th>ETA Date</th>
|
||||
<th>ETA</th>
|
||||
<th>Status</th>
|
||||
<th>Delivery Location</th>
|
||||
<th>ETD Date</th>
|
||||
<th>Mode</th>
|
||||
<th>Inco Terms</th>
|
||||
<th>Port Of Loading</th>
|
||||
<th>Port Of Discharge</th>
|
||||
<th>Delivery City</th>
|
||||
<th>Packages</th>
|
||||
<th>Type of package</th>
|
||||
<th>Gross Weight</th>
|
||||
<th>Volume</th>
|
||||
<th>Bill Number</th>
|
||||
<th>Bill Received Date</th>
|
||||
<th>Vessel Number</th>
|
||||
<th>Remark</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($tableData as $row)
|
||||
<tr>
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $row['cri_rfq_number'] }}</td>
|
||||
<td>{{ $row['mail_received_date'] }}</td>
|
||||
<td>{{ $row['pricol_ref_number'] }}</td>
|
||||
<td>{{ $row['requester'] }}</td>
|
||||
<td>{{ $row['shipper'] }}</td>
|
||||
<td>{{ $row['shipper_location'] }}</td>
|
||||
<td>{{ $row['shipper_invoice'] }}</td>
|
||||
<td>{{ $row['shipper_invoice_date'] }}</td>
|
||||
<td>{{ $row['customs_agent_name'] }}</td>
|
||||
<td>{{ $row['eta_date'] }}</td>
|
||||
<td>{{ $row['status'] }}</td>
|
||||
<td>{{ $row['delivery_location'] }}</td>
|
||||
<td>{{ $row['etd_date'] }}</td>
|
||||
<td>{{ $row['mode'] }}</td>
|
||||
<td>{{ $row['inco_terms'] }}</td>
|
||||
<td>{{ $row['port_of_loading'] }}</td>
|
||||
<td>{{ $row['port_of_discharge'] }}</td>
|
||||
<td>{{ $row['delivery_city'] }}</td>
|
||||
<td>{{ $row['packages'] }}</td>
|
||||
<td>{{ $row['type_of_package'] }}</td>
|
||||
<td>{{ $row['gross_weight'] }}</td>
|
||||
<td>{{ $row['volume'] }}</td>
|
||||
<td>{{ $row['bill_number'] }}</td>
|
||||
<td>{{ $row['bill_received_date'] }}</td>
|
||||
<td>{{ $row['vessel_number'] }}</td>
|
||||
</tr>
|
||||
<tr style="{{ $row['is_transit_identified'] == 1 ? 'background-color:#FFFF00;' . 'font-weight: bold;' : '' }}">
|
||||
<td>{{ $loop->iteration }}</td>
|
||||
<td>{{ $row['cri_rfq_number'] }}</td>
|
||||
{{-- <td>{{ $row['mail_received_date'] }}</td> --}}
|
||||
{{-- <td>{{ \Carbon\Carbon::parse($row['mail_received_date'])->format('Y-m-d') }}</td> --}}
|
||||
<td>{{ $row['pricol_ref_number'] }}</td>
|
||||
<td>{{ $row['requester'] }}</td>
|
||||
<td>{{ $row['shipper'] }}</td>
|
||||
<td>{{ $row['shipper_location'] }}</td>
|
||||
<td>{{ $row['shipper_invoice'] }}</td>
|
||||
{{-- <td>{{ $row['shipper_invoice_date'] }}</td> --}}
|
||||
<td>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td>
|
||||
<td>{{ $row['customs_agent_name'] }}</td>
|
||||
{{-- <td>{{ $row['eta_date'] }}</td> --}}
|
||||
<td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td>
|
||||
<td>{{ $row['status'] }}</td>
|
||||
<td>{{ $row['delivery_location'] }}</td>
|
||||
{{-- <td>{{ $row['etd_date'] }}</td> --}}
|
||||
<td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td>
|
||||
{{-- <td>{{ $row['mode'] }}</td>
|
||||
<td>{{ $row['inco_terms'] }}</td>
|
||||
<td>{{ $row['port_of_loading'] }}</td>
|
||||
<td>{{ $row['port_of_discharge'] }}</td>
|
||||
<td>{{ $row['delivery_city'] }}</td>
|
||||
<td>{{ $row['packages'] }}</td>
|
||||
<td>{{ $row['type_of_package'] }}</td>
|
||||
<td>{{ $row['gross_weight'] }}</td>
|
||||
<td>{{ $row['volume'] }}</td>
|
||||
<td>{{ $row['bill_number'] }}</td> --}}
|
||||
{{-- <td>{{ $row['bill_received_date'] }}</td> --}}
|
||||
{{-- <td>{{ \Carbon\Carbon::parse($row['bill_received_date'])->format('Y-m-d') }}</td>
|
||||
<td>{{ $row['vessel_number'] }}</td> --}}
|
||||
<td>{{ $row['remark'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
124
resources/views/mail/visitor-arrival.blade.php
Normal file
124
resources/views/mail/visitor-arrival.blade.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Visitor Arrival Notification</title>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;background:#f4f6f9;font-family:Arial,Helvetica,sans-serif;">
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Visitor Arrival Notification</title>
|
||||
</head>
|
||||
<body style="margin:0;padding:0;background:#ffffff;font-family:Arial,Helvetica,sans-serif;">
|
||||
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="background:#ffffff;">
|
||||
<tr>
|
||||
<td align="center">
|
||||
|
||||
<table width="700" cellpadding="0" cellspacing="0" style="background:#ffffff;border:1px solid #e5e7eb;">
|
||||
|
||||
<!-- Header -->
|
||||
<tr>
|
||||
<td style="background:#0f766e;padding:20px;text-align:center;">
|
||||
<h2 style="margin:0;color:#ffffff;">
|
||||
Visitor Arrival Notification
|
||||
</h2>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Content -->
|
||||
<tr>
|
||||
<td style="padding:25px;">
|
||||
|
||||
<p style="margin-top:0;">
|
||||
{!! $greeting !!}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A visitor has arrived and is waiting to meet you.
|
||||
Please find the details below:
|
||||
</p>
|
||||
|
||||
<table width="100%" cellpadding="10" cellspacing="0"
|
||||
style="border-collapse:collapse;margin-top:15px;">
|
||||
|
||||
<tr>
|
||||
<td style="border:1px solid #d1d5db;width:30%;font-weight:bold;">
|
||||
Visitor Name
|
||||
</td>
|
||||
<td style="border:1px solid #d1d5db;">
|
||||
{{ $visitor->name }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||
Mobile Number
|
||||
</td>
|
||||
<td style="border:1px solid #d1d5db;">
|
||||
{{ $visitor->mobile_number }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||
Company
|
||||
</td>
|
||||
<td style="border:1px solid #d1d5db;">
|
||||
{{ $visitor->company }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||
Purpose of Visit
|
||||
</td>
|
||||
<td style="border:1px solid #d1d5db;">
|
||||
{{ $visitor->purpose_of_visit }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||
Visit Time
|
||||
</td>
|
||||
<td style="border:1px solid #d1d5db;">
|
||||
{{ $visitor->created_at?->format('d-m-Y h:i A') }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<p>
|
||||
{!! $wishes !!}
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Footer -->
|
||||
<tr>
|
||||
<td style="padding:15px;text-align:center;border-top:1px solid #e5e7eb;font-size:12px;color:#666;">
|
||||
© {{ date('Y') }} {{ $company }}<br>
|
||||
Visitor Management System
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -56,7 +56,7 @@
|
||||
$itemRowHeight -= 2.0;
|
||||
}
|
||||
if ($numItems == 2) {
|
||||
$itemRowHeight -= 0.3;
|
||||
$itemRowHeight -= 2.0;
|
||||
}
|
||||
|
||||
if ($itemRowHeight < 3) {
|
||||
|
||||
@@ -7,8 +7,16 @@
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
@page {
|
||||
size: 80mm 50mm;
|
||||
size: 80mm auto;
|
||||
margin: 0mm;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width: 80mm;
|
||||
height: 50mm;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -23,7 +31,7 @@
|
||||
.badge {
|
||||
width: 80mm;
|
||||
height: 50mm;
|
||||
border: 1px solid #333;
|
||||
border: 1.5px solid #000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
@@ -70,22 +78,29 @@
|
||||
}
|
||||
|
||||
.field-row {
|
||||
display: flex;
|
||||
gap: 1mm;
|
||||
display: grid;
|
||||
grid-template-columns: 16mm 3mm 1fr;
|
||||
line-height: 1.3;
|
||||
margin-bottom: 0.7mm;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
color: #555;
|
||||
min-width: 14mm;
|
||||
color: #000; /* was #555 — now pure black */
|
||||
font-size: 6.5pt;
|
||||
font-weight: 700; /* was normal — now bold */
|
||||
}
|
||||
|
||||
.field-colon {
|
||||
color: #000; /* was #555 — now pure black */
|
||||
font-size: 6.5pt;
|
||||
font-weight: 700; /* added bold */
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.field-value {
|
||||
font-weight: 600;
|
||||
font-weight: 700; /* was 600 — now fully bold */
|
||||
font-size: 6.5pt;
|
||||
color: #111;
|
||||
flex: 1;
|
||||
color: #000; /* was #111 — now pure black */
|
||||
}
|
||||
|
||||
/* ── Photo (right) ── */
|
||||
@@ -107,31 +122,34 @@
|
||||
.badge-photo .no-photo {
|
||||
width: 16mm;
|
||||
height: 18mm;
|
||||
border: 1px dashed #aaa;
|
||||
border: 1.5px dashed #000; /* was #aaa — darker border */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 5.5pt;
|
||||
color: #aaa;
|
||||
font-size: 6pt; /* slightly larger */
|
||||
color: #000; /* was #aaa */
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.host-sign {
|
||||
font-size: 5.5pt;
|
||||
color: #555;
|
||||
font-size: 6pt; /* was 5.5pt — slightly larger */
|
||||
color: #000; /* was #555 — now pure black */
|
||||
font-weight: 700; /* added bold */
|
||||
text-align: center;
|
||||
border-top: 0.5px solid #aaa;
|
||||
border-top: 1px solid #000; /* was 0.5px #aaa — darker line */
|
||||
padding-top: 0.5mm;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* ── Footer ── */
|
||||
.badge-footer {
|
||||
border-top: 0.5px solid #ddd;
|
||||
border-top: 1px solid #000; /* was 0.5px #ddd — darker line */
|
||||
padding: 1mm 2mm;
|
||||
text-align: right;
|
||||
font-size: 5.5pt;
|
||||
color: #888;
|
||||
font-size: 6pt; /* was 5.5pt — slightly larger */
|
||||
color: #000; /* was #888 — now pure black */
|
||||
font-weight: 700; /* added bold */
|
||||
}
|
||||
|
||||
@media print {
|
||||
@@ -157,7 +175,7 @@
|
||||
{{-- Header --}}
|
||||
<div class="badge-header">
|
||||
<span class="type">{{ strtoupper($visitor->type ?? 'VISITOR') }}</span>
|
||||
<span class="badge-id">#{{ strtoupper($visitor->register_id) }}</span>
|
||||
<span class="badge-id">#{{ str_pad($visitor->register_id, 5, '0', STR_PAD_LEFT) }}</span>
|
||||
</div>
|
||||
|
||||
{{-- Body --}}
|
||||
@@ -165,45 +183,42 @@
|
||||
|
||||
{{-- Left: fields --}}
|
||||
<div class="badge-fields">
|
||||
<div class="field-row">
|
||||
<span class="field-label">Name:</span>
|
||||
<span class="field-value">{{ strtoupper($visitor->name) }}</span>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Name</span>
|
||||
<span class="field-colon">:</span>
|
||||
<span class="field-value">{{ strtoupper($visitor->name) }}</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Company</span>
|
||||
<span class="field-colon">:</span>
|
||||
<span class="field-value">{{ $visitor->company }}</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">To Meet</span>
|
||||
<span class="field-colon">:</span>
|
||||
<span class="field-value">{{ strtoupper($visitor->employeeMaster?->name ?? '—') }}</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Dept</span>
|
||||
<span class="field-colon">:</span>
|
||||
<span class="field-value">{{ strtoupper($visitor->employeeMaster?->department ?? $visitor->department ?? '—') }}</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Valid Upto</span>
|
||||
<span class="field-colon">:</span>
|
||||
<span class="field-value">{{ $visitor->valid_upto ? \Carbon\Carbon::parse($visitor->valid_upto)->format('d/m/Y H:i:s') : '—' }}</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Date & Time</span>
|
||||
<span class="field-colon">:</span>
|
||||
<span class="field-value">{{ $visitor->in_time ? \Carbon\Carbon::parse($visitor->in_time)->format('d/m/Y H:i:s') : '—' }}</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">No of Visitors</span>
|
||||
<span class="field-colon">:</span>
|
||||
<span class="field-value">{{ $visitor->number_of_person ?? 1 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Company:</span>
|
||||
<span class="field-value">{{ $visitor->company }}</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">To Meet:</span>
|
||||
<span class="field-value">{{ strtoupper($visitor->employeeMaster?->name ?? '—') }}</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Dept:</span>
|
||||
<span class="field-value">
|
||||
{{ strtoupper($visitor->employeeMaster?->department ?? $visitor->department ?? '—') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Valid upto:</span>
|
||||
<span class="field-value">
|
||||
{{-- {{ $visitor->valid_upto ? \Carbon\Carbon::parse($visitor->valid_upto)->format('d/m/Y H:i') : '—' }} --}}
|
||||
{{ !empty($visitor->valid_upto)
|
||||
? \Carbon\Carbon::parse($visitor->valid_upto)->format('d/m/Y H:i:s')
|
||||
: '—'
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">Date&Time:</span>
|
||||
<span class="field-value">
|
||||
{{ $visitor->in_time ? \Carbon\Carbon::parse($visitor->in_time)->format('d/m/Y H:i:s') : '—' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="field-row">
|
||||
<span class="field-label">No of Visitor:</span>
|
||||
<span class="field-value">{{ $visitor->number_of_person ?? 1 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Right: photo + host sign --}}
|
||||
<div class="badge-photo">
|
||||
@@ -218,7 +233,7 @@
|
||||
->margin(0)
|
||||
->generate($visitor->register_id) !!} --}}
|
||||
@if(!empty($visitor->register_id))
|
||||
{!! QrCode::size(25)
|
||||
{!! QrCode::size(35)
|
||||
->margin(0)
|
||||
->generate((string) $visitor->register_id) !!}
|
||||
@endif
|
||||
|
||||
@@ -161,7 +161,7 @@ Route::post('testing/reading/store-data', [TestingPanelController::class, 'store
|
||||
|
||||
Route::post('testing/leak-test/store-data', [TestingPanelController::class, 'storeLeakTestStatus']);
|
||||
|
||||
Route::get('testing/leak-test/get-data', [TestingPanelController::class, 'getLeakTestStatus']);
|
||||
Route::post('testing/leak-test/get-data', [TestingPanelController::class, 'getLeakTestStatus']);
|
||||
|
||||
Route::get('get-pdf', [PdfController::class, 'getPdf']); // processorder/get-pdf
|
||||
|
||||
|
||||
Reference in New Issue
Block a user