diff --git a/app/Controllers/Service.php b/app/Controllers/Service.php index 9f859fb..5412a59 100755 --- a/app/Controllers/Service.php +++ b/app/Controllers/Service.php @@ -219,24 +219,27 @@ class Service extends BaseController return $this->response->setJSON([]); } } - + public function get_product_by_cc(){ $cc_id = $this->request->getPost('cc_id'); $products = []; $model_ids = $this->BikemodelsModel->select('model_id')->where('cubic_capacity_id', $cc_id)->asArray()->findAll(); - foreach ($model_ids as $model) { - $modelId = $model['model_id']; - // echo $modelId; - $product = $this->ProductModel->select('products.*, manufacturer.manufacturer_name') - ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') - ->where('JSON_CONTAINS(products.models_id, \'["' . $modelId . '"]\')', null, false) - ->where('products.isactive', 1) - ->findAll(); - // echo( $this->ProductModel->getLastQuery()->getQuery()); - $products = array_merge($products, $product); - } - $products = array_unique($products, SORT_REGULAR); + $mid[] = 0; // default zero. because general.. + foreach($model_ids as $model){ + $mid[] = $model['model_id']; + } + $products = []; + foreach ($mid as $id) { + $sql = "SELECT products.*, manufacturer.manufacturer_name + FROM products + JOIN manufacturer ON manufacturer.manufacturer_id = products.manufacturer_id + WHERE JSON_CONTAINS(products.models_id, ?) + AND products.isactive = 1"; + + $result = $this->ProductModel->query($sql, ['"' . $id . '"'])->getResult(); + $products = array_merge($products, $result); + } return $this->response->setJSON($products); } diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php index a9fba7f..6256648 100755 --- a/app/Views/job_card_form.php +++ b/app/Views/job_card_form.php @@ -90,8 +90,8 @@
@@ -312,7 +312,7 @@

Complaint

-

Customer Complaint

+

Additional Complaint

Outsource

diff --git a/app/Views/sales_order_form.php b/app/Views/sales_order_form.php index c7b0b9e..6e1f817 100755 --- a/app/Views/sales_order_form.php +++ b/app/Views/sales_order_form.php @@ -232,7 +232,7 @@ + value="" onchange="updateTaxAmount(this)" readonly> - + + value="" > ' + '' + '' + - '' + + '' + '' + '
' + ''; diff --git a/app/Views/service_form.php b/app/Views/service_form.php index c1187a6..be12a7c 100755 --- a/app/Views/service_form.php +++ b/app/Views/service_form.php @@ -35,7 +35,7 @@
> - @@ -93,24 +93,28 @@
- + +
- + +
- + +
- + +
@@ -311,14 +315,16 @@ $(document).ready(function() { if (service_id != 0) { var category = ; - if (category == 1) { + if (parseInt(category) == 1) { $('#cc_hide').css('display', 'block'); $('#service_hide').css('display' ,'block'); - $('#cubiccapacity').attr('required', false).attr('readonly', true); + $('#cubiccapacity').attr('required', true).attr('readonly', false); + // $('#serviceSelected').attr('required', true).attr('readonly', false); } else { $('#cc_hide').css('display', 'none'); $('#service_hide').css('display' ,'none'); - $('#cubiccapacity').attr('required', true).attr('readonly', false); + $('#cubiccapacity').attr('required', false).attr('readonly', true); + $('#serviceSelected').attr('required', false); } } }); @@ -334,8 +340,8 @@ document.getElementById('category').addEventListener('change', function() { var ccSelect = document.getElementById('cubiccapacity'); var serviceSelected = document.getElementById('serviceSelected'); var productSelect = document.getElementById('productSelect'); - - if (this.value == '1') { // 1 ==> Standalone + if (parseInt(this.value) == 1) { + // 1 ==> Standalone // customFields.style.display = 'block'; // $('#make_hide').css('display' , 'block'); // $('#model_hide').css('display' ,'block'); @@ -343,7 +349,7 @@ document.getElementById('category').addEventListener('change', function() { $('#service_hide').css('display' ,'block'); $('#cubiccapacity').val(''); $('#productSelect').empty(); - ccSelect.setAttribute('required', 'required'); + $('#cubiccapacity').attr('required', true).attr('readonly', false); // makeSelect.setAttribute('required', 'required'); // modelSelect.setAttribute('required', 'required'); // serviceSelected.setAttribute('required', 'required'); @@ -355,10 +361,10 @@ document.getElementById('category').addEventListener('change', function() { $('#service_hide').css('display' ,'none'); $('#cubiccapacity').val(''); $('#productSelect').empty(); - ccSelect.removeAttribute('required'); + $('#cubiccapacity').attr('required', false).attr('readonly', true); + $('#serviceSelected').attr('required', false); // makeSelect.removeAttribute('required'); // modelSelect.removeAttribute('required'); - serviceSelected.removeAttribute('required'); $.ajax({ url: '', // URL to your CodeIgniter controller method type: 'GET', diff --git a/app/Views/service_list.php b/app/Views/service_list.php index eb8d37c..5158a7f 100755 --- a/app/Views/service_list.php +++ b/app/Views/service_list.php @@ -23,8 +23,8 @@ Service Name - Price With General - Price WithOut General + General Service Price + Complaint Price Tax Description Action