Added page number options in serial livewire
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 9m24s
Laravel Larastan / larastan (pull_request) Failing after 10m59s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 9m24s
Laravel Larastan / larastan (pull_request) Failing after 10m59s
This commit is contained in:
@@ -2,20 +2,24 @@
|
|||||||
|
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use App\Models\SerialValidation;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use App\Models\SerialValidation;
|
use Livewire\WithPagination;
|
||||||
|
|
||||||
|
|
||||||
class SerialValidationData extends Component
|
class SerialValidationData extends Component
|
||||||
{
|
{
|
||||||
|
|
||||||
|
use WithPagination;
|
||||||
|
|
||||||
public $invoiceData = [];
|
public $invoiceData = [];
|
||||||
|
|
||||||
public $plantId = 0;
|
public $plantId = 0;
|
||||||
|
|
||||||
public string $invoiceNumber = '';
|
public string $invoiceNumber = '';
|
||||||
|
|
||||||
public string $serialNumber = '';
|
public string $serialNumber = '';
|
||||||
|
|
||||||
public bool $completedInvoice = false;
|
public bool $completedInvoice = false;
|
||||||
@@ -30,22 +34,22 @@ class SerialValidationData extends Component
|
|||||||
|
|
||||||
public bool $showCapacitorInput = false;
|
public bool $showCapacitorInput = false;
|
||||||
|
|
||||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||||
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
'refreshCompletedInvoice' => 'loadCompletedData',
|
'refreshCompletedInvoice' => 'loadCompletedData',
|
||||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||||
'refreshInvoiceData' => 'loadData',
|
'refreshInvoiceData' => 'loadData',
|
||||||
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
||||||
'focusCapacitor' => 'focusCapacitorInput'
|
'focusCapacitor' => 'focusCapacitorInput',
|
||||||
//'openCapacitorModal' => 'showCapacitorInputBox',
|
// 'openCapacitorModal' => 'showCapacitorInputBox',
|
||||||
];
|
];
|
||||||
|
|
||||||
public $capacitorInput = '';
|
public $capacitorInput = '';
|
||||||
|
|
||||||
public $panel_box_supplier;
|
public $panel_box_supplier;
|
||||||
|
|
||||||
public $panel_box_item_code;
|
public $panel_box_code;
|
||||||
|
|
||||||
public $panel_box_serial_number;
|
public $panel_box_serial_number;
|
||||||
|
|
||||||
@@ -96,43 +100,155 @@ class SerialValidationData extends Component
|
|||||||
// $this->showCapacitorInput = false;
|
// $this->showCapacitorInput = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadData($invoiceNumber, $plantId)
|
// public function loadData($invoiceNumber, $plantId)
|
||||||
|
// {
|
||||||
|
// $this->plantId = $plantId;
|
||||||
|
// $this->invoiceNumber = $invoiceNumber;
|
||||||
|
// $this->completedInvoice = false;
|
||||||
|
// $this->isSerial = true;
|
||||||
|
// $this->emptyInvoice = false;
|
||||||
|
// $this->hasSearched = true;
|
||||||
|
// $this->materialInvoice = false;
|
||||||
|
// // $this->showCapacitorInput = false;
|
||||||
|
|
||||||
|
// // ->where('serial_number', '!=', '')
|
||||||
|
// $this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)
|
||||||
|
// ->where('plant_id', $plantId)->where('scanned_status', null)
|
||||||
|
// ->get()
|
||||||
|
// ->map(function ($record) {
|
||||||
|
// return [
|
||||||
|
// 'sticker_master_id' => $record->sticker_master_id,
|
||||||
|
// 'serial_number' => $record->serial_number,
|
||||||
|
// 'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||||
|
// 'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||||
|
// 'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||||
|
// 'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||||
|
// 'scanned_status' => $record->scanned_status ?? '', //
|
||||||
|
// 'panel_box_code' => $record->panel_box_code ?? '',
|
||||||
|
// 'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||||
|
// 'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||||
|
// 'created_at' => $record->created_at,
|
||||||
|
// 'operator_id' => $record->operator_id,
|
||||||
|
// ];
|
||||||
|
// })
|
||||||
|
// ->toArray();
|
||||||
|
|
||||||
|
// // Loop through and replace 'code' using related StickerMaster > Item > code
|
||||||
|
// foreach ($this->invoiceData as &$row) {
|
||||||
|
// // $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||||
|
// $row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||||
{
|
{
|
||||||
$this->plantId = $plantId;
|
|
||||||
$this->invoiceNumber = $invoiceNumber;
|
$this->invoiceNumber = $invoiceNumber;
|
||||||
|
$this->plantId = $plantId;
|
||||||
|
|
||||||
$this->completedInvoice = false;
|
$this->completedInvoice = false;
|
||||||
$this->isSerial = true;
|
$this->isSerial = true;
|
||||||
|
$this->onCapFocus = $onCapFocus;
|
||||||
$this->emptyInvoice = false;
|
$this->emptyInvoice = false;
|
||||||
$this->hasSearched = true;
|
$this->hasSearched = true;
|
||||||
$this->materialInvoice = false;
|
$this->materialInvoice = false;
|
||||||
// $this->showCapacitorInput = false;
|
|
||||||
|
|
||||||
//->where('serial_number', '!=', '')
|
$this->resetPage();
|
||||||
$this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)
|
$this->packageCount = 0;
|
||||||
->where('plant_id', $plantId)->where('scanned_status', null)
|
|
||||||
->get()
|
|
||||||
->map(function ($record) {
|
|
||||||
return [
|
|
||||||
'sticker_master_id' => $record->sticker_master_id,
|
|
||||||
'serial_number' => $record->serial_number,
|
|
||||||
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
|
||||||
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
|
||||||
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
|
||||||
'scanned_status_set' => $record->scanned_status_set ?? '',
|
|
||||||
'scanned_status' => $record->scanned_status ?? '',
|
|
||||||
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
|
||||||
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
|
||||||
'created_at' => $record->created_at,
|
|
||||||
'operator_id' => $record->operator_id,
|
|
||||||
];
|
|
||||||
})
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
//Loop through and replace 'code' using related StickerMaster > Item > code
|
$records = SerialValidation::with('stickerMasterRelation')
|
||||||
foreach ($this->invoiceData as &$row) {
|
->where('invoice_number', $this->invoiceNumber)
|
||||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
->where('plant_id', $this->plantId)
|
||||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
->get();
|
||||||
}
|
|
||||||
|
$this->packageCount = $records->sum(function ($record) {
|
||||||
|
|
||||||
|
$sm = $record->stickerMasterRelation;
|
||||||
|
|
||||||
|
if (! $sm) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stickCount = 0;
|
||||||
|
$scannedCount = 0;
|
||||||
|
|
||||||
|
if (! empty($sm->panel_box_code)) {
|
||||||
|
$stickCount++;
|
||||||
|
|
||||||
|
if ($record->capacitor_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// $sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1
|
||||||
|
if (! empty($sm->tube_sticker_motor) || ! empty($sm->tube_sticker_pump) || ! empty($sm->tube_sticker_pumpset)) {
|
||||||
|
|
||||||
|
if (! empty($sm->tube_sticker_motor)) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->motor_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ($sm->tube_sticker_pumpset != 1 && $sm->tube_sticker_pump != 1 && $sm->pack_slip_pump == 1)
|
||||||
|
if (! empty($sm->tube_sticker_pump) || (empty($sm->tube_sticker_pumpset) && empty($sm->tube_sticker_pump) && ! empty($sm->pack_slip_pump))) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->pump_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($sm->tube_sticker_pumpset)) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->scanned_status_set == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif (! empty($sm->pack_slip_motor) || ! empty($sm->pack_slip_pump) || ! empty($sm->pack_slip_pumpset)) {
|
||||||
|
if (! empty($sm->pack_slip_motor)) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->motor_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($sm->pack_slip_pump)) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->pump_scanned_status == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($sm->pack_slip_pumpset)) {
|
||||||
|
$stickCount++;
|
||||||
|
if ($record->scanned_status_set == 1) {
|
||||||
|
$scannedCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return max($stickCount - $scannedCount, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->dispatch(
|
||||||
|
$onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInvoiceRecordsProperty()
|
||||||
|
{
|
||||||
|
return SerialValidation::with('stickerMasterRelation.item')
|
||||||
|
->where('invoice_number', $this->invoiceNumber)
|
||||||
|
->where('plant_id', $this->plantId)
|
||||||
|
->where(function ($query) {
|
||||||
|
$query->whereNull('scanned_status')
|
||||||
|
->orWhere('scanned_status', '');
|
||||||
|
})
|
||||||
|
// ->when($this->hasSearched, function ($query) {
|
||||||
|
// $query->where('invoice_number', $this->invoiceNumber)
|
||||||
|
// ->where('plant_id', $this->plantId)
|
||||||
|
// ->where('scanned_status', '=', '');
|
||||||
|
// })
|
||||||
|
->paginate(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loadMaterialData($invoiceNumber, $plantId)
|
public function loadMaterialData($invoiceNumber, $plantId)
|
||||||
@@ -146,43 +262,36 @@ class SerialValidationData extends Component
|
|||||||
$this->materialInvoice = true;
|
$this->materialInvoice = true;
|
||||||
// $this->showCapacitorInput = false;
|
// $this->showCapacitorInput = false;
|
||||||
|
|
||||||
//->where('serial_number', '!=', '')
|
// ->where('serial_number', '!=', '')
|
||||||
$this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $plantId)->where('serial_number', null)
|
$this->invoiceData = SerialValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $plantId)->where('serial_number', null)
|
||||||
->get()
|
->get()
|
||||||
->map(function ($record) {
|
->map(function ($record) {
|
||||||
return [
|
return [
|
||||||
'sticker_master_id' => $record->sticker_master_id,
|
'sticker_master_id' => $record->sticker_master_id,
|
||||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||||
'quantity' => $record->quantity ?? '',
|
'quantity' => $record->quantity ?? '',
|
||||||
'serial_number' => $record->serial_number ?? '',
|
'serial_number' => $record->serial_number ?? '',
|
||||||
'batch_number' => $record->batch_number ?? '',
|
'batch_number' => $record->batch_number ?? '',
|
||||||
'created_at' => $record->created_at,
|
'created_at' => $record->created_at,
|
||||||
'operator_id' => $record->operator_id,
|
'operator_id' => $record->operator_id,
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
//Loop through and replace 'code' using related StickerMaster > Item > code
|
// Loop through and replace 'code' using related StickerMaster > Item > code
|
||||||
foreach ($this->invoiceData as &$row) {
|
foreach ($this->invoiceData as &$row) {
|
||||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||||
if($matType === 1)
|
if ($matType === 1) {
|
||||||
{
|
|
||||||
$row['material_type'] = 'Individual';
|
$row['material_type'] = 'Individual';
|
||||||
}
|
} elseif ($matType === 2) {
|
||||||
else if($matType === 2)
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'Bundle';
|
$row['material_type'] = 'Bundle';
|
||||||
}
|
} elseif ($matType === 3) {
|
||||||
else if($matType === 3)
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'Quantity';
|
$row['material_type'] = 'Quantity';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'N/A';
|
$row['material_type'] = 'N/A';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,11 +325,11 @@ class SerialValidationData extends Component
|
|||||||
$user = Filament::auth()->user();
|
$user = Filament::auth()->user();
|
||||||
$operatorName = $user->name;
|
$operatorName = $user->name;
|
||||||
|
|
||||||
if (!$this->capacitorInput) {
|
if (! $this->capacitorInput) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
if (! preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Panel Box QR Format:')
|
->title('Invalid Panel Box QR Format:')
|
||||||
->body('Scan the valid panel box QR code to proceed!')
|
->body('Scan the valid panel box QR code to proceed!')
|
||||||
@@ -228,6 +337,7 @@ class SerialValidationData extends Component
|
|||||||
// ->duration(3000)
|
// ->duration(3000)
|
||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,9 +349,9 @@ class SerialValidationData extends Component
|
|||||||
$existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
$existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
||||||
$query->where('code', $this->currentItemCode);
|
$query->where('code', $this->currentItemCode);
|
||||||
})
|
})
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if (!$existsInStickerMaster) {
|
if (! $existsInStickerMaster) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown: Panel Box Code')
|
->title('Unknown: Panel Box Code')
|
||||||
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
||||||
@@ -250,6 +360,7 @@ class SerialValidationData extends Component
|
|||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->capacitorInput = '';
|
$this->capacitorInput = '';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +370,7 @@ class SerialValidationData extends Component
|
|||||||
($row['serial_number'] ?? '') === $this->currentSerialNumber
|
($row['serial_number'] ?? '') === $this->currentSerialNumber
|
||||||
) {
|
) {
|
||||||
$row['panel_box_supplier'] = $supplier;
|
$row['panel_box_supplier'] = $supplier;
|
||||||
$row['panel_box_item_code'] = $itemCode;
|
$row['panel_box_code'] = $itemCode;
|
||||||
$row['panel_box_serial_number'] = $serialNumber;
|
$row['panel_box_serial_number'] = $serialNumber;
|
||||||
$row['capacitor_scanned_status'] = 1;
|
$row['capacitor_scanned_status'] = 1;
|
||||||
// $row['scanned_status_set'] = true;
|
// $row['scanned_status_set'] = true;
|
||||||
@@ -286,47 +397,41 @@ class SerialValidationData extends Component
|
|||||||
$packCnt = 1;
|
$packCnt = 1;
|
||||||
$scanCnt = 1;
|
$scanCnt = 1;
|
||||||
// if($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
// if($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||||
if($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
|
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||||
{
|
|
||||||
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||||
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||||
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||||
|
|
||||||
$scanCnt = $hadMotorQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadMotorQr ? $scanCnt + 1 : $scanCnt;
|
||||||
$scanCnt = $hadPumpQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
|
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||||
|
|
||||||
if($packCnt === $scanCnt)
|
if ($packCnt === $scanCnt) {
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'operator_id'=> $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'operator_id'=> $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_code' => $itemCode,
|
||||||
'panel_box_serial_number' => $serialNumber,
|
'panel_box_serial_number' => $serialNumber,
|
||||||
'capacitor_scanned_status' => 1,
|
'capacitor_scanned_status' => 1,
|
||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'operator_id'=> $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,15 +446,14 @@ class SerialValidationData extends Component
|
|||||||
$totalQuantity = SerialValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->count();
|
$totalQuantity = SerialValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->count();
|
||||||
$scannedQuantity = SerialValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
$scannedQuantity = SerialValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
||||||
// $this->form->fill([
|
// $this->form->fill([
|
||||||
// 'plant_id' => $matchingValidation->plant_id,
|
// 'plant_id' => $matchingValidation->plant_id,
|
||||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||||
// 'serial_number' => null,
|
// 'serial_number' => null,
|
||||||
// 'total_quantity' => $totalQuantity,
|
// 'total_quantity' => $totalQuantity,
|
||||||
// 'scanned_quantity'=> $scannedQuantity,
|
// 'scanned_quantity'=> $scannedQuantity,
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
if($totalQuantity === $scannedQuantity)
|
if ($totalQuantity === $scannedQuantity) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Completed: Serial Invoice')
|
->title('Completed: Serial Invoice')
|
||||||
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
||||||
@@ -357,9 +461,7 @@ class SerialValidationData extends Component
|
|||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id);
|
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -373,7 +475,8 @@ class SerialValidationData extends Component
|
|||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.serial-validation-data');
|
return view('livewire.serial-validation-data', [
|
||||||
|
'records' => $this->invoiceRecords,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,52 +45,57 @@
|
|||||||
|
|
||||||
{{-- Modal for serial invoice--}}
|
{{-- Modal for serial invoice--}}
|
||||||
@if ($hasSearched)
|
@if ($hasSearched)
|
||||||
<div class="overflow-x-auto overflow-y-visible" style="height: 385px;">
|
<div class="overflow-x-auto" style="height: 385px;">
|
||||||
{{-- <table class="min-w-[1500px] text-sm text-center border border-gray-300"> --}}
|
<table class="min-w-full text-sm text-center border border-gray-300">
|
||||||
{{-- <table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300"> --}}
|
<table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300">
|
||||||
<table class="min-w-full text-sm text-center border border-gray-300">
|
|
||||||
<thead class="bg-gray-100 font-bold">
|
<thead class="bg-gray-100 font-bold">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="border px-4 py-2">No</th>
|
<th class="border px-4 py-2">No</th>
|
||||||
<th class="border px-4 py-2">Material Code</th>
|
<th class="border px-4 py-2">Material Code</th>
|
||||||
<th class="border px-4 py-2">Serial Number</th>
|
<th class="border px-4 py-2">Serial Number</th>
|
||||||
<th class="border px-4 py-2">Motor Scanned Status</th>
|
<th class="border px-4 py-2">Motor Scanned Status</th>
|
||||||
<th class="border px-4 py-2">Pump Scanned Status</th>
|
<th class="border px-4 py-2">Pump Scanned Status</th>
|
||||||
<th class="border px-4 py-2">Capacitor Scanned Status</th>
|
<th class="border px-4 py-2">Capacitor Scanned Status</th>
|
||||||
<th class="border px-4 py-2">Scanned Status Set</th>
|
<th class="border px-4 py-2">Scanned Status Set</th>
|
||||||
<th class="border px-4 py-2">Scanned Status</th>
|
<th class="border px-4 py-2">Scanned Status</th>
|
||||||
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
||||||
<th class="border px-4 py-2">Operator ID</th>
|
<th class="border px-4 py-2">Operator ID</th>
|
||||||
<th class="border px-4 py-2">Panel Box Supplier</th>
|
{{-- <th class="border px-4 py-2">Panel Box Code</th> --}}
|
||||||
<th class="border px-4 py-2">Panel Box Serial Number</th>
|
<th class="border px-4 py-2">Panel Box Supplier</th>
|
||||||
|
<th class="border px-4 py-2">Panel Box Serial Number</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@forelse ($records as $index => $record)
|
||||||
|
<tr wire:key="inv-{{ $record->id }}" class="border-t">
|
||||||
|
<td class="border px-2 py-2">{{ $records->firstItem() + $index }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->stickerMasterRelation?->item?->code ?? 'N/A' }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->serial_number ?? 'N/A' }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->motor_scanned_status ? '1' : '' }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->pump_scanned_status ? '1' : '' }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->capacitor_scanned_status ? '1' : '' }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->scanned_status_set ? '1' : '' }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->scanned_status ?? '' }}</td>
|
||||||
|
<td class="border px-2 py-2 whitespace-nowrap">{{ optional($record->created_at)->format('d-m-Y H:i:s') }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->operator_id ?? '' }}</td>
|
||||||
|
{{-- <td class="border px-2 py-2">{{ $record->panel_box_code ?? '' }}</td> --}}
|
||||||
|
<td class="border px-2 py-2">{{ $record->panel_box_supplier ?? '' }}</td>
|
||||||
|
<td class="border px-2 py-2">{{ $record->panel_box_serial_number ?? '' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
@empty
|
||||||
<tbody>
|
<tr>
|
||||||
@forelse ($invoiceData as $index => $row)
|
<td colspan="12" class="py-4 text-gray-500">
|
||||||
<tr class="border-t">
|
No data found for invoice <strong>{{ $invoiceNumber }}</strong>
|
||||||
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
</td>
|
||||||
<td class="border px-4 py-2">{{ $row['code'] ?? 'N/A' }}</td>
|
</tr>
|
||||||
<td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td>
|
@endforelse
|
||||||
<td class="border px-4 py-2">{{ $row['motor_scanned_status'] ?? '' }}</td>
|
</tbody>
|
||||||
<td class="border px-4 py-2">{{ $row['pump_scanned_status'] ?? '' }}</td>
|
</table>
|
||||||
<td class="border px-4 py-2">{{ $row['capacitor_scanned_status'] ?? '' }}</td>
|
<div class="mt-3 flex justify-center">
|
||||||
<td class="border px-4 py-2">{{ $row['scanned_status_set'] ?? '' }}</td>
|
{{ $records->onEachSide(3)->links() }}
|
||||||
<td class="border px-4 py-2">{{ $row['scanned_status'] ?? '' }}</td>
|
|
||||||
<td class="border px-4 py-2">{{ $row['created_at'] ?? '' }}</td>
|
|
||||||
<td class="border px-4 py-2">{{ $row['operator_id'] ?? '' }}</td>
|
|
||||||
<td class="border px-4 py-2">{{ $row['panel_box_supplier'] ?? '' }}</td>
|
|
||||||
<td class="border px-4 py-2">{{ $row['panel_box_serial_number'] ?? '' }}</td>
|
|
||||||
</tr>
|
|
||||||
@empty
|
|
||||||
<tr>
|
|
||||||
<td colspan="12" class="text-center py-4 text-gray-500">
|
|
||||||
No data found for the invoice number <strong>{{ $invoiceNumber }}</strong>.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforelse
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{-- Modal for Capacitor Input --}}
|
{{-- Modal for Capacitor Input --}}
|
||||||
|
|||||||
Reference in New Issue
Block a user