diff --git a/app/Config/Routes.php b/app/Config/Routes.php index d177174c..3e22539f 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -65,7 +65,6 @@ $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'); $routes->post('deleteMaterial', 'Rawmaterialdetails::deleteMaterial'); $routes->post('reActivateMaterial', 'Rawmaterialdetails::reActivateMaterial'); @@ -144,6 +143,7 @@ $routes->post('configurationctrl/saveconfig', 'Configurationctrl::saveconfig'); $routes->post('configurationctrl/configValueCheck', 'Configurationctrl::configValueCheck'); $routes->get('configurationctrl/deleteConfigValue', 'Configurationctrl::deleteConfigValue'); $routes->get('configurationctrl/reActivateConfigValue', 'Configurationctrl::reActivateConfigValue'); +$routes->get('activeInactiveConfigValue', 'Configurationctrl::activeInactiveConfigValue'); $routes->get('configurationctrl/editconfig', 'Configurationctrl::editconfig'); $routes->post('configurationctrl/updateconfig', 'Configurationctrl::updateconfig'); $routes->post('configurationctrl/configNameCheck', 'Configurationctrl::configNameCheck'); diff --git a/app/Controllers/Configurationctrl.php b/app/Controllers/Configurationctrl.php index 68061b09..83b09a79 100755 --- a/app/Controllers/Configurationctrl.php +++ b/app/Controllers/Configurationctrl.php @@ -182,6 +182,16 @@ class Configurationctrl extends BaseController } + public function activeInactiveConfigValue(){ + + $key = $this->request->getVar('key'); + $value = $this->request->getVar('value'); + $where = ['isActive'=> $value]; + $result = $this->configmodel->activeInactiveConfigValue($key, $where); + return redirect()->back(); + } + + public function deleteConfigValue(){ $configId = $this->request->getVar('ConfigID'); diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index e2f5681a..31f51c2f 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -69,6 +69,7 @@ class Rawmaterialdetails extends BaseController $this->rawmaterialdetails_model = new rawmaterialdetails_model();; $data['userRecords'] = $this->rawmaterialdetails_model->rawmaterialListing(); + $data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll(); $this->global['pageTitle'] = 'RawMaterial Listing'; $this->loadViews("rawmaterialListing", $this->global, $data, NULL); @@ -133,7 +134,7 @@ class Rawmaterialdetails extends BaseController $this->rawmaterialdetails_model = new rawmaterialdetails_model();; $data['material'] = $this->rawmaterialdetails_model->getmaterialType(); $data['materialcategory'] = $this->rawmaterialdetails_model->getmaterialCategory(); - $data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll(); + // $data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll(); $data['UOM'] = $this->rawmaterialdetails_model->getUOM(); $data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode(); $data['costcentercode'] = $this->rawmaterialdetails_model->getcostcentercode(); @@ -283,7 +284,7 @@ class Rawmaterialdetails extends BaseController $data['currentstock'] = $this->rawmaterialdetails_model->getMaterialstock($RawMaterialID, $currentdate); $data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType); $data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory); - $data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll(); + $data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll(); // Told by Pavithra $data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM); $data['costcentercode'] = $this->rawmaterialdetails_model->getCostCenterCode(); $data['cfUOM'] = $this->rawmaterialdetails_model->getConversionfactorUOM(); @@ -351,13 +352,12 @@ class Rawmaterialdetails extends BaseController } - function addMaterialCategories(){ + function addMaterialCategories(){ - $data['category_name']=$this->request->getpost('category_name'); - - $existingCategory = $this->materialCategories_model - ->where('category_name', $data['category_name']) - ->first(); + $configCode = 'C023'; + $configVal = $this->request->getpost('category_name'); + $configArr = array('Config_ID' => $configCode, 'ConfigValue' => $configVal); + $existingCategory = $this->rawmaterialdetails_model->checkMaterialCategory($configVal); if ($existingCategory) { // Data already exists, handle this case (e.g., return an error or ignore the insert) @@ -367,8 +367,7 @@ class Rawmaterialdetails extends BaseController ]); } - - $insertResult=$this->materialCategories_model->insert($data); + $insertResult=$this->rawmaterialdetails_model->insertvalueintoconfig($configArr); if ($insertResult) { // Send a success response as JSON @@ -386,19 +385,6 @@ class Rawmaterialdetails extends BaseController } - function autocomplete() - { - - - $mc = $this->request->getGet('query'); - //echo $mc;die; - $query = $this->rawmaterialdetails_model->checkMaterialCategory($mc); - - echo json_encode($query); - // foreach($query->result() as $row): - // echo "