diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 03c45a3..3cdd261 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -36,6 +36,7 @@ $routes->get("delete_business/(:any)", "Business::delete_business/$1");
// Products//
$routes->get('product_index/', 'Products::product_index');
+$routes->get('product_index/(:any)', 'Products::product_index/$1');
$routes->post("add_product", "Products::add_product");
$routes->get("new_product/(:any)", "Products::new_product/$1");
$routes->get("delete_product/(:any)", "Products::delete_product/$1");
@@ -85,7 +86,7 @@ $routes->get('dashboard', 'Users::dashboard');
-//---------------------- Make And Model | Service | Spare Manufacturer and Category
+//---------------------- Make And Model | Service | Manufacturer
// Make
$routes->get('make_index', 'Make::index');
$routes->post('create_make', 'Make::create_make');
@@ -108,11 +109,6 @@ $routes->get("delete_service/(:any)", "Service::delete_service/$1");
//Spare manufacturer
-$routes->get('spare_manufacturer_index', 'SpareManufacturer::index');
-$routes->post('create_spare_manufacturer', 'SpareManufacturer::create_make');
+$routes->get('spare_manufacturer_index', 'Manufacturer::index');
+$routes->post('create_manufacturer', 'Manufacturer::create_manufacturer');
-//Spare category
-
-$routes->get('spare_category_index/(:any)', 'SpareCategory::index/$1');
-$routes->post('create_model', 'SpareCategory::create_model');
-$routes->post('status_model', 'SpareCategory::status_model');
\ No newline at end of file
diff --git a/app/Controllers/SpareManufacturer.php b/app/Controllers/Manufacturer.php
similarity index 51%
rename from app/Controllers/SpareManufacturer.php
rename to app/Controllers/Manufacturer.php
index 2fe73f7..419be86 100644
--- a/app/Controllers/SpareManufacturer.php
+++ b/app/Controllers/Manufacturer.php
@@ -2,11 +2,11 @@
namespace App\Controllers;
-use App\Models\SpareManufacturerModel;
+use App\Models\ManufacturerModel;
use CodeIgniter\API\ResponseTrait;
-class SpareManufacturer extends BaseController
+class Manufacturer extends BaseController
{
public $session;
@@ -16,30 +16,32 @@ class SpareManufacturer extends BaseController
{
$this->session = session();
- $this->SpareManufacturerModel = new SpareManufacturerModel();
+ $this->ManufacturerModel = new ManufacturerModel();
}
public function index()
{
- $SpareManufacturerModel = new SpareManufacturerModel();
- $spare_manufacturer = $SpareManufacturerModel->findAll();
- $data['spare_manufacturer']=$spare_manufacturer;
+ $ManufacturerModel = new ManufacturerModel();
+ $spare_manufacturer = $ManufacturerModel->findAll();
+ $data['manufacturer']=$spare_manufacturer;
- return view('spare_manufacturer_list',$data);
+ return view('manufacturer_list',$data);
}
- public function create_make()
+ public function create_manufacturer()
{
try {
- $make_name = $this->request->getPost('makename');
- $SpareManufacturerModel = new SpareManufacturerModel();
+ $manufacturer_name = $this->request->getPost('manufacturername');
+ $quantity = $this->request->getPost('quantity');
+ $ManufacturerModel = new ManufacturerModel();
$data = [
- 'make' => $make_name
+ 'manufacturer_name' => $manufacturer_name,
+ 'quantity' => $quantity,
];
- $inserted = $SpareManufacturerModel->insert($data);
+ $inserted = $ManufacturerModel->insert($data);
if ($inserted) {
$result = $data;
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php
index f76fa8a..63f882b 100644
--- a/app/Controllers/Products.php
+++ b/app/Controllers/Products.php
@@ -18,16 +18,33 @@ class Products extends BaseController
$this->session = session();
}
- public function product_index()
+ public function product_index($manufacturer_id = null)
{
- $ProductModel = new ProductModel();
- $products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
- $data['products']=$products;
+ if ($manufacturer_id) {
+ $ProductModel = new ProductModel();
+ $products = $ProductModel->where('manufacturer_id',$manufacturer_id)->findAll();
+ $data['products']=$products;
+ $data['manufacturer_id'] = $manufacturer_id;
+
+ return view('product_list',$data);
+ } else {
+ $ProductModel = new ProductModel();
+ $products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
+ $data['products']=$products;
+ $data['manufacturer_id'] = $manufacturer_id;
+
+
+ return view('product_list',$data);
+ }
+
- return view('product_list',$data);
}
+
+
+
+
public function new_product($product_id)
{
diff --git a/app/Models/ManufacturerModel.php b/app/Models/ManufacturerModel.php
new file mode 100644
index 0000000..4ce777f
--- /dev/null
+++ b/app/Models/ManufacturerModel.php
@@ -0,0 +1,11 @@
+
-<<<<<<< HEAD
- Spare
+ Manufacturer
diff --git a/app/Views/manufacturer_list.php b/app/Views/manufacturer_list.php
new file mode 100644
index 0000000..b755642
--- /dev/null
+++ b/app/Views/manufacturer_list.php
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add Manufacturer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/product_list.php b/app/Views/product_list.php
index f5374c3..f69d39b 100644
--- a/app/Views/product_list.php
+++ b/app/Views/product_list.php
@@ -6,9 +6,10 @@
Product List
@@ -29,7 +30,6 @@
-
| Product Name |
Category |
Serial Number |
@@ -37,10 +37,7 @@
Qty in Stock |
Sgst |
Cgst |
-
-
- Actions |
-
+ Actions |
@@ -50,7 +47,7 @@
if ($value['isactive'] == 1) : ?>
| = $value['product_name']; ?> |
- = $value['product_category']; ?> |
+ = $value['product_category']; ?> |
= $value['serial_no']; ?> |
= number_format($value['unit_price']); ?> |
= $value['qty_stock']; ?> |
@@ -58,13 +55,14 @@
= $value['sgst']; ?>% |
-
- " class="edit-button">
- "
- class="delete-button">
- |
-
+
+
+ " class="edit-button">
+ "
+ class="delete-button">
+ |
+
diff --git a/app/Views/spare_manufacturer_list.php b/app/Views/spare_manufacturer_list.php
deleted file mode 100644
index 21a0a95..0000000
--- a/app/Views/spare_manufacturer_list.php
+++ /dev/null
@@ -1,179 +0,0 @@
-
-
-
-
-
-
-
Spare Manufacturer List
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add Bike Make
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-