diff --git a/app/Livewire/PanelCheckList.php b/app/Livewire/PanelCheckList.php index a95b89f..24638dd 100644 --- a/app/Livewire/PanelCheckList.php +++ b/app/Livewire/PanelCheckList.php @@ -32,6 +32,8 @@ public $records = []; public bool $selectForNotOk = false; + public $remark; + // public $skipChecklistValidation = false; // protected $listeners = ['focus-item-id' => 'handleFocus', 'trigger-create' => 'doCreate',]; @@ -83,6 +85,18 @@ public $records = []; } } + if($this->selectForNotOk){ + + if (empty($this->remark) || $this->remark == '') { + Notification::make() + ->title('Remark Mandatory') + ->body("Remark can't be empty!") + ->danger() + ->send(); + return; + } + } + $item = Item::where('code', $this->data['item_id'])->first(); if (! $item) { @@ -350,6 +364,7 @@ public $records = []; 'status' => $status, 'inspection_status' => $finalInspectionStatus ?? null, 'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null, + 'remark' => $this->remark ?? null, 'created_by' => $this->data['created_by'] ?? null, 'updated_by' => $this->data['updated_by'] ?? null, ]); @@ -393,6 +408,7 @@ public $records = []; $mail->send(new PanelBoxNotOkAlert( $plantName, $code ?? null, + $this->remark ?? null, $this->data['serial_number'] ?? null, $this->data['panel_box_supplier'] ?? null, $notOkCharacteristics diff --git a/app/Mail/PanelBoxNotOkAlert.php b/app/Mail/PanelBoxNotOkAlert.php index 8e09e27..931fda9 100644 --- a/app/Mail/PanelBoxNotOkAlert.php +++ b/app/Mail/PanelBoxNotOkAlert.php @@ -20,13 +20,16 @@ class PanelBoxNotOkAlert extends Mailable public $supplier; + public $remark; + /** * Create a new message instance. */ - public function __construct($plant,$itemCode,$serialNumber,$supplier, $characteristics) + public function __construct($plant,$itemCode,$remark, $serialNumber,$supplier, $characteristics) { $this->plant = $plant; $this->itemCode = $itemCode; + $this->remark = $remark; $this->serialNumber = $serialNumber; $this->supplier = $supplier; $this->characteristics = $characteristics; diff --git a/resources/views/livewire/panel-check-list.blade.php b/resources/views/livewire/panel-check-list.blade.php index 5def0d2..8395442 100644 --- a/resources/views/livewire/panel-check-list.blade.php +++ b/resources/views/livewire/panel-check-list.blade.php @@ -117,7 +117,7 @@ @else
No records found.
@endif -