1 Commits

Author SHA1 Message Date
090bcff02a Update dependency concurrently to v10
Some checks failed
renovate/artifacts Artifact file update failure
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 33s
Laravel Pint / pint (pull_request) Successful in 4m32s
Laravel Larastan / larastan (pull_request) Failing after 20m45s
2026-06-07 00:01:29 +00:00
71 changed files with 1306 additions and 5702 deletions

View File

@@ -337,7 +337,7 @@ class Scheduler extends Command
} }
break; break;
case 'Daily': case 'Daily':
if (now()->format('H:i') == '08:00') { if (now()->format('H:i') == '11:10') {
try { try {
\Artisan::call('send-import-transit', [ \Artisan::call('send-import-transit', [
'schedule_type' => $rule->schedule_type, 'schedule_type' => $rule->schedule_type,

View File

@@ -7,8 +7,6 @@ use App\Models\AlertMailRule;
use App\Models\ImportTransit; use App\Models\ImportTransit;
use App\Models\Plant; use App\Models\Plant;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\ImportTransitReportExport;
class SendImportTransit extends Command class SendImportTransit extends Command
{ {
@@ -53,14 +51,44 @@ class SendImportTransit extends Command
return; return;
} }
$tableData = ImportTransit::where('status', '!=', 'Delivered')->orderByRaw(" // $todayRecordExists = ImportTransit::whereDate('created_at', now()->toDateString())->first();
CASE
WHEN cri_rfq_number ~ '[0-9]+'
THEN CAST(regexp_replace(cri_rfq_number, '[^0-9]', '', 'g') AS INTEGER)
ELSE NULL
END NULLS LAST
")->get();
// if (!$todayRecordExists) {
// $this->info('No records created today. Mail not sent.');
// return;
// }
$tableData = ImportTransit::select([
'cri_rfq_number',
'mail_received_date',
'pricol_ref_number',
'requester',
'shipper',
'shipper_location',
'shipper_invoice',
'shipper_invoice_date',
'customs_agent_name',
'eta_date',
'status',
'delivery_location',
'etd_date',
'mode',
'inco_terms',
'port_of_loading',
'port_of_discharge',
'delivery_city',
'packages',
'type_of_package',
'gross_weight',
'volume',
'bill_number',
'bill_received_date',
'vessel_number',
'remark',
'is_transit_identified',
])
->where('status', '!=', 'Delivered')
->get();
if ($tableData->isEmpty()) { if ($tableData->isEmpty()) {
$this->info('No pending Import Transit records found. Mail skipped.'); $this->info('No pending Import Transit records found. Mail skipped.');
@@ -73,19 +101,10 @@ class SendImportTransit extends Command
$mailSubject = 'Daily Import Transit Report'; $mailSubject = 'Daily Import Transit Report';
$fileName = 'reports/pending_import_shipment_' . now()->format('Ymd_His') . '.xlsx';
Excel::store(
new ImportTransitReportExport($tableData),
$fileName,
'local'
);
$mail = new ImportTransitMail( $mail = new ImportTransitMail(
$scheduleType, $scheduleType,
$tableData, $tableData,
$mailSubject, $mailSubject
$fileName
); );
$toEmails = collect(explode(',', $rule->email)) $toEmails = collect(explode(',', $rule->email))

View File

@@ -1,97 +0,0 @@
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithEvents;
use PhpOffice\PhpSpreadsheet\Style\Fill;
use Illuminate\Support\Facades\Log;
use Maatwebsite\Excel\Events\AfterSheet;
class ImportTransitReportExport implements FromCollection, WithHeadings, WithMapping, WithEvents
{
protected $data;
public function __construct($data)
{
$this->data = $data;
}
public function headings(): array
{
return [
'No',
'CRI RFQ Number',
'Requestor',
'Shipper',
'Shipper Location',
'Shipper Invoice',
'Shipper Invoice Date',
'Custom Agent Name',
'ETA',
'Status',
'Delivery Location',
'ETD Date',
'Remark',
];
}
public function collection()
{
return collect($this->data);
}
public function map($row): array
{
static $srNo = 0;
$srNo++;
return [
$srNo,
$row->cri_rfq_number,
$row->requester,
$row->shipper,
$row->shipper_location,
$row->shipper_invoice,
$row->shipper_invoice_date,
$row->customs_agent_name,
$row->eta_date,
$row->status,
$row->delivery_location,
$row->etd_date,
$row->remark,
];
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
$rowNumber = 2; // Excel row starts after header
foreach ($this->data as $row) {
if ((int) $row->is_transit_identified == 1) {
$event->sheet
->getStyle("A{$rowNumber}:M{$rowNumber}")
->applyFromArray([
'fill' => [
'fillType' => Fill::FILL_SOLID,
'startColor' => [
'rgb' => 'FFFF00',
],
],
]);
}
$rowNumber++;
}
},
];
}
}

View File

@@ -300,8 +300,6 @@ class ClassCharacteristicExporter extends Exporter
->label('ZQMM QTY'), ->label('ZQMM QTY'),
ExportColumn::make('zmm_operating_temperature') ExportColumn::make('zmm_operating_temperature')
->label('ZMM OPERATING TEMPERATURE'), ->label('ZMM OPERATING TEMPERATURE'),
ExportColumn::make('zmm_axial_force')
->label('ZMM AXIAL FORCE'),
ExportColumn::make('mark_status') ExportColumn::make('mark_status')
->label('MARKED STATUS'), ->label('MARKED STATUS'),
ExportColumn::make('marked_datetime') ExportColumn::make('marked_datetime')

View File

@@ -36,18 +36,12 @@ class ImportTransitExporter extends Exporter
->label('SHIPPER INVOICE'), ->label('SHIPPER INVOICE'),
ExportColumn::make('shipper_invoice_date') ExportColumn::make('shipper_invoice_date')
->label('SHIPPER INVOICE DATE'), ->label('SHIPPER INVOICE DATE'),
ExportColumn::make('inv_value')
->label('Inv Value'),
ExportColumn::make('freight_charge')
->label('Freight Charge'),
ExportColumn::make('customs_agent_name') ExportColumn::make('customs_agent_name')
->label('CUSTOMS AGENT NAME'), ->label('CUSTOMS AGENT NAME'),
ExportColumn::make('eta_date') ExportColumn::make('eta_date')
->label('ETA DATE'), ->label('ETA DATE'),
ExportColumn::make('status') ExportColumn::make('status')
->label('STATUS'), ->label('STATUS'),
ExportColumn::make('insurance_status')
->label('Insurance Status'),
ExportColumn::make('delivery_location') ExportColumn::make('delivery_location')
->label('DELIVERY LOCATION'), ->label('DELIVERY LOCATION'),
ExportColumn::make('etd_date') ExportColumn::make('etd_date')

View File

@@ -36,6 +36,15 @@ class InvoiceValidationExporter extends Exporter
->label('ITEM DESCRIPTION'), ->label('ITEM DESCRIPTION'),
ExportColumn::make('stickerMaster.item.uom') ExportColumn::make('stickerMaster.item.uom')
->label('UNIT OF MEASURE'), ->label('UNIT OF MEASURE'),
ExportColumn::make('stickerMaster.material_type')
->label('MATERIAL TYPE')
->formatStateUsing(fn ($state) => match ($state) {
1 => 'Individual',
2 => 'Bundle',
3 => 'Quantity',
4 => 'Bundle Individual',
default => '-',
}),
ExportColumn::make('motor_scanned_status') ExportColumn::make('motor_scanned_status')
->label('MOTOR SCANNED STATUS'), ->label('MOTOR SCANNED STATUS'),
ExportColumn::make('pump_scanned_status') ExportColumn::make('pump_scanned_status')
@@ -56,6 +65,10 @@ class InvoiceValidationExporter extends Exporter
->label('LOAD RATE'), ->label('LOAD RATE'),
ExportColumn::make('upload_status') ExportColumn::make('upload_status')
->label('UPLOAD STATUS'), ->label('UPLOAD STATUS'),
ExportColumn::make('batch_number')
->label('BATCH NUMBER'),
ExportColumn::make('quantity')
->label('QUANTITY'),
ExportColumn::make('operator_id') ExportColumn::make('operator_id')
->label('OPERATOR ID'), ->label('OPERATOR ID'),
ExportColumn::make('created_at') ExportColumn::make('created_at')
@@ -77,7 +90,7 @@ class InvoiceValidationExporter extends Exporter
public static function getCompletedNotificationBody(Export $export): string public static function getCompletedNotificationBody(Export $export): string
{ {
$body = 'Your serial invoice validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.'; $body = 'Your invoice validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) { if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.'; $body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';

View File

@@ -1,85 +0,0 @@
<?php
namespace App\Filament\Exports;
use App\Models\InvoiceValidation;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class MaterialInvoiceValidationExporter extends Exporter
{
protected static ?string $model = InvoiceValidation::class;
public static function getColumns(): array
{
static $rowNumber = 0;
return [
// ExportColumn::make('id')
// ->label('ID'),
ExportColumn::make('no')
->label('NO')
->state(function ($record) use (&$rowNumber) {
// Increment and return the row number
return ++$rowNumber;
}),
ExportColumn::make('plant.code')
->label('PLANT CODE'),
ExportColumn::make('invoice_number')
->label('INVOICE NUMBER'),
ExportColumn::make('stickerMaster.item.code')
->label('ITEM CODE'),
ExportColumn::make('stickerMaster.item.description')
->label('ITEM DESCRIPTION'),
ExportColumn::make('stickerMaster.item.uom')
->label('UNIT OF MEASURE'),
ExportColumn::make('stickerMaster.material_type')
->label('MATERIAL TYPE')
->formatStateUsing(fn ($state) => match ($state) {
1 => 'Individual',
2 => 'Bundle',
3 => 'Quantity',
4 => 'Bundle Individual',
default => '-',
}),
ExportColumn::make('serial_number')
->label('SERIAL NUMBER'),
ExportColumn::make('batch_number')
->label('BATCH NUMBER'),
ExportColumn::make('quantity')
->label('QUANTITY'),
ExportColumn::make('load_rate')
->label('LOAD RATE'),
ExportColumn::make('upload_status')
->label('UPLOAD STATUS'),
ExportColumn::make('operator_id')
->label('OPERATOR ID'),
ExportColumn::make('created_at')
->label('CREATED AT'),
// ->dateTimeFormat('d-m-Y H:i:s'),
ExportColumn::make('created_by')
->label('CREATED BY'),
ExportColumn::make('updated_at')
->label('UPDATED AT'),
// ->dateTimeFormat('d-m-Y H:i:s'),
ExportColumn::make('updated_by')
->label('UPDATED BY'),
ExportColumn::make('deleted_at')
->enabledByDefault(false)
->label('DELETED AT'),
// ->dateTimeFormat('d-m-Y H:i:s'),
];
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your material invoice validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
}
return $body;
}
}

View File

@@ -28,10 +28,8 @@ class StickerMasterExporter extends Exporter
->label('PLANT CODE'), ->label('PLANT CODE'),
ExportColumn::make('item.code') ExportColumn::make('item.code')
->label('ITEM CODE'), ->label('ITEM CODE'),
ExportColumn::make('item.category')
->label('CATEGORY'),
ExportColumn::make('item.description') ExportColumn::make('item.description')
->label('DESCRIPTION'), ->label('ITEM DESCRIPTION'),
ExportColumn::make('item.uom') ExportColumn::make('item.uom')
->label('UNIT OF MEASURE'), ->label('UNIT OF MEASURE'),
ExportColumn::make('serial_number_motor') ExportColumn::make('serial_number_motor')

View File

@@ -14,7 +14,6 @@ class TempClassCharacteristicExporter extends Exporter
public static function getColumns(): array public static function getColumns(): array
{ {
static $rowNumber = 0; static $rowNumber = 0;
return [ return [
ExportColumn::make('no') ExportColumn::make('no')
->label('NO') ->label('NO')
@@ -300,8 +299,6 @@ class TempClassCharacteristicExporter extends Exporter
->label('ZQMM QTY'), ->label('ZQMM QTY'),
ExportColumn::make('zmm_operating_temperature') ExportColumn::make('zmm_operating_temperature')
->label('ZMM OPERATING TEMPERATURE'), ->label('ZMM OPERATING TEMPERATURE'),
ExportColumn::make('zmm_axial_force')
->label('ZMM AXIAL FORCE'),
ExportColumn::make('winded_serial_number') ExportColumn::make('winded_serial_number')
->label('WINDED SERIAL NUMBER'), ->label('WINDED SERIAL NUMBER'),
ExportColumn::make('model_type') ExportColumn::make('model_type')
@@ -324,10 +321,10 @@ class TempClassCharacteristicExporter extends Exporter
public static function getCompletedNotificationBody(Export $export): string public static function getCompletedNotificationBody(Export $export): string
{ {
$body = 'Your temp class characteristic export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.'; $body = 'Your temp class characteristic export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) { if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.'; $body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
} }
return $body; return $body;

View File

@@ -579,10 +579,6 @@ class ClassCharacteristicImporter extends Importer
->label('ZMM OPERATING TEMPERATURE') ->label('ZMM OPERATING TEMPERATURE')
->exampleHeader('ZMM OPERATING TEMPERATURE') ->exampleHeader('ZMM OPERATING TEMPERATURE')
->example(''), ->example(''),
ImportColumn::make('zmm_axial_force')
->label('ZMM AXIAL FORCE')
->exampleHeader('ZMM AXIAL FORCE')
->example(''),
ImportColumn::make('mark_status') ImportColumn::make('mark_status')
->label('MARKED STATUS') ->label('MARKED STATUS')
->exampleHeader('MARKED STATUS') ->exampleHeader('MARKED STATUS')

View File

@@ -75,7 +75,7 @@ class ImportTransitImporter extends Importer
->label('Status'), ->label('Status'),
ImportColumn::make('insurance_status') ImportColumn::make('insurance_status')
->exampleHeader('Insurance Status') ->exampleHeader('Insurance Status')
->example('Yes') ->example('Receipted')
->label('Insurance Status'), ->label('Insurance Status'),
ImportColumn::make('delivery_location') ImportColumn::make('delivery_location')
->exampleHeader('Delivery Location') ->exampleHeader('Delivery Location')
@@ -176,7 +176,6 @@ class ImportTransitImporter extends Importer
return ImportTransit::updateOrCreate([ return ImportTransit::updateOrCreate([
'cri_rfq_number' => $criRfqNumber, 'cri_rfq_number' => $criRfqNumber,
'shipper_invoice' => $shipperInvoice,
], ],
[ [
'mail_received_date' => $this->formatDate($mailRecDate), 'mail_received_date' => $this->formatDate($mailRecDate),
@@ -188,6 +187,7 @@ class ImportTransitImporter extends Importer
'requester' => $requester, 'requester' => $requester,
'shipper' => $shipper, 'shipper' => $shipper,
'shipper_location' => $shipperLocation, 'shipper_location' => $shipperLocation,
'shipper_invoice' => $shipperInvoice,
'inv_value' => $invValue, 'inv_value' => $invValue,
'freight_charge' => $freightCharge, 'freight_charge' => $freightCharge,
'custom_agent_name' => $customsAgentname, 'custom_agent_name' => $customsAgentname,

View File

@@ -359,7 +359,7 @@ class InvoiceValidationImporter extends Importer
$curPanelBoxSerialNumber = $record->panel_box_serial_number ?? null; $curPanelBoxSerialNumber = $record->panel_box_serial_number ?? null;
} }
$warnMsg[] = 'Invoice Record Item ID : '.$record->sticker_master_id.' Master Item ID : '.$stickId; $warnMsg[] = 'Record Item ID : '.$record->sticker_master_id.' Master Item ID : '.$stickId;
if ($record->invoice_number != $invoiceNumber) { if ($record->invoice_number != $invoiceNumber) {
$stickId = null; $stickId = null;
$warnMsg[] = 'Invoice number mismatch with existing record!'; $warnMsg[] = 'Invoice number mismatch with existing record!';

View File

@@ -1,308 +0,0 @@
<?php
namespace App\Filament\Imports;
use App\Models\InvoiceValidation;
use App\Models\Item;
use App\Models\Plant;
use App\Models\StickerMaster;
use Carbon\Carbon;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Filament\Facades\Filament;
use Str;
class SapInvoiceValidationImporter extends Importer
{
protected static ?string $model = InvoiceValidation::class;
public static function getColumns(): array
{
return [
ImportColumn::make('plant')
->requiredMapping()
->exampleHeader('PLANT CODE')
->example('2040')
->label('PLANT CODE')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('invoice_number')
->requiredMapping()
->exampleHeader('INVOICE NUMBER')
->example('INV000001')
->label('INVOICE NUMBER')
->rules(['required']),
ImportColumn::make('item_reference') // stickerMaster
->requiredMapping()
->exampleHeader('ITEM CODE')
->example('123456')
->label('ITEM CODE')
// ->relationship() // resolveUsing: 'items.code'
->rules(['required']),
ImportColumn::make('serial_number')
->requiredMapping()
->exampleHeader('SERIAL NUMBER')
->example('12345678901234')
->label('SERIAL NUMBER'),
ImportColumn::make('scanned_status_set')
->requiredMapping()
->exampleHeader('PUMPSET SCANNED STATUS')
->example('1')
->label('PUMPSET SCANNED STATUS'),
ImportColumn::make('created_at')
->requiredMapping()
->exampleHeader('CREATED AT')
->example('19-06-2026 15:00:00')
->label('CREATED AT')
->rules(['required']),
ImportColumn::make('operator_id')
->requiredMapping()
->exampleHeader('OPERATOR ID')
->example('USER00001')
->label('OPERATOR ID')
->rules(['required']),
];
}
public function resolveRecord(): ?InvoiceValidation
{
// return InvoiceValidation::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
$warnMsg = [];
$plantId = null;
$stickId = null;
$plantCod = $this->data['plant'];
$invoiceNumber = strtoupper(trim($this->data['invoice_number'])) ?? null;
$iCode = strtoupper(trim($this->data['item_reference'])) ?? null;
$serialNumber = trim($this->data['serial_number']) ?? null;
$curPumpSetQr = trim($this->data['scanned_status_set']) ?? null;
$curScanStatus = null;
$loadRate = 0;
$operatorId = trim($this->data['operator_id']);
$createdAt = $this->data['created_at'];
$createdBy = Filament::auth()->user()?->name;
$updatedBy = $createdBy;
$packCnt = 0;
$scanCnt = 0;
$hasPumpSetQr = null;
$hadPumpSetQr = null;
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = "Plant code can't be empty!";
} elseif ($invoiceNumber == null || $invoiceNumber == '') {
$warnMsg[] = "Invoice number can't be empty!";
} elseif ($iCode == null || $iCode == '') {
$warnMsg[] = "Item code can't be empty!";
} elseif ($serialNumber == null || $serialNumber == '') {
$warnMsg[] = "Serial number can't be empty!";
} elseif ($curPumpSetQr != null && $curPumpSetQr != '' && $curPumpSetQr != '1' && $curPumpSetQr != 1) {
$warnMsg[] = 'PumpSet scanned status is invalid!';
} elseif ($operatorId == null || $operatorId == '') {
$warnMsg[] = "Operator ID can't be empty!";
} elseif ($createdAt == null || $createdAt == '') {
$warnMsg[] = "Created at timestamp can't be empty!";
}
if (Str::length($plantCod) > 0) {
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
$warnMsg[] = 'Invalid plant code found!';
} elseif ($plantCod == '2040') { // 2040
$plant = Plant::where('code', $plantCod)->first();
if (! $plant) {
$warnMsg[] = 'Plant code not found!';
} else {
$plantId = $plant->id;
}
} else {
$warnMsg[] = "Unknown plant code '$plantCod' found!";
}
}
if (Str::length($invoiceNumber) > 0 && ! ctype_alnum($invoiceNumber)) {
$warnMsg[] = "Invalid invoice number '$invoiceNumber' found!";
} elseif (Str::length($iCode) > 0 && (Str::length($iCode) < 6 || ! ctype_alnum($iCode))) {
$warnMsg[] = "Invalid item code '$iCode' found!";
} elseif ($plantId) {
$itemCode = Item::where('code', $iCode)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in item master!';
} else {
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in item master for the given plant!';
} else {
$itemId = $itemCode->id;
$itemCode = StickerMaster::where('item_id', $itemId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in sticker master!';
} else {
if ($plantId) {
$itemCode = StickerMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
if (! $itemCode) {
$warnMsg[] = 'Item code not found in sticker master for the given plant!';
} elseif ($itemCode->material_type != '' && $itemCode->material_type != null) {
$stickId = null;
$warnMsg[] = 'Material invoice item code found!';
} else {
$stickId = $itemCode->id;
$loadRate = $itemCode->load_rate ?? 0;
$invalidPackage = false;
$hasMotorQr = $itemCode->tube_sticker_motor ?? null;
$hasPumpQr = $itemCode->tube_sticker_pump ?? null;
$hasPumpSetQr = $itemCode->tube_sticker_pumpset ?? null;
$hasCapacitorQr = $itemCode->panel_box_code ?? null;
if (! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr) {// && ! $hasCapacitorQr
$hasMotorQr = $itemCode->pack_slip_motor ?? null;
$hasPumpQr = $itemCode->pack_slip_pump ?? null;
$hasPumpSetQr = $itemCode->pack_slip_pumpset ?? null;
} else {
if (! $hasPumpSetQr && ! $hasPumpQr) {
$hasPumpQr = $itemCode->pack_slip_pump ?? null;
}
$hasTubeMotorQr = $itemCode->tube_sticker_motor ?? null;
$hasPackMotorQr = $itemCode->pack_slip_motor ?? null;
$hasTubePumpSetQr = $itemCode->tube_sticker_pumpset ?? null;
$hasPackPumpSetQr = $itemCode->pack_slip_pumpset ?? null;
if ($hasTubeMotorQr != $hasPackMotorQr || $hasTubePumpSetQr != $hasPackPumpSetQr) {
$invalidPackage = true;
}
}
if ($hasMotorQr || $hasPumpQr || ! $hasPumpSetQr || $hasCapacitorQr || $invalidPackage) {
$stickId = null;
$warnMsg[] = "Item code doesn't have valid package type to proceed!";
} else {
$packCnt++;
}
}
}
}
}
}
}
if ($stickId) {
$record = InvoiceValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->first();
if ($record) {
if ($record->sticker_master_id != $stickId) {
$stickId = null;
$warnMsg[] = 'Item code mismatch with existing record!';
} else {
$record = InvoiceValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)
->whereHas('stickerMasterRelation.item', function ($query) use ($plantId, $iCode) {
$query->where('plant_id', $plantId)->where('code', $iCode);
})
->first();
if ($record) {
$hadPumpSetQr = $record->scanned_status_set ?? null;
if ($hadPumpSetQr && $hasPumpSetQr) {
$curPumpSetQr = $hadPumpSetQr;
}
$warnMsg[] = 'Invoice Record Item ID : '.$record->sticker_master_id.' Master Item ID : '.$stickId;
if ($record->invoice_number != $invoiceNumber) {
$stickId = null;
$warnMsg[] = 'Invoice number mismatch with existing record!';
} elseif ($record->scanned_status == 'Scanned') {
$stickId = null;
return null;
} else {
if ($hasPumpSetQr) {
$scanCnt = $curPumpSetQr ? $scanCnt + 1 : $scanCnt;
$record->scanned_status_set = $curPumpSetQr;
if ($packCnt == $scanCnt) {
$record->scanned_status = 'Scanned';
}
$record->upload_status = 'Y';
$record->updated_by = $updatedBy;
$record->save();
return null;
}
}
}
}
}
}
if ($stickId) {
$formats = ['d-m-Y H:i', 'd-m-Y H:i:s']; // '07-05-2025 08:00' or '07-05-2025 08:00:00'
$cDateTime = null;
foreach ($formats as $format) {
try {
$cDateTime = Carbon::createFromFormat($format, $createdAt);
break;
} catch (\Exception $e) {
// $warnMsg[] = "Date format mismatch with format: $format";
}
}
if (! isset($cDateTime)) {
$warnMsg[] = "Invalid 'Created DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
}
}
if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
if ($stickId) {
if ($hasPumpSetQr) {
$scanCnt = $curPumpSetQr ? $scanCnt + 1 : $scanCnt;
if ($packCnt == $scanCnt) {
$curScanStatus = 'Scanned';
} else {
$curScanStatus = null;
}
}
// $curScanStatus
InvoiceValidation::updateOrCreate([
'plant_id' => $plantId,
'sticker_master_id' => $stickId,
'serial_number' => $serialNumber,
],
[
'invoice_number' => $invoiceNumber,
'scanned_status_set' => $curPumpSetQr,
'scanned_status' => $curScanStatus,
'load_rate' => $loadRate,
'upload_status' => 'Y',
'operator_id' => $operatorId,
'created_by' => $createdBy,
'created_at' => $cDateTime->format('Y-m-d H:i:s'),
'updated_by' => $updatedBy,
]);
}
return null;
// return new InvoiceValidation;
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your sap invoice validation import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
}
return $body;
}
}

View File

@@ -579,10 +579,6 @@ class TempClassCharacteristicImporter extends Importer
->label('ZMM OPERATING TEMPERATURE') ->label('ZMM OPERATING TEMPERATURE')
->exampleHeader('ZMM OPERATING TEMPERATURE') ->exampleHeader('ZMM OPERATING TEMPERATURE')
->example(''), ->example(''),
ImportColumn::make('zmm_axial_force')
->label('ZMM AXIAL FORCE')
->exampleHeader('ZMM AXIAL FORCE')
->example(''),
ImportColumn::make('winded_serial_number') ImportColumn::make('winded_serial_number')
->label('WINDed SERIAL NUMBER') ->label('WINDed SERIAL NUMBER')
->exampleHeader('WINDED SERIAL NUMBER') ->exampleHeader('WINDED SERIAL NUMBER')
@@ -609,15 +605,15 @@ class TempClassCharacteristicImporter extends Importer
// 'email' => $this->data['email'], // 'email' => $this->data['email'],
// ]); // ]);
return new TempClassCharacteristic; return new TempClassCharacteristic();
} }
public static function getCompletedNotificationBody(Import $import): string public static function getCompletedNotificationBody(Import $import): string
{ {
$body = 'Your temp class characteristic import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.'; $body = 'Your temp class characteristic import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) { if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.'; $body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
} }
return $body; return $body;

View File

@@ -2,11 +2,8 @@
namespace App\Filament\Pages; namespace App\Filament\Pages;
use App\Mail\VisitorOutMail;
use App\Models\EmployeeMaster;
use App\Models\Plant; use App\Models\Plant;
use App\Models\VisitorEntry; use App\Models\VisitorEntry;
use Carbon\Carbon;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Pages\Page; use Filament\Pages\Page;
use Filament\Forms\Contracts\HasForms; use Filament\Forms\Contracts\HasForms;
@@ -17,8 +14,6 @@ use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput; use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Mail\VisitorMail;
use Illuminate\Support\Facades\Mail;
class GateOutEntry extends Page implements HasForms class GateOutEntry extends Page implements HasForms
{ {
@@ -42,182 +37,38 @@ class GateOutEntry extends Page implements HasForms
->schema([ ->schema([
Section::make('') // You can give your section a title or leave it blank Section::make('') // You can give your section a title or leave it blank
->schema([ ->schema([
Select::make('scan_out_gate_pass') TextInput::make('scan_out_gate_pass')
->label('Scan Gate Pass')
->required()
->reactive()
->options([
'In' => 'In',
'Out' => 'Out',
]),
TextInput::make('scan_out_gate_pass_in')
->label('Scan In Gate Pass')
->required()
->reactive()
->visible(fn ($get) => $get('scan_out_gate_pass') == 'In')
->extraAttributes([
'wire:keydown.enter' => 'processGatePassIn($event.target.value)',
]),
TextInput::make('scan_out_gate_pass_out')
->label('Scan Out Gate Pass') ->label('Scan Out Gate Pass')
->required() ->required()
->reactive() ->reactive()
->visible(fn ($get) => $get('scan_out_gate_pass') == 'Out')
->extraAttributes([ ->extraAttributes([
'wire:keydown.enter' => 'processGatePassOut($event.target.value)', 'wire:keydown.enter' => 'processGatePass($event.target.value)',
]), ]),
]) ])
->columns(5) ->columns(5)
]); ]);
} }
public function processGatePassIn($gatePass) public function processGatePass($gatePass)
{ {
$entry = VisitorEntry::where('register_id', $gatePass)->latest()->first(); $entry = VisitorEntry::where('register_id', $gatePass)->first();
if ($entry) if ($entry) {
{ $entry->out_time = now();
if($entry->in_time && !$entry->out_time && (empty($entry->valid_upto) || $entry->valid_upto == '' || $entry->valid_upto == null)){ $entry->save();
Notification::make()
->title('Already Entered')
->body('Gate pass In has already been processed for entry.')
->warning()
->send();
$this->filters['scan_out_gate_pass_in'] = '';
return;
}
elseif (
!empty($entry->valid_upto) &&
Carbon::parse($entry->valid_upto)->endOfDay()->gte(now())
){
if (empty($entry->out_time)) {
Notification::make()
->title('Gate In Not Allowed')
->body("Previous gate-out has not been punched. Please complete gate-out first for ID ' . $gatePass . '.")
->warning()
->send();
$this->filters['scan_out_gate_pass_in'] = ''; Notification::make()
return; ->title('Gate Pass Processed')
} ->body('Gate pass has been successfully processed. Visitor marked as exited.')
else{ ->success()
$newEntry = $entry->replicate(); ->send();
$newEntry->in_time = now(); $this->filters['scan_out_gate_pass'] = '';
$newEntry->out_time = null; } else {
$newEntry->save();
Notification::make()
->title('Gate In')
->body('Gate in has been successfully processed. Visitor marked as entered.')
->success()
->send();
$this->filters['scan_out_gate_pass_in'] = '';
}
}
else{
Notification::make()
->title('Visitor Pass Expired')
->body('Your visitor pass validity has expired.')
->danger()
->send();
$this->filters['scan_out_gate_pass_in'] = '';
return;
}
}
else
{
Notification::make() Notification::make()
->title('Invalid Gate Pass') ->title('Invalid Gate Pass')
->body('Scanned gate in pass is not valid.') ->body('The scanned gate pass is not valid. Please try again.')
->danger() ->danger()
->send(); ->send();
return;
}
}
public function processGatePassOut($gatePass)
{
$entry = VisitorEntry::where('register_id', $gatePass)->latest()->first();
if (!$entry) {
Notification::make()
->title('Invalid Gate Pass')
->body('Scanned gate out pass is not valid.')
->danger()
->send();
$this->filters['scan_out_gate_pass_out'] = '';
return;
}
if (empty($entry->valid_upto) || $entry->valid_upto == '' || $entry->valid_upto == null) {
if (!empty($entry->out_time)) {
Notification::make()
->title('Already Exited')
->body('Gate pass has already been processed.')
->warning()
->send();
$this->filters['scan_out_gate_pass_out'] = '';
return;
}
else
{
$entry->out_time = now();
$entry->save();
$employee = EmployeeMaster::find($entry->employee_master_id);
if ($employee && !empty($employee->email)) {
Mail::to($employee->email)
->send(new VisitorOutMail($entry)); // or ->send()
}
else{
\Log::warning('No email found for employee ID: ' . $entry->employee_master_id);
}
Notification::make()
->title('Gate Pass Processed')
->body('Visitor marked as exited.')
->success()
->send();
$this->filters['scan_out_gate_pass_out'] = '';
return;
}
}
elseif ((empty($entry->valid_upto) || $entry->valid_upto != '' || $entry->valid_upto != null))
{
if (Carbon::parse($entry->valid_upto)->endOfDay()->lt(now()))
{
Notification::make()
->title('Visitor Pass Expired')
->body('Your visitor pass validity has expired.')
->danger()
->send();
$this->filters['scan_out_gate_pass_out'] = '';
return;
}
if (!empty($entry->out_time)) {
Notification::make()
->title('Already Exited')
->body('Gate pass has already been processed.')
->warning()
->send();
$this->filters['scan_out_gate_pass_out'] = '';
return;
}
else{
$entry->out_time = now();
$entry->save();
Notification::make()
->title('Gate Out')
->body('Visitor marked as exited.')
->success()
->send();
$this->filters['scan_out_gate_pass_out'] = '';
}
} }
} }

View File

@@ -60,7 +60,6 @@ class AlertMailRuleResource extends Resource
'InvoiceTransit' => 'InvoiceTransit', 'InvoiceTransit' => 'InvoiceTransit',
'ImportTransit' => 'ImportTransit', 'ImportTransit' => 'ImportTransit',
'VehicleReport' => 'VehicleReport', 'VehicleReport' => 'VehicleReport',
'ExportDispatchReport' => 'ExportDispatchReport'
]), ]),
Forms\Components\Select::make('rule_name') Forms\Components\Select::make('rule_name')
->label('Rule Name') ->label('Rule Name')
@@ -74,7 +73,6 @@ class AlertMailRuleResource extends Resource
'InvoiceTransitMail' => 'Invoice Transit Mail', 'InvoiceTransitMail' => 'Invoice Transit Mail',
'ImportTransitMail' => 'Import Transit Mail', 'ImportTransitMail' => 'Import Transit Mail',
'VehicleReportMail' => 'Vehicle Report Mail', 'VehicleReportMail' => 'Vehicle Report Mail',
'ExportDispatchReportMail' => 'Export Dispatch Report Mail'
]) ])
->required(), ->required(),
Forms\Components\TextInput::make('email') Forms\Components\TextInput::make('email')

View File

@@ -285,27 +285,27 @@ class AsrsItemValidationResource extends Resource
$status = $data['status'] ?? 'NotUpdated'; $status = $data['status'] ?? 'NotUpdated';
// 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_code']) && empty($data['uom']) && empty($data['status']) && empty($data['created_from']) && empty($data['created_to'])) { // if (empty($data['Plant']) && empty($data['item_code']) && empty($data['status']) && empty($data['created_from']) && empty($data['created_to'])) {
return $query->whereRaw('1 = 0'); // // return $query->whereRaw('1 = 0');
// $query->where('status', 'NotUpdated'); // $query->where('status', 'NotUpdated');
}
// if (
// empty($data['Plant']) &&
// empty($data['item_code']) &&
// empty($data['uom']) &&
// empty($data['status']) &&
// empty($data['created_from']) &&
// empty($data['created_to'])
// ) {
// // $query->where('status', 'NotUpdated');
// $query->where(function ($q) {
// $q->where('status', 'NotUpdated')
// ->orWhereNull('status')
// ->orWhere('status', '');
// });
// } // }
if (
empty($data['Plant']) &&
empty($data['item_code']) &&
empty($data['uom']) &&
empty($data['status']) &&
empty($data['created_from']) &&
empty($data['created_to'])
) {
// $query->where('status', 'NotUpdated');
$query->where(function ($q) {
$q->where('status', 'NotUpdated')
->orWhereNull('status')
->orWhere('status', '');
});
}
if (! empty($data['Plant'])) { if (! empty($data['Plant'])) {
$query->where('plant_id', $data['Plant']); $query->where('plant_id', $data['Plant']);
} }
@@ -387,12 +387,11 @@ class AsrsItemValidationResource extends Resource
Tables\Actions\ViewAction::make(), Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(), Tables\Actions\EditAction::make(),
// ->hidden(function ($record): bool { // ->hidden(function ($record): bool {
// if (auth()->user()?->hasRole('Super Admin')) { // if (auth()->user()?->hasRole('SuperAdmin')) {
// return false; // return false;
// } // }
// else{
// return trim(($record->status)) == 'Updated'; // return trim(strtolower($record->status)) == 'updated';
// }
// }), // }),
// ->visible(function ($record): bool { // ->visible(function ($record): bool {
// return auth()->user()?->hasRole('SuperAdmin') // return auth()->user()?->hasRole('SuperAdmin')

View File

@@ -11,22 +11,22 @@ use App\Models\Machine;
use App\Models\Plant; use App\Models\Plant;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Forms; use Filament\Forms;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Section; use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Forms\Get; use Filament\Forms\Get;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
use Filament\Tables\Actions\ExportAction; use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction; use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table; use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Str; use Str;
use Filament\Tables\Filters\Filter;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
class ClassCharacteristicResource extends Resource class ClassCharacteristicResource extends Resource
{ {
@@ -974,12 +974,6 @@ class ClassCharacteristicResource 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('zmm_axial_force')
->label('ZMM AXIAL FORCE')
->reactive()
->afterStateUpdated(function (callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('mark_status') Forms\Components\TextInput::make('mark_status')
->label('MARKED STATUS') ->label('MARKED STATUS')
->reactive() ->reactive()
@@ -1820,10 +1814,6 @@ class ClassCharacteristicResource extends Resource
->label('ZMM OPERATING TEMPERATURE') ->label('ZMM OPERATING TEMPERATURE')
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('zmm_axial_force')
->label('ZMM AXIAL FORCE')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('mark_status') Tables\Columns\TextColumn::make('mark_status')
->label('MARKED STATUS') ->label('MARKED STATUS')
->alignCenter() ->alignCenter()

View File

@@ -77,48 +77,42 @@ class GuardPatrolEntryResource extends Resource
]) ])
->hint(fn ($get) => $get('gPePlantError') ? $get('gPePlantError') : null) ->hint(fn ($get) => $get('gPePlantError') ? $get('gPePlantError') : null)
->hintColor('danger'), ->hintColor('danger'),
// Forms\Components\Select::make('guard_name_id') Forms\Components\Select::make('guard_name_id')
// ->label('Guard Name')
// // ->relationship('guardNames', 'name')
// ->options(function (callable $get) {
// $plantId = $get('plant_id');
// if (! $plantId) {
// return [];
// }
// return GuardName::where('plant_id', $plantId)
// ->pluck('name', 'id')
// ->toArray();
// })
// ->required()
// ->reactive()
// ->default(function () {
// return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->guard_name_id;
// })
// ->disabled(fn (Get $get) => ! empty($get('id')))
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
// $guardName = $get('guard_name_id');
// if (! $guardName) {
// $set('gPeGuardNameError', 'Please select a guard name first.');
// return;
// } else {
// $set('patrol_time', now()->format('Y-m-d H:i:s'));
// $set('updated_by', Filament::auth()->user()?->name);
// $set('gPeGuardNameError', null);
// }
// })
// ->extraAttributes(fn ($get) => [
// 'class' => $get('gPeGuardNameError') ? 'border-red-500' : '',
// ])
// ->hint(fn ($get) => $get('gPeGuardNameError') ? $get('gPeGuardNameError') : null)
// ->hintColor('danger'),
Forms\Components\TextInput::make('guard_name')
->label('Guard Name') ->label('Guard Name')
->default(fn () => Filament::auth()->user()?->name) // ->relationship('guardNames', 'name')
->readOnly() ->options(function (callable $get) {
->dehydrated(), $plantId = $get('plant_id');
if (! $plantId) {
return [];
}
return GuardName::where('plant_id', $plantId)
->pluck('name', 'id')
->toArray();
})
->required()
->reactive()
->default(function () {
return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->guard_name_id;
})
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$guardName = $get('guard_name_id');
if (! $guardName) {
$set('gPeGuardNameError', 'Please select a guard name first.');
return;
} else {
$set('patrol_time', now()->format('Y-m-d H:i:s'));
$set('updated_by', Filament::auth()->user()?->name);
$set('gPeGuardNameError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('gPeGuardNameError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('gPeGuardNameError') ? $get('gPeGuardNameError') : null)
->hintColor('danger'),
Forms\Components\Hidden::make('check_point_name')// TextInput Forms\Components\Hidden::make('check_point_name')// TextInput
->label('Check Point Name') ->label('Check Point Name')
->reactive() ->reactive()
@@ -129,88 +123,50 @@ class GuardPatrolEntryResource extends Resource
->extraAttributes([ ->extraAttributes([
'x-on:keydown.enter.prevent' => '$wire.processCheckPointName()', 'x-on:keydown.enter.prevent' => '$wire.processCheckPointName()',
]), ]),
// Forms\Components\Select::make('check_point_name_id') Forms\Components\Select::make('check_point_name_id')
// ->label('Check Point Name')
// // ->relationship('checkPointNames', 'name')
// ->options(function (callable $get) {
// $plantId = $get('plant_id');
// if (! $plantId) {
// return [];
// }
// return CheckPointName::where('plant_id', $plantId)
// ->pluck('name', 'id')
// ->toArray();
// })
// ->required()
// ->reactive()
// // ->default(function () {
// // return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->check_point_name_id;
// // })
// ->disabled(fn (Get $get) => ! empty($get('id')))
// ->afterStateUpdated(function ($state, callable $set, callable $get) {
// $checkPointName = $get('check_point_name_id');
// if (! $checkPointName) {
// $set('check_point_name_id', null);
// $set('gPeCheckPointNameError', 'Please select a check point name first.');
// return;
// } else {
// $set('patrol_time', now()->format('Y-m-d H:i:s'));
// $set('updated_by', Filament::auth()->user()?->name);
// $set('gPeCheckPointNameError', null);
// }
// })
// ->extraAttributes(fn ($get) => [
// 'class' => $get('gPeCheckPointNameError') ? 'border-red-500' : '',
// ])
// ->hint(fn ($get) => $get('gPeCheckPointNameError') ? $get('gPeCheckPointNameError') : null)
// ->hintColor('danger')
// ->rule(function (callable $get) {
// return Rule::unique('guard_patrol_entries', 'check_point_name_id')
// ->where('guard_name_id', $get('guard_name_id'))
// ->where('patrol_time', now())
// ->where('plant_id', $get('plant_id'))
// ->ignore($get('id'));
// }),
Forms\Components\Hidden::make('check_point_name_id')
->dehydrated(true),
Forms\Components\TextInput::make('check_point_name')
->label('Check Point Name') ->label('Check Point Name')
// ->relationship('checkPointNames', 'name')
->options(function (callable $get) {
$plantId = $get('plant_id');
if (! $plantId) {
return [];
}
return CheckPointName::where('plant_id', $plantId)
->pluck('name', 'id')
->toArray();
})
->required() ->required()
->reactive() ->reactive()
// ->default(function () {
// return optional(GuardPatrolEntry::where('created_by', Filament::auth()->user()?->name)->latest()->first())->check_point_name_id;
// })
->disabled(fn (Get $get) => ! empty($get('id'))) ->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) { ->afterStateUpdated(function ($state, callable $set, callable $get) {
$checkPointName = $get('check_point_name_id');
if (blank($state)) { if (! $checkPointName) {
$set('check_point_name_id', null); $set('check_point_name_id', null);
$set('gPeCheckPointNameError', 'Please enter a check point name.'); $set('gPeCheckPointNameError', 'Please select a check point name first.');
return; return;
} else {
$set('patrol_time', now()->format('Y-m-d H:i:s'));
$set('updated_by', Filament::auth()->user()?->name);
$set('gPeCheckPointNameError', null);
} }
$checkPoint = CheckPointName::where('plant_id', $get('plant_id'))
->whereRaw('LOWER(name) = ?', [strtolower(trim($state))])
->first();
if (! $checkPoint) {
$set('check_point_name_id', null);
$set('gPeCheckPointNameError', 'Invalid check point name.');
return;
}
$set('check_point_name_id', $checkPoint->id);
$set('patrol_time', now()->format('Y-m-d H:i:s'));
$set('updated_by', Filament::auth()->user()?->name);
$set('gPeCheckPointNameError', null);
}) })
->extraAttributes(fn ($get) => [ ->extraAttributes(fn ($get) => [
'class' => $get('gPeCheckPointNameError') ? 'border-red-500' : '', 'class' => $get('gPeCheckPointNameError') ? 'border-red-500' : '',
]) ])
->hint(fn ($get) => $get('gPeCheckPointNameError')) ->hint(fn ($get) => $get('gPeCheckPointNameError') ? $get('gPeCheckPointNameError') : null)
->hintColor('danger'), ->hintColor('danger')
->rule(function (callable $get) {
return Rule::unique('guard_patrol_entries', 'check_point_name_id')
->where('guard_name_id', $get('guard_name_id'))
->where('patrol_time', now())
->where('plant_id', $get('plant_id'))
->ignore($get('id'));
}),
Forms\Components\TextInput::make('reader_code') Forms\Components\TextInput::make('reader_code')
->label('Reader Code') ->label('Reader Code')
->hidden(fn (Get $get) => ! $get('id')) ->hidden(fn (Get $get) => ! $get('id'))

View File

@@ -3,10 +3,6 @@
namespace App\Filament\Resources\GuardPatrolEntryResource\Pages; namespace App\Filament\Resources\GuardPatrolEntryResource\Pages;
use App\Filament\Resources\GuardPatrolEntryResource; use App\Filament\Resources\GuardPatrolEntryResource;
use App\Models\CheckPointName;
use App\Models\CheckPointTime;
use App\Models\GuardName;
use App\Models\GuardPatrolEntry;
use Filament\Actions; use Filament\Actions;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Notifications\Notification; use Filament\Notifications\Notification;
@@ -33,100 +29,6 @@ class CreateGuardPatrolEntry extends CreateRecord
// public ?array $data = null; // public ?array $data = null;
protected function mutateFormDataBeforeCreate(array $data): array
{
$guardId = GuardName::where(
'name',
Filament::auth()->user()?->name
)->value('id');
if (! $guardId) {
Notification::make()
->title('Guard Name Not Matched')
->body('Logged-in user name was not found in Guard Name Master.')
->danger()
->send();
$this->halt();
}
$data['guard_name_id'] = $guardId;
$checkPoint = CheckPointName::where('plant_id', $data['plant_id'])
->where('name', trim($data['check_point_name']))
->value('id');
if (! $checkPoint) {
Notification::make()
->title('Invalid Check Point')
->body('The entered check point name does not exist.')
->danger()
->send();
$this->halt();
}
// $lastScan = GuardPatrolEntry::where('plant_id', $data['plant_id'])
// ->where('guard_name_id', $guardId)
// ->latest('id')
// ->first();
// if ($lastScan) {
// $previousPoint = $lastScan->check_point_name_id;
// $route = CheckPointTime::where('plant_id', $data['plant_id'])
// ->where('check_point1_id', $previousPoint)
// ->where('check_point2_id', $checkPoint->id)
// ->first();
// if (! $route) {
// Notification::make()
// ->title('Wrong Check Point Order')
// ->body('This checkpoint is not the next allowed point.')
// ->danger()
// ->send();
// $this->halt();
// }
// } else {
// // First scan must start from sequence 1
// $firstRoute = CheckPointTime::where('plant_id', $data['plant_id'])
// ->where('check_point2_id', $checkPoint->id)
// ->where('sequence_number', 1)
// ->first();
// if (! $firstRoute) {
// Notification::make()
// ->title('Invalid Starting Point')
// ->body('Patrol must start from the first checkpoint.')
// ->danger()
// ->send();
// $this->halt();
// }
// }
$data['check_point_name_id'] = $checkPoint;
unset($data['check_point_name']);
return $data;
}
public function processCheckPointName() public function processCheckPointName()
{ {

View File

@@ -24,10 +24,6 @@ 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 Filament\Tables\Actions\ImportAction;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Tables\Filters\Filter;
use Filament\Forms\Components\TextInput;
// use PhpOffice\PhpSpreadsheet\IOFactory; // use PhpOffice\PhpSpreadsheet\IOFactory;
class ImportTransitResource extends Resource class ImportTransitResource extends Resource
@@ -44,16 +40,16 @@ class ImportTransitResource extends Resource
->schema([ ->schema([
Forms\Components\TextInput::make('cri_rfq_number') Forms\Components\TextInput::make('cri_rfq_number')
->label('CRI/RFQ Number') ->label('CRI/RFQ Number')
->required() ->disabled(fn ($operation) => $operation == 'edit')
->disabled(fn ($operation) => $operation == 'edit'), ->unique(ignoreRecord: true),
Forms\Components\DatePicker::make('mail_received_date') Forms\Components\DatePicker::make('mail_received_date')
->label('Mail Received Date') ->label('Mail Received Date')
->required(), ->required(),
// Forms\Components\TextInput::make('pricol_ref_number') Forms\Components\TextInput::make('pricol_ref_number')
// ->label('Ref Number') ->label('Pricol Ref Number')
// ->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('requester') Forms\Components\TextInput::make('requester')
->label('Requester') ->label('Requester')
->afterStateUpdated(function (callable $set) { ->afterStateUpdated(function (callable $set) {
@@ -79,7 +75,7 @@ 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('inv_value') Forms\Components\DatePicker::make('inv_value')
->label('Inv Value') ->label('Inv Value')
->afterStateUpdated(function (callable $set) { ->afterStateUpdated(function (callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
@@ -99,8 +95,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\TextInput::make('status') Forms\Components\Select::make('status')
->label('Status') ->label('Status')
->options([
'Under Service Provider Finalization' => 'Under Service Provider Finalization',
'Yet to pick up' => 'Yet to pick up',
'Awaiting Vessel Loading' => 'Awaiting Vessel Loading',
'In Transit' => 'In Transit',
'Under Import Customs Clearance in Destination' => 'Under Import Customs Clearance in Destination',
'Delivered' => 'Delivered',
])
->reactive() ->reactive()
->afterStateUpdated(function (callable $set) { ->afterStateUpdated(function (callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
@@ -180,17 +184,8 @@ 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\Select::make('remark') Forms\Components\TextInput::make('remark')
->label('Remark') ->label('Remark')
->options([
'Under Service Provider Finalization' => 'Under Service Provider Finalization',
'Yet to pick up' => 'Yet to pick up',
'Awaiting Vessel Loading' => 'Awaiting Vessel Loading',
'In Transit' => 'In Transit',
'Under Import Customs Clearance in Destination' => 'Under Import Customs Clearance in Destination',
'Delivered' => 'Delivered',
])
->reactive()
->afterStateUpdated(function (callable $set) { ->afterStateUpdated(function (callable $set) {
$set('updated_by', Filament::auth()->user()?->name); $set('updated_by', Filament::auth()->user()?->name);
}), }),
@@ -225,158 +220,128 @@ class ImportTransitResource extends Resource
}), }),
Tables\Columns\TextColumn::make('cri_rfq_number') Tables\Columns\TextColumn::make('cri_rfq_number')
->label('CRI/RFQ Number') ->label('CRI/RFQ Number')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('mail_received_date') Tables\Columns\TextColumn::make('mail_received_date')
->label('Mail Received Date') ->label('Mail Received Date')
->searchable()
->date() ->date()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('pricol_ref_number') Tables\Columns\TextColumn::make('pricol_ref_number')
->label('Ref Number') ->label('Pricol Ref Number')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('requester') Tables\Columns\TextColumn::make('requester')
->label('Requester') ->label('Requester')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('shipper') Tables\Columns\TextColumn::make('shipper')
->label('Shipper') ->label('Shipper')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('shipper_location') Tables\Columns\TextColumn::make('shipper_location')
->label('Shipper Location') ->label('Shipper Location')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('shipper_invoice') Tables\Columns\TextColumn::make('shipper_invoice')
->label('Shipper Invoice') ->label('Shipper Invoice')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('shipper_invoice_date') Tables\Columns\TextColumn::make('shipper_invoice_date')
->label('Shipper Invoice Date') ->label('Shipper Invoice Date')
->searchable()
->date() ->date()
->formatStateUsing(fn ($state) => $state?->format('Y-m-d')) ->formatStateUsing(fn ($state) => $state?->format('Y-m-d'))
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('inv_value') Tables\Columns\TextColumn::make('inv_value')
->label('Inv Value') ->label('Inv Value')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('freight_charge') Tables\Columns\TextColumn::make('freight_charge')
->label('Freight Charge') ->label('Freight Charge')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('customs_agent_name') Tables\Columns\TextColumn::make('customs_agent_name')
->label('Customs Agent Name') ->label('Customs Agent Name')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('eta_date') Tables\Columns\TextColumn::make('eta_date')
->label('ETA Date') ->label('ETA Date')
->searchable()
->date() ->date()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('status') Tables\Columns\TextColumn::make('status')
->label('Status') ->label('Status')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('insurance_status') Tables\Columns\TextColumn::make('insurance_status')
->label('Insurance Status') ->label('Insurance Status')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('delivery_location') Tables\Columns\TextColumn::make('delivery_location')
->label('Delivery Location') ->label('Delivery Location')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('etd_date') Tables\Columns\TextColumn::make('etd_date')
->label('ETD Date') ->label('ETD Date')
->searchable()
->date() ->date()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('mode') Tables\Columns\TextColumn::make('mode')
->label('Mode') ->label('Mode')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('inco_terms') Tables\Columns\TextColumn::make('inco_terms')
->label('Inco Terms') ->label('Inco Terms')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('port_of_loading') Tables\Columns\TextColumn::make('port_of_loading')
->label('Port of Loading') ->label('Port of Loading')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('port_of_discharge') Tables\Columns\TextColumn::make('port_of_discharge')
->label('Port of Discharge') ->label('Port of Discharge')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('delivery_city') Tables\Columns\TextColumn::make('delivery_city')
->label('Delivery City') ->label('Delivery City')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('packages') Tables\Columns\TextColumn::make('packages')
->label('Packages') ->label('Packages')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('type_of_package') Tables\Columns\TextColumn::make('type_of_package')
->label('Type of Package') ->label('Type of Package')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('gross_weight') Tables\Columns\TextColumn::make('gross_weight')
->label('Gross Weight') ->label('Gross Weight')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('volume') Tables\Columns\TextColumn::make('volume')
->label('Volume') ->label('Volume')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('bill_number') Tables\Columns\TextColumn::make('bill_number')
->label('Bill Number') ->label('Bill Number')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('bill_received_date') Tables\Columns\TextColumn::make('bill_received_date')
->label('Bill Received Date') ->label('Bill Received Date')
->searchable()
->alignCenter() ->alignCenter()
->date() ->date()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('vessel_number') Tables\Columns\TextColumn::make('vessel_number')
->label('Vessel Number') ->label('Vessel Number')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('remark') Tables\Columns\TextColumn::make('remark')
->label('Remark') ->label('Remark')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('is_transit_identified') Tables\Columns\TextColumn::make('is_transit_identified')
->label('Is Transit Identified') ->label('Is Transit Identified')
->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('created_at') Tables\Columns\TextColumn::make('created_at')
@@ -407,100 +372,7 @@ class ImportTransitResource extends Resource
]) ])
->filters([ ->filters([
Tables\Filters\TrashedFilter::make(), Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters')
->label('Advanced Filters')
->form([
TextInput::make('cri_rfq_number')
->label('CRI RFQ Number')
->reactive()
->placeholder('Enter Rfq Number')
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('created_from', null);
$set('created_to', null);
}),
TextInput::make('status')
->label('Status')
->reactive()
->placeholder('Enter Status')
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('created_from', null);
$set('created_to', null);
}),
Select::make('is_transit_identified')
->label('Is Transit Identified')
->reactive()
->options([
0 => 0,
1 => 1,
])
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('created_from', null);
$set('created_to', null);
}),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder(placeholder: 'Select From DateTime')
->reactive()
->native(false),
DateTimePicker::make('created_to')
->label('Created To')
->placeholder(placeholder: 'Select To DateTime')
->reactive()
->native(false),
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['cri_rfq_number']) && empty($data['status']) && ! isset($data['is_transit_identified']) && empty($data['created_from']) && empty($data['created_to'])) {
return $query;
}
if (! empty($data['cri_rfq_number'])) {
$query->where('cri_rfq_number', 'like', '%'.$data['cri_rfq_number'].'%');
}
if (! empty($data['status'])) {
$query->where('status', 'like', '%'.$data['status'].'%');
}
if (isset($data['is_transit_identified'])) {
$query->where('is_transit_identified', $data['is_transit_identified']);
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (! empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
})
->indicateUsing(function (array $data) {
$indicators = [];
if (! empty($data['cri_rfq_number'])) {
$indicators[] = 'CRI Rfq Number: '.$data['cri_rfq_number'];
}
if (! empty($data['status'])) {
$indicators[] = 'Status: '.$data['status'];
}
if (isset($data['is_transit_identified'])) {
$indicators[] = 'Is Transit Identified: '.$data['is_transit_identified'];
}
if (! empty($data['created_from'])) {
$indicators[] = 'From: '.$data['created_from'];
}
if (! empty($data['created_to'])) {
$indicators[] = 'To: '.$data['created_to'];
}
return $indicators;
}),
]) ])
->filtersFormMaxHeight('280px')
->actions([ ->actions([
Tables\Actions\ViewAction::make(), Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(), Tables\Actions\EditAction::make(),

File diff suppressed because it is too large Load Diff

View File

@@ -611,7 +611,6 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id, 'sticker_master_id' => $sticker->id,
'plant_id' => $plantId, 'plant_id' => $plantId,
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'invoice_quantity' => 1,
'quantity' => 1, 'quantity' => 1,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName, 'created_by' => $operatorName,
@@ -654,7 +653,6 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id, 'sticker_master_id' => $sticker->id,
'plant_id' => $plantId, 'plant_id' => $plantId,
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'invoice_quantity' => $bundleQty,
'quantity' => $bundleQty, 'quantity' => $bundleQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName, 'created_by' => $operatorName,
@@ -699,13 +697,11 @@ class CreateInvoiceValidation extends CreateRecord
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0 // 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
// 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0 // 8 = 3 + 5 // 8 = 5 + 3 // 8 = 0 + 8 // 8 = 8 + 0
// 0 = 0 + 0 // 0 = 0 + 0
// 4 = 1.5 + 2.5
$existQty = $existEmpQty + $existComQty; $existQty = $existEmpQty + $existComQty;
// 8 <= 11 // 8 <= 8 // 8 <= 11 // 8 <= 9 // 8 <= 11 // 8 <= 8 // 8 <= 11 // 8 <= 9
// 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7 // 8 <= 7
// 0 <= 5 // 0 <= 5
// 4 <= 2
if ($existQty <= $totalExcelQty) { if ($existQty <= $totalExcelQty) {
// 6 = 11 - 5 // 5 = 8 - 3 // 3 = 11 - 8 // 9 = 9 - 0 // 6 = 11 - 5 // 5 = 8 - 3 // 3 = 11 - 8 // 9 = 9 - 0
@@ -727,46 +723,29 @@ class CreateInvoiceValidation extends CreateRecord
'updated_by' => $operatorName, 'updated_by' => $operatorName,
'updated_at' => now(), 'updated_at' => now(),
]); ]);
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
->update([
'invoice_quantity' => $totalExcelQty,
]);
$newQuan--; $newQuan--;
$inserted++; $inserted++;
} elseif ($newInsQty > 0) { // if ($sticker) // create } elseif ($newInsQty > 0) { // if ($sticker) // create
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
->update([
'invoice_quantity' => $totalExcelQty,
]);
InvoiceValidation::create([ InvoiceValidation::create([
'sticker_master_id' => $sticker->id, 'sticker_master_id' => $sticker->id,
'plant_id' => $plantId, 'plant_id' => $plantId,
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'invoice_quantity' => $totalExcelQty,
'quantity' => $newInsQty, 'quantity' => $newInsQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName, 'created_by' => $operatorName,
'updated_by' => $operatorName, 'updated_by' => $operatorName,
]); ]);
$inserted++; $inserted++;
} }
} }
// 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7 // 8 > 7
// 4 > 2
else { else {
// 2 = 7 - 5 // 4 = 7 - 3 // -1 = 7 - 8 // 7 = 7 - 0 // 2 = 7 - 5 // 4 = 7 - 3 // -1 = 7 - 8 // 7 = 7 - 0
// -0.5 = 2 - 2.5 //
$newInsQty = $totalExcelQty - $existComQty; $newInsQty = $totalExcelQty - $existComQty;
// 3 > 0 // 5 > 0 // 0 > 0 // 8 > 0 // 3 > 0 // 5 > 0 // 0 > 0 // 8 > 0
// 1.5 > 0 // if ($existEmpQty > 0) { // update
if ($newInsQty > 0 && $existEmpQty > 0) { // update
// 3 = 2 // 5 = 4 // 0 = -1 // 8 = 7 // 3 = 2 // 5 = 4 // 0 = -1 // 8 = 7
// 1.5 == -0.5 //
if ($existEmpQty == $newInsQty) { if ($existEmpQty == $newInsQty) {
continue; continue;
} }
@@ -777,12 +756,6 @@ class CreateInvoiceValidation extends CreateRecord
'updated_by' => $operatorName, 'updated_by' => $operatorName,
'updated_at' => now(), 'updated_at' => now(),
]); ]);
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
->update([
'invoice_quantity' => $totalExcelQty,
]);
$newQuan--; $newQuan--;
$inserted++; $inserted++;
} elseif ($newInsQty > 0) { // create } elseif ($newInsQty > 0) { // create
@@ -790,18 +763,11 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id, 'sticker_master_id' => $sticker->id,
'plant_id' => $plantId, 'plant_id' => $plantId,
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'invoice_quantity' => $totalExcelQty,
'quantity' => $newInsQty, 'quantity' => $newInsQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName, 'created_by' => $operatorName,
'updated_by' => $operatorName, 'updated_by' => $operatorName,
]); ]);
InvoiceValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->where('sticker_master_id', $sticker->id)
->update([
'invoice_quantity' => $totalExcelQty,
]);
$inserted++; $inserted++;
} }
} }
@@ -1825,7 +1791,6 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id, 'sticker_master_id' => $sticker->id,
'plant_id' => $plantId, 'plant_id' => $plantId,
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'invoice_quantity' => 1,
'quantity' => 1, 'quantity' => 1,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName, 'created_by' => $operatorName,
@@ -1861,7 +1826,6 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id, 'sticker_master_id' => $sticker->id,
'plant_id' => $plantId, 'plant_id' => $plantId,
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'invoice_quantity' => $bundleQty,
'quantity' => $bundleQty, 'quantity' => $bundleQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName, 'created_by' => $operatorName,
@@ -1895,7 +1859,6 @@ class CreateInvoiceValidation extends CreateRecord
'sticker_master_id' => $sticker->id, 'sticker_master_id' => $sticker->id,
'plant_id' => $plantId, 'plant_id' => $plantId,
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'invoice_quantity' => $totalExcelQty,
'quantity' => $totalExcelQty, 'quantity' => $totalExcelQty,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
'created_by' => $operatorName, 'created_by' => $operatorName,
@@ -3384,7 +3347,6 @@ class CreateInvoiceValidation extends CreateRecord
$createdDt = $record->created_at; $createdDt = $record->created_at;
$stickMasterId = $record->sticker_master_id; $stickMasterId = $record->sticker_master_id;
$curExistQty = $record->quantity; $curExistQty = $record->quantity;
$curItemInvQty = $record->invoice_quantity;
// $curScanQty = 2; // $curScanQty = 2;
if ($curExistQty > $curScanQty) { // 5 > 2 if ($curExistQty > $curScanQty) { // 5 > 2
@@ -3400,7 +3362,6 @@ class CreateInvoiceValidation extends CreateRecord
'invoice_number' => $invoiceNumber, 'invoice_number' => $invoiceNumber,
'serial_number' => $serialNumber, 'serial_number' => $serialNumber,
'batch_number' => $batchNumber, 'batch_number' => $batchNumber,
'invoice_quantity' => $curItemInvQty,
'quantity' => $curScanQty, 'quantity' => $curScanQty,
'created_at' => $createdDt, 'created_at' => $createdDt,
'operator_id' => $operatorName, 'operator_id' => $operatorName,
@@ -3584,7 +3545,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false); $this->dispatch('refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId, onCapFocus: false);
} }
// TN01/BOX22/SERIAL999 >> PANEL BOX QR
// /^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/ // /^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/', $serNo, $matches)) { if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPpCc])?\|?$/', $serNo, $matches)) {
Notification::make() Notification::make()

View File

@@ -6,7 +6,6 @@ use App\Filament\Exports\LineExporter;
use App\Filament\Imports\LineImporter; use App\Filament\Imports\LineImporter;
use App\Filament\Resources\LineResource\Pages; use App\Filament\Resources\LineResource\Pages;
use App\Models\Block; use App\Models\Block;
use App\Models\Item;
use App\Models\Line; use App\Models\Line;
use App\Models\Plant; use App\Models\Plant;
use App\Models\WorkGroupMaster; use App\Models\WorkGroupMaster;
@@ -25,11 +24,6 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\Unique; use Illuminate\Validation\Rules\Unique;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Tables\Filters\Filter;
class LineResource extends Resource class LineResource extends Resource
{ {
@@ -1190,207 +1184,7 @@ class LineResource extends Resource
]) ])
->filters([ ->filters([
Tables\Filters\TrashedFilter::make(), Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters')
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Search by Plant Name')
->nullable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('items', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id')->toArray();
}
})
->searchable()
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('code', null);
$set('operator_id', null);
}),
Select::make('name')
->label('Search by Line Name')
->nullable()
->options(function (callable $get) {
$plantId = $get('Plant');
return $plantId ? Line::where('plant_id', $plantId)->pluck('name', 'id') : [];
})
->searchable()
->reactive(),
Select::make('type')
->label('Search by Line Type')
->nullable()
->options(function (callable $get) {
$plantId = $get('Plant');
return $plantId ? Line::where('plant_id', $plantId)->distinct()->pluck('type', 'type')->toArray(): [];
})
->searchable()
->reactive(),
Select::make('work_group_id')
->label('Search by WorkGroupCenter')
->nullable()
->options(function (callable $get) {
$plantId = $get('Plant');
$workGroupIds = Line::where('plant_id', $plantId)
->get([
'work_group1_id',
'work_group2_id',
'work_group3_id',
'work_group4_id',
'work_group5_id',
'work_group6_id',
'work_group7_id',
'work_group8_id',
'work_group9_id',
'work_group10_id',
])
->flatMap(function ($line) {
return [
$line->work_group1_id,
$line->work_group2_id,
$line->work_group3_id,
$line->work_group4_id,
$line->work_group5_id,
$line->work_group6_id,
$line->work_group7_id,
$line->work_group8_id,
$line->work_group9_id,
$line->work_group10_id,
];
})
->filter()
->unique()
->values()
->toArray();
return WorkGroupMaster::whereIn('id', $workGroupIds)
->pluck('name', 'id')
->toArray();
})
->searchable()
->reactive(),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder(placeholder: 'Select From DateTime')
->reactive()
->native(false),
DateTimePicker::make('created_to')
->label('Created To')
->placeholder(placeholder: 'Select To DateTime')
->reactive()
->native(false),
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['name']) && empty($data['type']) && empty($data['work_group_id']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_from']) && empty($data['updated_to'])) {
// return $query->whereRaw('1 = 0');
}
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
$query->where('plant_id', $data['Plant']);
} else {
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return $query->whereRaw('1 = 0');
}
}
if (! empty($data['name'])) {
$query->where('id', $data['name']);
}
if (! empty($data['type'])) {
$query->where('type', $data['type']);
}
// if (! empty($data['work_group_id'])) {
// $query->where('name', $data['work_group_id']);
// }
if (! empty($data['work_group_id'])) {
$query->where(function ($q) use ($data) {
$q->where('work_group1_id', $data['work_group_id'])
->orWhere('work_group2_id', $data['work_group_id'])
->orWhere('work_group3_id', $data['work_group_id'])
->orWhere('work_group4_id', $data['work_group_id'])
->orWhere('work_group5_id', $data['work_group_id'])
->orWhere('work_group6_id', $data['work_group_id'])
->orWhere('work_group7_id', $data['work_group_id'])
->orWhere('work_group8_id', $data['work_group_id'])
->orWhere('work_group9_id', $data['work_group_id'])
->orWhere('work_group10_id', $data['work_group_id']);
});
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (! empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
})
->indicateUsing(function (array $data) {
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return 'Plant: Choose plant to filter records.';
}
}
if (! empty($data['name'])) {
$indicators[] = 'Line Name: '.Line::where('id', $data['name'])->value('name');
}
if (! empty($data['type'])) {
$indicators[] = 'Line Type: '.Line::where('type', $data['type'])->value('type');
}
if (! empty($data['work_group_id'])) {
$indicators[] = 'Work Group: ' .
WorkGroupMaster::where('id', $data['work_group_id'])->value('name');
}
if (! empty($data['created_from'])) {
$indicators[] = 'From: '.$data['created_from'];
}
if (! empty($data['created_to'])) {
$indicators[] = 'To: '.$data['created_to'];
}
if (! empty($data['updated_from'])) {
$indicators[] = 'From: '.$data['updated_from'];
}
if (! empty($data['updated_to'])) {
$indicators[] = 'To: '.$data['updated_to'];
}
return $indicators;
}),
]) ])
->filtersFormMaxHeight('280px')
->actions([ ->actions([
Tables\Actions\ViewAction::make(), Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(), Tables\Actions\EditAction::make(),

View File

@@ -23,11 +23,6 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Str; use Str;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Tables\Filters\Filter;
class MachineResource extends Resource class MachineResource extends Resource
{ {
@@ -254,177 +249,7 @@ class MachineResource extends Resource
]) ])
->filters([ ->filters([
Tables\Filters\TrashedFilter::make(), Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters')
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Search by Plant Name')
->nullable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('machines', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id')->toArray();
}
})
->searchable()
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('code', null);
$set('operator_id', null);
}),
Select::make('Line')
->label('Search by Line')
->searchable()
->options(function (callable $get) {
$plantId = $get('Plant');
if (empty($plantId)) {
return [];
}
return Line::whereHas('machines', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('name', 'id');
})
->searchable()
->reactive(),
TextInput::make('name')
->label('Description')
->reactive(),
Select::make('work_group_master')
->label('Search by Work Group Center')
->options(function (callable $get) {
$plantId = $get('Plant');
return WorkGroupMaster::whereHas('machines', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})
->pluck('name', 'id')
->toArray();
})
->searchable()
->reactive(),
Select::make('work_center')
->label('Search by Work Center')
->options(function (callable $get) {
$plantId = $get('Plant');
$workGroupMasterId = $get('work_group_master');
if (!$workGroupMasterId) {
return [];
}
return Machine::query()
->when($plantId, fn ($q) => $q->where('plant_id', $plantId))
->where('work_group_master_id', $workGroupMasterId)
->pluck('work_center', 'work_center')
->toArray();
})
->searchable()
->reactive(),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder(placeholder: 'Select From DateTime')
->reactive()
->native(false),
DateTimePicker::make('created_to')
->label('Created To')
->placeholder(placeholder: 'Select To DateTime')
->reactive()
->native(false),
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['Line']) && empty($data['name']) && empty($data['work_group_master']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_from']) && empty($data['updated_to'])) {
// return $query->whereRaw('1 = 0');
}
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
$query->where('plant_id', $data['Plant']);
} else {
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return $query->whereRaw('1 = 0');
}
}
if (! empty($data['Line'])) {
$query->where('line_id', $data['Line']);
}
if (! empty($data['name'])) {
$query->where('name', $data['name']);
}
if (! empty($data['work_group_master'])) {
$query->where('work_group_master_id', $data['work_group_master']);
}
if (! empty($data['work_center'])) {
$query->where('work_center', $data['work_center']);
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (! empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
})
->indicateUsing(function (array $data) {
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return 'Plant: Choose plant to filter records.';
}
}
if (! empty($data['Line'])) {
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
}
if (! empty($data['name'])) {
$indicators[] = 'Description: ' . $data['name'];
}
if (! empty($data['work_group_master'])) {
$indicators[] = 'Work Group Center: '.WorkGroupMaster::where('id', $data['work_group_master'])->value('name');
}
if (! empty($data['work_center'])) {
$indicators[] = 'Work Center: '.Machine::where('work_center', $data['work_center'])->value('work_center');
}
if (! empty($data['created_from'])) {
$indicators[] = 'From: '.$data['created_from'];
}
if (! empty($data['created_to'])) {
$indicators[] = 'To: '.$data['created_to'];
}
return $indicators;
}),
]) ])
->filtersFormMaxHeight('280px')
->actions([ ->actions([
Tables\Actions\ViewAction::make(), Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(), Tables\Actions\EditAction::make(),

File diff suppressed because it is too large Load Diff

View File

@@ -1,269 +0,0 @@
<?php
namespace App\Filament\Resources\PanelBoxValidationResource\Pages;
use App\Filament\Resources\PanelBoxValidationResource;
use App\Models\ProductCharacteristicsMaster;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Illuminate\Validation\ValidationException;
class CreatePanelBoxValidation extends CreateRecord {
protected static string $resource = PanelBoxValidationResource::class;
public $showChecklist = false;
public $checklist;
public $skipChecklistValidation = false;
public bool $shouldSkipChecklist = false;
public $existingRecords = [];
protected $listeners = [
'checklistUpdated' => 'setChecklist',
'checklist-cancelled' => 'handleChecklistCancel',
'checklist-saved' => 'checkListSaved',
];
public function setChecklist($checklist)
{
$this->data['checklist'] = $checklist;
}
public function doCreate()
{
$this->create();
}
public function mount(): void
{
parent::mount();
session()->forget([
'last_selected_plant_id',
'last_selected_line',
'last_selected_production',
]);
}
public function handleChecklistCancel()
{
$this->skipChecklistValidation = true;
$this->showChecklist = false;
}
protected function mutateFormDataBeforeCreate(array $data): array
{
// if ($this->shouldSkipChecklist) {
// return $data;
// }
if ($this->checkIfHasCharacteristics($data)) {
$this->showChecklist = true;
$this->halt();
}
return $data;
}
protected function checkIfHasCharacteristics(array $data)
{
$plantId = $data['plant_id'] ?? null;
$itemCode = $data['item_id'] ?? null;
$lineId = $data['line_id'] ?? null;
if (!$plantId || !$itemCode || !$lineId) {
return false;
}
$item = \App\Models\Item::where('code', $itemCode)
->where('plant_id', $plantId)
->first();
$categoryName = trim($item->category) ?? null;
if (!$item) {
$this->existingRecords = collect();
return false;
}
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
->where('category', $categoryName)
->where('line_id', $lineId)
->get();
return $this->existingRecords->isNotEmpty();
}
public function checkListSaved()
{
$this->showChecklist = false;
$plantId = $this->data['plant_id'] ?? null;
$lineId = $this->data['line_id'] ?? null;
$productionOrder = $this->data['production_order'] ?? null;
return redirect()->to(
static::getResource()::getUrl('create', [
'plant_id' => $this->data['plant_id'] ?? null,
'line_id' => $this->data['line_id'] ?? null,
'production_order' => $this->data['production_order'] ?? null,
])
);
}
protected function beforeCreate(): void
{
$errors = [];
if (!empty($this->data['validationError'])) {
$errors['validationError'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['serialPanelError'])) {
$errors['serialPanelError'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['packSlipPanelError'])) {
$errors['packSlipPanelError'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['namePlatePanelError'])) {
$errors['namePlatePanelError'] = ['Fix the errors before submitting.'];
}
//..name plate
if (!empty($this->data['tubeStickerPanelError'])) {
$errors['tubeStickerPanelError'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['warrantyCardPanelError'])) {
$errors['warrantyCardPanelError'] = ['Fix the errors before submitting.'];
}
//..part validations
if (!empty($this->data['part_validation1_error'])) {
$errors['part_validation1_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['part_validation2_error'])) {
$errors['part_validation2_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['part_validation3_error'])) {
$errors['part_validation3_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['part_validation4_error'])) {
$errors['part_validation4_error'] = ['Fix the errors before submitting.'];
}
if (!empty($this->data['part_validation5_error'])) {
$errors['part_validation5_error'] = ['Fix the errors before submitting.'];
}
if (!empty($errors)) {
throw ValidationException::withMessages($errors);
}
$this->checkExisting();
$checklist = $this->data['data']['checklist'] ?? [];
if (count($this->existingRecords) > 0){
$this->showChecklist = true;
$this->halt();
}
else{
$this->showChecklist = false;
}
}
public function checkExisting()
{
$plant_id = $this->data['plant_id'] ?? null;
$item_code = $this->data['item_id'] ?? null;
$line_id = $this->data['line_id'] ?? null;
$item = \App\Models\Item::where('code', $item_code)->where('plant_id', $plant_id)->first();
if (!$item) {
$this->existingRecords = collect();
return;
}
// $item_id = $item->id;
$categoryName = trim($item->category) ?? null;
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plant_id)
->where('category', $categoryName)
->where('line_id', $line_id)
->get();
}
protected function afterCreate(): void
{
// Get the value from the hidden field 'plant'
$plant = $this->form->getState()['plant'] ?? null;
$line = $this->form->getState()['line'] ?? null;
$production = $this->form->getState()['production'] ?? null;
// $this->skipChecklistValidation = false;
// $this->showChecklist = false;
// $this->checklist = [];
// $this->form->fill();
// reset checklist
$this->checklist = [];
$this->skipChecklistValidation = false;
$this->showChecklist = false;
$this->form->fill([]);
$this->data = [];
$this->resetValidation();
$this->resetErrorBag();
$this->form->fill([
'plant_id' => null,
'line_id' => null,
'production_order' => null,
]);
// $this->dispatch('focus-item-id');
session()->flash('focus_item_id_after_redirect', true);
logger('Focus flag set in session');
if ($plant) {
session(['last_selected_plant_id' => $plant]);
}
if ($line) {
session(['last_selected_line' => $line]);
}
if ($production) {
session(['last_selected_production' => $production]);
}
}
protected function getRedirectUrl(): string
{
//return $this->getResource()::getUrl('create'); // Stay on Create Page after savin
return $this->getResource()::getUrl('create', [
'plant_id' => $this->data['plant_id'] ?? null,
'line_id' => $this->data['line_id'] ?? null,
'production_order' => $this->data['production_order'] ?? null,
]);
}
}

View File

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

View File

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

View File

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

View File

@@ -253,9 +253,9 @@ class ProductionCharacteristicResource extends Resource
->label('Spec. Value') ->label('Spec. Value')
// ->searchable() // ->searchable()
->formatStateUsing(function ($record) { ->formatStateUsing(function ($record) {
$specVal = ProductCharacteristicsMaster::where('plant_id', $record->plant_id)->where('item_id', $record->item_id)->where('line_id', $record->line_id)->where('machine_id', $record->machine_id)->where('name', $record->characteristic_name)->first(); $specVal = ProductCharacteristicsMaster::where('plant_id', $record->plant_id)->where('item_id', $record->item_id)->where('line_id', $record->line_id)->where('machine_id', $record->machine_id)->first();
// return $record?->plant_id.'-'.$record?->item_id.'-'.$record->line_id.'-'.$record?->machine_id;
// return $record?->plant_id.'-'.$record?->item_id.'-'.$record->line_id.'-'.$record?->machine_id;
return $specVal?->lower.' - '.$specVal?->upper; return $specVal?->lower.' - '.$specVal?->upper;
}) })
->alignCenter() ->alignCenter()
@@ -276,7 +276,7 @@ class ProductionCharacteristicResource extends Resource
'Not Ok' => 'danger', 'Not Ok' => 'danger',
'NotOk' => 'danger', 'NotOk' => 'danger',
'ConditionallyAccepted' => 'success', 'ConditionallyAccepted' => 'success',
default => 'black', default => 'gray',
}) })
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),

View File

@@ -3507,17 +3507,6 @@ class QualityValidationResource extends Resource
return; return;
} }
if (strpos($state, '|') !== false) {
$state = explode('|', $state)[0];
if ($state != $expectedValue){
$set('part_validation1_error', 'Invalid input for part validation 1.');
}
else{
$set('part_validation1', $state);
$set('part_validation1_error', null);
}
}
if ($state == $expectedValue) { if ($state == $expectedValue) {
$set('part_validation1_error', null); $set('part_validation1_error', null);
} else { } else {
@@ -3529,80 +3518,14 @@ class QualityValidationResource extends Resource
$mPlantName = $mailData['plant_name']; $mPlantName = $mailData['plant_name'];
$emails = $mailData['emails']; $emails = $mailData['emails'];
$ccEmails = $mailData['cc_emails'] ?? [];
$mUserName = Filament::auth()->user()->name; $mUserName = Filament::auth()->user()->name;
// if (! empty($emails)) { if (! empty($emails)) {
// if (is_array($emails)) { // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
// $emailList = collect($emails) Mail::to($emails)->send(
// ->flatMap(fn ($email) => explode(',', $email)) new InvalidQualityMail($state, $mPorder, $mPlantName, $mLinePart, $mUserName, $mExpectedValue, 'InvalidPartNumber')
// ->map(fn ($email) => trim($email)) );
// ->filter() } else {
// ->toArray();
// } else {
// $emailList = array_map('trim', explode(',', $emails));
// }
// $ccList = [];
// if (!empty($cc_emails)) {
// if (is_array($cc_emails)) {
// $ccList = collect($cc_emails)
// ->flatMap(fn ($email) => explode(',', $email))
// ->map(fn ($email) => trim($email))
// ->filter()
// ->toArray();
// } else {
// $ccList = collect(explode(',', $cc_emails))
// ->map(fn ($email) => trim($email))
// ->filter()
// ->toArray();
// }
// }
// Mail::to($emailList)
// ->cc($ccList)
// ->send(
// new InvalidQualityMail(
// $state,
// $mPorder,
// $mPlantName,
// $mLinePart,
// $mUserName,
// $mExpectedValue,
// 'InvalidPartNumber'
// )
// );
// }
if (!empty($emails)) {
$emailList = collect(is_array($emails) ? $emails : explode(',', $emails))
->flatMap(fn ($email) => explode(',', $email))
->map(fn ($email) => trim($email))
->filter()
->toArray();
$ccList = collect(is_array($ccEmails) ? $ccEmails : explode(',', $ccEmails))
->flatMap(fn ($email) => explode(',', $email))
->map(fn ($email) => trim($email))
->filter()
->toArray();
Mail::to($emailList)
->cc($ccList)
->send(
new InvalidQualityMail(
$state,
$mPorder,
$mPlantName,
$mLinePart,
$mUserName,
$mExpectedValue,
'InvalidPartNumber'
)
);
}
else {
\Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial."); \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
} }
$set('part_validation1', null); $set('part_validation1', null);
@@ -4044,7 +3967,6 @@ class QualityValidationResource extends Resource
->where('module', 'QualityValidation') ->where('module', 'QualityValidation')
->where('rule_name', 'QualityMail') ->where('rule_name', 'QualityMail')
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', '')) ->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
// ->get()
->pluck('email') ->pluck('email')
->toArray(); ->toArray();
@@ -4062,16 +3984,13 @@ class QualityValidationResource extends Resource
->where('module', 'QualityValidation') ->where('module', 'QualityValidation')
->where('rule_name', 'QualityMail') ->where('rule_name', 'QualityMail')
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', '')) ->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
->get(['email', 'cc_emails']); ->pluck('email')
// ->pluck('email') ->toArray();
// ->toArray();
return [ return [
'plant_id' => $plantId, 'plant_id' => $plantId,
'plant_name' => $mPlantName, 'plant_name' => $mPlantName,
'emails' => $emails->pluck('email')->filter()->toArray(), 'emails' => $emails,
'cc_emails' => $emails->pluck('cc_emails')->filter()->toArray(),
// 'emails' => $emails,
]; ];
} }

View File

@@ -540,15 +540,8 @@ class StickerMasterResource extends Resource
->alignCenter() ->alignCenter()
->sortable() ->sortable()
->searchable(), ->searchable(),
Tables\Columns\TextColumn::make('item.category')
->label('Category')
->default('-')
->alignCenter()
->sortable()
->searchable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('item.description') Tables\Columns\TextColumn::make('item.description')
->label('Description') ->label('Item Description')
->alignCenter() ->alignCenter()
->sortable() ->sortable()
->searchable() ->searchable()

View File

@@ -973,12 +973,6 @@ class TempClassCharacteristicResource 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('zmm_axial_force')
->label('ZMM AXIAL FORCE')
->reactive()
->afterStateUpdated(function (callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('winded_serial_number') Forms\Components\TextInput::make('winded_serial_number')
->label('WINDED SERIAL NUMBER') ->label('WINDED SERIAL NUMBER')
->reactive() ->reactive()
@@ -1590,10 +1584,6 @@ class TempClassCharacteristicResource extends Resource
->label('ZMM OPERATING TEMPERATURE') ->label('ZMM OPERATING TEMPERATURE')
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('zmm_axial_force')
->label('ZMM AXIAL FORCE')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('winded_serial_number') Tables\Columns\TextColumn::make('winded_serial_number')
->label('WINDED SERIAL NUMBER') ->label('WINDED SERIAL NUMBER')
->alignCenter() ->alignCenter()

View File

@@ -813,7 +813,7 @@ class TestingPanelReadingResource extends Resource
if ($plantId) { if ($plantId) {
return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) { return MotorTestingMaster::whereHas('testingPanelReadings', function ($query) {
$query->whereNotNull('id'); $query->whereNotNull('id');
})->whereNotNull('subassembly_code')->orderBy('subassembly_code')->pluck('subassembly_code', 'id'); })->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
} else { } else {
return []; return [];
// return Item::whereHas('motorTestingMasters') // return Item::whereHas('motorTestingMasters')

View File

@@ -187,15 +187,6 @@ class VisitorEntryResource extends Resource
->numeric() ->numeric()
->default(1) ->default(1)
->required(), ->required(),
Forms\Components\Select::make('mode_of_travel')
->label('Mode of Travel')
->options([
'Rental' => 'Rental',
'Car' => 'Car',
'Bike' => 'Bike',
])
->reactive()
->placeholder('Select Mode of Travel'),
Forms\Components\DateTimePicker::make('in_time') Forms\Components\DateTimePicker::make('in_time')
->label('In Time') ->label('In Time')
->required() ->required()
@@ -223,7 +214,6 @@ class VisitorEntryResource extends Resource
public static function table(Table $table): Table public static function table(Table $table): Table
{ {
return $table return $table
// ->modifyQueryUsing(fn (Builder $query) => $query->whereDate('created_at', today()))
->columns([ ->columns([
Tables\Columns\TextColumn::make('No.') Tables\Columns\TextColumn::make('No.')
->label('NO') ->label('NO')
@@ -254,26 +244,16 @@ class VisitorEntryResource extends Resource
->alignCenter() ->alignCenter()
->searchable() ->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('mobile_number')
->label('Visitor Mobile Number')
->alignCenter()
->searchable()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('name') Tables\Columns\TextColumn::make('name')
->label('Visitor Name') ->label('Visitor Name')
->sortable() ->sortable()
->alignCenter() ->alignCenter()
->searchable(), ->searchable(),
Tables\Columns\TextColumn::make('company') Tables\Columns\TextColumn::make('mobile_number')
->label('Visitor Company') ->label('Visitor Mobile Number')
->sortable()
->alignCenter()
->searchable(),
Tables\Columns\TextColumn::make('employeeMaster.plant.name')
->label('Visited Plant')
->alignCenter() ->alignCenter()
->searchable() ->searchable()
->searchable()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('employeeMaster.name') Tables\Columns\TextColumn::make('employeeMaster.name')
->label('Recipient Name') ->label('Recipient Name')
@@ -295,16 +275,6 @@ class VisitorEntryResource extends Resource
->searchable() ->searchable()
->alignCenter() ->alignCenter()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('purpose_of_visit')
->label('Purpose of Visit')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('mode_of_travel')
->label('Mode of Travel')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('in_time') Tables\Columns\TextColumn::make('in_time')
->label('In Time') ->label('In Time')
->searchable() ->searchable()
@@ -435,25 +405,9 @@ class VisitorEntryResource 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['register_id']) && empty($data['type']) && empty($data['name']) && empty($data['company']) && empty($data['employee_master_id']) && empty($data['created_from']) && empty($data['created_to'])) { if (empty($data['register_id']) && empty($data['type']) && empty($data['name']) && empty($data['company']) && empty($data['employee_master_id']) && empty($data['created_from']) && empty($data['created_to'])) {
// $query->where(function ($q) { $query->where(function ($q) {
// }); });
// }
$hasAnyFilter = !empty($data['register_id'])
|| !empty($data['type'])
|| !empty($data['name'])
|| !empty($data['company'])
|| !empty($data['employee_master_id'])
|| !empty($data['employee_department'])
|| !empty($data['created_from'])
|| !empty($data['created_to']);
if (!$hasAnyFilter) {
// $query->whereDate('created_at', today());
$query->whereDate('visitor_entries.created_at', today())
->whereNull('out_time');
return;
} }
if (! empty($data['register_id'])) { if (! empty($data['register_id'])) {
@@ -469,15 +423,8 @@ class VisitorEntryResource extends Resource
} }
} }
// if (! empty($data['name'])) {
// $query->where('name', 'like', '%'.$data['name'].'%');
// }
if (! empty($data['name'])) { if (! empty($data['name'])) {
$query->whereRaw( $query->where('name', 'like', '%'.$data['name'].'%');
'LOWER(name) LIKE ?',
['%' . strtolower($data['name']) . '%']
);
} }
if (! empty($data['company'])) { if (! empty($data['company'])) {
@@ -674,5 +621,4 @@ class VisitorEntryResource extends Resource
SoftDeletingScope::class, SoftDeletingScope::class,
]); ]);
} }
} }

View File

@@ -21,42 +21,36 @@ class CreateVisitorEntry extends CreateRecord
public function processMobile($mobile) public function processMobile($mobile)
{ {
$registerId = $this->data['register_id'] ?? null;
$visitor = VisitorEntry::where('mobile_number', $mobile)->latest()->first(); $visitor = VisitorEntry::where('mobile_number', $mobile)->latest()->first();
if ($visitor) { if ($visitor) {
$employee = EmployeeMaster::where('id', $visitor->employee_master_id)->first(); $employee = EmployeeMaster::where('id', $visitor->employee_master_id)->first();
$this->form->fill([ $this->form->fill([
'register_id' => $registerId ?? '', 'register_id' => $visitor->register_id ?? '',
'mobile_number' => $visitor->mobile_number, 'mobile_number' => $mobile ?? '',
'name' => $visitor->name ?? '', 'name' => $visitor->name ?? '',
'company' => $visitor->company ?? '', 'company' => $visitor->company ?? '',
'type' => $visitor->type ?? '', 'type' => $visitor->type ?? '',
'department' => $employee?->department ?? '', 'department' => $employee->department ?? '',
'employee_master_id' => $visitor->employee_master_id, 'employee_master_id' => $visitor->employee_master_id->name ?? '',
'code' => $employee?->code ?? '', 'code' => $employee->code ?? '',
'purpose_of_visit' => '',
'in_time' => now(),
'out_time' => null,
'valid_upto' => null,
]); ]);
} }
else { else {
$registerId = $this->form->getState()['register_id'] ?? '';
$this->form->fill([ $this->form->fill([
'register_id' => $registerId ?? '', 'register_id' => $registerId ?? '',
'mobile_number' => $mobile, 'mobile_number' => $mobile ?? '',
'name' => '', 'name' => $visitor->name ?? '',
'company' => '', 'company' => $visitor->company ?? '',
'type' => '', 'type' => $visitor->type ?? '',
'department' => '', 'department' => $employee->department ?? '',
'employee_master_id' => null, 'employee_master_id' => $visitor->employee_master_id->name ?? '',
'code' => '', 'code' => $employee->code ?? '',
'purpose_of_visit' => '',
'in_time' => now(),
'out_time' => null,
'valid_upto' => null,
]); ]);
} }
} }

View File

@@ -5,7 +5,6 @@ namespace App\Filament\Resources;
use App\Filament\Exports\WorkGroupMasterExporter; use App\Filament\Exports\WorkGroupMasterExporter;
use App\Filament\Imports\WorkGroupMasterImporter; use App\Filament\Imports\WorkGroupMasterImporter;
use App\Filament\Resources\WorkGroupMasterResource\Pages; use App\Filament\Resources\WorkGroupMasterResource\Pages;
use App\Models\Line;
use App\Models\Plant; use App\Models\Plant;
use App\Models\WorkGroupMaster; use App\Models\WorkGroupMaster;
use Filament\Facades\Filament; use Filament\Facades\Filament;
@@ -21,11 +20,6 @@ use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Tables\Filters\Filter;
class WorkGroupMasterResource extends Resource class WorkGroupMasterResource extends Resource
{ {
@@ -172,144 +166,7 @@ class WorkGroupMasterResource extends Resource
]) ])
->filters([ ->filters([
Tables\Filters\TrashedFilter::make(), Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters')
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Search by Plant Name')
->nullable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
if ($userHas && strlen($userHas) > 0) {
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
} else {
return Plant::whereHas('workGroupMasters', function ($query) {
$query->whereNotNull('id');
})->orderBy('code')->pluck('name', 'id')->toArray();
}
})
->searchable()
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('code', null);
$set('operator_id', null);
}),
Select::make('name')
->label('Search by Work Group Center')
->searchable()
->options(function (callable $get) {
$plantId = $get('Plant');
if(!$plantId){
return [];
}
else{
return $plantId ? WorkGroupMaster::where('plant_id', $plantId)->distinct()->pluck('name', 'name')->toArray(): [];
}
})
->searchable()
->reactive(),
TextInput::make('description')
->label('Description')
->reactive(),
TextInput::make('operation_number')
->label('Operation Number')
->reactive(),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder(placeholder: 'Select From DateTime')
->reactive()
->native(false),
DateTimePicker::make('created_to')
->label('Created To')
->placeholder(placeholder: 'Select To DateTime')
->reactive()
->native(false),
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['name']) && empty($data['description']) && empty($data['operation_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_from']) && empty($data['updated_to'])) {
// return $query->whereRaw('1 = 0');
}
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
$query->where('plant_id', $data['Plant']);
} else {
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return $query->whereRaw('1 = 0');
}
}
if (! empty($data['name'])) {
$query->where('name', $data['name']);
}
if (! empty($data['description'])) {
$query->where('description', $data['description']);
}
if (! empty($data['operation_number'])) {
$query->where('operation_number', $data['operation_number']);
}
if (! empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (! empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
})
->indicateUsing(function (array $data) {
$indicators = [];
if (! empty($data['Plant'])) {
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
} else {
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return 'Plant: Choose plant to filter records.';
}
}
if (! empty($data['name'])) {
$indicators[] = 'Work Group Name: ' . $data['name'];
}
if (! empty($data['description'])) {
$indicators[] = 'Description: ' . $data['description'];
}
if (! empty($data['operation_number'])) {
$indicators[] = 'Operation Number: ' . $data['operation_number'];
}
if (! empty($data['created_from'])) {
$indicators[] = 'From: '.$data['created_from'];
}
if (! empty($data['created_to'])) {
$indicators[] = 'To: '.$data['created_to'];
}
if (! empty($data['updated_from'])) {
$indicators[] = 'From: '.$data['updated_from'];
}
if (! empty($data['updated_to'])) {
$indicators[] = 'To: '.$data['updated_to'];
}
return $indicators;
}),
]) ])
->filtersFormMaxHeight('280px')
->actions([ ->actions([
Tables\Actions\ViewAction::make(), Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(), Tables\Actions\EditAction::make(),

View File

@@ -520,7 +520,7 @@ class CharacteristicsController extends Controller
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) { if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE']; $typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
} elseif (Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP']; $typesToCreate = ['MOTOR', 'PUMP'];
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
$typesToCreate = ['PUMP']; $typesToCreate = ['PUMP'];
@@ -673,7 +673,7 @@ class CharacteristicsController extends Controller
// 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!", // 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!",
// ], 404); // ], 404);
} }
} elseif (! Str::contains($curHead, 'PUMP SET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPS', ignoreCase: true)) { } elseif (! Str::contains($curHead, 'PUMPS', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
return response()->json([ return response()->json([
'status_code' => 'ERROR', 'status_code' => 'ERROR',
'status_description' => "Serial number '{$serialNumber}' doesn't have valid model type to proceed!", 'status_description' => "Serial number '{$serialNumber}' doesn't have valid model type to proceed!",
@@ -1286,9 +1286,9 @@ class CharacteristicsController extends Controller
], 404); ], 404);
} }
$machineId = $machine->id; // $machineId = $machine->id;
$availFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_pf', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_pf', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature', 'zmm_axial_force', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_motoridentification', 'zmm_packtype', 'zmm_panel', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_type', 'zmm_usp', 'marked_datetime', 'marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'pending_released_status', 'has_work_flow_id']; // 'mark_status','marked_physical_count', 'marked_expected_time', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'winded_serial_number', 'part_validation_1', 'part_validation_2', 'samlight_logged_name' $availFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_pf', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_pf', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_motoridentification', 'zmm_packtype', 'zmm_panel', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_type', 'zmm_usp', 'marked_datetime', 'marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'pending_released_status', 'has_work_flow_id']; // 'mark_status','marked_physical_count', 'marked_expected_time', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'winded_serial_number', 'part_validation_1', 'part_validation_2', 'samlight_logged_name'
if ($itemCode != '' && $itemCode != null && $itemCode && Str::length($itemCode) > 0) { if ($itemCode != '' && $itemCode != null && $itemCode && Str::length($itemCode) > 0) {
$existingJobNo = ClassCharacteristic::where('aufnr', $jobNo)->first(); // ->where('machine_id', $machineId)->where('plant_id', $plantId) $existingJobNo = ClassCharacteristic::where('aufnr', $jobNo)->first(); // ->where('machine_id', $machineId)->where('plant_id', $plantId)
@@ -1562,7 +1562,7 @@ class CharacteristicsController extends Controller
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) { if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE']; $typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
} elseif (Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP']; $typesToCreate = ['MOTOR', 'PUMP'];
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
$typesToCreate = ['PUMP']; $typesToCreate = ['PUMP'];
@@ -1845,7 +1845,7 @@ class CharacteristicsController extends Controller
} }
} }
$masterFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature', 'zmm_axial_force', 'pending_released_status']; $masterFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature', 'pending_released_status'];
$isInsertOrUpdate = false; $isInsertOrUpdate = false;
@@ -1941,7 +1941,7 @@ class CharacteristicsController extends Controller
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) { if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE']; $typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
} elseif (Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP']; $typesToCreate = ['MOTOR', 'PUMP'];
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
$typesToCreate = ['PUMP']; $typesToCreate = ['PUMP'];
@@ -2175,7 +2175,7 @@ class CharacteristicsController extends Controller
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id']; $columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id'];
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature', 'zmm_axial_force']; $characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature'];
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get(); $characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get();
@@ -2399,7 +2399,7 @@ class CharacteristicsController extends Controller
// 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!", // 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!",
// ], 404); // ], 404);
} }
} elseif (! Str::contains($curHead, 'PUMP SET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPS', ignoreCase: true)) { } elseif (! Str::contains($curHead, 'PUMPS', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
return response()->json([ return response()->json([
'status_code' => 'ERROR', 'status_code' => 'ERROR',
'status_description' => "Serial number '{$serialNumber}' doesn't have valid model type to proceed!", 'status_description' => "Serial number '{$serialNumber}' doesn't have valid model type to proceed!",
@@ -2709,7 +2709,7 @@ class CharacteristicsController extends Controller
// $columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id']; // $columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id'];
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature', 'zmm_axial_force']; $characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_grwt_motor', 'zmm_grwt_pump', 'zmm_grwt_pset', 'zmm_newt_motor', 'zmm_newt_pump', 'zmm_newt_pset', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_eff_ttl', 'zmm_labelperiod', 'zmm_modelyear', 'zmm_performance_factor', 'zqmm_qty', 'zmm_operating_temperature'];
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get(); $characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get();
@@ -2951,7 +2951,7 @@ class CharacteristicsController extends Controller
// $columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id']; // $columnsToShow = ['mark_status', 'marked_datetime', 'marked_physical_count', 'marked_expected_time', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_physical_count', 'motor_expected_time', 'motor_marked_by', 'pump_marked_status', 'pump_marked_physical_count', 'pump_expected_time', 'pump_marked_by', 'name_plate_marked_status', 'name_plate_expected_time', 'name_plate_marked_by', 'motor_pump_pumpset_status', 'winded_serial_number', 'motor_machine_name', 'pump_machine_name', 'name_plate_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'has_work_flow_id'];
// $characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zqmm_qty', 'zmm_operating_temperature', 'zmm_axial_force']; // $characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_logo_eac', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'zmm_operating_range', 'zmm_intake_air', 'zmm_oxygen_transfer_rate', 'zmm_air_inlet_pipesize', 'zmm_sump_depth', 'zmm_poles', 'zmm_motor_heading', 'zmm_motor_speed', 'zqmm_qty', 'zmm_operating_temperature'];
// $characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get(); // $characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)->where('machine_id', $machineId)->where('plant_id', $plantId)->distinct()->get($characteristicsColumns); // ->get();
@@ -3666,7 +3666,7 @@ class CharacteristicsController extends Controller
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) { if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE']; $typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
} elseif (Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP']; $typesToCreate = ['MOTOR', 'PUMP'];
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
$typesToCreate = ['PUMP']; $typesToCreate = ['PUMP'];
@@ -4701,7 +4701,7 @@ class CharacteristicsController extends Controller
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) { if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE']; $typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
} elseif (Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) || Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
$typesToCreate = ['MOTOR', 'PUMP']; $typesToCreate = ['MOTOR', 'PUMP'];
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) { } elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
$typesToCreate = ['PUMP']; $typesToCreate = ['PUMP'];

View File

@@ -581,9 +581,6 @@ class InvoiceDataTable extends Component
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 ?? '',
'invoice_quantity' => $record->invoice_quantity ?? 0,
'scanned_quantity' => ($record->invoice_quantity == null) ? 0 : ($record->invoice_quantity - $record->quantity) ?? 0,
// 'scanned_quantity' => number_format(($record->invoice_quantity == null ? 0 : ($record->invoice_quantity - $record->quantity)), 3, '.', ''),
'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 ?? '',
@@ -600,17 +597,12 @@ class InvoiceDataTable extends Component
$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';
$row['invoice_quantity'] = $row['quantity'];
} elseif ($matType == 2) { } elseif ($matType == 2) {
$row['material_type'] = 'Bundle'; $row['material_type'] = 'Bundle';
$row['invoice_quantity'] = $row['quantity'];
} elseif ($matType == 3) { } elseif ($matType == 3) {
$row['material_type'] = 'Quantity'; $row['material_type'] = 'Quantity';
$row['invoice_quantity'] = number_format($row['invoice_quantity'], 3, '.', '');
$row['scanned_quantity'] = number_format($row['scanned_quantity'], 3, '.', '');
} elseif ($matType == 4) { } elseif ($matType == 4) {
$row['material_type'] = 'Bundle Individual'; $row['material_type'] = 'Bundle Individual';
$row['invoice_quantity'] = $row['quantity'];
} else { } else {
$row['material_type'] = 'N/A'; $row['material_type'] = 'N/A';
} }

View File

@@ -1,266 +0,0 @@
<?php
namespace App\Livewire;
use App\Models\AlertMailRule;
use App\Models\Item;
use App\Models\Line;
use App\Models\PanelBoxValidation;
use App\Models\Plant;
use App\Models\ProductCharacteristicsMaster;
use App\Models\ProductionCharacteristic;
use Filament\Facades\Filament;
use Livewire\Component;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Mail;
use App\Mail\InvalidQualityMail;
class PanelCheckList extends Component
{
public $records = [];
public $existingRecords = [];
// public bool $shouldSkipChecklist = false;
public array $checklist = [];
public $showChecklist = false;
// public $skipChecklistValidation = false;
// protected $listeners = ['focus-item-id' => 'handleFocus', 'trigger-create' => 'doCreate',];
public $data =
[
'item_id' => '',
'plant_id' => '',
];
public $data1 = [
'checklist' => [],
];
// public function doCreate()
// {
// $this->create();
// $this->shouldSkipChecklist = false;
// }
public function mount($records = [])
{
// $this->records = collect($records);
$this->records = $records;
// foreach ($records as $record) {
// $this->checklist[$record['id']] = 'ok';
// }
}
public function cancel()
{
$this->dispatch('checklist-cancelled');
}
public function saveChecklist()
{
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
Notification::make()
->title('Incomplete Checklist')
->body('Please complete all checklist fields before submitting.')
->danger()
->send();
return;
}
$item = Item::where('code', $this->data['item_id'])->first();
if (! $item) {
Notification::make()
->title('Invalid Item Code')
->body('Item not found for given code.')
->danger()
->send();
return;
}
$itemAgaPlant = Item::where('code', $this->data['item_id'])->where('plant_id', $this->data['plant_id'])->first();
$plant = Plant::find($this->data['plant_id']);
if (! $itemAgaPlant) {
Notification::make()
->title('Invalid Item Code')
->body("Item code '$this->data['item_id']' not found for given plant code '{$plant?->code}'.")
->danger()
->send();
return;
}
$itemId = $itemAgaPlant->id;
$exists = PanelBoxValidation::where('plant_id', $this->data['plant_id'] ?? null)
->where('serial_number', $this->data['serial_number'] ?? null)
->first();
$plan = Plant::find($this->data['plant_id']);
if ($exists) {
Notification::make()
->title('Duplicate Serial Number')
->body("serial number {$this->data['serial_number']} already exists for the selected plant $plan->code.")
->danger()
->send();
return;
}
$qualityValidation = PanelBoxValidation::create([
'plant_id' => $this->data['plant_id'] ?? null,
'line_id' => $this->data['line_id'] ?? null,
'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
'production_order' => $this->data['production_order'] ?? null,
'serial_number' => $this->data['serial_number'] ?? null,
'serial_number_panel' => $this->data['serial_number_panel'] ?? null,
'pack_slip_panel' => $this->data['pack_slip_panel'] ?? null,
'name_plate_panel' => $this->data['name_plate_panel'] ?? null,
'tube_sticker_panel' => $this->data['tube_sticker_panel'] ?? null,
'warranty_card_panel' => $this->data['warranty_card_panel'] ?? null,
'part_validation1' => $this->data['part_validation1'] ?? null,
'part_validation2' => $this->data['part_validation2'] ?? null,
'part_validation3' => $this->data['part_validation3'] ?? null,
'part_validation4' => $this->data['part_validation4'] ?? null,
'part_validation5' => $this->data['part_validation5'] ?? null,
'created_by' => $this->data['created_by'] ?? null,
]);
if (! $qualityValidation || ! $qualityValidation->exists) {
Notification::make()
->title('Failed to save Panel Box Validation')
->body('Something went wrong while inserting data.')
->danger()
->send();
return;
}
foreach ($this->checklist as $characteristicId => $value) {
// $status = 'Ok';
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
if (($characteristic?->inspection_type ?? null) === 'Value') {
if (
$characteristic &&
is_numeric($value) &&
$value >= $characteristic->lower &&
$value <= $characteristic->upper
) {
$status = 'Ok';
} else {
$status = 'NotOk';
}
}
else {
$status = $value;
}
ProductionCharacteristic::create([
'plant_id' => $this->data['plant_id'] ?? null,
'item_id' => $itemId ?? null,
'line_id' => $this->data['line_id'] ?? null,
'machine_id' => $characteristic?->machine_id ?? null,
'production_order' => $this->data['production_order'] ?? null,
'serial_number' => $this->data['serial_number'] ?? null,
'characteristic_name' => $characteristic?->name ?? null,
'observed_value' => $value ?? null,
'status' => $status,
'inspection_status' => $finalInspectionStatus ?? null,
'created_by' => $this->data['operator_id'] ?? null,
]);
}
$this->showChecklist = false;
$this->dispatch('checklist-saved');
}
public function canSaveChecklist(): bool
{
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
return false;
}
foreach ($this->checklist as $characteristicId => $value) {
if ($value == null || $value == '') {
return false;
}
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
if (! $characteristic || ! is_numeric($value) || $value <= $characteristic->lower || $value >= $characteristic->upper){
return false;
}
}
return true;
}
public function getCharacteristicStatus($characteristicId): ?string
{
$value = $this->checklist[$characteristicId] ?? null;
if ($value == null || $value == '') {
return null;
}
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
if (! $characteristic || ! is_numeric($value)) {
return 'Not Ok';
}
return ($value > $characteristic->lower && $value < $characteristic->upper) ? 'Ok' : 'Not Ok';
}
// public static function getMailData($plantId)
// {
// $globalEmails = AlertMailRule::where('plant', 0)
// ->where('module', 'QualityValidation')
// ->where('rule_name', 'QualityMail')
// ->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
// ->pluck('email')
// ->toArray();
// if (! empty($globalEmails)) {
// return [
// 'plant_id' => 0,
// 'plant_name' => 'All Plants',
// 'emails' => $globalEmails,
// ];
// }
// $mPlantName = Plant::where('id', $plantId)->value('name');
// $emails = AlertMailRule::where('plant', $plantId)
// ->where('module', 'QualityValidation')
// ->where('rule_name', 'QualityMail')
// ->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
// ->pluck('email')
// ->toArray();
// return [
// 'plant_id' => $plantId,
// 'plant_name' => $mPlantName,
// 'emails' => $emails,
// ];
// }
public function render()
{
return view('livewire.panel-check-list');
}
}

View File

@@ -25,15 +25,15 @@ class ProductionCheckList extends Component
public $existingRecords = []; public $existingRecords = [];
// public bool $shouldSkipChecklist = false; public bool $shouldSkipChecklist = false;
public array $checklist = []; public array $checklist = [];
public $showChecklist = false; public $showChecklist = false;
// public $skipChecklistValidation = false; public $skipChecklistValidation = false;
// protected $listeners = ['focus-item-id' => 'handleFocus', 'trigger-create' => 'doCreate',]; protected $listeners = ['focus-item-id' => 'handleFocus', 'trigger-create' => 'doCreate',];
public $data = public $data =
[ [
@@ -45,21 +45,23 @@ class ProductionCheckList extends Component
'checklist' => [], 'checklist' => [],
]; ];
// public function doCreate() #[On('focus-item-id')]
// { public function handleFocus()
// $this->create(); {
$this->dispatch('focus-input');
}
public function doCreate()
{
$this->create();
$this->shouldSkipChecklist = false;
}
// $this->shouldSkipChecklist = false;
// }
public function mount($records = []) public function mount($records = [])
{ {
// $this->records = collect($records); $this->records = collect($records);
$this->records = $records;
foreach ($records as $record) {
$this->checklist[$record['id']] = 'ok';
}
} }
public function cancel() public function cancel()
@@ -176,12 +178,7 @@ class ProductionCheckList extends Component
'serial_number' => $this->data['serial_number'] ?? null, 'serial_number' => $this->data['serial_number'] ?? null,
'characteristic_name' => $characteristic?->name ?? null, 'characteristic_name' => $characteristic?->name ?? null,
'observed_value' => $this->data['observed_value'] ?? null, 'observed_value' => $this->data['observed_value'] ?? null,
// 'status' => $value == 'ok' ? 'Ok' : 'NotOk', 'status' => $value == 'ok' ? 'Ok' : 'NotOk',
'status' => match (strtolower($value)) {
'ok' => 'Ok',
'na' => 'N/A',
'not_ok' => 'NotOk',
},
'inspection_status' => $finalInspectionStatus ?? null, 'inspection_status' => $finalInspectionStatus ?? null,
'created_by' => $this->data['operator_id'] ?? null, 'created_by' => $this->data['operator_id'] ?? null,
]); ]);
@@ -258,10 +255,11 @@ class ProductionCheckList extends Component
]; ];
} }
// public function updatedDataChecklist() public function updatedDataChecklist()
// { {
// $this->dispatch('checklistUpdated', $this->data['checklist']); $this->dispatch('checklistUpdated', $this->data['checklist']);
// } }
public function render() public function render()
{ {

View File

@@ -9,7 +9,6 @@ use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope; use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Mail\Mailables\Attachment;
class ImportTransitMail extends Mailable class ImportTransitMail extends Mailable
{ {
@@ -21,17 +20,14 @@ class ImportTransitMail extends Mailable
public $mailSubject; public $mailSubject;
public $excelPath;
/** /**
* Create a new message instance. * Create a new message instance.
*/ */
public function __construct($scheduleType, $tableData, $mailSubject, $excelPath) public function __construct($scheduleType, $tableData, $mailSubject)
{ {
$this->scheduleType = $scheduleType; $this->scheduleType = $scheduleType;
$this->tableData = $tableData ?? []; $this->tableData = $tableData ?? [];
$this->mailSubject = $mailSubject ?? 'Import Transit'; $this->mailSubject = $mailSubject ?? 'Import Transit';
$this->excelPath = $excelPath;
} }
/** /**
@@ -40,7 +36,7 @@ class ImportTransitMail extends Mailable
public function envelope(): Envelope public function envelope(): Envelope
{ {
return new Envelope( return new Envelope(
subject: 'Import Shipment InTransit Mail', subject: 'Import Transit Mail',
); );
} }
@@ -49,9 +45,7 @@ class ImportTransitMail extends Mailable
*/ */
public function content(): Content public function content(): Content
{ {
$now = now(); $greeting = '<b>Dear Sir</b>';
$reportDate = $now->format('d/m/Y');
$greeting = '<b>Dear Sir/Madam</b>,<br>Kindly find attached the Pending Import Shipment Status Report as on ' . $reportDate . ' for your reference.<br>We request you to review the shipments highlighted in <span style="background-color: yellow; font-weight: bold;">yellow</span> and arrange for their clearance at the earliest to avoid further delays and additional charges.<br>Please note that for shipments pending under <b>Telex Release</b> and <b>Duty Payment</b>, CFS charges will be commenced post ETA. We therefore urge you to expedite the necessary actions at your end.<br>FCL shipment will take 5-6 Days for clearance & LCL shipment will take 7-8 Days for clearance after arrival of the shipment @ destination Port.</br>';
//$greeting1 = 'Dear C.R.I Branch Team, <br><br> Please follow and ensure the same'; //$greeting1 = 'Dear C.R.I Branch Team, <br><br> Please follow and ensure the same';
@@ -94,14 +88,6 @@ class ImportTransitMail extends Mailable
*/ */
public function attachments(): array public function attachments(): array
{ {
return [ return [];
Attachment::fromStorageDisk(
'local',
$this->excelPath
)->as('Import_Transit_Report.xlsx')
->withMime(
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
),
];
} }
} }

View File

@@ -1,63 +0,0 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class VisitorOutMail extends Mailable
{
use Queueable, SerializesModels;
public $entry;
/**
* Create a new message instance.
*/
public function __construct($entry)
{
$this->entry = $entry;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: 'Visitor Out Notification',
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
$greeting = '<b>Dear Sir</b>';
return new Content(
view: 'mail.visitor-out',
with: [
'company' => 'CRI Digital Manufacturing Solutions',
'greeting' => $greeting,
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
],
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}

View File

@@ -153,7 +153,6 @@ class ClassCharacteristic extends Model
'zmm_motor_speed', 'zmm_motor_speed',
'zqmm_qty', 'zqmm_qty',
'zmm_operating_temperature', 'zmm_operating_temperature',
'zmm_axial_force',
'mark_status', 'mark_status',
'marked_datetime', 'marked_datetime',
'marked_physical_count', 'marked_physical_count',

View File

@@ -30,7 +30,6 @@ class InvoiceValidation extends Model
'upload_status', 'upload_status',
'batch_number', 'batch_number',
'quantity', 'quantity',
'invoice_quantity',
'operator_id', 'operator_id',
'created_by', 'created_by',
'updated_by', 'updated_by',

View File

@@ -61,11 +61,6 @@ class Line extends Model
return $this->hasMany(ProcessOrder::class); return $this->hasMany(ProcessOrder::class);
} }
public function machines()
{
return $this->hasMany(Machine::class);
}
public function productCharacteristicsMasters() public function productCharacteristicsMasters()
{ {
return $this->hasMany(ProductCharacteristicsMaster::class); return $this->hasMany(ProductCharacteristicsMaster::class);

View File

@@ -1,46 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class PanelBoxValidation extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'line_id',
'sticker_master_id',
'production_order',
'serial_number',
'serial_number_panel',
'pack_slip_panel',
'name_plate_panel',
'tube_sticker_panel',
'warranty_card_panel',
'part_validation1',
'part_validation2',
'part_validation3',
'part_validation4',
'part_validation5',
'created_by',
'updated_by'
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function stickerMaster(): BelongsTo
{
return $this->belongsTo(StickerMaster::class);
}
}

View File

@@ -49,11 +49,6 @@ class Plant extends Model
return $this->hasMany(StickerMaster::class, 'plant_id', 'id'); return $this->hasMany(StickerMaster::class, 'plant_id', 'id');
} }
public function locators(): HasMany
{
return $this->hasMany(Locator::class, 'plant_id', 'id');
}
public function weightValidations(): HasMany public function weightValidations(): HasMany
{ {
return $this->hasMany(WeightValidation::class, 'plant_id', 'id'); return $this->hasMany(WeightValidation::class, 'plant_id', 'id');
@@ -109,11 +104,6 @@ class Plant extends Model
return $this->hasMany(WorkGroupMaster::class, 'plant_id', 'id'); return $this->hasMany(WorkGroupMaster::class, 'plant_id', 'id');
} }
public function machines()
{
return $this->hasMany(Machine::class, 'plant_id', 'id');
}
public function processOrders() public function processOrders()
{ {
return $this->hasMany(ProcessOrder::class, 'plant_id', 'id'); return $this->hasMany(ProcessOrder::class, 'plant_id', 'id');
@@ -188,9 +178,4 @@ class Plant extends Model
{ {
return $this->hasMany(AsrsItemValidation::class, 'plant_id', 'id'); return $this->hasMany(AsrsItemValidation::class, 'plant_id', 'id');
} }
// public function locatorValidations()
// {
// return $this->hasMany(LocatorValidation::class, 'plant_id', 'id');
// }
} }

View File

@@ -150,7 +150,6 @@ class TempClassCharacteristic extends Model
'zmm_motor_speed', 'zmm_motor_speed',
'zqmm_qty', 'zqmm_qty',
'zmm_operating_temperature', 'zmm_operating_temperature',
'zmm_axial_force',
'winded_serial_number', 'winded_serial_number',
'model_type', 'model_type',
'has_work_flow_id', 'has_work_flow_id',

View File

@@ -23,7 +23,6 @@ class VisitorEntry extends Model
'employee_master_id', 'employee_master_id',
'number_of_person', 'number_of_person',
'valid_upto', 'valid_upto',
'mode_of_travel',
]; ];
public function employeeMaster(): BelongsTo public function employeeMaster(): BelongsTo

View File

@@ -30,11 +30,6 @@ class WorkGroupMaster extends Model
return $this->hasMany(ProductCharacteristicsMaster::class); return $this->hasMany(ProductCharacteristicsMaster::class);
} }
public function machines()
{
return $this->hasMany(Machine::class, 'work_group_master_id');
}
// public function rejectReasons() // public function rejectReasons()
// { // {
// return $this->hasMany(RejectReason::class, 'work_group_master_id', 'id'); // return $this->hasMany(RejectReason::class, 'work_group_master_id', 'id');

View File

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

View File

@@ -1,31 +0,0 @@
<?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 visitor_entries
ADD COLUMN mode_of_travel TEXT DEFAULT NULL
SQL;
DB::statement($sql1);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('visitor_entries', function (Blueprint $table) {
// //
// });
}
};

View File

@@ -1,56 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE panel_box_validations (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
line_id BIGINT NOT NULL,
sticker_master_id BIGINT NOT NULL,
production_order TEXT DEFAULT NULL,
serial_number TEXT DEFAULT NULL,
serial_number_panel TEXT DEFAULT NULL,
pack_slip_panel TEXT DEFAULT NULL,
name_plate_panel TEXT DEFAULT NULL,
tube_sticker_panel TEXT DEFAULT NULL,
warranty_card_panel TEXT DEFAULT NULL,
part_validation1 TEXT DEFAULT NULL,
part_validation2 TEXT DEFAULT NULL,
part_validation3 TEXT DEFAULT NULL,
part_validation4 TEXT DEFAULT NULL,
part_validation5 TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP,
created_by TEXT DEFAULT NULL,
updated_by TEXT DEFAULT NULL,
deleted_at TIMESTAMP,
UNIQUE (plant_id, serial_number),
FOREIGN KEY (plant_id) REFERENCES plants (id),
FOREIGN KEY (line_id) REFERENCES lines (id),
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('panel_box_validations');
}
};

View File

@@ -1,29 +0,0 @@
<?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
{
DB::statement(<<<'SQL'
ALTER TABLE invoice_validations
ADD COLUMN invoice_quantity NUMERIC(10,3) NULL;
SQL);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Schema::table('invoice_validations', function (Blueprint $table) {
// //
// });
}
};

View File

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

View File

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

View File

@@ -91,9 +91,7 @@ class PermissionSeeder extends Seeder
Permission::updateOrCreate(['name' => 'view import serial invoice']); Permission::updateOrCreate(['name' => 'view import serial invoice']);
Permission::updateOrCreate(['name' => 'view import material invoice']); Permission::updateOrCreate(['name' => 'view import material invoice']);
Permission::updateOrCreate(['name' => 'view import invoice']); Permission::updateOrCreate(['name' => 'view import invoice']);
Permission::updateOrCreate(['name' => 'view import sap invoice']); Permission::updateOrCreate(['name' => 'view export invoice']);
Permission::updateOrCreate(['name' => 'view export serial invoice']);
Permission::updateOrCreate(['name' => 'view export material invoice']);
Permission::updateOrCreate(['name' => 'view export asn invoice']); Permission::updateOrCreate(['name' => 'view export asn invoice']);
Permission::updateOrCreate(['name' => 'view import locator invoice validation']); Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
@@ -230,14 +228,7 @@ class PermissionSeeder extends Seeder
Permission::updateOrCreate(['name' => 'view import asrs item validation']); Permission::updateOrCreate(['name' => 'view import asrs item validation']);
Permission::updateOrCreate(['name' => 'view export asrs item validation']); Permission::updateOrCreate(['name' => 'view export asrs item validation']);
Permission::updateOrCreate(['name' => 'view import employee master']);
Permission::updateOrCreate(['name' => 'view export employee master']);
Permission::updateOrCreate(['name' => 'view import visitor entries']);
Permission::updateOrCreate(['name' => 'view export visitor entries']);
Permission::updateOrCreate(['name' => 'view gate entry page']); Permission::updateOrCreate(['name' => 'view gate entry page']);
Permission::updateOrCreate(['name' => 'view import locator validation']);
Permission::updateOrCreate(['name' => 'view export locator validation']);
} }
} }

View File

@@ -9,7 +9,7 @@
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"axios": "^1.7.4", "axios": "^1.7.4",
"chartjs-plugin-datalabels": "^2.2.0", "chartjs-plugin-datalabels": "^2.2.0",
"concurrently": "^9.0.1", "concurrently": "^10.0.0",
"laravel-vite-plugin": "^1.2.0", "laravel-vite-plugin": "^1.2.0",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"tailwindcss": "^3.4.13", "tailwindcss": "^3.4.13",

View File

@@ -1,6 +0,0 @@
<div>
@livewire('panel-check-list', [
'records' => $existingRecords,
'data' => $data
])
</div>

View File

@@ -229,9 +229,7 @@
<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">Material Type</th> <th class="border px-4 py-2">Material Type</th>
<th class="border px-4 py-2">Invoice Quantity</th> <th class="border px-4 py-2">Material Quantity</th>
<th class="border px-4 py-2">To Be Scanned</th>
<th class="border px-4 py-2">Scanned Quantity</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">Batch Number</th> <th class="border px-4 py-2">Batch Number</th>
<th class="border px-4 py-2">TimeStamp</th> <th class="border px-4 py-2">TimeStamp</th>
@@ -246,23 +244,9 @@
<td class="border px-4 py-2">{{ $row['material_type'] ?? 'N/A' }}</td> <td class="border px-4 py-2">{{ $row['material_type'] ?? 'N/A' }}</td>
<td class="border px-4 py-2"> <td class="border px-4 py-2">
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual') @if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
{{ number_format((float)($row['invoice_quantity'] ?? 0), 0) }} {{ number_format((float)($row['quantity'] ?? 0), 0) }}
@else @else
{{ $row['invoice_quantity'] ?? 'N/A' }} {{ $row['quantity'] ?? 'N/A' }}
@endif
</td>
<td class="border px-4 py-2">
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
{{ number_format((float)($row['quantity'] ?? 0), 0) }}
@else
{{ $row['quantity'] ?? 'N/A' }}
@endif
</td>
<td class="border px-4 py-2">
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
{{ number_format((float)($row['scanned_quantity'] ?? 0), 0) }}
@else
{{ $row['scanned_quantity'] ?? 'N/A' }}
@endif @endif
</td> </td>
<td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td> <td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td>

View File

@@ -1,141 +0,0 @@
<div class="fixed inset-0 flex items-center justify-center z-50">
{{-- <div class="bg-white max-h-[80vh] overflow-hidden p-6 rounded-lg shadow-lg pointer-events-auto"
style="width:30vw !important; max-width:none !important;"> --}}
<div
class="bg-white rounded-lg shadow-lg pointer-events-auto
w-full max-w-2xl max-h-[90vh] flex flex-col">
{{-- @if($records && $records->count()) --}}
@if(!empty($records) && count($records))
<div style="max-height:250px; overflow-y:auto; border:1px solid #ccc;">
{{-- <table class="min-w-full border"> --}}
<table class="w-full table-fixed border text-sm">
<thead>
<tr class="bg-gray-100">
<th class="border px-2 py-1 w-2/3">Characteristics</th>
<th class="border px-2 py-1 w-1/3">Value</th>
</tr>
</thead>
<tbody>
@foreach($records as $record)
<tr>
<td class="border p-2">
{{ $record['name'] }}
</td>
{{-- <td class="border p-2">
<input
type="text"
wire:model.defer="checklist.{{ $record['id'] }}"
wire:model.live="checklist.{{ $record['id'] }}"
class="w-full border rounded px-2 py-1"
placeholder="Enter value"
>
</td> --}}
{{-- <td class="border p-2">
@php
$status = $this->getCharacteristicStatus($record['id']);
@endphp
<input
type="text"
wire:model.live="checklist.{{ $record['id'] }}"
class="w-full rounded px-2 py-1 border-2 transition-all duration-200"
style="
@if($status === 'Ok')
border-color: #22c55e;
box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
@elseif($status === 'Not Ok')
border-color: #ef4444;
box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
@else
border-color: #d1d5db;
@endif
"
placeholder="Enter value"
>
</td> --}}
<td class="border p-2">
@php
$status = $this->getCharacteristicStatus($record['id']);
@endphp
@if(($record['inspection_type'] ?? null) === 'Visual')
<div class="flex gap-4">
<label class="flex items-center gap-1">
<input
type="radio"
wire:model.live="checklist.{{ $record['id'] }}"
value="Ok"
>
Ok
</label>
<label class="flex items-center gap-1">
<input
type="radio"
wire:model.live="checklist.{{ $record['id'] }}"
value="NotOk"
>
Not Ok
</label>
</div>
@else
<input
type="text"
wire:model.live="checklist.{{ $record['id'] }}"
class="w-full rounded px-2 py-1 border-2 transition-all duration-200"
style="
@if($status === 'Ok')
border-color: #22c55e;
box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
@elseif($status === 'Not Ok')
border-color: #ef4444;
box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
@else
border-color: #d1d5db;
@endif
"
placeholder="Enter value"
>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@else
<p>No records found.</p>
@endif
<div class="border-t mt-6 pt-4 flex justify-end gap-3">
<button
type="button"
wire:click="cancel"
style="background-color:#dc2626; color:white;"
class="px-6 py-2 rounded-lg shadow-md"
>
Cancel
</button>
<button
type="button"
wire:click="saveChecklist"
style="background-color:#16a34a; color:white;"
{{-- @disabled(!$this->canSaveChecklist()) --}}
class="px-6 py-2 rounded-lg shadow-md disabled:opacity-50 disabled:cursor-not-allowed"
>
Save
</button>
</div>
</div>
</div>

View File

@@ -1,11 +1,7 @@
<div class="fixed inset-0 flex items-center justify-center z-50"> <div class="fixed inset-0 flex items-center justify-center z-50">
{{-- <div class="bg-white max-h-[80vh] overflow-hidden p-6 rounded-lg shadow-lg pointer-events-auto" <div class="bg-white max-h-[80vh] overflow-hidden p-6 rounded-lg shadow-lg pointer-events-auto"
style="width:30vw !important; max-width:none !important;"> --}} style="width:30vw !important; max-width:none !important;">
<div
class="bg-white rounded-lg shadow-lg pointer-events-auto
w-full max-w-2xl max-h-[90vh] flex flex-col">
{{-- @if($records && $records->count()) --}} {{-- @if($records && $records->count()) --}}
@if(!empty($records) && count($records)) @if(!empty($records) && count($records))
@@ -18,7 +14,6 @@
<th class="border px-2 py-1 w-2/3">Characteristics</th> <th class="border px-2 py-1 w-2/3">Characteristics</th>
<th class="border px-2 py-1 w-1/6">OK</th> <th class="border px-2 py-1 w-1/6">OK</th>
<th class="border px-2 py-1 w-1/6">Not OK</th> <th class="border px-2 py-1 w-1/6">Not OK</th>
<th class="border px-2 py-1 w-1/6">N/A</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -39,12 +34,6 @@
wire:model="checklist.{{ $record['id'] }}" wire:model="checklist.{{ $record['id'] }}"
value="not_ok"> value="not_ok">
</td> </td>
<td class="border text-center">
<input type="radio"
wire:model="checklist.{{ $record['id'] }}"
value="na">
</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@@ -29,10 +29,6 @@
<td>Item Code</td> <td>Item Code</td>
<td style="text-align: center;">{{ $request->item->code ?? $request->code }}</td> <td style="text-align: center;">{{ $request->item->code ?? $request->code }}</td>
</tr> </tr>
<tr>
<td>Description</td>
<td style="text-align: center;">{{ $request->item->description ?? $request->description }}</td>
</tr>
<tr> <tr>
<td>Job Number</td> <td>Job Number</td>
<td style="text-align: center;">{{ $request->aufnr }}</td> <td style="text-align: center;">{{ $request->aufnr }}</td>

View File

@@ -19,13 +19,13 @@
table { table {
border-collapse: collapse; border-collapse: collapse;
width: 100%; width: 100%;
font-size: 10px; font-size: 14px;
white-space: nowrap !important; white-space: nowrap !important;
} }
th, td { th, td {
border: 1px solid #020813da; border: 1px solid #020813da;
padding: 8px 10px; padding: 8px 10px;
text-align: left; text-align: center;
white-space: nowrap !important; white-space: nowrap !important;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@@ -41,13 +41,6 @@
background-color: #f3f4f6; background-color: #f3f4f6;
} }
.status-column {
text-align: left !important;
white-space: normal !important;
min-width: 250px;
width: 250px;
vertical-align: top;
}
.footer { .footer {
text-align: center; text-align: center;
font-size: 13px; font-size: 13px;
@@ -71,6 +64,7 @@
<tr> <tr>
<th>No</th> <th>No</th>
<th>CRI RFQ Number</th> <th>CRI RFQ Number</th>
<th>Ref Number</th>
<th>Requestor</th> <th>Requestor</th>
<th>Shipper</th> <th>Shipper</th>
<th>Shipper Location</th> <th>Shipper Location</th>
@@ -89,30 +83,36 @@
<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>{{ \Carbon\Carbon::parse($row['mail_received_date'])->format('Y-m-d') }}</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>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td> --}} {{-- <td>{{ $row['shipper_invoice_date'] }}</td> --}}
<td> <td>{{ \Carbon\Carbon::parse($row['shipper_invoice_date'])->format('Y-m-d') }}</td>
{{ !empty($row['shipper_invoice_date']) ? \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>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td> --}} {{-- <td>{{ $row['eta_date'] }}</td> --}}
<td> <td>{{ \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') }}</td>
{{ !empty($row['eta_date']) ? \Carbon\Carbon::parse($row['eta_date'])->format('Y-m-d') : '' }} <td>{{ $row['status'] }}</td>
</td>
<td class="status-column">
{{ $row['status'] }}
</td>
<td>{{ $row['delivery_location'] }}</td> <td>{{ $row['delivery_location'] }}</td>
{{-- <td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td> --}} {{-- <td>{{ $row['etd_date'] }}</td> --}}
<td> <td>{{ \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') }}</td>
{{ !empty($row['etd_date']) ? \Carbon\Carbon::parse($row['etd_date'])->format('Y-m-d') : '' }} {{-- <td>{{ $row['mode'] }}</td>
</td> <td>{{ $row['inco_terms'] }}</td>
<td> <td>{{ $row['port_of_loading'] }}</td>
{{ $row['remark'] }} <td>{{ $row['port_of_discharge'] }}</td>
</td> <td>{{ $row['delivery_city'] }}</td>
<td>{{ $row['packages'] }}</td>
<td>{{ $row['type_of_package'] }}</td>
<td>{{ $row['gross_weight'] }}</td>
<td>{{ $row['volume'] }}</td>
<td>{{ $row['bill_number'] }}</td> --}}
{{-- <td>{{ $row['bill_received_date'] }}</td> --}}
{{-- <td>{{ \Carbon\Carbon::parse($row['bill_received_date'])->format('Y-m-d') }}</td>
<td>{{ $row['vessel_number'] }}</td> --}}
<td>{{ $row['remark'] }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>

View File

@@ -1,119 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Visitor Out Notification</title>
</head>
<body style="margin:0;padding:0;background:#ffffff;font-family:Arial,Helvetica,sans-serif;">
<table width="100%" cellpadding="0" cellspacing="0" style="background:#ffffff;">
<tr>
<td align="center">
<table width="700" cellpadding="0" cellspacing="0" style="background:#ffffff;border:1px solid #e5e7eb;">
<!-- Header -->
<tr>
<td style="background:#0f766e;padding:20px;text-align:center;">
<h2 style="margin:0;color:#ffffff;">
Visitor Out Notification
</h2>
</td>
</tr>
<!-- Content -->
<tr>
<td style="padding:25px;">
<p style="margin-top:0;">
{!! $greeting !!}
</p>
<p>
A visitor has checked out. Please find the details below:
</p>
<table width="100%" cellpadding="10" cellspacing="0"
style="border-collapse:collapse;margin-top:15px;">
<tr>
<td style="border:1px solid #d1d5db;width:30%;font-weight:bold;">
Visitor Name
</td>
<td style="border:1px solid #d1d5db;">
{{ $entry?->name ?? '-' }}
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
Mobile Number
</td>
<td style="border:1px solid #d1d5db;">
{{ $entry?->mobile_number ?? '-' }}
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
Company
</td>
<td style="border:1px solid #d1d5db;">
{{ $entry?->company ?? '-' }}
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
Purpose of Visit
</td>
<td style="border:1px solid #d1d5db;">
{{ $entry?->purpose_of_visit ?? '-' }}
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
No of Persons
</td>
<td style="border:1px solid #d1d5db;">
{{ $entry?->number_of_person ?? '-' }}
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
Out Time
</td>
<td style="border:1px solid #d1d5db;">
{{ $entry?->out_time?->format('d-m-Y h:i A') ?? '-' }}
</td>
</tr>
</table>
<br>
<p>
{!! $wishes !!}
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="padding:15px;text-align:center;border-top:1px solid #e5e7eb;font-size:12px;color:#666;">
© {{ date('Y') }} {{ $company }}<br>
Visitor Management System
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -1,7 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8">
<style> <style>
@page { @page {
margin: 0; margin: 0;

View File

@@ -1,7 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8">
<style> <style>
@page { @page {
margin: 0; margin: 0;

View File

@@ -1,7 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8">
<style> <style>
@page { @page {
margin: 0; margin: 0;

View File

@@ -41,26 +41,32 @@
.badge-header { .badge-header {
background: #1a1a2e; background: #1a1a2e;
color: #fff; color: #fff;
padding: 1.5mm 2mm; text-align: center;
padding: 2mm 2mm 1.5mm;
font-size: 8pt; font-size: 8pt;
font-weight: bold; font-weight: bold;
letter-spacing: 1px; letter-spacing: 1px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-shrink: 0;
} }
.badge-header .type { font-size: 9pt; letter-spacing: 2px; } .badge-header .type {
.badge-header .badge-id { font-size: 7pt; opacity: 0.85; } font-size: 9pt;
letter-spacing: 2px;
}
.badge-header .badge-id {
font-size: 7pt;
opacity: 0.85;
}
/* ── Body ── */ /* ── Body ── */
.badge-body { .badge-body {
display: flex; display: flex;
flex: 1; flex: 1;
padding: 1.5mm 2mm; padding: 2mm;
gap: 2mm; gap: 2mm;
overflow: hidden;
} }
/* ── Fields (left) ── */ /* ── Fields (left) ── */
@@ -68,104 +74,82 @@
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; gap: 1.2mm;
} }
.field-row { .field-row {
display: grid; display: grid;
grid-template-columns: 16mm 3mm 1fr; grid-template-columns: 16mm 3mm 1fr;
line-height: 1.25; line-height: 1.3;
margin-bottom: 0.6mm; margin-bottom: 0.7mm;
align-items: start;
} }
.field-label { .field-label {
color: #000; color: #000; /* was #555 — now pure black */
font-size: 6.5pt; font-size: 6.5pt;
font-weight: 700; font-weight: 700; /* was normal — now bold */
white-space: nowrap;
} }
.field-colon { .field-colon {
color: #000; color: #000; /* was #555 — now pure black */
font-size: 6.5pt; font-size: 6.5pt;
font-weight: 700; font-weight: 700; /* added bold */
text-align: center; text-align: center;
} }
.field-value { .field-value {
font-weight: 700; font-weight: 700; /* was 600 — now fully bold */
font-size: 6.5pt; font-size: 6.5pt;
color: #000; color: #000; /* was #111 — now pure black */
/* Prevent wrapping — truncate with ellipsis if too long */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
/* ── Photo column (right) ── */ /* ── Photo (right) ── */
.badge-photo { .badge-photo {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
gap: 1mm;
width: 18mm; width: 18mm;
flex-shrink: 0;
gap: 0.5mm;
} }
.badge-photo img { .badge-photo img {
width: 16mm; width: 16mm;
height: 16mm; height: 18mm;
object-fit: cover; object-fit: cover;
border: 1px solid #000; border: 1px solid #ccc;
} }
.badge-photo .no-photo { .badge-photo .no-photo {
width: 16mm; width: 16mm;
height: 16mm; height: 18mm;
border: 1.5px dashed #000; border: 1.5px dashed #000; /* was #aaa — darker border */
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 6pt; font-size: 6pt; /* slightly larger */
color: #000; color: #000; /* was #aaa */
font-weight: 700; font-weight: 700;
text-align: center; text-align: center;
} }
.host-sign { .host-sign {
font-size: 6pt; font-size: 6pt; /* was 5.5pt — slightly larger */
color: #000; color: #000; /* was #555 — now pure black */
font-weight: 700; font-weight: 700; /* added bold */
text-align: center; text-align: center;
border-top: 1px solid #000; border-top: 1px solid #000; /* was 0.5px #aaa — darker line */
padding-top: 0.5mm; padding-top: 0.5mm;
width: 100%; width: 100%;
} }
/* ── QR code ── */
.visitor-qr {
margin-top: 1mm;
width: 18mm;
display: flex;
justify-content: center;
}
.visitor-qr svg {
width: 16mm !important;
height: 16mm !important;
display: block;
}
/* ── Footer ── */ /* ── Footer ── */
.badge-footer { .badge-footer {
border-top: 1px solid #000; border-top: 1px solid #000; /* was 0.5px #ddd — darker line */
padding: 0.8mm 2mm; padding: 1mm 2mm;
text-align: right; text-align: right;
font-size: 6pt; font-size: 6pt; /* was 5.5pt — slightly larger */
color: #000; color: #000; /* was #888 — now pure black */
font-weight: 700; font-weight: 700; /* added bold */
flex-shrink: 0;
} }
@media print { @media print {
@@ -174,9 +158,9 @@
} }
</style> </style>
</head> </head>
<body> <body onload="window.print()">
{{-- ── Print / Close buttons (screen only) ── --}} {{-- ── Print button (visible on screen only, hidden when printing) ── --}}
<div class="no-print" style="padding: 8px; text-align:center; background:#f3f4f6;"> <div class="no-print" style="padding: 8px; text-align:center; background:#f3f4f6;">
<button onclick="window.print()" style="padding:6px 18px; background:#1a1a2e; color:#fff; border:none; border-radius:6px; cursor:pointer; font-size:13px;"> <button onclick="window.print()" style="padding:6px 18px; background:#1a1a2e; color:#fff; border:none; border-radius:6px; cursor:pointer; font-size:13px;">
🖨️ Print Badge 🖨️ Print Badge
@@ -191,7 +175,7 @@
{{-- Header --}} {{-- Header --}}
<div class="badge-header"> <div class="badge-header">
<span class="type">{{ strtoupper($visitor->type ?? 'VISITOR') }}</span> <span class="type">{{ strtoupper($visitor->type ?? 'VISITOR') }}</span>
<span class="badge-id">#{{ $visitor->register_id ?? str_pad($visitor->id, 5, '0', STR_PAD_LEFT) }}</span> <span class="badge-id">#{{ str_pad($visitor->register_id, 5, '0', STR_PAD_LEFT) }}</span>
</div> </div>
{{-- Body --}} {{-- Body --}}
@@ -199,62 +183,61 @@
{{-- Left: fields --}} {{-- Left: fields --}}
<div class="badge-fields"> <div class="badge-fields">
<div class="field-row"> <div class="field-row">
<span class="field-label">Name</span> <span class="field-label">Name</span>
<span class="field-colon">:</span> <span class="field-colon">:</span>
<span class="field-value">{{ strtoupper($visitor->name) }}</span> <span class="field-value">{{ strtoupper($visitor->name) }}</span>
</div>
<div class="field-row">
<span class="field-label">Company</span>
<span class="field-colon">:</span>
<span class="field-value">{{ $visitor->company }}</span>
</div>
<div class="field-row">
<span class="field-label">To Meet</span>
<span class="field-colon">:</span>
<span class="field-value">{{ strtoupper($visitor->employeeMaster?->name ?? '—') }}</span>
</div>
<div class="field-row">
<span class="field-label">Dept</span>
<span class="field-colon">:</span>
<span class="field-value">{{ strtoupper($visitor->employeeMaster?->department ?? $visitor->department ?? '—') }}</span>
</div>
<div class="field-row">
<span class="field-label">Valid Upto</span>
<span class="field-colon">:</span>
<span class="field-value">{{ $visitor->valid_upto ? \Carbon\Carbon::parse($visitor->valid_upto)->format('d/m/Y H:i:s') : '—' }}</span>
</div>
<div class="field-row">
<span class="field-label">Date & Time</span>
<span class="field-colon">:</span>
<span class="field-value">{{ $visitor->in_time ? \Carbon\Carbon::parse($visitor->in_time)->format('d/m/Y H:i:s') : '—' }}</span>
</div>
<div class="field-row">
<span class="field-label">No of Visitors</span>
<span class="field-colon">:</span>
<span class="field-value">{{ $visitor->number_of_person ?? 1 }}</span>
</div>
</div> </div>
<div class="field-row">
<span class="field-label">Company</span>
<span class="field-colon">:</span>
<span class="field-value">{{ $visitor->company }}</span>
</div>
<div class="field-row">
<span class="field-label">To Meet</span>
<span class="field-colon">:</span>
<span class="field-value">{{ strtoupper($visitor->employeeMaster?->name ?? '—') }}</span>
</div>
<div class="field-row">
<span class="field-label">Dept</span>
<span class="field-colon">:</span>
<span class="field-value">{{ strtoupper($visitor->employeeMaster?->department ?? $visitor->department ?? '—') }}</span>
</div>
<div class="field-row">
<span class="field-label">Valid Upto</span>
<span class="field-colon">:</span>
<span class="field-value">{{ $visitor->valid_upto ? \Carbon\Carbon::parse($visitor->valid_upto)->format('d/m/Y H:i:s') : '—' }}</span>
</div>
<div class="field-row">
<span class="field-label">Date & Time</span>
<span class="field-colon">:</span>
<span class="field-value">{{ $visitor->in_time ? \Carbon\Carbon::parse($visitor->in_time)->format('d/m/Y H:i:s') : '—' }}</span>
</div>
<div class="field-row">
<span class="field-label">No of Visitors</span>
<span class="field-colon">:</span>
<span class="field-value">{{ $visitor->number_of_person ?? 1 }}</span>
</div>
</div>
{{-- Right: photo + host sign + QR --}} {{-- Right: photo + host sign --}}
<div class="badge-photo"> <div class="badge-photo">
@if($photoUrl) @if($photoUrl)
<img src="{{ $photoUrl }}" alt="Visitor Photo" /> <img src="{{ $photoUrl }}" alt="Visitor Photo" />
@else @else
<div class="no-photo">No Photo</div> <div class="no-photo">No Photo</div>
@endif @endif
<div class="host-sign">Host Sign</div> <div class="host-sign">Host Sign</div>
<div class="visitor-qr" style="margin-top:2mm;">
{{-- QR Code high res, with quiet zone and high error correction --}} {{-- {!! QrCode::size(25)
@if(!empty($visitor->register_id)) ->margin(0)
<div class="visitor-qr"> ->generate($visitor->register_id) !!} --}}
{!! QrCode::size(300) @if(!empty($visitor->register_id))
->margin(2) {!! QrCode::size(35)
->errorCorrection('H') ->margin(0)
->generate((string) $visitor->register_id) !!} ->generate((string) $visitor->register_id) !!}
</div> @endif
@endif </div>
</div> </div>
</div> </div>
@@ -264,11 +247,5 @@
</div> </div>
<script>
window.addEventListener('load', function () {
setTimeout(function () { window.print(); }, 300);
});
</script>
</body> </body>
</html> </html>