diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 310f51e..a9156e3 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -63,6 +63,7 @@ $routes->post("get_models", "Products::get_models"); $routes->get("get_makes", "Products::get_makes"); $routes->post("save_make", "Products::save_make"); $routes->post("save_model", "Products::save_model"); +$routes->post("save_manufacturer", "Products::save_manufacturer"); $routes->get("product_list_for_service", "Products::product_list_for_service"); //end products// @@ -111,6 +112,7 @@ $routes->post("add_vehicle", "Vehicle::add_vehicle"); $routes->get("new_vehicle/(:any)", "Vehicle::new_vehicle/$1"); $routes->get("delete_vehicle/(:any)", "Vehicle::delete_vehicle/$1"); $routes->post("get_models_vehicle", "Vehicle::get_models"); +$routes->post("checkRegisterNo", "Vehicle::checkRegisterNo"); //end Vehicle @@ -157,6 +159,8 @@ $routes->get('dashboard', 'Users::dashboard'); //Spare manufacturer// $routes->get('spare_manufacturer_index', 'Manufacturer::index'); $routes->post('create_manufacturer/(:any)', 'Manufacturer::create_manufacturer/$1'); + $routes->post('create_manufacture_product_form', 'Manufacturer::create_manufacture_product_form'); + //Spare manufacturer End's// diff --git a/app/Controllers/Make.php b/app/Controllers/Make.php index b5382aa..243ecf1 100644 --- a/app/Controllers/Make.php +++ b/app/Controllers/Make.php @@ -42,6 +42,7 @@ class Make extends BaseController ]; if (!$make_id) { try { + $data['business_id'] = $this->session->get('logged_user_business_id'); $inserted = $BikemakeModel->insert($data); } catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) { diff --git a/app/Controllers/Manufacturer.php b/app/Controllers/Manufacturer.php index 5740902..2e8334e 100644 --- a/app/Controllers/Manufacturer.php +++ b/app/Controllers/Manufacturer.php @@ -24,7 +24,7 @@ class Manufacturer extends BaseController if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } $ManufacturerModel = new ManufacturerModel(); - $spare_manufacturer = $ManufacturerModel->findAll(); + $spare_manufacturer = $ManufacturerModel->where('business_id',$this->session->get('logged_user_business_id'))->findAll(); $data['manufacturer']=$spare_manufacturer; return view('manufacturer_list',$data); @@ -45,12 +45,13 @@ class Manufacturer extends BaseController ]; if (!$manufacturer_id) { + $data['business_id'] = $this->session->get('logged_user_business_id'); $inserted = $ManufacturerModel->insert($data); if ($inserted) { $result = $data; return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); } else { - $result = "No Match's"; + $result = "Duplicate Match!"; return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404); } } else { @@ -70,4 +71,40 @@ class Manufacturer extends BaseController } } -} \ No newline at end of file + + + public function create_manufacture_product_form() + { + try { + $manufacturer_name = $this->request->getPost('manufacturername'); + $quality = $this->request->getPost('quality'); + $ManufacturerModel = new ManufacturerModel(); + $data = [ + 'manufacturer_name' => $manufacturer_name, + 'quality' => $quality, + ]; + + $data['business_id'] = $this->session->get('logged_user_business_id'); + + $manufacturer_find = $ManufacturerModel->where('manufacturer_name',$manufacturer_name)->first(); + + if (!$manufacturer_find) { + $inserted = $ManufacturerModel->insert($data); + if ($inserted) { + $manufacturer = $ManufacturerModel->where('manufacturer_id',$inserted)->first(); + echo json_encode($manufacturer); + } + }else{ + $result = "Duplicate Match!"; + echo json_encode($result); + } + + + + + } catch (\Exception $e) { + echo json_encode($e); + } + } + +} diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index 6542ca5..6708cfe 100644 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -391,6 +391,39 @@ class Products extends BaseController } + + public function save_manufacturer(){ + $response = []; + $ManufacturerModel = new ManufacturerModel(); + + $manufacturer_name = $this->request->getPost('manufacturer_name'); + $quality = $this->request->getPost('quality'); + if (!empty($manufacturer_name) && !empty($quality)) { + $modelData = [ + 'manufacturer_name' => $manufacturer_name, + 'quality' => $quality, + 'business_id'=> $this->session->get('logged_user_business_id') + ]; + + + $manufacturer_id = $ManufacturerModel->insert($modelData); + + $modelData = $ManufacturerModel->where('business_id', $this->session->get('logged_user_business_id'))->orderBy('manufacturer_name')->findAll(); + + + $response['success'] = true; + $response['manufacturer_id'] = $manufacturer_id; + $response['quality'] = $quality; + $response['modelData'] = $modelData; + } else { + + $response['success'] = false; + } + + + return $this->response->setJSON($response); + } + public function product_list_for_service(){ $ProductModel = new ProductModel(); $products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index 361c204..991eaa1 100644 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -155,6 +155,9 @@ public function add_sales() $sales_order_id = $this->request->getPost('sales_order_id'); if (!empty($sales_order_id)) { // print_r("hello");die; + if ($this->request->getPost('status') === "Paid") { + $data['mode_of_payment'] = $this->request->getPost('mode_of_payment'); + } $SalesOrderModel->update($sales_order_id, $data); } else { $SalesOrderModel->insert($data); diff --git a/app/Controllers/Vehicle.php b/app/Controllers/Vehicle.php index 8e3dc9f..db65a0a 100644 --- a/app/Controllers/Vehicle.php +++ b/app/Controllers/Vehicle.php @@ -152,5 +152,18 @@ class Vehicle extends BaseController return $this->response->setJSON($formatted_models); } + + public function checkRegisterNo(){ + + // if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); } + $VehicleModel = new VehicleModel(); + + $reg_no = $this->request->getPost('register_number'); + + $register_find = $VehicleModel->where('reg_no',$reg_no)->first(); + + + return json_encode($register_find); + } } \ No newline at end of file diff --git a/app/Models/SalesOrderModel.php b/app/Models/SalesOrderModel.php index 2d58a55..f14cf82 100644 --- a/app/Models/SalesOrderModel.php +++ b/app/Models/SalesOrderModel.php @@ -5,7 +5,7 @@ class SalesOrderModel extends Model { protected $table = 'sales_order'; protected $primaryKey = 'sales_order_id'; - protected $allowedFields = ['sales_order_id','client_name','vehicle_id','order_number','branch_id','status','mobile_no','billing_address','billing_city','billing_state','billing_country','billing_postal_code','total','tax','subtotal','discount','terms_condition','isactive']; + protected $allowedFields = ['sales_order_id','client_name','vehicle_id','order_number','branch_id','status','mode_of_payment','mobile_no','billing_address','billing_city','billing_state','billing_country','billing_postal_code','total','tax','subtotal','discount','terms_condition','isactive']; // public function getSalesPdf($sales_order_id){ return $this->db->table('sales_order') @@ -44,10 +44,13 @@ class SalesOrderModel extends Model $result = $this->db->table('sales_order_product') ->where('sales_order_product.sales_order_id', $sales_order_id) ->join('products', 'products.product_id = sales_order_product.product_id') - ->select('sales_order_product.*, products.product_name') + ->select('sales_order_product.*, products.product_name, products.per, products.ml') ->get() ->getResult(); + // echo "
";
+        // print_r($result);die;
+
     return $result;
 }
 
diff --git a/app/Views/bike_model_list.php b/app/Views/bike_model_list.php
index 03abaaa..c507e48 100644
--- a/app/Views/bike_model_list.php
+++ b/app/Views/bike_model_list.php
@@ -8,7 +8,7 @@
                     
@@ -21,7 +21,7 @@
             
- +
@@ -60,7 +60,6 @@ -
Model Name
- - - - - - - - - - - - - - - - - - - - - - - - - + +
Branch NameAddressCityStatePostal CodeMobile NoActiveUser ListAction
- - Inactive - - Active - - - " style="margin-left: 15px;">View - + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + " + class="delete-button"> + - + - - -
Branch NameAddressCityStatePostal CodeMobile NoActiveUser ListAction
+ + Inactive + + Active + + + " style="margin-left: 15px;">View + + + - - - " - class="delete-button"> -
-
- -
-
-
+
+
+
+ + - - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/app/Views/business_form.php b/app/Views/business_form.php index db5acbd..e3b29ab 100644 --- a/app/Views/business_form.php +++ b/app/Views/business_form.php @@ -1,24 +1,19 @@
-
-
-

-
- -
+
+
+

+
+
+
-
" method="post">
diff --git a/app/Views/business_list.php b/app/Views/business_list.php index 48353b7..6f7fa42 100644 --- a/app/Views/business_list.php +++ b/app/Views/business_list.php @@ -1,15 +1,13 @@
-
+
@@ -20,12 +18,7 @@
- - - - - - @@ -76,10 +69,58 @@
-
-
- \ No newline at end of file + + + + \ No newline at end of file diff --git a/app/Views/client_form.php b/app/Views/client_form.php index e962a9a..5d74b00 100644 --- a/app/Views/client_form.php +++ b/app/Views/client_form.php @@ -1,27 +1,22 @@
-
-
-
- +
" method="post"> -

Client Details :

+

Client Details :

@@ -78,9 +73,9 @@
- -
+ + \ No newline at end of file diff --git a/app/Views/complaint_list.php b/app/Views/complaint_list.php index b4caab5..872b768 100644 --- a/app/Views/complaint_list.php +++ b/app/Views/complaint_list.php @@ -6,7 +6,7 @@

Complaints List

@@ -16,7 +16,7 @@
- +
@@ -86,6 +86,7 @@ + - \ No newline at end of file + + diff --git a/app/Views/dashboard.php b/app/Views/dashboard.php index 3355ad6..0106059 100644 --- a/app/Views/dashboard.php +++ b/app/Views/dashboard.php @@ -5,11 +5,6 @@

diff --git a/app/Views/edit_account_form.php b/app/Views/edit_account_form.php index 335426a..70b9ae3 100644 --- a/app/Views/edit_account_form.php +++ b/app/Views/edit_account_form.php @@ -10,165 +10,145 @@ - - - -
-
-
-
-

-

@

+
+
+
+

+

@

+
+
+
Name
+ + + + + + + + + + + + + - -
-
-
Full Name :
Mobile :
Email :
- - - - - - - - - - - - - - - -
Full Name :
Mobile :
Email :
-
+ +
- - - - - -
-
- -
-
-
-
-
- -
Personal Info
- -
-
-
- - -
-
-
-
- - -
-
-
-
-
-
- - - -
-
-
-
- -
-
-
- - -
- -
+
- -
-
-
-
-
- -
Change Password
- +
+
+
+
+
+
+
+
Personal Info
+
- -
- -
- - - -
-
+ +
-
- +
- -
- -
- - - -
-
+ +
-
- +
+
+
- -
- -
- - - -
-
+ + +
- -
- +
+
+ +
+ +
+ -
-
+
+ +
+
+
+
+
+ +
Change Password
+ +
+
+
+ +
+ +
+ + + +
+
+
+
+ +
+
+ +
+ +
+ + + +
+
+
+
+ +
+
+ +
+ +
+ + + +
+
+
+
+ +
+ +
+
+
+ +
+
+
- - - - - - - - - - - - + + diff --git a/app/Views/manufacturer_list.php b/app/Views/manufacturer_list.php index b594ed7..b8069f2 100644 --- a/app/Views/manufacturer_list.php +++ b/app/Views/manufacturer_list.php @@ -8,9 +8,7 @@ @@ -36,10 +34,10 @@ - +       " class="view-list-button" title="Model List" style="margin-left: 16px;"> - + @@ -70,8 +68,7 @@
- @@ -80,7 +77,7 @@
- +
@@ -98,7 +95,7 @@ - function submitMake(params) { + function submitManufacturer(params) { var formData = { manufacturername: $('#manufacturer_name').val(), quality: $('#quality').val() diff --git a/app/Views/product_form.php b/app/Views/product_form.php index 67230d0..e9bab74 100644 --- a/app/Views/product_form.php +++ b/app/Views/product_form.php @@ -53,6 +53,7 @@
+ ' ?> + +
+
+ + +
+ +
+ +
+ + +
+
+
+
+ +
@@ -7,7 +29,7 @@
@@ -21,14 +43,34 @@
- - - + - + + + + + + + + + @@ -39,9 +81,8 @@ + - - @@ -53,28 +94,24 @@ - -
+ + + + + + + + + + + + + +
SKU Id Product NameRack No Actions
" class="edit-button"> + class="ri-pencil-line" style="font-size:20px;">      " - class="delete-button"> + class="delete-button">
-
-
@@ -122,7 +159,27 @@ "language": { "search": "Search: " // Customize search label }, + // "ordering": false }); }); + + + + \ No newline at end of file diff --git a/app/Views/purchase_list.php b/app/Views/purchase_list.php index 66f0dad..292a227 100644 --- a/app/Views/purchase_list.php +++ b/app/Views/purchase_list.php @@ -27,7 +27,7 @@

Purchase Order List

diff --git a/app/Views/reorder_level_list.php b/app/Views/reorder_level_list.php index ae504a6..1153c41 100644 --- a/app/Views/reorder_level_list.php +++ b/app/Views/reorder_level_list.php @@ -22,7 +22,7 @@ - +
@@ -62,4 +62,53 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/Views/return_list.php b/app/Views/return_list.php index 3b6e683..6094a1a 100644 --- a/app/Views/return_list.php +++ b/app/Views/return_list.php @@ -27,7 +27,7 @@

Purchase Return List

diff --git a/app/Views/sales_list.php b/app/Views/sales_list.php index d1a1d63..5a68dbc 100644 --- a/app/Views/sales_list.php +++ b/app/Views/sales_list.php @@ -28,7 +28,7 @@

Sales Order List

diff --git a/app/Views/sales_order_form.php b/app/Views/sales_order_form.php index b2463fa..66657c0 100644 --- a/app/Views/sales_order_form.php +++ b/app/Views/sales_order_form.php @@ -30,7 +30,7 @@ ' ?> +
+ + + +
> +
+
@@ -802,44 +814,65 @@ $(document).ready(function() { console.log(ifStatementCondition); - if (eval(ifStatementCondition)) { - - // Send AJAX request to save the client + if (reg_no) { $.ajax({ - url: '', // URL to your save_client method - method: 'POST', - data: { - client_id: clientName, - mobile_no: clientMobile, - reg_no: reg_no, - model: model, - make: make, - createclientName: createclientName, - createclientMobile: createclientMobile, - createclientType: createclientType, - formType: formType, - - }, + url: '', // URL to your controller method for fetching models + type: 'POST', + dataType: 'json', + data: { register_number: reg_no }, success: function(response) { - if (response.success) { - $('#addVehicleModal').modal('hide'); - toastr.success("Vehicle saved successfully!"); - window.location.reload(); + if (response) { + $('#reg_no').val(""); + toastr.warning("Register Number Already Added!"); + }else{ + if (eval(ifStatementCondition)) { + + // Send AJAX request to save the client + $.ajax({ + url: '', // URL to your save_client method + method: 'POST', + data: { + client_id: clientName, + mobile_no: clientMobile, + reg_no: reg_no, + model: model, + make: make, + createclientName: createclientName, + createclientMobile: createclientMobile, + createclientType: createclientType, + formType: formType, + + }, + success: function(response) { + if (response.success) { + $('#addVehicleModal').modal('hide'); + toastr.success("Vehicle saved successfully!"); + window.location.reload(); + + } else { + toastr.warning("Failed to save vehicle. Please try again"); + } + }, + error: function(xhr, status, error) { + console.error('Error occurred while saving vehicle:', error); + toastr.warning("Failed to save vehicle. Please try again"); + } + }); + + } else { + toastr.warning("Please Fill All Data"); + } - } else { - toastr.warning("Failed to save vehicle. Please try again"); } }, error: function(xhr, status, error) { - console.error('Error occurred while saving vehicle:', error); - toastr.warning("Failed to save vehicle. Please try again"); + console.error(error); // Log any errors to the console } }); - } else { - toastr.warning("Please Fill All Data"); } + }); }); @@ -929,9 +962,20 @@ $(document).on('click', '#selectClient', function() { } \ No newline at end of file diff --git a/app/Views/service_form.php b/app/Views/service_form.php index 0e49166..7333402 100644 --- a/app/Views/service_form.php +++ b/app/Views/service_form.php @@ -75,11 +75,11 @@
+
@@ -45,10 +45,10 @@ @@ -64,4 +64,53 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/Views/user_list.php b/app/Views/user_list.php index 5cd3557..9c27518 100644 --- a/app/Views/user_list.php +++ b/app/Views/user_list.php @@ -7,7 +7,7 @@
Service Name " class="edit-button"> - - + +       " class="delete-button"> - +
+
@@ -69,4 +69,52 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/app/Views/user_list_super_admin.php b/app/Views/user_list_super_admin.php index 2fb3149..fed0fb4 100644 --- a/app/Views/user_list_super_admin.php +++ b/app/Views/user_list_super_admin.php @@ -40,8 +40,8 @@ diff --git a/app/Views/vehicle_form.php b/app/Views/vehicle_form.php index fed7418..5fc5f7d 100644 --- a/app/Views/vehicle_form.php +++ b/app/Views/vehicle_form.php @@ -18,7 +18,7 @@
-
" method="post"> + " method="post">

Vehicle Details :

@@ -112,7 +112,7 @@
- +
@@ -440,6 +440,42 @@ $('#saveModelBtn').click(function() { } }); + + + + +
# getRoleNameById($value['role']); ?> - " class="edit-button"> - " class="delete-button"> + " class="edit-button">      + " class="delete-button">