Merge pull request 'changed logic again in invoice data table' (#285) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #285
This commit was merged in pull request #285.
This commit is contained in:
@@ -323,12 +323,12 @@ class InvoiceDataTable extends Component
|
|||||||
|
|
||||||
// $this->packageCount = 0;
|
// $this->packageCount = 0;
|
||||||
|
|
||||||
// $this->packageCount = InvoiceValidation::with('stickerMasterRelation')
|
// $records = InvoiceValidation::with('stickerMasterRelation')
|
||||||
// ->where('invoice_number', $this->invoiceNumber)
|
// ->where('invoice_number', $this->invoiceNumber)
|
||||||
// ->where('plant_id', $this->plantId)
|
// ->where('plant_id', $this->plantId)
|
||||||
// ->whereNull('scanned_status')
|
// ->get();
|
||||||
// ->get()
|
|
||||||
// ->sum(function ($record) {
|
// $this->packageCount = $records->sum(function ($record) {
|
||||||
// $sm = $record->stickerMasterRelation;
|
// $sm = $record->stickerMasterRelation;
|
||||||
|
|
||||||
// $stickCount = 0;
|
// $stickCount = 0;
|
||||||
@@ -336,14 +336,14 @@ class InvoiceDataTable extends Component
|
|||||||
|
|
||||||
// if ($sm) {
|
// if ($sm) {
|
||||||
|
|
||||||
// // if (strlen($sm->panel_box_code) > 0) $stickCount++;
|
// if (strlen($sm->panel_box_code) > 0) $stickCount++;
|
||||||
|
|
||||||
// if (!empty($sm->panel_box_code)) {
|
// // if (!empty($sm->panel_box_code)) {
|
||||||
// $stickCount++;
|
// // $stickCount++;
|
||||||
// if (!empty($record->panel_box_serial_number)) {
|
// // if (!empty($record->panel_box_serial_number)) {
|
||||||
// $scannedCount++;
|
// // $scannedCount++;
|
||||||
// }
|
// // }
|
||||||
// }
|
// // }
|
||||||
|
|
||||||
// // Tube stickers
|
// // Tube stickers
|
||||||
// if ($sm->tube_sticker_motor || $sm->tube_sticker_pump || $sm->tube_sticker_pumpset) {
|
// if ($sm->tube_sticker_motor || $sm->tube_sticker_pump || $sm->tube_sticker_pumpset) {
|
||||||
@@ -365,41 +365,18 @@ class InvoiceDataTable extends Component
|
|||||||
// $scannedCount += $record->capacitor_scanned_status == 1 ? 1 : 0;
|
// $scannedCount += $record->capacitor_scanned_status == 1 ? 1 : 0;
|
||||||
// $scannedCount += $record->scanned_status_set == 1 ? 1 : 0;
|
// $scannedCount += $record->scanned_status_set == 1 ? 1 : 0;
|
||||||
|
|
||||||
// // if (!empty($record->panel_box_serial_number)) {
|
|
||||||
// // $scannedCount++;
|
|
||||||
// // }
|
|
||||||
// return max($stickCount - $scannedCount, 0);
|
// return max($stickCount - $scannedCount, 0);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
|
// $this->dispatch($onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number');
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// public function getInvoiceRecordsProperty()
|
|
||||||
// {
|
|
||||||
// return InvoiceValidation::with('stickerMasterRelation.item')
|
|
||||||
// ->when(! $this->hasSearched, fn ($q) => $q->whereRaw('1 = 0'))
|
|
||||||
// ->when($this->hasSearched, fn ($q) =>
|
|
||||||
// $q->where('invoice_number', $this->invoiceNumber)
|
|
||||||
// ->where('plant_id', $this->plantId)
|
|
||||||
// ->whereNull('scanned_status')
|
|
||||||
// )
|
|
||||||
// ->paginate(7);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function getInvoiceRecordsProperty()
|
|
||||||
// {
|
|
||||||
// return InvoiceValidation::with('stickerMasterRelation.item')
|
|
||||||
// ->where('invoice_number', $this->hasSearched ? $this->invoiceNumber : null)
|
|
||||||
// ->where('plant_id', $this->hasSearched ? $this->plantId : null)
|
|
||||||
// ->whereNull('scanned_status')
|
|
||||||
// ->paginate(7);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||||
{
|
{
|
||||||
$this->plantId = $plantId;
|
|
||||||
$this->invoiceNumber = $invoiceNumber;
|
$this->invoiceNumber = $invoiceNumber;
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
|
||||||
$this->completedInvoice = false;
|
$this->completedInvoice = false;
|
||||||
$this->isSerial = true;
|
$this->isSerial = true;
|
||||||
$this->onCapFocus = $onCapFocus;
|
$this->onCapFocus = $onCapFocus;
|
||||||
@@ -407,77 +384,186 @@ class InvoiceDataTable extends Component
|
|||||||
$this->hasSearched = true;
|
$this->hasSearched = true;
|
||||||
$this->materialInvoice = false;
|
$this->materialInvoice = false;
|
||||||
|
|
||||||
// Eager load stickerMasterRelation and item
|
$this->resetPage();
|
||||||
$invoiceRecords = InvoiceValidation::with('stickerMasterRelation.item')
|
|
||||||
->where('invoice_number', $invoiceNumber)
|
|
||||||
->where('plant_id', $plantId)
|
|
||||||
->whereNull('scanned_status')
|
|
||||||
->get();
|
|
||||||
|
|
||||||
$this->invoiceData = [];
|
|
||||||
$this->packageCount = 0;
|
$this->packageCount = 0;
|
||||||
|
|
||||||
foreach ($invoiceRecords as $record) {
|
$records = InvoiceValidation::with('stickerMasterRelation')
|
||||||
|
->where('invoice_number', $this->invoiceNumber)
|
||||||
|
->where('plant_id', $this->plantId)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$this->packageCount = $records->sum(function ($record) {
|
||||||
|
|
||||||
$sm = $record->stickerMasterRelation;
|
$sm = $record->stickerMasterRelation;
|
||||||
|
|
||||||
// Compute code
|
if (!$sm) {
|
||||||
$rowCode = $sm?->item?->code ?? 'N/A';
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$stickCount = 0;
|
$stickCount = 0;
|
||||||
$scannedCount = 0;
|
$scannedCount = 0;
|
||||||
|
|
||||||
if ($sm) {
|
if (!empty($sm->panel_box_code)) {
|
||||||
// Panel box code
|
|
||||||
if (Str::length($sm->panel_box_code) > 0) {
|
|
||||||
$stickCount++;
|
$stickCount++;
|
||||||
|
|
||||||
|
if ($record->capacitor_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
// Tube stickers logic
|
|
||||||
if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1) {
|
|
||||||
if ($sm->tube_sticker_motor == 1) $stickCount++;
|
|
||||||
if ($sm->tube_sticker_pump == 1 || ($sm->tube_sticker_pumpset != 1 && $sm->tube_sticker_pump != 1 && $sm->pack_slip_pump == 1)) $stickCount++;
|
|
||||||
if ($sm->tube_sticker_pumpset == 1) $stickCount++;
|
|
||||||
}
|
}
|
||||||
// Pack slip logic (only if tube sticker block didn't apply)
|
if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1){
|
||||||
elseif ($sm->pack_slip_motor == 1 || $sm->pack_slip_pump == 1 || $sm->pack_slip_pumpset == 1) {
|
|
||||||
if ($sm->pack_slip_motor == 1) $stickCount++;
|
if ($sm->tube_sticker_motor == 1)
|
||||||
if ($sm->pack_slip_pump == 1) $stickCount++;
|
{
|
||||||
if ($sm->pack_slip_pumpset == 1) $stickCount++;
|
$stickCount++;
|
||||||
|
if ($record->motor_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count already scanned
|
if (
|
||||||
$scannedCount += ($record->motor_scanned_status == 1) ? 1 : 0;
|
$sm->tube_sticker_pump == 1 ||
|
||||||
$scannedCount += ($record->pump_scanned_status == 1) ? 1 : 0;
|
($sm->tube_sticker_pumpset != 1 &&
|
||||||
$scannedCount += ($record->capacitor_scanned_status == 1) ? 1 : 0;
|
$sm->tube_sticker_pump != 1 &&
|
||||||
$scannedCount += ($record->scanned_status_set == 1) ? 1 : 0;
|
$sm->pack_slip_pump == 1)
|
||||||
|
) {
|
||||||
// Increment packageCount
|
$stickCount++;
|
||||||
$this->packageCount += max($stickCount - $scannedCount, 0);
|
if ($record->pump_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
$this->invoiceData[] = [
|
|
||||||
'sticker_master_id' => $record->sticker_master_id,
|
|
||||||
'serial_number' => $record->serial_number,
|
|
||||||
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
|
||||||
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
|
||||||
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
|
||||||
'scanned_status_set' => $record->scanned_status_set ?? '',
|
|
||||||
'scanned_status' => $record->scanned_status ?? '',
|
|
||||||
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
|
||||||
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
|
||||||
'created_at' => $record->created_at,
|
|
||||||
'operator_id' => $record->operator_id,
|
|
||||||
'code' => $rowCode,
|
|
||||||
'stickCount' => $stickCount,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($onCapFocus) {
|
|
||||||
$this->dispatch('focus-capacitor-input');
|
|
||||||
} else {
|
|
||||||
$this->dispatch('focus-serial-number');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($sm->tube_sticker_pumpset == 1) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->scanned_status_set == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($sm->pack_slip_motor == 1 || $sm->pack_slip_pump == 1 || $sm->pack_slip_pumpset == 1)
|
||||||
|
{
|
||||||
|
if ($sm->pack_slip_motor == 1) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->motor_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sm->pack_slip_pump == 1) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->pump_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sm->pack_slip_pumpset == 1) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->scanned_status_set == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return max($stickCount - $scannedCount, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->dispatch(
|
||||||
|
$onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInvoiceRecordsProperty()
|
||||||
|
{
|
||||||
|
return InvoiceValidation::with('stickerMasterRelation.item')
|
||||||
|
->when($this->hasSearched, function ($query) {
|
||||||
|
$query->where('invoice_number', $this->invoiceNumber)
|
||||||
|
->where('plant_id', $this->plantId);
|
||||||
|
})
|
||||||
|
->paginate(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||||
|
// {
|
||||||
|
// $this->plantId = $plantId;
|
||||||
|
// $this->invoiceNumber = $invoiceNumber;
|
||||||
|
// $this->completedInvoice = false;
|
||||||
|
// $this->isSerial = true;
|
||||||
|
// $this->onCapFocus = $onCapFocus;
|
||||||
|
// $this->emptyInvoice = false;
|
||||||
|
// $this->hasSearched = true;
|
||||||
|
// $this->materialInvoice = false;
|
||||||
|
|
||||||
|
// // Eager load stickerMasterRelation and item
|
||||||
|
// $invoiceRecords = InvoiceValidation::with('stickerMasterRelation.item')
|
||||||
|
// ->where('invoice_number', $invoiceNumber)
|
||||||
|
// ->where('plant_id', $plantId)
|
||||||
|
// ->whereNull('scanned_status')
|
||||||
|
// ->get();
|
||||||
|
|
||||||
|
// $this->invoiceData = [];
|
||||||
|
// $this->packageCount = 0;
|
||||||
|
|
||||||
|
// foreach ($invoiceRecords as $record) {
|
||||||
|
// $sm = $record->stickerMasterRelation;
|
||||||
|
|
||||||
|
// // Compute code
|
||||||
|
// $rowCode = $sm?->item?->code ?? 'N/A';
|
||||||
|
|
||||||
|
// $stickCount = 0;
|
||||||
|
// $scannedCount = 0;
|
||||||
|
|
||||||
|
// if ($sm) {
|
||||||
|
// // Panel box code
|
||||||
|
// if (Str::length($sm->panel_box_code) > 0) {
|
||||||
|
// $stickCount++;
|
||||||
|
// }
|
||||||
|
// // Tube stickers logic
|
||||||
|
// if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1) {
|
||||||
|
// if ($sm->tube_sticker_motor == 1) $stickCount++;
|
||||||
|
// if ($sm->tube_sticker_pump == 1 || ($sm->tube_sticker_pumpset != 1 && $sm->tube_sticker_pump != 1 && $sm->pack_slip_pump == 1)) $stickCount++;
|
||||||
|
// if ($sm->tube_sticker_pumpset == 1) $stickCount++;
|
||||||
|
// }
|
||||||
|
// // Pack slip logic (only if tube sticker block didn't apply)
|
||||||
|
// elseif ($sm->pack_slip_motor == 1 || $sm->pack_slip_pump == 1 || $sm->pack_slip_pumpset == 1) {
|
||||||
|
// if ($sm->pack_slip_motor == 1) $stickCount++;
|
||||||
|
// if ($sm->pack_slip_pump == 1) $stickCount++;
|
||||||
|
// if ($sm->pack_slip_pumpset == 1) $stickCount++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Count already scanned
|
||||||
|
// $scannedCount += ($record->motor_scanned_status == 1) ? 1 : 0;
|
||||||
|
// $scannedCount += ($record->pump_scanned_status == 1) ? 1 : 0;
|
||||||
|
// $scannedCount += ($record->capacitor_scanned_status == 1) ? 1 : 0;
|
||||||
|
// $scannedCount += ($record->scanned_status_set == 1) ? 1 : 0;
|
||||||
|
|
||||||
|
// // Increment packageCount
|
||||||
|
// $this->packageCount += max($stickCount - $scannedCount, 0);
|
||||||
|
|
||||||
|
// $this->invoiceData[] = [
|
||||||
|
// 'sticker_master_id' => $record->sticker_master_id,
|
||||||
|
// 'serial_number' => $record->serial_number,
|
||||||
|
// 'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||||
|
// 'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||||
|
// 'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||||
|
// 'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||||
|
// 'scanned_status' => $record->scanned_status ?? '',
|
||||||
|
// 'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||||
|
// 'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||||
|
// 'created_at' => $record->created_at,
|
||||||
|
// 'operator_id' => $record->operator_id,
|
||||||
|
// 'code' => $rowCode,
|
||||||
|
// 'stickCount' => $stickCount,
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($onCapFocus) {
|
||||||
|
// $this->dispatch('focus-capacitor-input');
|
||||||
|
// } else {
|
||||||
|
// $this->dispatch('focus-serial-number');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
public function loadMaterialData($invoiceNumber, $plantId)
|
public function loadMaterialData($invoiceNumber, $plantId)
|
||||||
{
|
{
|
||||||
@@ -547,6 +633,165 @@ class InvoiceDataTable extends Component
|
|||||||
$this->dispatch('focus-serial-number');
|
$this->dispatch('focus-serial-number');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function processCapacitorInput()
|
||||||
|
// {
|
||||||
|
// $user = Filament::auth()->user();
|
||||||
|
// $operatorName = $user->name;
|
||||||
|
|
||||||
|
// if (! $this->capacitorInput) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (! preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Invalid Panel Box QR Format:')
|
||||||
|
// ->body("Scan the valid panel box QR '$this->capacitorInput' to proceed!")
|
||||||
|
// ->danger()
|
||||||
|
// // ->duration(3000)
|
||||||
|
// ->seconds(2)
|
||||||
|
// ->send();
|
||||||
|
|
||||||
|
// $this->capacitorInput = '';
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $parts = explode('/', $this->capacitorInput);
|
||||||
|
// $supplier = $parts[0];
|
||||||
|
// $itemCode = $parts[1];
|
||||||
|
// $serialNumber = implode('/', array_slice($parts, 2)); // Keep rest of the string
|
||||||
|
|
||||||
|
// $existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
||||||
|
// $query->where('code', $this->currentItemCode);
|
||||||
|
// })
|
||||||
|
// ->exists();
|
||||||
|
|
||||||
|
// if (! $existsInStickerMaster) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Unknown: Panel Box Code')
|
||||||
|
// ->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
||||||
|
// ->danger()
|
||||||
|
// // ->duration(4000)
|
||||||
|
// ->seconds(2)
|
||||||
|
// ->send();
|
||||||
|
// $this->capacitorInput = '';
|
||||||
|
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// foreach ($this->invoiceData as &$row) {
|
||||||
|
|
||||||
|
// if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
||||||
|
// $row['panel_box_supplier'] = $supplier;
|
||||||
|
// $row['panel_box_item_code'] = $itemCode;
|
||||||
|
// $row['panel_box_serial_number'] = $serialNumber;
|
||||||
|
// $row['capacitor_scanned_status'] = 1;
|
||||||
|
// // $row['scanned_status_set'] = true;
|
||||||
|
|
||||||
|
// $matchingValidation = InvoiceValidation::with('stickerMaster.item')
|
||||||
|
// ->where('serial_number', $this->currentSerialNumber)
|
||||||
|
// ->where('plant_id', $this->plantId)
|
||||||
|
// ->get()
|
||||||
|
// ->first(function ($validation) {
|
||||||
|
// return $validation->stickerMaster?->item?->code === $this->currentItemCode;
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // dd($matchingValidation);
|
||||||
|
|
||||||
|
// if ($matchingValidation) {
|
||||||
|
// $hasMotorQr = $matchingValidation->stickerMasterRelation->tube_sticker_motor ?? null;
|
||||||
|
// $hasPumpQr = $matchingValidation->stickerMasterRelation->tube_sticker_pump ?? null;
|
||||||
|
// $hasPumpSetQr = $matchingValidation->stickerMasterRelation->tube_sticker_pumpset ?? null;
|
||||||
|
// // $hasCapacitorQr = $matchingValidation->stickerMasterRelation->panel_box_code ?? null;
|
||||||
|
|
||||||
|
// $hadMotorQr = $matchingValidation->motor_scanned_status ?? null;
|
||||||
|
// $hadPumpQr = $matchingValidation->pump_scanned_status ?? null;
|
||||||
|
// $hadPumpSetQr = $matchingValidation->scanned_status_set ?? null;
|
||||||
|
// // $hadCapacitorQr = $matchingValidation->capacitor_scanned_status ?? null;
|
||||||
|
|
||||||
|
// $packCnt = 1;
|
||||||
|
// $scanCnt = 1;
|
||||||
|
// // if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||||
|
// if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||||
|
// $packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||||
|
// $packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||||
|
// $packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||||
|
|
||||||
|
// $scanCnt = $hadMotorQr ? $scanCnt + 1 : $scanCnt;
|
||||||
|
// $scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||||
|
// $scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||||
|
|
||||||
|
// if ($packCnt === $scanCnt) {
|
||||||
|
// $matchingValidation->update([
|
||||||
|
// 'panel_box_supplier' => $supplier,
|
||||||
|
// 'panel_box_item_code' => $itemCode,
|
||||||
|
// 'panel_box_serial_number' => $serialNumber,
|
||||||
|
// 'capacitor_scanned_status' => 1,
|
||||||
|
// 'scanned_status' => 'Scanned',
|
||||||
|
// 'operator_id' => $operatorName,
|
||||||
|
// ]);
|
||||||
|
// } else {
|
||||||
|
// $matchingValidation->update([
|
||||||
|
// 'panel_box_supplier' => $supplier,
|
||||||
|
// 'panel_box_item_code' => $itemCode,
|
||||||
|
// 'panel_box_serial_number' => $serialNumber,
|
||||||
|
// 'capacitor_scanned_status' => 1,
|
||||||
|
// 'operator_id' => $operatorName,
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// $matchingValidation->update([
|
||||||
|
// 'panel_box_supplier' => $supplier,
|
||||||
|
// 'panel_box_item_code' => $itemCode,
|
||||||
|
// 'panel_box_serial_number' => $serialNumber,
|
||||||
|
// 'capacitor_scanned_status' => 1,
|
||||||
|
// 'scanned_status' => 'Scanned',
|
||||||
|
// 'operator_id' => $operatorName,
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Notification::make()
|
||||||
|
// // ->title('Success: Capacitor QR')
|
||||||
|
// // // ->title("Panel box code scanned: $itemCode")
|
||||||
|
// // ->body("'Capacitor' QR scanned status updated, Scan next QR.")
|
||||||
|
// // ->success() // commented
|
||||||
|
// // ->seconds(2)
|
||||||
|
// // ->send();
|
||||||
|
|
||||||
|
// $totalQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->count();
|
||||||
|
// $scannedQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
||||||
|
// // $this->form->fill([
|
||||||
|
// // 'plant_id' => $matchingValidation->plant_id,
|
||||||
|
// // 'invoice_number' => $matchingValidation->invoice_number,
|
||||||
|
// // 'serial_number' => null,
|
||||||
|
// // 'total_quantity' => $totalQuantity,
|
||||||
|
// // 'scanned_quantity'=> $scannedQuantity,
|
||||||
|
// // ]);
|
||||||
|
|
||||||
|
// if ($totalQuantity === $scannedQuantity) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Completed: Serial Invoice')
|
||||||
|
// ->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
||||||
|
// ->success()
|
||||||
|
// ->seconds(2)
|
||||||
|
// ->send();
|
||||||
|
// $this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||||
|
// } else {
|
||||||
|
// $this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $this->showCapacitorInput = false;
|
||||||
|
// $this->capacitorInput = '';
|
||||||
|
// $this->dispatch('updateScannedQuantity');
|
||||||
|
// // $this->loadData($this->invoiceNumber, $this->plantId);
|
||||||
|
// $this->dispatch('focus-serial-number');
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function processCapacitorInput()
|
public function processCapacitorInput()
|
||||||
{
|
{
|
||||||
$user = Filament::auth()->user();
|
$user = Filament::auth()->user();
|
||||||
@@ -592,20 +837,17 @@ class InvoiceDataTable extends Component
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->package = InvoiceValidation::with('stickerMasterRelation')
|
$this->package = InvoiceValidation::with('stickerMasterRelation')
|
||||||
// ->where('invoice_number', $this->invoiceNumber)
|
->where('invoice_number', $this->invoiceNumber)
|
||||||
// ->where('plant_id', $this->plantId)
|
->where('plant_id', $this->plantId)
|
||||||
// ->whereNull('scanned_status')
|
->get();
|
||||||
// ->get();
|
|
||||||
|
|
||||||
foreach ($this->invoiceData as &$row) {
|
foreach ($this->package as &$row) {
|
||||||
|
|
||||||
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
$stickerCode = $row->stickerMasterRelation?->item?->code ?? null;
|
||||||
// // if ($row->stickerMasterRelation?->item?->code == $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
$serialNo = $row->serial_number ?? null;
|
||||||
// $stickerCode = $row->stickerMasterRelation?->item?->code ?? null;
|
|
||||||
// $serialNumber = $row->serial_number ?? null;
|
|
||||||
|
|
||||||
// if ($stickerCode === $this->currentItemCode && $serialNumber === $this->currentSerialNumber) {
|
if ($stickerCode === $this->currentItemCode && $serialNo === $this->currentSerialNumber) {
|
||||||
$row['panel_box_supplier'] = $supplier;
|
$row['panel_box_supplier'] = $supplier;
|
||||||
$row['panel_box_item_code'] = $itemCode;
|
$row['panel_box_item_code'] = $itemCode;
|
||||||
$row['panel_box_serial_number'] = $serialNumber;
|
$row['panel_box_serial_number'] = $serialNumber;
|
||||||
@@ -715,15 +957,15 @@ class InvoiceDataTable extends Component
|
|||||||
$this->dispatch('focus-serial-number');
|
$this->dispatch('focus-serial-number');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
return view('livewire.invoice-data-table');
|
|
||||||
}
|
|
||||||
|
|
||||||
// public function render()
|
// public function render()
|
||||||
// {
|
// {
|
||||||
// return view('livewire.invoice-data-table', [
|
// return view('livewire.invoice-data-table');
|
||||||
// 'records' => $this->invoiceRecords,
|
|
||||||
// ]);
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.invoice-data-table', [
|
||||||
|
'records' => $this->invoiceRecords,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{-- Modal for serial invoice--}}
|
{{-- Modal for serial invoice--}}
|
||||||
@if ($hasSearched)
|
{{-- @if ($hasSearched)
|
||||||
<div class="overflow-x-auto overflow-y-visible" style="height: 385px;">
|
<div class="overflow-x-auto overflow-y-visible" style="height: 385px;">
|
||||||
<table class="min-w-[1500px] text-sm text-center border border-gray-300">
|
<table class="min-w-[1500px] text-sm text-center border border-gray-300">
|
||||||
<table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300">
|
<table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300">
|
||||||
@@ -111,10 +111,10 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif --}}
|
||||||
|
|
||||||
|
|
||||||
{{-- @if ($hasSearched)
|
@if ($hasSearched)
|
||||||
<div class="overflow-x-auto" style="height: 385px;">
|
<div class="overflow-x-auto" style="height: 385px;">
|
||||||
<table class="min-w-full text-sm text-center border border-gray-300">
|
<table class="min-w-full text-sm text-center border border-gray-300">
|
||||||
<table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300">
|
<table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300">
|
||||||
@@ -163,8 +163,8 @@
|
|||||||
<div class="mt-3 flex justify-center">
|
<div class="mt-3 flex justify-center">
|
||||||
{{ $records->onEachSide(3)->links() }}
|
{{ $records->onEachSide(3)->links() }}
|
||||||
</div>
|
</div>
|
||||||
</div> --}}
|
</div>
|
||||||
{{-- @endif --}}
|
@endif
|
||||||
|
|
||||||
{{-- Modal for Capacitor Input --}}
|
{{-- Modal for Capacitor Input --}}
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user