diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 33b7f8ca..8ace46cf 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -120,10 +120,14 @@ $routes->post('companycontroller/bankdtl', 'Companycontroller::bankdtl'); $routes->get('configlisting', 'Configurationctrl::index'); $routes->get('addconfig', 'Configurationctrl::addconfig'); $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('configurationctrl/editconfig', 'Configurationctrl::editconfig'); $routes->post('configurationctrl/updateconfig', 'Configurationctrl::updateconfig'); -$routes->get('configurationctrl/deleteConfig','configurationctrl::deleteConfig'); -$routes->get('configurationctrl/reActivateConfig','configurationctrl::reActivateConfig'); +$routes->post('configurationctrl/configNameCheck', 'Configurationctrl::configNameCheck'); +$routes->get('configurationctrl/deleteConfig', 'configurationctrl::deleteConfig'); +$routes->get('configurationctrl/reActivateConfig', 'configurationctrl::reActivateConfig'); // Department Master Routes $routes->get('departmentListing', 'Department::index'); @@ -282,7 +286,7 @@ $routes->post('getCostCenterData', 'Inwardgateregister::getCostCenterData'); $routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile'); $routes->post('getAdditionalIGRFile', 'Inwardgateregister::getAdditionalIGRFile'); $routes->post('deleteAdditionalIGRFile', 'Inwardgateregister::deleteAdditionalIGRFile'); -$routes->get('download-files/(:segment)', 'Inwardgateregister::downloadFilesAsZip/$1'); +$routes->get('download-files/(:segment)', 'Inwardgateregister::downloadFilesAsZip/$1'); $routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile'); @@ -417,13 +421,13 @@ $routes->post('checkTransporter', 'Supplier::checkTransporter'); //Factory Machine Master Routes -$routes->post('createFactoryMachineMasterDetails' , 'FactoryMachineController::createFactoryMachineMasterDetails'); -$routes->get('readFactoryMachineMasterDetails' , 'FactoryMachineController::readFactoryMachineMasterDetails'); -$routes->get('readFactoryMachineMasterDetailsById ' ,'FactoryMachineController::readFactoryMachineMasterDetailsById'); -$routes->post('updateFactoryMachineMasterDetails ','FactoryMachineController::updateFactoryMachineMasterDetails'); -$routes->get('deleteFactoryMachineMasterDetails' , 'FactoryMachineController::deleteFactoryMachineMasterDetails'); +$routes->post('createFactoryMachineMasterDetails', 'FactoryMachineController::createFactoryMachineMasterDetails'); +$routes->get('readFactoryMachineMasterDetails', 'FactoryMachineController::readFactoryMachineMasterDetails'); +$routes->get('readFactoryMachineMasterDetailsById', 'FactoryMachineController::readFactoryMachineMasterDetailsById'); +$routes->post('updateFactoryMachineMasterDetails', 'FactoryMachineController::updateFactoryMachineMasterDetails'); +$routes->get('deleteFactoryMachineMasterDetails', 'FactoryMachineController::deleteFactoryMachineMasterDetails'); $routes->get('reActivateFactoryMachineMasterDetails', 'FactoryMachineController::reActivateFactoryMachineMasterDetails'); -$routes->post('checkMachineName' ,'FactoryMachineController::checkMachineName'); +$routes->post('checkMachineName', 'FactoryMachineController::checkMachineName'); $routes->get('loadView_createFactoryMachineMasterDetail', 'FactoryMachineController::loadView_createFactoryMachineMasterDetail'); $routes->get('loadView_updateFactoryMachineMasterDetail', 'FactoryMachineController::loadView_updateFactoryMachineMasterDetail'); diff --git a/app/Controllers/Configurationctrl.php b/app/Controllers/Configurationctrl.php index 36562da7..f4d5bbd8 100755 --- a/app/Controllers/Configurationctrl.php +++ b/app/Controllers/Configurationctrl.php @@ -105,6 +105,7 @@ class Configurationctrl extends BaseController $config = array('Config_ID' => $ConfigId, 'ConfigName' => $ConfigName, 'Comments' => $Comments); $result = $this->configmodel->updateconfig($config, $ConfigId); + $child_result = false ; for ($i = 1; $i <= $Rowcount; $i++) { $child_primary_key = $this->request->getPost('DbKey' . $i); @@ -158,5 +159,51 @@ class Configurationctrl extends BaseController } + public function configNameCheck(){ + + $data = $this->request->getPost(); + $configName = ($data['configName']); + + $result = $this->configmodel->configNameCheck($configName); + + return $this->response->setJSON($result); + + } + + public function configValueCheck(){ + + $data = $this->request->getPost(); + $configId = $data['configId']; + $configValue = $data['ConfigValue']; + + $result = $this->configmodel->configValueCheck($configId, $configValue); + + return $this->response->setJSON($result); + + } + + public function deleteConfigValue(){ + + $configId = $this->request->getVar('ConfigID'); + $configValue = $this->request->getVar('ConfigValue'); + + $result = $this->configmodel->deleteConfigValue($configId, $configValue); + + return redirect()->back(); + + + } + + public function reActivateConfigValue(){ + + $configId = $this->request->getVar('ConfigID'); + $configValue = $this->request->getVar('ConfigValue'); + + $result = $this->configmodel->reActivateConfigValue($configId, $configValue); + + return redirect()->back(); + } + + } diff --git a/app/Controllers/FactoryMachineController.php b/app/Controllers/FactoryMachineController.php index 1f2eb513..41784c63 100644 --- a/app/Controllers/FactoryMachineController.php +++ b/app/Controllers/FactoryMachineController.php @@ -31,6 +31,28 @@ class FactoryMachineController extends BaseController } + public function createFactoryMachineMasterDetails(){ + + $this->global['pageTitle'] = 'Edit Factory Machine Master Detail '; + + + $data=[ + 'machine_name'=> $this->request->getPost('machineName'), + 'machine_type'=> $this->request->getPost('machineType'), + 'energy_type' => $this->request->getPost('energyType'), + ]; + + $inserted = $this->factoryMachineMaster_model->insert($data); + + if ($inserted) { + // Set flashdata for success message + return redirect()->to('/readFactoryMachineMasterDetails')->with('success', 'Machine details created successfully'); + } else { + // Set flashdata for error message + return redirect()->back()->with('error', 'Failed to create machine details'); + } + + } public function loadView_createFactoryMachineMasterDetail(){ @@ -62,7 +84,7 @@ class FactoryMachineController extends BaseController $data['masterData'] = $this->factoryMachineMaster_model ->orderBy('created_at','DESC') - ->findAll(); + ->findAll(); return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL); @@ -92,7 +114,7 @@ class FactoryMachineController extends BaseController $postData=[ 'machine_name'=> $this->request->getPost('machineName'), 'machine_type'=> $this->request->getPost('machineType'), - 'energy_type' => $this->request->getPost('energyType'), + 'energy_type' => $this->request->getPost('energyType'), ]; $updated = $this->factoryMachineMaster_model->update($id,$postData); diff --git a/app/Models/Config_model.php b/app/Models/Config_model.php index 3243ef8f..1fddb1a9 100755 --- a/app/Models/Config_model.php +++ b/app/Models/Config_model.php @@ -177,4 +177,44 @@ class Config_model extends Model return $query->getResult(); } + + public function configNameCheck($configName){ + $builder = $this->db->table('t_configmaster') + ->where('ConfigName ', $configName); + $query = $builder->get(); + + // dd( $this->db->getLastQuery()); + + return $query->getResultArray(); + } + + public function configValueCheck($configId , $configValue){ + $builder = $this->db->table('t_configdetails') + ->where('Config_ID',$configId) + ->where('configValue ', $configValue); + $query = $builder->get(); + + // dd( $this->db->getLastQuery()); + + return $query->getResultArray(); + } + + public function deleteConfigValue($configId, $configValue){ + $builder = $this->db->table('t_configdetails') + ->where('Config_ID',$configId) + ->where('configValue ', $configValue) + ->update(['isActive'=> 0]); + $res = $this->db->affectedRows(); + return $res; + } + + public function reActivateConfigValue($configId, $configValue){ + $builder = $this->db->table('t_configdetails') + ->where('Config_ID',$configId) + ->where('configValue ', $configValue) + ->update(['isActive'=> 1]); + $res = $this->db->affectedRows(); + return $res; + } + } \ No newline at end of file diff --git a/app/Models/FactoryMachineModel.php b/app/Models/FactoryMachineModel.php index 1dfae473..9f41778f 100644 --- a/app/Models/FactoryMachineModel.php +++ b/app/Models/FactoryMachineModel.php @@ -29,7 +29,7 @@ class FactoryMachineModel extends Model protected $validationRules = [ 'machine_name' => 'required|max_length[255]', 'machine_type' => 'required|max_length[255]', - 'energy_type' => 'required|max_length[255]', + 'energy_type' => 'required|max_length[255]', ]; diff --git a/app/Views/addEmployeenew.php b/app/Views/addEmployeenew.php index 584c36fc..3e6464d8 100755 --- a/app/Views/addEmployeenew.php +++ b/app/Views/addEmployeenew.php @@ -314,10 +314,17 @@ $("#photo").src(""); } + + function capitalizeFirstLetter(word) { + if (!word) return ""; // Handle empty or undefined strings + return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); + } + function ValidatePassport() { - var regsaid = /^[A-Z][1-9]\d\s?\d{4}[1-9]$/; - var passport = $("#passportno").val().trim(); + var regsaid =/^[A-Z][1-9]\d\s?\d{4}[1-9]$/; + + var passport = capitalizeFirstLetter($("#passportno").val().trim()); if (regsaid.test(passport) == false) { alert('You have entered invalid Passport.'); @@ -1042,7 +1049,6 @@