From 690780e4b25a3e39ae762f31df0f2d2061cfc158 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Thu, 21 Nov 2024 11:41:11 +0530 Subject: [PATCH] Changes in product module : GWM --- app/Config/Routes.php | 1 + app/Controllers/Products.php | 22 ++++++++ app/Views/product_form.php | 25 ++++++--- app/Views/product_list.php | 98 +++++++++++++++++++++++++++++++--- app/Views/sales_list.php | 20 +++---- app/Views/sales_order_form.php | 2 +- 6 files changed, 140 insertions(+), 28 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index ff8df13..0fc9ba8 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -73,6 +73,7 @@ $routes->post("save_manufacturer", "Products::save_manufacturer"); $routes->get("product_list_for_service", "Products::product_list_for_service"); $routes->post('status_product', 'Products::status_product'); $routes->get('delete_product_name/(:any)', 'Products::delete_product_name/$1'); +$routes->get('get_product_addtional_details/(:any)', 'Products::get_product_addtional_details/$1'); //end products// //Sales order // diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index 5c27b84..1002bba 100755 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -571,5 +571,27 @@ class Products extends BaseController return redirect()->to('new_product/' . $product_id); } + + public function get_product_addtional_details($product_id) + { + $ProductModel = new ProductModel(); + $products = $ProductModel->where('product_id', $product_id)->get()->getRowArray(); + $products['models_id'] = json_decode($products['models_id'], true); + $BikemodelsModel = new BikemodelsModel(); + + $models = []; + if( $products['models_id'] != null) { + foreach ($products['models_id'] as $model_id) { + + $model = $BikemodelsModel->select('model_name')->where('model_id', $model_id)->get()->getRow(); + array_push($models,$model); + } + } + $data['modelNames'] = $models; + + $data['additionalNames'] = $this->additionalProductNameModal->select('additional_product_name')->where('product_id', $product_id)->findAll(); + + return json_encode($data); + } } \ No newline at end of file diff --git a/app/Views/product_form.php b/app/Views/product_form.php index e5672a5..26c6c99 100755 --- a/app/Views/product_form.php +++ b/app/Views/product_form.php @@ -17,7 +17,7 @@

-
" method="post"> + " id="productForm" method="post">

Product Details :


@@ -144,9 +144,14 @@

Pricing Information :


-
+ + +
+ +
@@ -162,10 +167,9 @@
-
- - -
+ + +
@@ -235,7 +239,7 @@

Additional Product Names :


- +
@@ -938,5 +942,12 @@ function deleteProductName(data) { } } + // Prevent multiple submissions by disabling the button on first click + document.querySelector('#productForm').addEventListener('submit', function (e) { + const submitButton = this.querySelector('button[type="submit"]'); + submitButton.disabled = true; // Disable the button + submitButton.textContent = 'Processing...'; // Optional: Show loading text + }); + \ No newline at end of file diff --git a/app/Views/product_list.php b/app/Views/product_list.php index 2d4433a..b9231f3 100755 --- a/app/Views/product_list.php +++ b/app/Views/product_list.php @@ -50,25 +50,25 @@ - + - + - + - + - + - + - + @@ -92,7 +92,12 @@ }?> - + + + + + + @@ -124,6 +129,48 @@
+ + + + + + + diff --git a/app/Views/sales_list.php b/app/Views/sales_list.php index 4ec5a91..55a4a69 100755 --- a/app/Views/sales_list.php +++ b/app/Views/sales_list.php @@ -49,18 +49,15 @@ - - - - - - - - - - + + + + + + + @@ -86,8 +83,7 @@ diff --git a/app/Views/sales_order_form.php b/app/Views/sales_order_form.php index 1e3c93b..4edb88f 100755 --- a/app/Views/sales_order_form.php +++ b/app/Views/sales_order_form.php @@ -569,7 +569,7 @@ $(document).ready(function() { // Event listener for product selection $(document).on('change', 'select[name="item_details[]"]', function() { var productId = $(this).val(); - + alert(productId); var quantity = $(this).closest('tr').find('.item-quantity').val(1);
Order NumberReg NoClient NameItemsQtyTotalStatusActionsReg NoClient NameItemsQtyTotalStatusActions