Compare commits
42 Commits
ccf6ca6aef
...
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 |
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']),
|
->rules(['required']),
|
||||||
ImportColumn::make('subassembly_code')
|
ImportColumn::make('subassembly_code')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('SubAssembly Code')
|
->exampleHeader('Subassembly Code')
|
||||||
->example(['123456'])
|
->example(['123456'])
|
||||||
->label('SubAssembly Code')
|
->label('Subassembly Code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('isi_model')
|
ImportColumn::make('isi_model')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
@@ -216,18 +216,18 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
->label('Plant Code')
|
->label('Plant Code')
|
||||||
->relationship(resolveUsing: 'code')
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('created_by')
|
// ImportColumn::make('created_by')
|
||||||
->requiredMapping()
|
// ->requiredMapping()
|
||||||
->exampleHeader('Created By')
|
// ->exampleHeader('Created By')
|
||||||
->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
// ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||||
->label('Created By')
|
// ->label('Created By')
|
||||||
->rules(['required']),
|
// ->rules(['required']),
|
||||||
ImportColumn::make('updated_by')
|
// ImportColumn::make('updated_by')
|
||||||
->requiredMapping()
|
// ->requiredMapping()
|
||||||
->exampleHeader('Updated By')
|
// ->exampleHeader('Updated By')
|
||||||
->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
// ->example([Filament::auth()->user()->name, Filament::auth()->user()->name, Filament::auth()->user()->name])
|
||||||
->label('Updated By')
|
// ->label('Updated By')
|
||||||
->rules(['required']),
|
// ->rules(['required']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
$plantCod = trim($this->data['plant']);
|
$plantCod = trim($this->data['plant']);
|
||||||
$iCode = trim($this->data['item']);
|
$iCode = trim($this->data['item']);
|
||||||
$sCode = trim($this->data['subassembly_code']);
|
$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']);
|
$phase = trim($this->data['phase']);
|
||||||
$kw = trim($this->data['kw']);
|
$kw = trim($this->data['kw']);
|
||||||
$hp = trim($this->data['hp']);
|
$hp = trim($this->data['hp']);
|
||||||
@@ -266,15 +266,15 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
$noloadPowUl = trim($this->data['noload_pow_ul']);
|
$noloadPowUl = trim($this->data['noload_pow_ul']);
|
||||||
$noloadSpdLl = trim($this->data['noload_spd_ll']);
|
$noloadSpdLl = trim($this->data['noload_spd_ll']);
|
||||||
$noloadSpdUl = trim($this->data['noload_spd_ul']);
|
$noloadSpdUl = trim($this->data['noload_spd_ul']);
|
||||||
$createdBy = trim($this->data['created_by']);
|
$createdBy = Filament::auth()->user()->name;
|
||||||
$updatedBy = trim($this->data['updated_by']);
|
$updatedBy = Filament::auth()->user()->name;
|
||||||
|
|
||||||
$plant = null;
|
$plant = null;
|
||||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||||
$warnMsg[] = 'Invalid plant code found';
|
$warnMsg[] = 'Invalid plant code found';
|
||||||
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||||
$warnMsg[] = 'Invalid item code found';
|
$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';
|
$warnMsg[] = 'Invalid sub-assembly code found';
|
||||||
} else {
|
} else {
|
||||||
$plant = Plant::where('code', $plantCod)->first();
|
$plant = Plant::where('code', $plantCod)->first();
|
||||||
@@ -289,13 +289,8 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
} elseif (! $iCode) {
|
} elseif (! $iCode) {
|
||||||
$warnMsg[] = 'Item code not found for choosed plant';
|
$warnMsg[] = 'Item code not found for choosed plant';
|
||||||
} else {
|
} else {
|
||||||
// if (Str::length($isiModel) <= 0 || $isiModel == "0" || $isiModel == "1") {
|
$isiModel = (Str::length($isiModel) == 1 && ctype_alnum($isiModel) && ($isiModel == '1' || $isiModel == 'Y' || $isiModel == 'y')) ? true : false;
|
||||||
// $warnMsg[] = "Invalid ISI Model found";
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// $isiModel = ($isiModel == "1");
|
|
||||||
// }
|
|
||||||
if (Str::length($phase) <= 0 || ($phase != 'Single' && $phase != 'Three')) {// !is_string($phase) ||
|
if (Str::length($phase) <= 0 || ($phase != 'Single' && $phase != 'Three')) {// !is_string($phase) ||
|
||||||
$warnMsg[] = 'Invalid phase found';
|
$warnMsg[] = 'Invalid phase found';
|
||||||
}
|
}
|
||||||
@@ -387,19 +382,8 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
$created = $oldCode->created_by ? User::where('name', $oldCode->created_by)->first() : null;
|
$created = $oldCode->created_by ? User::where('name', $oldCode->created_by)->first() : null;
|
||||||
if (! $created) {
|
if (! $created) {
|
||||||
$warnMsg[] = 'Created by not found on update';
|
$warnMsg[] = 'Created by not found on update';
|
||||||
}
|
} else {
|
||||||
$updated = User::where('name', $updatedBy)->first();
|
$createdBy = $created->name;
|
||||||
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';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -444,8 +428,8 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
'noload_pow_ul' => $noloadPowUl,
|
'noload_pow_ul' => $noloadPowUl,
|
||||||
'noload_spd_ll' => $noloadSpdLl,
|
'noload_spd_ll' => $noloadSpdLl,
|
||||||
'noload_spd_ul' => $noloadSpdUl,
|
'noload_spd_ul' => $noloadSpdUl,
|
||||||
'created_by' => $created->name,
|
'created_by' => $createdBy,
|
||||||
'updated_by' => $updated->name,
|
'updated_by' => $updatedBy,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Exports\ImportTransitExporter;
|
use App\Filament\Exports\ImportTransitExporter;
|
||||||
|
use App\Filament\Imports\ImportTransitImporter;
|
||||||
use App\Filament\Resources\ImportTransitResource\Pages;
|
use App\Filament\Resources\ImportTransitResource\Pages;
|
||||||
use App\Filament\Resources\ImportTransitResource\RelationManagers;
|
use App\Filament\Resources\ImportTransitResource\RelationManagers;
|
||||||
use App\Models\ImportTransit;
|
use App\Models\ImportTransit;
|
||||||
@@ -22,6 +23,7 @@ use Filament\Notifications\Notification;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Filament\Tables\Actions\ImportAction;
|
||||||
// use PhpOffice\PhpSpreadsheet\IOFactory;
|
// use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
|
|
||||||
class ImportTransitResource extends Resource
|
class ImportTransitResource extends Resource
|
||||||
@@ -73,6 +75,16 @@ class ImportTransitResource extends Resource
|
|||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$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')
|
Forms\Components\TextInput::make('customs_agent_name')
|
||||||
->label('Customs Agent Name')
|
->label('Customs Agent Name')
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
@@ -97,6 +109,11 @@ class ImportTransitResource extends Resource
|
|||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$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')
|
Forms\Components\TextInput::make('delivery_location')
|
||||||
->label('Delivery Location')
|
->label('Delivery Location')
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
@@ -232,6 +249,16 @@ class ImportTransitResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('shipper_invoice_date')
|
Tables\Columns\TextColumn::make('shipper_invoice_date')
|
||||||
->label('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()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('customs_agent_name')
|
Tables\Columns\TextColumn::make('customs_agent_name')
|
||||||
@@ -240,18 +267,24 @@ class ImportTransitResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('eta_date')
|
Tables\Columns\TextColumn::make('eta_date')
|
||||||
->label('ETA Date')
|
->label('ETA Date')
|
||||||
|
->date()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('status')
|
Tables\Columns\TextColumn::make('status')
|
||||||
->label('Status')
|
->label('Status')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('insurance_status')
|
||||||
|
->label('Insurance Status')
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('delivery_location')
|
Tables\Columns\TextColumn::make('delivery_location')
|
||||||
->label('Delivery Location')
|
->label('Delivery Location')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('etd_date')
|
Tables\Columns\TextColumn::make('etd_date')
|
||||||
->label('ETD Date')
|
->label('ETD Date')
|
||||||
|
->date()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('mode')
|
Tables\Columns\TextColumn::make('mode')
|
||||||
@@ -352,297 +385,304 @@ class ImportTransitResource extends Resource
|
|||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->headerActions([
|
->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')
|
->label('Import Transit')
|
||||||
->form([
|
->color('warning')
|
||||||
FileUpload::make('import_transit_file')
|
->importer(ImportTransitImporter::class)
|
||||||
->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 () {
|
->visible(function () {
|
||||||
return Filament::auth()->user()->can('view import transit');
|
return Filament::auth()->user()->can('view import transit');
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class MachineResource extends Resource
|
|||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
Forms\Components\Select::make('line_id')
|
Forms\Components\Select::make('line_id')
|
||||||
->label('Line Name')
|
->label('Line Name')
|
||||||
->relationship('line', 'name')
|
// ->relationship('line', 'name')
|
||||||
->searchable()
|
->searchable()
|
||||||
->required()
|
->required()
|
||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
@@ -116,7 +116,7 @@ class MachineResource extends Resource
|
|||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
Forms\Components\Select::make('work_group_master_id')
|
Forms\Components\Select::make('work_group_master_id')
|
||||||
->label('Group Work Center')
|
->label('Group Work Center')
|
||||||
->relationship('workGroupMaster', 'name')
|
// ->relationship('workGroupMaster', 'name')
|
||||||
->searchable()
|
->searchable()
|
||||||
->required()
|
->required()
|
||||||
->columnSpan(1)
|
->columnSpan(1)
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class MotorTestingMasterResource extends Resource
|
|||||||
Forms\Components\TextInput::make('subassembly_code')
|
Forms\Components\TextInput::make('subassembly_code')
|
||||||
->label('Subassembly Code')
|
->label('Subassembly Code')
|
||||||
// ->required()
|
// ->required()
|
||||||
->placeholder('Scan the valid code')
|
->placeholder('Scan the subassembly code')
|
||||||
->reactive()
|
->reactive()
|
||||||
->alphaNum()
|
->alphaNum()
|
||||||
->minLength(6)
|
->minLength(6)
|
||||||
@@ -195,42 +195,49 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
Forms\Components\TextInput::make('hp')
|
Forms\Components\TextInput::make('hp')
|
||||||
->label('HP')
|
->label('HP')
|
||||||
|
->placeholder('Scan the HP')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('kw')
|
Forms\Components\TextInput::make('kw')
|
||||||
->label('KW')
|
->label('KW')
|
||||||
|
->placeholder('Scan the KW')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('volt')
|
Forms\Components\TextInput::make('volt')
|
||||||
->label('Volt')
|
->label('Volt')
|
||||||
|
->placeholder('Scan the volt')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('current')
|
Forms\Components\TextInput::make('current')
|
||||||
->label('Current')
|
->label('Current')
|
||||||
|
->placeholder('Scan the current')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('rpm')
|
Forms\Components\TextInput::make('rpm')
|
||||||
->label('RPM')
|
->label('RPM')
|
||||||
|
->placeholder('Scan the RPM')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('torque')
|
Forms\Components\TextInput::make('torque')
|
||||||
->label('Torque')
|
->label('Torque')
|
||||||
|
->placeholder('Scan the torque')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('frequency')
|
Forms\Components\TextInput::make('frequency')
|
||||||
->label('Frequency')
|
->label('Frequency')
|
||||||
|
->placeholder('Scan the frequency')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
@@ -265,12 +272,14 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
Forms\Components\TextInput::make('ins_res_limit')
|
Forms\Components\TextInput::make('ins_res_limit')
|
||||||
->label('Insulation Resistance Limit')
|
->label('Insulation Resistance Limit')
|
||||||
|
->placeholder('Scan the insulation resistance limit')
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\Select::make('ins_res_type')
|
Forms\Components\Select::make('ins_res_type')
|
||||||
->label('Insulation Resistance Type')
|
->label('Insulation Resistance Type')
|
||||||
|
->placeholder('Scan the insulation resistance type')
|
||||||
->default('O')
|
->default('O')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
@@ -294,96 +303,112 @@ class MotorTestingMasterResource extends Resource
|
|||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_ry_ll')
|
Forms\Components\TextInput::make('res_ry_ll')
|
||||||
->label('Resistance RY LL')
|
->label('Resistance RY LL')
|
||||||
|
->placeholder('Scan the resistance RY LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_ry_ul')
|
Forms\Components\TextInput::make('res_ry_ul')
|
||||||
->label('Resistance RY UL')
|
->label('Resistance RY UL')
|
||||||
|
->placeholder('Scan the resistance RY UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_yb_ll')
|
Forms\Components\TextInput::make('res_yb_ll')
|
||||||
->label('Resistance YB LL')
|
->label('Resistance YB LL')
|
||||||
|
->placeholder('Scan the resistance YB LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_yb_ul')
|
Forms\Components\TextInput::make('res_yb_ul')
|
||||||
->label('Resistance YB UL')
|
->label('Resistance YB UL')
|
||||||
|
->placeholder('Scan the resistance YB UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_br_ll')
|
Forms\Components\TextInput::make('res_br_ll')
|
||||||
->label('Resistance BR LL')
|
->label('Resistance BR LL')
|
||||||
|
->placeholder('Scan the resistance BR LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('res_br_ul')
|
Forms\Components\TextInput::make('res_br_ul')
|
||||||
->label('Resistance BR UL')
|
->label('Resistance BR UL')
|
||||||
|
->placeholder('Scan the resistance BR UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('lock_volt_limit')
|
Forms\Components\TextInput::make('lock_volt_limit')
|
||||||
->label('Lock Volt Limit')
|
->label('Lock Volt Limit')
|
||||||
|
->placeholder('Scan the lock volt limit')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('leak_cur_limit')
|
Forms\Components\TextInput::make('leak_cur_limit')
|
||||||
->label('Leakage Current Limit')
|
->label('Leakage Current Limit')
|
||||||
|
->placeholder('Scan the leakage current limit')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('lock_cur_ll')
|
Forms\Components\TextInput::make('lock_cur_ll')
|
||||||
->label('Lock Current LL')
|
->label('Lock Current LL')
|
||||||
|
->placeholder('Scan the lock current LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('lock_cur_ul')
|
Forms\Components\TextInput::make('lock_cur_ul')
|
||||||
->label('Lock Current UL')
|
->label('Lock Current UL')
|
||||||
|
->placeholder('Scan the lock current UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_cur_ll')
|
Forms\Components\TextInput::make('noload_cur_ll')
|
||||||
->label('No Load Current LL')
|
->label('No Load Current LL')
|
||||||
|
->placeholder('Scan the no load current LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_cur_ul')
|
Forms\Components\TextInput::make('noload_cur_ul')
|
||||||
->label('No Load Current UL')
|
->label('No Load Current UL')
|
||||||
|
->placeholder('Scan the no load current UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_pow_ll')
|
Forms\Components\TextInput::make('noload_pow_ll')
|
||||||
->label('No Load Power LL')
|
->label('No Load Power LL')
|
||||||
|
->placeholder('Scan the no load power LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_pow_ul')
|
Forms\Components\TextInput::make('noload_pow_ul')
|
||||||
->label('No Load Power UL')
|
->label('No Load Power UL')
|
||||||
|
->placeholder('Scan the no load power UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_spd_ll')
|
Forms\Components\TextInput::make('noload_spd_ll')
|
||||||
->label('No Load Speed LL')
|
->label('No Load Speed LL')
|
||||||
|
->placeholder('Scan the no load speed LL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('noload_spd_ul')
|
Forms\Components\TextInput::make('noload_spd_ul')
|
||||||
->label('No Load Speed UL')
|
->label('No Load Speed UL')
|
||||||
|
->placeholder('Scan the no load speed UL')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
@@ -420,6 +445,7 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('item.category')
|
Tables\Columns\TextColumn::make('item.category')
|
||||||
->label('Category')
|
->label('Category')
|
||||||
|
->default('-')
|
||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
@@ -430,6 +456,7 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('subassembly_code')
|
Tables\Columns\TextColumn::make('subassembly_code')
|
||||||
->label('Subassembly Code')
|
->label('Subassembly Code')
|
||||||
|
->default('-')
|
||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
@@ -593,17 +620,34 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$pId = $get('Plant');
|
$pId = $get('Plant');
|
||||||
|
|
||||||
return Item::whereHas('motorTestingMasters', function ($query) use ($pId) {
|
if (! $pId) {
|
||||||
if ($pId) {
|
return [];
|
||||||
$query->where('plant_id', $pId);
|
} else {
|
||||||
}
|
return Item::whereHas('motorTestingMasters', function ($query) use ($pId) {
|
||||||
})->pluck('code', 'id');
|
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()
|
->searchable()
|
||||||
->reactive(),
|
->reactive(),
|
||||||
TextInput::make('description')
|
TextInput::make('description')
|
||||||
->label('Description')
|
->label('Model')
|
||||||
->placeholder('Enter Description'),
|
->placeholder('Enter Model'),
|
||||||
Radio::make('isi_type')
|
Radio::make('isi_type')
|
||||||
->label('ISI Model ?')
|
->label('ISI Model ?')
|
||||||
->boolean()
|
->boolean()
|
||||||
@@ -714,7 +758,7 @@ class MotorTestingMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->query(function ($query, array $data) {
|
->query(function ($query, array $data) {
|
||||||
// Hide all records initially if no filters are applied
|
// 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');
|
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'])) {
|
if (! empty($data['description'])) {
|
||||||
$pId = $data['Plant'] ?? null;
|
$pId = $data['Plant'] ?? null;
|
||||||
$descIds = Item::where('description', 'like', '%'.$data['description'].'%')->whereHas('motorTestingMasters', function ($query) use ($pId) {
|
$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;
|
$indicators[] = 'Item Codes: '.$itemCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($data['subassembly_code'])) {
|
||||||
|
$indicators[] = 'Subassembly Code: '.$data['subassembly_code'];
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($data['description'])) {
|
if (! empty($data['description'])) {
|
||||||
$indicators[] = 'Description: '.$data['description'];
|
$indicators[] = 'Model: '.$data['description'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data['isi_type'] == 'Y') {
|
if ($data['isi_type'] == 'Y') {
|
||||||
|
|||||||
@@ -267,6 +267,9 @@ class SerialValidationResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('scanned_status')
|
Tables\Columns\TextColumn::make('scanned_status')
|
||||||
->label('Scanned Status')
|
->label('Scanned Status')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
|
Tables\Columns\TextColumn::make('panel_box_code')
|
||||||
|
->label('Panel Box Code')
|
||||||
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('panel_box_supplier')
|
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||||
->label('Panel Box Supplier')
|
->label('Panel Box Supplier')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
@@ -296,12 +299,25 @@ class SerialValidationResource extends Resource
|
|||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->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')
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
->label('Updated At')
|
->label('Updated At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('updated_by')
|
||||||
|
->label('Updated By')
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
->label('Deleted At')
|
->label('Deleted At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
// ->send();
|
// ->send();
|
||||||
|
|
||||||
// $this->dispatch('playNotificationSound');
|
// $this->dispatch('playNotificationSound');
|
||||||
// // $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
// // $hasRecords = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
||||||
// // $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
|
// // $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
|
||||||
// $this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
// $this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||||
|
|
||||||
@@ -994,7 +994,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
// 'total_quantity' => $totQuan,
|
// 'total_quantity' => $totQuan,
|
||||||
// 'scanned_quantity'=> $scanSQuan,
|
// 'scanned_quantity'=> $scanSQuan,
|
||||||
// ]);
|
// ]);
|
||||||
// //$hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
// //$hasRecords = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
||||||
// // $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
// // $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||||
|
|
||||||
// if ($totQuan == $scanSQuan)
|
// if ($totQuan == $scanSQuan)
|
||||||
@@ -1421,7 +1421,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
// // $disk->delete($filePath);
|
// // $disk->delete($filePath);
|
||||||
// // }
|
// // }
|
||||||
|
|
||||||
// // $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
// // $hasRecords = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
||||||
// // $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
|
// // $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
|
||||||
// $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
// $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||||
// }
|
// }
|
||||||
@@ -2033,7 +2033,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
// // $disk->delete($filePath);
|
// // $disk->delete($filePath);
|
||||||
// // }
|
// // }
|
||||||
|
|
||||||
// // $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
// // $hasRecords = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
||||||
// // $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
|
// // $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
|
||||||
// $this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
// $this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||||
// }
|
// }
|
||||||
@@ -2416,7 +2416,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
// // $disk->delete($filePath);
|
// // $disk->delete($filePath);
|
||||||
// // }
|
// // }
|
||||||
|
|
||||||
// // $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
// // $hasRecords = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
||||||
// // $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
|
// // $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId); //$this->invoiceNumber
|
||||||
// $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
// $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||||
// }
|
// }
|
||||||
@@ -2922,25 +2922,25 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
// }
|
// }
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
$oldQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
$oldQuan = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
||||||
$newQuan = -1;
|
$newQuan = -1;
|
||||||
|
|
||||||
$inserted = 0;
|
$inserted = 0;
|
||||||
foreach ($matchedItems as $sticker) {
|
foreach ($matchedItems as $sticker) {
|
||||||
if ($newQuan == -1 && ! $hasQuanTyp) {
|
if ($newQuan == -1 && ! $hasQuanTyp) {
|
||||||
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function ($query) {
|
SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function ($query) {
|
||||||
$query->whereNull('serial_number')->orWhere('serial_number', '');
|
$query->whereNull('serial_number')->orWhere('serial_number', '');
|
||||||
})
|
})
|
||||||
->forceDelete(); // ->delete();
|
->forceDelete(); // ->delete();
|
||||||
|
|
||||||
$newQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
$newQuan = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
||||||
} elseif ($newQuan == -1 && $hasQuanTyp) {
|
} elseif ($newQuan == -1 && $hasQuanTyp) {
|
||||||
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function ($query) {
|
SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where(function ($query) {
|
||||||
$query->whereNull('serial_number')->orWhere('serial_number', '');
|
$query->whereNull('serial_number')->orWhere('serial_number', '');
|
||||||
})->whereNotIn('sticker_master_id', $hasQuanTypIds)
|
})->whereNotIn('sticker_master_id', $hasQuanTypIds)
|
||||||
->forceDelete(); // ->delete();
|
->forceDelete(); // ->delete();
|
||||||
|
|
||||||
$newQuan = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
$newQuan = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
$code = $sticker->item->code;
|
$code = $sticker->item->code;
|
||||||
@@ -4153,7 +4153,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
|
|
||||||
for ($i = 0; $i < $totalExcelQty; $i++) {
|
for ($i = 0; $i < $totalExcelQty; $i++) {
|
||||||
if ($sticker) {
|
if ($sticker) {
|
||||||
InvoiceValidation::create([
|
SerialValidation::create([
|
||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
@@ -4188,7 +4188,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
|
|
||||||
for ($i = 0; $i < ($totalExcelQty / $bundleQty); $i++) {
|
for ($i = 0; $i < ($totalExcelQty / $bundleQty); $i++) {
|
||||||
if ($sticker) {
|
if ($sticker) {
|
||||||
InvoiceValidation::create([
|
SerialValidation::create([
|
||||||
'sticker_master_id' => $sticker->id,
|
'sticker_master_id' => $sticker->id,
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
@@ -4266,7 +4266,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
// $disk->delete($filePath);
|
// $disk->delete($filePath);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
// $hasRecords = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
||||||
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); //$this->invoiceNumber
|
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); //$this->invoiceNumber
|
||||||
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||||
}
|
}
|
||||||
@@ -4632,7 +4632,7 @@ class CreateSerialValidation extends CreateRecord
|
|||||||
// $disk->delete($filePath);
|
// $disk->delete($filePath);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// $hasRecords = InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
// $hasRecords = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first()->stickerMasterRelation->material_type ?? null;
|
||||||
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); //$this->invoiceNumber
|
// $this->dispatch( (!empty($hasRecords) && $hasRecords) ? 'refreshMaterialInvoiceData' : 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); //$this->invoiceNumber
|
||||||
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
|
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use App\Models\MotorTestingMaster;
|
|||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\TestingPanelReading;
|
use App\Models\TestingPanelReading;
|
||||||
use Barryvdh\DomPDF\Facade\Pdf;
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
use Closure;
|
||||||
// use Barryvdh\Reflection\DocBlock\Type\Collection;
|
// use Barryvdh\Reflection\DocBlock\Type\Collection;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
@@ -36,6 +37,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Response;
|
use Illuminate\Support\Facades\Response;
|
||||||
// use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
// use Barryvdh\Snappy\Facades\SnappyPdf as PDF;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
// use App\Exports\TestingPanelReadingExport;
|
// use App\Exports\TestingPanelReadingExport;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory; // For loading Excel file
|
use PhpOffice\PhpSpreadsheet\IOFactory; // For loading Excel file
|
||||||
@@ -95,7 +97,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
Forms\Components\Select::make('line_id')
|
Forms\Components\Select::make('line_id')
|
||||||
->label('Line Name')
|
->label('Line Name')
|
||||||
->relationship('line', 'name')
|
// ->relationship('line', 'name')
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
@@ -115,11 +117,12 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('motor_testing_master_id', null);
|
$set('motor_testing_master_id', null);
|
||||||
|
$set('machine_id', null);
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\Select::make('machine_id')
|
Forms\Components\Select::make('machine_id')
|
||||||
->label('Work Center')
|
->label('Work Center')
|
||||||
->relationship('machine', 'work_center')
|
// ->relationship('machine', 'work_center')
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$lineId = $get('line_id');
|
$lineId = $get('line_id');
|
||||||
@@ -183,17 +186,92 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$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')
|
Forms\Components\TextInput::make('serial_number')
|
||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->required()
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$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')
|
Forms\Components\TextInput::make('winded_serial_number')
|
||||||
->label('Winded Serial Number')
|
->label('Winded Serial Number')
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$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')
|
Forms\Components\TextInput::make('before_fr_volt')
|
||||||
->label('Before FR Volt')
|
->label('Before FR Volt')
|
||||||
@@ -350,24 +428,40 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('hv_test')
|
Forms\Components\Select::make('hv_test')
|
||||||
->label('High Voltage 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) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('batch_number')
|
Forms\Components\TextInput::make('batch_number')
|
||||||
->label('Batch Number')
|
->label('Batch Number')
|
||||||
|
->readOnly(fn (callable $get) => ! $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('batch_count')
|
Forms\Components\TextInput::make('batch_count')
|
||||||
->label('Batch Count')
|
->label('Batch Count')
|
||||||
->default('0')
|
->default('0')
|
||||||
|
->readOnly(fn (callable $get) => ! $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('result')
|
Forms\Components\Select::make('result')
|
||||||
->label('Result')
|
->label('Result')
|
||||||
|
->options([
|
||||||
|
'PASS' => 'PASS', // Not With Stood
|
||||||
|
'FAIL' => 'FAIL',
|
||||||
|
])
|
||||||
|
->selectablePlaceholder(false)
|
||||||
|
->default('FAIL')
|
||||||
|
->required()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
@@ -379,27 +473,28 @@ class TestingPanelReadingResource extends Resource
|
|||||||
Forms\Components\TextInput::make('rework_count')
|
Forms\Components\TextInput::make('rework_count')
|
||||||
->label('Rework Count')
|
->label('Rework Count')
|
||||||
->default('0')
|
->default('0')
|
||||||
|
->readOnly(fn (callable $get) => ! $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('update_count')
|
Forms\Components\TextInput::make('update_count')
|
||||||
->label('Update Count')
|
->label('Update Count')
|
||||||
->default('0')
|
->default('0')
|
||||||
|
->readOnly(fn (callable $get) => ! $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('output_flag')
|
Forms\Components\TextInput::make('output_flag')
|
||||||
->label('Output Flag')
|
->label('Output Flag')
|
||||||
->default('0')
|
->default('0')
|
||||||
|
->readOnly(fn (callable $get) => ! $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('tested_by')
|
Forms\Components\Hidden::make('tested_by')
|
||||||
->label('Tested By')
|
|
||||||
->default(fn () => Filament::auth()->user()?->name)
|
->default(fn () => Filament::auth()->user()?->name)
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('updated_by')
|
Forms\Components\Hidden::make('updated_by')
|
||||||
->label('Updated By')
|
|
||||||
->default(fn () => Filament::auth()->user()?->name)
|
->default(fn () => Filament::auth()->user()?->name)
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('id')
|
Forms\Components\TextInput::make('id')
|
||||||
@@ -665,6 +760,24 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_code', null);
|
$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')
|
Select::make('item_code')
|
||||||
->label('Search by Item Code')
|
->label('Search by Item Code')
|
||||||
->searchable()
|
->searchable()
|
||||||
@@ -687,30 +800,37 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_description', null);
|
$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')
|
TextInput::make('serial_number')
|
||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->reactive()
|
->reactive()
|
||||||
->placeholder('Enter Serial Number'),
|
->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')
|
Select::make('item_description')
|
||||||
->label('Model')
|
->label('Search by Model')
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
@@ -739,13 +859,12 @@ class TestingPanelReadingResource extends Resource
|
|||||||
$set('item_code', null);
|
$set('item_code', null);
|
||||||
}),
|
}),
|
||||||
Select::make('output')
|
Select::make('output')
|
||||||
->label('Output')
|
->label('Search by Output')
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function () {
|
->options(function () {
|
||||||
return TestingPanelReading::query()
|
return TestingPanelReading::whereNotNull('output')
|
||||||
->select('output')
|
->select('output')
|
||||||
->distinct()
|
->distinct()
|
||||||
->whereNotNull('output')
|
|
||||||
->orderBy('output')
|
->orderBy('output')
|
||||||
->pluck('output', 'output') // key and label are both the output value
|
->pluck('output', 'output') // key and label are both the output value
|
||||||
->toArray();
|
->toArray();
|
||||||
@@ -781,6 +900,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
// })
|
// })
|
||||||
// ->reactive(),
|
// ->reactive(),
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
Select::make('connection')
|
Select::make('connection')
|
||||||
->label('Connection')
|
->label('Connection')
|
||||||
->required()
|
->required()
|
||||||
@@ -805,13 +925,14 @@ class TestingPanelReadingResource extends Resource
|
|||||||
// ..
|
// ..
|
||||||
TextInput::make('remark')
|
TextInput::make('remark')
|
||||||
->label('Remark')
|
->label('Remark')
|
||||||
->reactive(),
|
->reactive()
|
||||||
|
->placeholder(placeholder: 'Enter Remark'),
|
||||||
TextInput::make('batch_number')
|
TextInput::make('batch_number')
|
||||||
->label('Batch Number')
|
->label('Batch Number')
|
||||||
->reactive()
|
->reactive()
|
||||||
->placeholder(placeholder: 'Enter Batch Number'),
|
->placeholder(placeholder: 'Enter Batch Number'),
|
||||||
Select::make('result')
|
Select::make('result')
|
||||||
->label('Result')
|
->label('Search by Result')
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function () {
|
->options(function () {
|
||||||
return TestingPanelReading::query()
|
return TestingPanelReading::query()
|
||||||
@@ -823,7 +944,19 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->toArray();
|
->toArray();
|
||||||
})
|
})
|
||||||
->reactive(),
|
->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')
|
DateTimePicker::make(name: 'created_from')
|
||||||
->label('Created From')
|
->label('Created From')
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
->placeholder(placeholder: 'Select From DateTime')
|
||||||
@@ -834,12 +967,35 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->placeholder(placeholder: 'Select To DateTime')
|
->placeholder(placeholder: 'Select To DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->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) {
|
->query(function ($query, array $data) {
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
// Hide all records initially if no filters are applied
|
// 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');
|
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'])) {
|
if (! empty($data['machine_name'])) {
|
||||||
$query->where('machine_id', $data['machine_name']);
|
$query->where('machine_id', $data['machine_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['serial_number'])) {
|
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'])) {
|
if (! empty($data['item_description'])) {
|
||||||
@@ -919,11 +1083,11 @@ class TestingPanelReadingResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['remark'])) {
|
if (! empty($data['remark'])) {
|
||||||
$query->where('remark', $data['remark']);
|
$query->where('remark', 'like', '%'.$data['remark'].'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['batch_number'])) {
|
if (! empty($data['batch_number'])) {
|
||||||
$query->where('batch_number', $data['batch_number']);
|
$query->where('batch_number', 'like', '%'.$data['batch_number'].'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['result'])) {
|
if (! empty($data['result'])) {
|
||||||
@@ -937,6 +1101,22 @@ class TestingPanelReadingResource extends Resource
|
|||||||
if (! empty($data['created_to'])) {
|
if (! empty($data['created_to'])) {
|
||||||
$query->where('created_at', '<=', $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) {
|
->indicateUsing(function (array $data) {
|
||||||
$indicators = [];
|
$indicators = [];
|
||||||
@@ -953,11 +1133,14 @@ class TestingPanelReadingResource extends Resource
|
|||||||
if (! empty($data['Line'])) {
|
if (! empty($data['Line'])) {
|
||||||
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
|
$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'])) {
|
if (! empty($data['item_code'])) {
|
||||||
$indicators[] = 'Item Code: '.Item::where('id', $data['item_code'])->value('code');
|
$indicators[] = 'Item Code: '.Item::where('id', $data['item_code'])->value('code');
|
||||||
}
|
}
|
||||||
if (! empty($data['machine_name'])) {
|
if (! empty($data['subassembly_code'])) {
|
||||||
$indicators[] = 'Work Center: '.Machine::where('id', $data['machine_name'])->value('work_center');
|
$indicators[] = 'Subassembly Code: '.MotorTestingMaster::where('id', $data['subassembly_code'])->value('subassembly_code');
|
||||||
}
|
}
|
||||||
if (! empty($data['output'])) {
|
if (! empty($data['output'])) {
|
||||||
$indicators[] = 'Output: '.$data['output'];
|
$indicators[] = 'Output: '.$data['output'];
|
||||||
@@ -986,6 +1169,10 @@ class TestingPanelReadingResource extends Resource
|
|||||||
$indicators[] = 'Serial Number: '.$data['serial_number'];
|
$indicators[] = 'Serial Number: '.$data['serial_number'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($data['tested_by'])) {
|
||||||
|
$indicators[] = 'Tested By: '.$data['tested_by'];
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($data['created_from'])) {
|
if (! empty($data['created_from'])) {
|
||||||
$indicators[] = 'From: '.$data['created_from'];
|
$indicators[] = 'From: '.$data['created_from'];
|
||||||
}
|
}
|
||||||
@@ -994,6 +1181,18 @@ class TestingPanelReadingResource extends Resource
|
|||||||
$indicators[] = 'To: '.$data['created_to'];
|
$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;
|
return $indicators;
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -118,8 +118,10 @@ class VisitorEntryResource extends Resource
|
|||||||
->label('Employee Department')
|
->label('Employee Department')
|
||||||
->options(
|
->options(
|
||||||
EmployeeMaster::distinct()
|
EmployeeMaster::distinct()
|
||||||
|
->orderBy('department')
|
||||||
->pluck('department', 'department')
|
->pluck('department', 'department')
|
||||||
)
|
)
|
||||||
|
->searchable()
|
||||||
->required()
|
->required()
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
@@ -156,6 +158,11 @@ class VisitorEntryResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$department = $get('department');
|
$department = $get('department');
|
||||||
|
|
||||||
|
if (!$department) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
// Always load ALL employees, filter by department if set
|
// Always load ALL employees, filter by department if set
|
||||||
if ($department) {
|
if ($department) {
|
||||||
return EmployeeMaster::where('department', $department)
|
return EmployeeMaster::where('department', $department)
|
||||||
@@ -319,7 +326,7 @@ class VisitorEntryResource extends Resource
|
|||||||
->reactive()
|
->reactive()
|
||||||
->placeholder('Enter Register ID')
|
->placeholder('Enter Register ID')
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('Rework', null);
|
$set('type', null);
|
||||||
}),
|
}),
|
||||||
Select::make('type')
|
Select::make('type')
|
||||||
->label('Type')
|
->label('Type')
|
||||||
@@ -356,7 +363,24 @@ class VisitorEntryResource extends Resource
|
|||||||
->reactive()
|
->reactive()
|
||||||
->placeholder('Enter Visitor Company')
|
->placeholder('Enter Visitor Company')
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('Rework', null);
|
$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')
|
Select::make('employee_master_id')
|
||||||
->label('Employee Name')
|
->label('Employee Name')
|
||||||
@@ -407,6 +431,10 @@ class VisitorEntryResource extends Resource
|
|||||||
$query->where('company', 'like', '%'.$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'])) {
|
if (! empty($data['employee_master_id'])) {
|
||||||
$query->where('employee_master_id', $data['employee_master_id']);
|
$query->where('employee_master_id', $data['employee_master_id']);
|
||||||
}
|
}
|
||||||
@@ -443,6 +471,10 @@ class VisitorEntryResource extends Resource
|
|||||||
$indicators[] = 'Company: '.$data['company'];
|
$indicators[] = 'Company: '.$data['company'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($data['employee_department'])) {
|
||||||
|
$indicators[] = 'Employee Department: '.$data['employee_department'];
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($data['employee_master_id'])) {
|
if (! empty($data['employee_master_id'])) {
|
||||||
$indicators[] = 'Employee Name: '.EmployeeMaster::where('id', $data['employee_master_id'])->value('name');
|
$indicators[] = 'Employee Name: '.EmployeeMaster::where('id', $data['employee_master_id'])->value('name');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ use Filament\Actions\Action;
|
|||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Livewire\Attributes\On;
|
use Livewire\Attributes\On;
|
||||||
|
use App\Mail\VisitorMail;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
class CreateVisitorEntry extends CreateRecord
|
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
|
protected function getRedirectUrl(): string
|
||||||
{
|
{
|
||||||
return $this->getResource()::getUrl('view', ['record' => $this->record]);
|
return $this->getResource()::getUrl('view', ['record' => $this->record]);
|
||||||
|
|||||||
@@ -102,13 +102,20 @@ class ProductionOrderController extends Controller
|
|||||||
$itemDes = $order->item->description ?? '';
|
$itemDes = $order->item->description ?? '';
|
||||||
$now = Carbon::now();
|
$now = Carbon::now();
|
||||||
$year = $now->format('y');
|
$year = $now->format('y');
|
||||||
$month = $now->format('m');
|
// $month = $now->format('m');
|
||||||
|
// $month = $now->format('m');
|
||||||
|
|
||||||
$stickers = [];
|
$stickers = [];
|
||||||
|
|
||||||
for ($i = $fromSerial; $i <= $toSerial; $i++)
|
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);
|
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
|
||||||
$serialCount = substr(str_pad($i, 6, '0', STR_PAD_LEFT), -6);
|
$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'))
|
$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');
|
return $pdf->stream('stickers.pdf');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,39 +498,47 @@ class TestingPanelController extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'Invalid authorization token!',
|
'status_description' => 'Invalid authorization token!',
|
||||||
|
'status_response' => (object) [],
|
||||||
], 403);
|
], 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
$plantCode = $request->header('plant-code') ?? null;
|
$plantCode = trim($request->header('plant-code')) ?? null;
|
||||||
$serialNumbers = $request->header('serial-numbers') ?? null;
|
// $serialNumbers = $request->header('serial-numbers') ?? null;
|
||||||
// $description = $item ? $item->description : '';
|
$data = $request->all();
|
||||||
|
$serialNumbers = $data['serial_numbers'] ?? '';
|
||||||
|
// $serialNumbers = $request->input('serial_numbers', []);
|
||||||
|
|
||||||
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Plant code can't be empty!",
|
'status_description' => "Plant code can't be empty!",
|
||||||
|
'status_response' => (object) [],
|
||||||
], 404);
|
], 404);
|
||||||
} elseif (! is_numeric($plantCode)) {
|
} elseif (! is_numeric($plantCode)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Plant code '{$plantCode}' should contain only numeric values!",
|
'status_description' => "Plant code '{$plantCode}' should contain only numeric values!",
|
||||||
|
'status_response' => (object) [],
|
||||||
], 404);
|
], 404);
|
||||||
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Plant code '{$plantCode}' must be between 4 and 7 digits only!",
|
'status_description' => "Plant code '{$plantCode}' must be between 4 and 7 digits only!",
|
||||||
|
'status_response' => (object) [],
|
||||||
], 404);
|
], 404);
|
||||||
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
|
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Invalid plant code '{$plantCode}' found!",
|
'status_description' => "Invalid plant code '{$plantCode}' found!",
|
||||||
|
'status_response' => (object) [],
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($serialNumbers == null || $serialNumbers == '' || ! $serialNumbers) {
|
if (empty($serialNumbers) || ! is_array($serialNumbers) || count($serialNumbers) == 0) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'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);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,18 +548,25 @@ class TestingPanelController extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Plant code '{$plantCode}' not found!",
|
'status_description' => "Plant code '{$plantCode}' not found!",
|
||||||
], 400);
|
'status_response' => (object) [],
|
||||||
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$plantId = $plant->id;
|
$plantId = $plant->id;
|
||||||
|
|
||||||
$serialArray = array_map('trim', explode(',', $serialNumbers));
|
// $serialArray = array_map('trim', explode(',', $serialNumbers));
|
||||||
// $serialNumber = 'SNO-'.Str::random(5).'-'.time(); // Default random serial number if not provided
|
// // $serialNumber = 'SNO-'.Str::random(5).'-'.time(); // Default random serial number if not provided
|
||||||
|
|
||||||
|
$serialArray = $serialNumbers;
|
||||||
|
|
||||||
// Remove null, empty string, or falsy values from $serialArray
|
// Remove null, empty string, or falsy values from $serialArray
|
||||||
$serialArray = array_filter($serialArray, function ($serial) {
|
// $serialArray = array_filter($serialArray, function ($serial) {
|
||||||
return $serial != null && $serial != '' && $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 = [];
|
$serialStatus = [];
|
||||||
$validSerials = [];
|
$validSerials = [];
|
||||||
@@ -586,7 +601,8 @@ class TestingPanelController extends Controller
|
|||||||
if ($validSerials == null || empty($validSerials)) {
|
if ($validSerials == null || empty($validSerials)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_descriptions' => $serialStatus,
|
'status_description' => 'Has pending leak test!',
|
||||||
|
'status_response' => [$serialStatus],
|
||||||
], 404);
|
], 404);
|
||||||
} else {
|
} else {
|
||||||
$serialArray = $validSerials; // nonExistingSerials
|
$serialArray = $validSerials; // nonExistingSerials
|
||||||
@@ -604,7 +620,8 @@ class TestingPanelController extends Controller
|
|||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_descriptions' => $mergedResult,
|
'status_description' => 'Has pending leak test!',
|
||||||
|
'status_response' => [$mergedResult],
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,14 +646,16 @@ class TestingPanelController extends Controller
|
|||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => $hasFail ? 'ERROR' : 'SUCCESS',
|
'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);
|
], $hasFail ? 404 : 200);
|
||||||
} else {
|
} else {
|
||||||
$mergedResult = $serialStatus + $nonExistingSerials + $existingSerials; // nonExistingSerials
|
$mergedResult = $serialStatus + $nonExistingSerials + $existingSerials; // nonExistingSerials
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_descriptions' => $mergedResult,
|
'status_description' => 'Has pending leak test!',
|
||||||
|
'status_response' => [$mergedResult],
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,24 @@
|
|||||||
|
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Models\SerialValidation;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use App\Models\SerialValidation;
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
|
|
||||||
class SerialValidationData extends Component
|
class SerialValidationData extends Component
|
||||||
{
|
{
|
||||||
|
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
public $invoiceData = [];
|
public $invoiceData = [];
|
||||||
|
|
||||||
public $plantId = 0;
|
public $plantId = 0;
|
||||||
|
|
||||||
public string $invoiceNumber = '';
|
public string $invoiceNumber = '';
|
||||||
|
|
||||||
public string $serialNumber = '';
|
public string $serialNumber = '';
|
||||||
|
|
||||||
public bool $completedInvoice = false;
|
public bool $completedInvoice = false;
|
||||||
@@ -30,22 +34,22 @@ class SerialValidationData extends Component
|
|||||||
|
|
||||||
public bool $showCapacitorInput = false;
|
public bool $showCapacitorInput = false;
|
||||||
|
|
||||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||||
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
'refreshCompletedInvoice' => 'loadCompletedData',
|
'refreshCompletedInvoice' => 'loadCompletedData',
|
||||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||||
'refreshInvoiceData' => 'loadData',
|
'refreshInvoiceData' => 'loadData',
|
||||||
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
||||||
'focusCapacitor' => 'focusCapacitorInput'
|
'focusCapacitor' => 'focusCapacitorInput',
|
||||||
//'openCapacitorModal' => 'showCapacitorInputBox',
|
// 'openCapacitorModal' => 'showCapacitorInputBox',
|
||||||
];
|
];
|
||||||
|
|
||||||
public $capacitorInput = '';
|
public $capacitorInput = '';
|
||||||
|
|
||||||
public $panel_box_supplier;
|
public $panel_box_supplier;
|
||||||
|
|
||||||
public $panel_box_item_code;
|
public $panel_box_code;
|
||||||
|
|
||||||
public $panel_box_serial_number;
|
public $panel_box_serial_number;
|
||||||
|
|
||||||
@@ -96,43 +100,155 @@ class SerialValidationData extends Component
|
|||||||
// $this->showCapacitorInput = false;
|
// $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->invoiceNumber = $invoiceNumber;
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
|
||||||
$this->completedInvoice = false;
|
$this->completedInvoice = false;
|
||||||
$this->isSerial = true;
|
$this->isSerial = true;
|
||||||
|
$this->onCapFocus = $onCapFocus;
|
||||||
$this->emptyInvoice = false;
|
$this->emptyInvoice = false;
|
||||||
$this->hasSearched = true;
|
$this->hasSearched = true;
|
||||||
$this->materialInvoice = false;
|
$this->materialInvoice = false;
|
||||||
// $this->showCapacitorInput = false;
|
|
||||||
|
|
||||||
//->where('serial_number', '!=', '')
|
$this->resetPage();
|
||||||
$this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)
|
$this->packageCount = 0;
|
||||||
->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();
|
|
||||||
|
|
||||||
//Loop through and replace 'code' using related StickerMaster > Item > code
|
$records = SerialValidation::with('stickerMasterRelation')
|
||||||
foreach ($this->invoiceData as &$row) {
|
->where('invoice_number', $this->invoiceNumber)
|
||||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
->where('plant_id', $this->plantId)
|
||||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
->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)
|
public function loadMaterialData($invoiceNumber, $plantId)
|
||||||
@@ -146,43 +262,36 @@ class SerialValidationData extends Component
|
|||||||
$this->materialInvoice = true;
|
$this->materialInvoice = true;
|
||||||
// $this->showCapacitorInput = false;
|
// $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)
|
$this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $plantId)->where('serial_number', null)
|
||||||
->get()
|
->get()
|
||||||
->map(function ($record) {
|
->map(function ($record) {
|
||||||
return [
|
return [
|
||||||
'sticker_master_id' => $record->sticker_master_id,
|
'sticker_master_id' => $record->sticker_master_id,
|
||||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||||
'quantity' => $record->quantity ?? '',
|
'quantity' => $record->quantity ?? '',
|
||||||
'serial_number' => $record->serial_number ?? '',
|
'serial_number' => $record->serial_number ?? '',
|
||||||
'batch_number' => $record->batch_number ?? '',
|
'batch_number' => $record->batch_number ?? '',
|
||||||
'created_at' => $record->created_at,
|
'created_at' => $record->created_at,
|
||||||
'operator_id' => $record->operator_id,
|
'operator_id' => $record->operator_id,
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
->toArray();
|
->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) {
|
foreach ($this->invoiceData as &$row) {
|
||||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
// $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';
|
$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 ?? '';
|
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||||
if($matType === 1)
|
if ($matType === 1) {
|
||||||
{
|
|
||||||
$row['material_type'] = 'Individual';
|
$row['material_type'] = 'Individual';
|
||||||
}
|
} elseif ($matType === 2) {
|
||||||
else if($matType === 2)
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'Bundle';
|
$row['material_type'] = 'Bundle';
|
||||||
}
|
} elseif ($matType === 3) {
|
||||||
else if($matType === 3)
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'Quantity';
|
$row['material_type'] = 'Quantity';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'N/A';
|
$row['material_type'] = 'N/A';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,11 +325,11 @@ class SerialValidationData extends Component
|
|||||||
$user = Filament::auth()->user();
|
$user = Filament::auth()->user();
|
||||||
$operatorName = $user->name;
|
$operatorName = $user->name;
|
||||||
|
|
||||||
if (!$this->capacitorInput) {
|
if (! $this->capacitorInput) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
if (! preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Panel Box QR Format:')
|
->title('Invalid Panel Box QR Format:')
|
||||||
->body('Scan the valid panel box QR code to proceed!')
|
->body('Scan the valid panel box QR code to proceed!')
|
||||||
@@ -228,6 +337,7 @@ class SerialValidationData extends Component
|
|||||||
// ->duration(3000)
|
// ->duration(3000)
|
||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
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) {
|
$existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
||||||
$query->where('code', $this->currentItemCode);
|
$query->where('code', $this->currentItemCode);
|
||||||
})
|
})
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if (!$existsInStickerMaster) {
|
if (! $existsInStickerMaster) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown: Panel Box Code')
|
->title('Unknown: Panel Box Code')
|
||||||
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
||||||
@@ -250,6 +360,7 @@ class SerialValidationData extends Component
|
|||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->capacitorInput = '';
|
$this->capacitorInput = '';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +370,7 @@ class SerialValidationData extends Component
|
|||||||
($row['serial_number'] ?? '') === $this->currentSerialNumber
|
($row['serial_number'] ?? '') === $this->currentSerialNumber
|
||||||
) {
|
) {
|
||||||
$row['panel_box_supplier'] = $supplier;
|
$row['panel_box_supplier'] = $supplier;
|
||||||
$row['panel_box_item_code'] = $itemCode;
|
$row['panel_box_code'] = $itemCode;
|
||||||
$row['panel_box_serial_number'] = $serialNumber;
|
$row['panel_box_serial_number'] = $serialNumber;
|
||||||
$row['capacitor_scanned_status'] = 1;
|
$row['capacitor_scanned_status'] = 1;
|
||||||
// $row['scanned_status_set'] = true;
|
// $row['scanned_status_set'] = true;
|
||||||
@@ -286,47 +397,41 @@ class SerialValidationData extends Component
|
|||||||
$packCnt = 1;
|
$packCnt = 1;
|
||||||
$scanCnt = 1;
|
$scanCnt = 1;
|
||||||
// if($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
// if($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||||
if($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
|
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||||
{
|
|
||||||
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||||
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||||
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||||
|
|
||||||
$scanCnt = $hadMotorQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadMotorQr ? $scanCnt + 1 : $scanCnt;
|
||||||
$scanCnt = $hadPumpQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||||
|
|
||||||
if($packCnt === $scanCnt)
|
if ($packCnt === $scanCnt) {
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'operator_id'=> $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'operator_id'=> $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'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();
|
$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();
|
$scannedQuantity = SerialValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
||||||
// $this->form->fill([
|
// $this->form->fill([
|
||||||
// 'plant_id' => $matchingValidation->plant_id,
|
// 'plant_id' => $matchingValidation->plant_id,
|
||||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||||
// 'serial_number' => null,
|
// 'serial_number' => null,
|
||||||
// 'total_quantity' => $totalQuantity,
|
// 'total_quantity' => $totalQuantity,
|
||||||
// 'scanned_quantity'=> $scannedQuantity,
|
// 'scanned_quantity'=> $scannedQuantity,
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
if($totalQuantity === $scannedQuantity)
|
if ($totalQuantity === $scannedQuantity) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Completed: Serial Invoice')
|
->title('Completed: Serial Invoice')
|
||||||
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
->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)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id);
|
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -373,7 +475,8 @@ class SerialValidationData extends Component
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.serial-validation-data');
|
return view('livewire.serial-validation-data', [
|
||||||
|
'records' => $this->invoiceRecords,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ class ImportTransit extends Model
|
|||||||
|
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'mail_received_date' => 'date',
|
||||||
|
'shipper_invoice_date' => 'date',
|
||||||
|
'eta_date' => 'date',
|
||||||
|
'etd_date' => 'date',
|
||||||
|
'bill_received_date' => 'date',
|
||||||
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'cri_rfq_number',
|
'cri_rfq_number',
|
||||||
'mail_received_date',
|
'mail_received_date',
|
||||||
@@ -22,6 +30,7 @@ class ImportTransit extends Model
|
|||||||
'customs_agent_name',
|
'customs_agent_name',
|
||||||
'eta_date',
|
'eta_date',
|
||||||
'status',
|
'status',
|
||||||
|
'insurance_status',
|
||||||
'delivery_location',
|
'delivery_location',
|
||||||
'etd_date',
|
'etd_date',
|
||||||
'mode',
|
'mode',
|
||||||
@@ -38,6 +47,8 @@ class ImportTransit extends Model
|
|||||||
'vessel_number',
|
'vessel_number',
|
||||||
'remark',
|
'remark',
|
||||||
'is_transit_identified',
|
'is_transit_identified',
|
||||||
|
'inv_value',
|
||||||
|
'freight_charge',
|
||||||
'created_at',
|
'created_at',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
|
|
||||||
class SerialValidation extends Model
|
class SerialValidation extends Model
|
||||||
{
|
{
|
||||||
use Prunable;
|
// use Prunable;
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@@ -30,6 +30,9 @@ class SerialValidation extends Model
|
|||||||
'batch_number',
|
'batch_number',
|
||||||
'quantity',
|
'quantity',
|
||||||
'operator_id',
|
'operator_id',
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
'panel_box_code',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function plant(): BelongsTo
|
public function plant(): BelongsTo
|
||||||
@@ -47,8 +50,8 @@ class SerialValidation extends Model
|
|||||||
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
|
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prunable(): Builder
|
// public function prunable(): Builder
|
||||||
{
|
// {
|
||||||
return static::where('created_at', '<=', now()->subMonthsNoOverflow(6));
|
// return static::where('created_at', '<=', now()->subMonthsNoOverflow(6));
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
"tpetry/laravel-postgresql-enhanced": "^2.3"
|
"tpetry/laravel-postgresql-enhanced": "^2.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"barryvdh/laravel-debugbar": "^3.15",
|
"barryvdh/laravel-debugbar": "^4.0",
|
||||||
"barryvdh/laravel-ide-helper": "^3.5",
|
"barryvdh/laravel-ide-helper": "^3.5",
|
||||||
"beyondcode/laravel-dump-server": "^2.1",
|
"beyondcode/laravel-dump-server": "^2.1",
|
||||||
"fakerphp/faker": "^1.23",
|
"fakerphp/faker": "^1.23",
|
||||||
|
|||||||
@@ -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--}}
|
{{-- Modal for serial invoice--}}
|
||||||
@if ($hasSearched)
|
@if ($hasSearched)
|
||||||
<div class="overflow-x-auto overflow-y-visible" style="height: 385px;">
|
<div class="overflow-x-auto" style="height: 385px;">
|
||||||
{{-- <table class="min-w-[1500px] text-sm text-center border border-gray-300"> --}}
|
<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"> --}}
|
<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">
|
|
||||||
<thead class="bg-gray-100 font-bold">
|
<thead class="bg-gray-100 font-bold">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="border px-4 py-2">No</th>
|
<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">Material Code</th>
|
||||||
<th class="border px-4 py-2">Serial Number</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">Motor Scanned Status</th>
|
||||||
<th class="border px-4 py-2">Pump 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">Capacitor Scanned Status</th>
|
||||||
<th class="border px-4 py-2">Scanned Status Set</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">Scanned Status</th>
|
||||||
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
||||||
<th class="border px-4 py-2">Operator ID</th>
|
<th class="border px-4 py-2">Operator ID</th>
|
||||||
<th class="border px-4 py-2">Panel Box Supplier</th>
|
{{-- <th class="border px-4 py-2">Panel Box Code</th> --}}
|
||||||
<th class="border px-4 py-2">Panel Box Serial Number</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>
|
</tr>
|
||||||
</thead>
|
@empty
|
||||||
<tbody>
|
<tr>
|
||||||
@forelse ($invoiceData as $index => $row)
|
<td colspan="12" class="py-4 text-gray-500">
|
||||||
<tr class="border-t">
|
No data found for invoice <strong>{{ $invoiceNumber }}</strong>
|
||||||
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
</td>
|
||||||
<td class="border px-4 py-2">{{ $row['code'] ?? 'N/A' }}</td>
|
</tr>
|
||||||
<td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td>
|
@endforelse
|
||||||
<td class="border px-4 py-2">{{ $row['motor_scanned_status'] ?? '' }}</td>
|
</tbody>
|
||||||
<td class="border px-4 py-2">{{ $row['pump_scanned_status'] ?? '' }}</td>
|
</table>
|
||||||
<td class="border px-4 py-2">{{ $row['capacitor_scanned_status'] ?? '' }}</td>
|
<div class="mt-3 flex justify-center">
|
||||||
<td class="border px-4 py-2">{{ $row['scanned_status_set'] ?? '' }}</td>
|
{{ $records->onEachSide(3)->links() }}
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{-- Modal for Capacitor Input --}}
|
{{-- Modal for Capacitor Input --}}
|
||||||
|
|||||||
@@ -64,30 +64,17 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>No</th>
|
<th>No</th>
|
||||||
<th>CRI RFQ Number</th>
|
<th>CRI RFQ Number</th>
|
||||||
<th>Mail Received Date</th>
|
<th>Ref Number</th>
|
||||||
<th>Pricol Ref Number</th>
|
|
||||||
<th>Requestor</th>
|
<th>Requestor</th>
|
||||||
<th>Shipper</th>
|
<th>Shipper</th>
|
||||||
<th>Shipper Location</th>
|
<th>Shipper Location</th>
|
||||||
<th>Shipper Invoice</th>
|
<th>Shipper Invoice</th>
|
||||||
<th>Shipper Invoice Date</th>
|
<th>Shipper Invoice Date</th>
|
||||||
<th>Custom Agent Name</th>
|
<th>Custom Agent Name</th>
|
||||||
<th>ETA Date</th>
|
<th>ETA</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Delivery Location</th>
|
<th>Delivery Location</th>
|
||||||
<th>ETD Date</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>
|
<th>Remark</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -96,19 +83,23 @@
|
|||||||
<tr style="{{ $row['is_transit_identified'] == 1 ? 'background-color:#FFFF00;' . 'font-weight: bold;' : '' }}">
|
<tr style="{{ $row['is_transit_identified'] == 1 ? 'background-color:#FFFF00;' . 'font-weight: bold;' : '' }}">
|
||||||
<td>{{ $loop->iteration }}</td>
|
<td>{{ $loop->iteration }}</td>
|
||||||
<td>{{ $row['cri_rfq_number'] }}</td>
|
<td>{{ $row['cri_rfq_number'] }}</td>
|
||||||
<td>{{ $row['mail_received_date'] }}</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['pricol_ref_number'] }}</td>
|
||||||
<td>{{ $row['requester'] }}</td>
|
<td>{{ $row['requester'] }}</td>
|
||||||
<td>{{ $row['shipper'] }}</td>
|
<td>{{ $row['shipper'] }}</td>
|
||||||
<td>{{ $row['shipper_location'] }}</td>
|
<td>{{ $row['shipper_location'] }}</td>
|
||||||
<td>{{ $row['shipper_invoice'] }}</td>
|
<td>{{ $row['shipper_invoice'] }}</td>
|
||||||
<td>{{ $row['shipper_invoice_date'] }}</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['customs_agent_name'] }}</td>
|
||||||
<td>{{ $row['eta_date'] }}</td>
|
{{-- <td>{{ $row['eta_date'] }}</td> --}}
|
||||||
|
<td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td>
|
||||||
<td>{{ $row['status'] }}</td>
|
<td>{{ $row['status'] }}</td>
|
||||||
<td>{{ $row['delivery_location'] }}</td>
|
<td>{{ $row['delivery_location'] }}</td>
|
||||||
<td>{{ $row['etd_date'] }}</td>
|
{{-- <td>{{ $row['etd_date'] }}</td> --}}
|
||||||
<td>{{ $row['mode'] }}</td>
|
<td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td>
|
||||||
|
{{-- <td>{{ $row['mode'] }}</td>
|
||||||
<td>{{ $row['inco_terms'] }}</td>
|
<td>{{ $row['inco_terms'] }}</td>
|
||||||
<td>{{ $row['port_of_loading'] }}</td>
|
<td>{{ $row['port_of_loading'] }}</td>
|
||||||
<td>{{ $row['port_of_discharge'] }}</td>
|
<td>{{ $row['port_of_discharge'] }}</td>
|
||||||
@@ -117,9 +108,10 @@
|
|||||||
<td>{{ $row['type_of_package'] }}</td>
|
<td>{{ $row['type_of_package'] }}</td>
|
||||||
<td>{{ $row['gross_weight'] }}</td>
|
<td>{{ $row['gross_weight'] }}</td>
|
||||||
<td>{{ $row['volume'] }}</td>
|
<td>{{ $row['volume'] }}</td>
|
||||||
<td>{{ $row['bill_number'] }}</td>
|
<td>{{ $row['bill_number'] }}</td> --}}
|
||||||
<td>{{ $row['bill_received_date'] }}</td>
|
{{-- <td>{{ $row['bill_received_date'] }}</td> --}}
|
||||||
<td>{{ $row['vessel_number'] }}</td>
|
{{-- <td>{{ \Carbon\Carbon::parse($row['bill_received_date'])->format('Y-m-d') }}</td>
|
||||||
|
<td>{{ $row['vessel_number'] }}</td> --}}
|
||||||
<td>{{ $row['remark'] }}</td>
|
<td>{{ $row['remark'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
$itemRowHeight -= 2.0;
|
$itemRowHeight -= 2.0;
|
||||||
}
|
}
|
||||||
if ($numItems == 2) {
|
if ($numItems == 2) {
|
||||||
$itemRowHeight -= 0.3;
|
$itemRowHeight -= 2.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($itemRowHeight < 3) {
|
if ($itemRowHeight < 3) {
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ Route::post('testing/reading/store-data', [TestingPanelController::class, 'store
|
|||||||
|
|
||||||
Route::post('testing/leak-test/store-data', [TestingPanelController::class, 'storeLeakTestStatus']);
|
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
|
Route::get('get-pdf', [PdfController::class, 'getPdf']); // processorder/get-pdf
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user