diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6ef0dd14..2b6be303 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -62,6 +62,7 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'rawmaterialListing/(:num)', 'Ra $routes->post('materialExist','Rawmaterialdetails::checkmaterial'); $routes->get('viewRawmaterial','Rawmaterialdetails::viewRawmaterial'); $routes->post('rawmaterialdetails/editRawmaterial', 'Rawmaterialdetails::editRawmaterial'); +$routes->post('rawmaterialdetails/addMaterialCategories', 'Rawmaterialdetails::addMaterialCategories'); $routes->get('exportmaterial' , 'Rawmaterialdetails::exportmaterial'); $routes->get('rawmaterialdetailsautocomplete' , 'Rawmaterialdetails::autocomplete'); diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index dee4db6e..ed4a2d3b 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -313,6 +313,29 @@ class Rawmaterialdetails extends BaseController } + + function addMaterialCategories(){ + + $data['category_name']=$this->request->getpost('category_name'); + + $insertResult=$this->materialCategories_model->insert($data); + + if ($insertResult) { + // Send a success response as JSON + return $this->response->setJSON([ + 'status' => '201', + 'message' => 'Category added successfully', + ]); + } else { + // Send an error response as JSON + return $this->response->setJSON([ + 'status' => '400', + 'message' => 'Failed to add category', + ]); + } + + } + function autocomplete() { diff --git a/app/Views/addRawMaterial.php b/app/Views/addRawMaterial.php index 66f53417..f73d5095 100755 --- a/app/Views/addRawMaterial.php +++ b/app/Views/addRawMaterial.php @@ -68,7 +68,12 @@
- + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file