diff --git a/app/Livewire/InvoiceDataTable.php b/app/Livewire/InvoiceDataTable.php
index fbe7183..87f1342 100644
--- a/app/Livewire/InvoiceDataTable.php
+++ b/app/Livewire/InvoiceDataTable.php
@@ -407,49 +407,47 @@ class InvoiceDataTable extends Component
$scannedCount++;
}
}
- if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1) {
- if ($sm->tube_sticker_motor == 1) {
+ // $sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1
+ if (! empty($sm->tube_sticker_motor) || ! empty($sm->tube_sticker_pump) || ! empty($sm->tube_sticker_pumpset)) {
+
+ if (! empty($sm->tube_sticker_motor)) {
$stickCount++;
if ($record->motor_scanned_status == 1) {
$scannedCount++;
}
}
- if (
- $sm->tube_sticker_pump == 1 ||
- ($sm->tube_sticker_pumpset != 1 &&
- $sm->tube_sticker_pump != 1 &&
- $sm->pack_slip_pump == 1)
- ) {
+ // ($sm->tube_sticker_pumpset != 1 && $sm->tube_sticker_pump != 1 && $sm->pack_slip_pump == 1)
+ if (! empty($sm->tube_sticker_pump) || (empty($sm->tube_sticker_pumpset) && empty($sm->tube_sticker_pump) && ! empty($sm->pack_slip_pump))) {
$stickCount++;
if ($record->pump_scanned_status == 1) {
$scannedCount++;
}
}
- if ($sm->tube_sticker_pumpset == 1) {
+ if (! empty($sm->tube_sticker_pumpset)) {
$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) {
+ } elseif (! empty($sm->pack_slip_motor) || ! empty($sm->pack_slip_pump) || ! empty($sm->pack_slip_pumpset)) {
+ if (! empty($sm->pack_slip_motor)) {
$stickCount++;
if ($record->motor_scanned_status == 1) {
$scannedCount++;
}
}
- if ($sm->pack_slip_pump == 1) {
+ if (! empty($sm->pack_slip_pump)) {
$stickCount++;
if ($record->pump_scanned_status == 1) {
$scannedCount++;
}
}
- if ($sm->pack_slip_pumpset == 1) {
+ if (! empty($sm->pack_slip_pumpset)) {
$stickCount++;
if ($record->scanned_status_set == 1) {
$scannedCount++;
@@ -597,13 +595,13 @@ class InvoiceDataTable extends Component
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
- if ($matType === 1) {
+ if ($matType == 1) {
$row['material_type'] = 'Individual';
- } elseif ($matType === 2) {
+ } elseif ($matType == 2) {
$row['material_type'] = 'Bundle';
- } elseif ($matType === 3) {
+ } elseif ($matType == 3) {
$row['material_type'] = 'Quantity';
- } elseif ($matType === 4) {
+ } elseif ($matType == 4) {
$row['material_type'] = 'Bundle Individual';
} else {
$row['material_type'] = 'N/A';
@@ -682,7 +680,7 @@ class InvoiceDataTable extends Component
// foreach ($this->invoiceData as &$row) {
- // if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
+ // if (($row['code'] ?? '') == $this->currentItemCode && ($row['serial_number'] ?? '') == $this->currentSerialNumber) {
// $row['panel_box_supplier'] = $supplier;
// $row['panel_box_code'] = $itemCode;
// $row['panel_box_serial_number'] = $serialNumber;
@@ -694,7 +692,7 @@ class InvoiceDataTable extends Component
// ->where('plant_id', $this->plantId)
// ->get()
// ->first(function ($validation) {
- // return $validation->stickerMaster?->item?->code === $this->currentItemCode;
+ // return $validation->stickerMaster?->item?->code == $this->currentItemCode;
// });
// // dd($matchingValidation);
@@ -712,7 +710,7 @@ class InvoiceDataTable extends Component
// $packCnt = 1;
// $scanCnt = 1;
- // // if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
+ // // if ($hadMotorQr == $hasMotorQr && $hadPumpQr == $hasPumpQr && $hadPumpSetQr == $hasPumpSetQr)
// if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
// $packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
// $packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
@@ -722,7 +720,7 @@ class InvoiceDataTable extends Component
// $scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
// $scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
- // if ($packCnt === $scanCnt) {
+ // if ($packCnt == $scanCnt) {
// $matchingValidation->update([
// 'panel_box_supplier' => $supplier,
// 'panel_box_code' => $itemCode,
@@ -769,7 +767,7 @@ class InvoiceDataTable extends Component
// // 'scanned_quantity'=> $scannedQuantity,
// // ]);
- // if ($totalQuantity === $scannedQuantity) {
+ // if ($totalQuantity == $scannedQuantity) {
// Notification::make()
// ->title('Completed: Serial Invoice')
// ->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.
Scan the next 'Serial Invoice' to proceed!")
@@ -848,7 +846,7 @@ class InvoiceDataTable extends Component
$stickerCode = $row->stickerMasterRelation?->item?->code ?? null;
$serialNo = $row->serial_number ?? null;
- if ($stickerCode === $this->currentItemCode && $serialNo === $this->currentSerialNumber) {
+ if ($stickerCode == $this->currentItemCode && $serialNo == $this->currentSerialNumber) {
$row['panel_box_supplier'] = $supplier;
$row['panel_box_code'] = $itemCode;
$row['panel_box_serial_number'] = $serialNumber;
@@ -860,7 +858,7 @@ class InvoiceDataTable extends Component
->where('plant_id', $this->plantId)
->get()
->first(function ($validation) {
- return $validation->stickerMaster?->item?->code === $this->currentItemCode;
+ return $validation->stickerMaster?->item?->code == $this->currentItemCode;
});
// dd($matchingValidation);
@@ -878,7 +876,7 @@ class InvoiceDataTable extends Component
$packCnt = 1;
$scanCnt = 1;
- // if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
+ // if ($hadMotorQr == $hasMotorQr && $hadPumpQr == $hasPumpQr && $hadPumpSetQr == $hasPumpSetQr)
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
@@ -935,7 +933,7 @@ class InvoiceDataTable extends Component
// 'scanned_quantity'=> $scannedQuantity,
// ]);
- if ($totalQuantity === $scannedQuantity) {
+ if ($totalQuantity == $scannedQuantity) {
Notification::make()
->title('Completed: Serial Invoice')
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.
Scan the next 'Serial Invoice' to proceed!")
diff --git a/database/migrations/2026_05_29_125118_create_leak_test_readings_table.php b/database/migrations/2026_05_29_125118_create_leak_test_readings_table.php
new file mode 100644
index 0000000..052b0a1
--- /dev/null
+++ b/database/migrations/2026_05_29_125118_create_leak_test_readings_table.php
@@ -0,0 +1,46 @@
+id();
+ // $table->timestamps();
+ // });
+ $sql = <<<'SQL'
+ CREATE TABLE leak_test_readings (
+ id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
+
+ plant_id BIGINT NOT NULL,
+
+ item_code TEXT NOT NULL,
+ serial_number TEXT NOT NULL,
+ test_status TEXT NOT NULL,
+
+ created_at TIMESTAMP NOT NULL DEFAULT NOW(),
+ updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
+ deleted_at TIMESTAMP,
+
+ FOREIGN KEY (plant_id) REFERENCES plants (id)
+ );
+ SQL;
+
+ DB::statement($sql);
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('leak_test_readings');
+ }
+};