diff --git a/app/Controllers/Model.php b/app/Controllers/Model.php index 0b9d59b..aa82da4 100755 --- a/app/Controllers/Model.php +++ b/app/Controllers/Model.php @@ -65,14 +65,16 @@ class Model extends BaseController $make_id = $this->request->getPost('make_id'); $model_name = $this->request->getPost('modelname'); $BikemodelsModel = new BikemodelsModel(); + + //they check model name already exist or not here. if ($make_id>0) { - $make = $BikemodelsModel->where(['make' => $model_name, 'isactive' => 1]) + $make = $BikemodelsModel->where(['model_name' => $model_name, 'isactive' => 1]) ->where('make_id !=', $make_id) ->findAll(); } else { - $make = $BikemodelsModel->where(['make' => $model_name, 'isactive' => 1])->findAll(); + $make = $BikemodelsModel->where(['model_name' => $model_name, 'isactive' => 1])->findAll(); } - + if (!empty($make)) { $result = "Name Already Exist"; return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 200); @@ -85,9 +87,11 @@ class Model extends BaseController ]; // print_r($model_id);die; + //here model id they get from Param. if (!$model_id) { try { $data['business_id'] = $this->session->get('logged_user_business_id'); + $data['created_by'] = (int)$this->session->get('logged_user'); $inserted = $BikemodelsModel->insert($data); } catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) { @@ -104,7 +108,7 @@ class Model extends BaseController } } else{ - + $data['updated_by'] = (int)$this->session->get('logged_user'); $updated = $BikemodelsModel->update($model_id ,$data); if ($updated) { $result = $data; @@ -133,7 +137,7 @@ class Model extends BaseController $data = [ 'isactive' => $isactive ]; - + $data['updated_by'] = (int)$this->session->get('logged_user'); $updated = $BikemodelsModel->update($model_id, $data); $model = $BikemodelsModel->where('model_id',$model_id)->first(); diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index 46b92a4..0821a94 100755 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -64,6 +64,7 @@ class Products extends BaseController $data['products'] = $this->ProductModel->where('manufacturer_id',$manufacturer_id)->orderBy('product_name')->findAll(); $manufacturer = $this->ManufacturerModel->where('manufacturer_id',$manufacturer_id)->select('manufacturer_name')->first(); + // print_r($manufacturer);die; $data['manufacturer_id'] = $manufacturer_id; $data['manufacturer_name'] = $manufacturer['manufacturer_name']; diff --git a/app/Controllers/Service.php b/app/Controllers/Service.php index 12b74a8..f49bd38 100755 --- a/app/Controllers/Service.php +++ b/app/Controllers/Service.php @@ -126,16 +126,18 @@ class Service extends BaseController public function add_service() - { - - - + { $tax= $this->request->getPost('tax')/2; + $final_price = ($this->request->getPost('productCost') ? $this->request->getPost('productCost') : 0) + + ($this->request->getPost('serviceCost') ? $this->request->getPost('serviceCost') : 0) + + ($this->request->getPost('labour_cost_With_Tax') ? $this->request->getPost('labour_cost_With_Tax') : 0); + + // print $final_price; + // print_r($this->request->getPost()); $make_ids = $this->request->getPost('make'); $model_ids = $this->request->getPost('model'); - $model_json = json_encode($model_ids); $make_json = json_encode($make_ids); $data = [ @@ -148,15 +150,13 @@ class Service extends BaseController 'tax' => $this->request->getPost('tax'), 'labour_cost' => $this->request->getPost('labour_cost'), 'labour_cost_with_cost' => $this->request->getPost('labour_cost_with_cost'), - 'price' => $this->request->getPost('price'), + 'price' => $final_price, 'makes_id' => $make_json, 'models_id' => $model_json, 'description' => $this->request->getPost('description'), 'isactive' => 1 , ]; - $service_id = $this->request->getPost('service_id'); - if (!empty($service_id)) { diff --git a/app/Views/make_list.php b/app/Views/make_list.php index 2984f87..1630633 100755 --- a/app/Views/make_list.php +++ b/app/Views/make_list.php @@ -172,6 +172,7 @@ $('#bike_model_login-modal').modal('hide'); $('#modelname').val(''); toastr.success(response.data, 'Success'); + $(params).attr('disabled', false).text('Submit'); } } else { alert(response.data || "Unexpected error occurred!"); diff --git a/app/Views/product_form.php b/app/Views/product_form.php index c081a32..ef3dc9f 100755 --- a/app/Views/product_form.php +++ b/app/Views/product_form.php @@ -149,8 +149,8 @@
- - + + + + \ No newline at end of file diff --git a/app/Views/product_list.php b/app/Views/product_list.php index 58d8e5f..822b05c 100755 --- a/app/Views/product_list.php +++ b/app/Views/product_list.php @@ -73,6 +73,7 @@ + SKU Id Product Name @@ -82,6 +83,7 @@ Qty in Stock Rack No Actions + @@ -100,7 +102,7 @@ - + diff --git a/app/Views/service_form.php b/app/Views/service_form.php index 84ee714..ade5137 100755 --- a/app/Views/service_form.php +++ b/app/Views/service_form.php @@ -122,8 +122,10 @@
- - + + + +

@@ -274,6 +276,14 @@ $(document).ready(function() { }); } }); + + data = ; + servicedata = ; + var service_id = ""; + if (service_id != 0) { + $("#productSelect").trigger('change'); + $('#serviceSelected').trigger('change'); + } }); @@ -330,9 +340,8 @@ document.getElementById('category').addEventListener('change', function() { } }); - + -