Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
Gowtham M 2024-12-09 17:31:16 +05:30
commit ec6b430eff
11 changed files with 642 additions and 246 deletions

View File

@ -120,10 +120,14 @@ $routes->post('companycontroller/bankdtl', 'Companycontroller::bankdtl');
$routes->get('configlisting', 'Configurationctrl::index'); $routes->get('configlisting', 'Configurationctrl::index');
$routes->get('addconfig', 'Configurationctrl::addconfig'); $routes->get('addconfig', 'Configurationctrl::addconfig');
$routes->post('configurationctrl/saveconfig', 'Configurationctrl::saveconfig'); $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->get('configurationctrl/editconfig', 'Configurationctrl::editconfig');
$routes->post('configurationctrl/updateconfig', 'Configurationctrl::updateconfig'); $routes->post('configurationctrl/updateconfig', 'Configurationctrl::updateconfig');
$routes->get('configurationctrl/deleteConfig','configurationctrl::deleteConfig'); $routes->post('configurationctrl/configNameCheck', 'Configurationctrl::configNameCheck');
$routes->get('configurationctrl/reActivateConfig','configurationctrl::reActivateConfig'); $routes->get('configurationctrl/deleteConfig', 'configurationctrl::deleteConfig');
$routes->get('configurationctrl/reActivateConfig', 'configurationctrl::reActivateConfig');
// Department Master Routes // Department Master Routes
$routes->get('departmentListing', 'Department::index'); $routes->get('departmentListing', 'Department::index');
@ -282,7 +286,7 @@ $routes->post('getCostCenterData', 'Inwardgateregister::getCostCenterData');
$routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile'); $routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile');
$routes->post('getAdditionalIGRFile', 'Inwardgateregister::getAdditionalIGRFile'); $routes->post('getAdditionalIGRFile', 'Inwardgateregister::getAdditionalIGRFile');
$routes->post('deleteAdditionalIGRFile', 'Inwardgateregister::deleteAdditionalIGRFile'); $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'); $routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
@ -417,13 +421,13 @@ $routes->post('checkTransporter', 'Supplier::checkTransporter');
//Factory Machine Master Routes //Factory Machine Master Routes
$routes->post('createFactoryMachineMasterDetails' , 'FactoryMachineController::createFactoryMachineMasterDetails'); $routes->post('createFactoryMachineMasterDetails', 'FactoryMachineController::createFactoryMachineMasterDetails');
$routes->get('readFactoryMachineMasterDetails' , 'FactoryMachineController::readFactoryMachineMasterDetails'); $routes->get('readFactoryMachineMasterDetails', 'FactoryMachineController::readFactoryMachineMasterDetails');
$routes->get('readFactoryMachineMasterDetailsById ' ,'FactoryMachineController::readFactoryMachineMasterDetailsById'); $routes->get('readFactoryMachineMasterDetailsById', 'FactoryMachineController::readFactoryMachineMasterDetailsById');
$routes->post('updateFactoryMachineMasterDetails ','FactoryMachineController::updateFactoryMachineMasterDetails'); $routes->post('updateFactoryMachineMasterDetails', 'FactoryMachineController::updateFactoryMachineMasterDetails');
$routes->get('deleteFactoryMachineMasterDetails' , 'FactoryMachineController::deleteFactoryMachineMasterDetails'); $routes->get('deleteFactoryMachineMasterDetails', 'FactoryMachineController::deleteFactoryMachineMasterDetails');
$routes->get('reActivateFactoryMachineMasterDetails', 'FactoryMachineController::reActivateFactoryMachineMasterDetails'); $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_createFactoryMachineMasterDetail', 'FactoryMachineController::loadView_createFactoryMachineMasterDetail');
$routes->get('loadView_updateFactoryMachineMasterDetail', 'FactoryMachineController::loadView_updateFactoryMachineMasterDetail'); $routes->get('loadView_updateFactoryMachineMasterDetail', 'FactoryMachineController::loadView_updateFactoryMachineMasterDetail');

View File

@ -105,6 +105,7 @@ class Configurationctrl extends BaseController
$config = array('Config_ID' => $ConfigId, 'ConfigName' => $ConfigName, 'Comments' => $Comments); $config = array('Config_ID' => $ConfigId, 'ConfigName' => $ConfigName, 'Comments' => $Comments);
$result = $this->configmodel->updateconfig($config, $ConfigId); $result = $this->configmodel->updateconfig($config, $ConfigId);
$child_result = false ;
for ($i = 1; $i <= $Rowcount; $i++) { for ($i = 1; $i <= $Rowcount; $i++) {
$child_primary_key = $this->request->getPost('DbKey' . $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();
}
} }

View File

@ -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(){ public function loadView_createFactoryMachineMasterDetail(){
@ -62,7 +84,7 @@ class FactoryMachineController extends BaseController
$data['masterData'] = $this->factoryMachineMaster_model $data['masterData'] = $this->factoryMachineMaster_model
->orderBy('created_at','DESC') ->orderBy('created_at','DESC')
->findAll(); ->findAll();
return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL); return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL);
@ -92,7 +114,7 @@ class FactoryMachineController extends BaseController
$postData=[ $postData=[
'machine_name'=> $this->request->getPost('machineName'), 'machine_name'=> $this->request->getPost('machineName'),
'machine_type'=> $this->request->getPost('machineType'), '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); $updated = $this->factoryMachineMaster_model->update($id,$postData);

View File

@ -177,4 +177,44 @@ class Config_model extends Model
return $query->getResult(); 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;
}
} }

View File

@ -29,7 +29,7 @@ class FactoryMachineModel extends Model
protected $validationRules = [ protected $validationRules = [
'machine_name' => 'required|max_length[255]', 'machine_name' => 'required|max_length[255]',
'machine_type' => 'required|max_length[255]', 'machine_type' => 'required|max_length[255]',
'energy_type' => 'required|max_length[255]', 'energy_type' => 'required|max_length[255]',
]; ];

View File

@ -314,10 +314,17 @@
$("#photo").src(""); $("#photo").src("");
} }
function capitalizeFirstLetter(word) {
if (!word) return ""; // Handle empty or undefined strings
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
}
function ValidatePassport() { function ValidatePassport() {
var regsaid = /^[A-Z][1-9]\d\s?\d{4}[1-9]$/; var regsaid =/^[A-Z][1-9]\d\s?\d{4}[1-9]$/;
var passport = $("#passportno").val().trim();
var passport = capitalizeFirstLetter($("#passportno").val().trim());
if (regsaid.test(passport) == false) { if (regsaid.test(passport) == false) {
alert('You have entered invalid Passport.'); alert('You have entered invalid Passport.');
@ -1042,7 +1049,6 @@
<input type="text" id="passportno" maxlength="9" <input type="text" id="passportno" maxlength="9"
onchange="ValidatePassport();" name="passportno" onchange="ValidatePassport();" name="passportno"
style="text-transform:uppercase" class="form-control" style="text-transform:uppercase" class="form-control"
pattern="^[A-Z][1-9]\d\s?\d{4}[1-9]$"
title=" title="
The first character must be an uppercase alphabet. The first character must be an uppercase alphabet.
The next two characters should be numbers, The next two characters should be numbers,
@ -1540,14 +1546,23 @@
<script> <script>
function capitalizeFirstFourLetters(value) {
if (!value) return ""; // Handle empty or undefined strings
return (
value.slice(0, 4).toUpperCase() + // Capitalize the first four letters
value.slice(4).toLowerCase() // Lowercase the rest of the string
);
}
function ifscCodeValidation(value) { function ifscCodeValidation(value) {
// Define the regex pattern for a valid IFSC code // Define the regex pattern for a valid IFSC code
const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/; const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/;
// Check if the value matches the pattern // Check if the value matches the pattern
if (ifscPattern.test(value)) { if (ifscPattern.test(capitalizeFirstFourLetters(value))) {
return; return;
} else { } else {
alert("Invalid IFSC Code. Please enter a valid one."); alert("Invalid IFSC Code. Please enter a valid one.");

View File

@ -46,7 +46,7 @@
<form role="form" id="addconfig" action="<?php echo base_url() ?>configurationctrl/saveconfig" method="post"> <form role="form" id="addconfig" action="<?php echo base_url() ?>configurationctrl/saveconfig" method="post">
<div class="form-row" style="margin-top:10px"> <div class="form-row" style="margin-top:10px">
<div class=" col-md-3"> <div class=" col-md-3">
<label class="col-form-label" for="ConfigurationName">Configuration Name</label> <label class="col-form-label" for="ConfigurationName">Configuration Name</label><span class="text-danger">*</span>
<?php <?php
$data = array('name' => 'configurationname', 'value' => set_value('configurationname'), 'id' => 'configurationname', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20'); $data = array('name' => 'configurationname', 'value' => set_value('configurationname'), 'id' => 'configurationname', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
echo form_input($data); ?> echo form_input($data); ?>
@ -381,4 +381,75 @@
} }
}); });
</script>
<script>
$('#configurationname').change(function () {
$('#loader').show();
$.ajax({
data: {configName: $('#configurationname').val()},
type: 'POST',
url: "<?php echo base_url(); ?>configurationctrl/configNameCheck",
success: function (data) {
if(data && data.length > 0){
if(data[0].isActive == 1){
alert("This Configuration Name is already present. kindly change it..!!");
$('#configurationname').val('');
return;
}else{
alert("This Configuration Name is already present in deleted section. kindly reactivate it If needed..!!");
$('#configurationname').val('');
return;
}
}
},
error:function(error){
console.log("error occured..!!" ,error);
},
complete:function(){
$('#loader').hide();
console.log('ajax call completed..!!');
}
});
});
</script>
<script>
$('#ConfigValue').change(function(){
$('#loader').show();
$.ajax({
data: {ConfigValue: $('#ConfigValue').val()},
type: 'POST',
url: "<?php echo base_url(); ?>configurationctrl/configValueCheck",
success: function (data) {
if(data && data.length > 0){
if(data[0].isActive == 1){
alert("This Configuration Value is already present. kindly change it..!!");
$('#ConfigValue').val('');
return;
}else{
alert("This Configuration Value is already present in deleted section. kindly reactivate it If needed..!!");
$('#ConfigValue').val('');
return;
}
}
},
error:function(error){
console.log("error occured..!!" ,error);
},
complete:function(){
$('#loader').hide();
console.log('ajax call completed..!!');
}
});
})
</script> </script>

View File

@ -109,13 +109,13 @@ if (!empty($EmpDetails)) {
} }
$isactive = $Emp->IsActive; $isactive = $Emp->IsActive;
$ProfilePicPath=''; $ProfilePicPath = '';
if (!empty($Emp->ProfilePic)) { if (!empty($Emp->ProfilePic)) {
$ProfilePicPath = base_url().'public/uploads/images/' . $Emp->ProfilePic; $ProfilePicPath = base_url() . 'public/uploads/images/' . $Emp->ProfilePic;
} else { } else {
$ProfilePicPath = base_url().'public/assets/dist/img/avatar.png'; $ProfilePicPath = base_url() . 'public/assets/dist/img/avatar.png';
} }
$Reference_Name = $Emp->Reference_Name; $Reference_Name = $Emp->Reference_Name;
$Reference_ContactNumber = $Emp->Reference_ContactNumber; $Reference_ContactNumber = $Emp->Reference_ContactNumber;
@ -202,9 +202,8 @@ if (!empty($EmpDetails)) {
<div class="tab-pane active" id="first"> <div class="tab-pane active" id="first">
<form id="accountForm" method="post" action="#" <form id="accountForm" method="post" action="#" enctype="multipart/form-data"
enctype="multipart/form-data" class="form-horizontal">
class="form-horizontal">
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2">
@ -213,8 +212,8 @@ if (!empty($EmpDetails)) {
<div class="box-header"> <div class="box-header">
<img id="profilepicture" <img id="profilepicture"
src="<?php echo $ProfilePicPath; ?>" src="<?php echo $ProfilePicPath; ?>" alt="your image"
alt="your image" style="width: 139px;" /> style="width: 139px;" />
@ -239,8 +238,8 @@ if (!empty($EmpDetails)) {
<input type="hidden" name="oldImageName" id="Image" <input type="hidden" name="oldImageName" id="Image"
value="<?php echo $Emp->ProfilePic; ?>" class="form-control" value="<?php echo $Emp->ProfilePic; ?>" class="form-control"
readonly> readonly>
</div> </div>
@ -1004,34 +1003,33 @@ if (!empty($EmpDetails)) {
maxlength="14" onchange="ValidateAadhar();" maxlength="14" onchange="ValidateAadhar();"
class="form-control" class="form-control"
onkeypress="return isNumberKey(event)" required onkeypress="return isNumberKey(event)" required
value="<?=$AadharNo?>"> value="<?= $AadharNo ?>">
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label>Aadhar File Name</label> <label>Aadhar File Name</label>
<input type="text" id="file_name" name="file_name1" <input type="text" id="file_name" name="file_name1"
maxlength="255" class="form-control" maxlength="255" class="form-control" value="Aadhar"
value="Aadhar" readonly> readonly>
</div> </div>
<?php <?php
if(!empty($aadharFile)){ ?> if (!empty($aadharFile)) { ?>
<div class="col-md-1"> <div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $aadharFile; ?>" <a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $aadharFile; ?>"
download> download>
<i class="fa fa-download mt-4" aria-hidden="true" <i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i> style="font-size: 25px;"></i>
</a> </a>
</div> </div>
<?php }else{?> <?php } else { ?>
<div class="col-md-1"></div> <div class="col-md-1"></div>
<?php }?> <?php } ?>
<div class="col-md-4"> <div class="col-md-4">
<label>Update Aadhar File</label><br> <label>Update Aadhar File</label><br>
<input type="file" name="emp_file1" class="" <input type="file" name="emp_file1" class="" value="">
value="">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -1042,33 +1040,32 @@ if (!empty($EmpDetails)) {
onchange="validatePAN();" class="form-control" onchange="validatePAN();" class="form-control"
pattern="([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}" pattern="([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}"
title=" 5 character,4 Digit Numbers,1 character (ex:ABCDE1234A) " title=" 5 character,4 Digit Numbers,1 character (ex:ABCDE1234A) "
onkeypress="return alpha(event);" onkeypress="return alpha(event);" value="<?= $PANNo ?>">
value="<?=$PANNo?>"
>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label>PAN File Name</label> <label>PAN File Name</label>
<input type="text" id="file_name" name="file_name2" <input type="text" id="file_name" name="file_name2"
maxlength="255" class="form-control" value="PAN" readonly> maxlength="255" class="form-control" value="PAN"
readonly>
</div> </div>
<?php if(!empty($panFile)) { ?> <?php if (!empty($panFile)) { ?>
<div class="col-md-1"> <div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $panFile; ?>" <a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $panFile; ?>"
download> download>
<i class="fa fa-download mt-4" aria-hidden="true" <i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i> style="font-size: 25px;"></i>
</a> </a>
</div> </div>
<?php }else{?> <?php } else { ?>
<div class="col-md-1"></div> <div class="col-md-1"></div>
<?php }?> <?php } ?>
<div class="col-md-4"> <div class="col-md-4">
<label>Update PAN File</label><br> <label>Update PAN File</label><br>
<input type="file" name="emp_file2" class=""> <input type="file" name="emp_file2" class="">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -1077,36 +1074,35 @@ if (!empty($EmpDetails)) {
<input type="text" id="passportno" maxlength="9" <input type="text" id="passportno" maxlength="9"
onchange="ValidatePassport();" name="passportno" onchange="ValidatePassport();" name="passportno"
style="text-transform:uppercase" class="form-control" style="text-transform:uppercase" class="form-control"
pattern="[aA-prPR-wyWY]{1}[1-9]{1}\d{1}\s\d{4}[1-9]{1}"
title="The first digit or the last digit will never be 0 title="The first digit or the last digit will never be 0
The first character cannot be Q, X or Z. (eg:A12 34567)" (eg:A12 34567)"
onkeypress="return alpha(event);" onkeypress="return alpha(event);"
value="<?=$PassportNo?>" value="<?= $PassportNo ?>">
>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label>Passport File Name</label> <label>Passport File Name</label>
<input type="text" id="file_name" name="file_name3" <input type="text" id="file_name" name="file_name3"
maxlength="255" class="form-control" value="Passport" readonly> maxlength="255" class="form-control" value="Passport"
readonly>
</div> </div>
<?php if(!empty($passportFile)){?> <?php if (!empty($passportFile)) { ?>
<div class="col-md-1"> <div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $passportFile; ?>" <a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $passportFile; ?>"
download> download>
<i class="fa fa-download mt-4" aria-hidden="true" <i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i> style="font-size: 25px;"></i>
</a> </a>
</div> </div>
<?php }else{?> <?php } else { ?>
<div class="col-md-1"></div> <div class="col-md-1"></div>
<?php }?> <?php } ?>
<div class="col-md-4"> <div class="col-md-4">
<label>Update Passport File</label><br> <label>Update Passport File</label><br>
<input type="file" name="emp_file3" class=""> <input type="file" name="emp_file3" class="">
</div> </div>
</div> </div>
@ -1118,23 +1114,23 @@ if (!empty($EmpDetails)) {
maxlength="255" class="form-control" maxlength="255" class="form-control"
value="Bank Passbook" readonly> value="Bank Passbook" readonly>
</div> </div>
<?php if(!empty($bankPassBookFile)){?> <?php if (!empty($bankPassBookFile)) { ?>
<div class="col-md-1"> <div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $bankPassBookFile; ?>" <a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $bankPassBookFile; ?>"
download> download>
<i class="fa fa-download mt-4" aria-hidden="true" <i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i> style="font-size: 25px;"></i>
</a> </a>
</div> </div>
<?php }else{?> <?php } else { ?>
<div class="col-md-1"></div> <div class="col-md-1"></div>
<?php }?> <?php } ?>
<div class="col-md-4"> <div class="col-md-4">
<label>Update Bank PassBok File</label><br> <label>Update Bank PassBok File</label><br>
<input type="file" name="emp_file4" class=""> <input type="file" name="emp_file4" class="">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -1143,25 +1139,25 @@ if (!empty($EmpDetails)) {
<label> Other Document File Name</label> <label> Other Document File Name</label>
<input type="text" id="file_name" name="file_name5" <input type="text" id="file_name" name="file_name5"
maxlength="255" class="form-control" maxlength="255" class="form-control"
value="<?= $otherDocumentFileName?>" > value="<?= $otherDocumentFileName ?>">
</div> </div>
<?php if(!empty($otherDocumentFile)){?> <?php if (!empty($otherDocumentFile)) { ?>
<div class="col-md-1"> <div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $otherDocumentFile; ?>" <a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $otherDocumentFile; ?>"
download> download>
<i class="fa fa-download mt-4" aria-hidden="true" <i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i> style="font-size: 25px;"></i>
</a> </a>
</div> </div>
<?php }else{?> <?php } else { ?>
<div class="col-md-1"></div> <div class="col-md-1"></div>
<?php }?> <?php } ?>
<div class="col-md-4"> <div class="col-md-4">
<label>Update Other Document File </label><br> <label>Update Other Document File </label><br>
<input type="file" name="emp_file5" class=""> <input type="file" name="emp_file5" class="">
</div> </div>
</div> </div>
@ -1211,8 +1207,8 @@ if (!empty($EmpDetails)) {
<div class="col-md-4"><label>Passport Number</label> <div class="col-md-4"><label>Passport Number</label>
<input type="text" id="passportno" maxlength="9" <input type="text" id="passportno" maxlength="9"
name="passportno" name="passportno" style="text-transform:uppercase"
style="text-transform:uppercase" class="form-control" class="form-control"
pattern="^[A-Z][1-9]\d\s?\d{4}[1-9]$" pattern="^[A-Z][1-9]\d\s?\d{4}[1-9]$"
title=" title="
The first character must be an uppercase alphabet. The first character must be an uppercase alphabet.
@ -1220,8 +1216,7 @@ if (!empty($EmpDetails)) {
with the first character ranging from 1 to 9 and the second character from 0 to 9. with the first character ranging from 1 to 9 and the second character from 0 to 9.
It may include zero or one white space character. It may include zero or one white space character.
The subsequent four characters can be any number from 0 to 9. The subsequent four characters can be any number from 0 to 9.
The last character should be any number from 1 to 9." The last character should be any number from 1 to 9.">
>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label>Passport File Name</label> <label>Passport File Name</label>
@ -1698,17 +1693,16 @@ if (!empty($EmpDetails)) {
} }
function ValidatePassport() { function ValidatePassport() {
var regsaid = /^[A-Z][1-9]\d\s?\d{4}[1-9]$/ig; var regsaid = /^[A-Z][1-9]\d\s?\d{4}[1-9]$/;
var passport = $("#passportno").val().trim();
var passport = capitalizeFirstLetter($("#passportno").val().trim());
if (regsaid.test(passport) == false) { if (regsaid.test(passport) == false) {
alert('You have entered invalid Passport.'); alert('You have entered invalid Passport.');
alert(` The first character must be an uppercase alphabet. alert(`The first character must be an uppercase alphabet. The next two characters should be numbers,with the first character ranging from 1 to 9 and the second character from 0 to 9. It may include zero or one white space character. The subsequent four characters can be any number from 0 to 9. The last character should be any number from 1 to 9."`);
The next two characters should be numbers, return (false);
with the first character ranging from 1 to 9 and the second character from 0 to 9. } else {
It may include zero or one white space character. return true;
The subsequent four characters can be any number from 0 to 9.
The last character should be any number from 1 to 9."`);
return;
} }
} }
@ -2063,16 +2057,25 @@ if (!empty($EmpDetails)) {
</script> </script>
<script> <script>
function capitalizeFirstFourLetters(value) {
if (!value) return ""; // Handle empty or undefined strings
return (
value.slice(0, 4).toUpperCase() + // Capitalize the first four letters
value.slice(4).toLowerCase() // Lowercase the rest of the string
);
}
function ifscCodeValidation(value) { function ifscCodeValidation(value) {
// Define the regex pattern for a valid IFSC code // Define the regex pattern for a valid IFSC code
const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/; const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/;
// Check if the value matches the pattern // Check if the value matches the pattern
if (ifscPattern.test(value)) { if (ifscPattern.test(capitalizeFirstFourLetters(value))) {
return; return;
} else { } else {
alert("Invalid IFSC Code. Please enter a valid one."); alert("Invalid IFSC Code. Please enter a valid one.");
$('#ifsccode').val('<?=$IFSCCode?>'); $('#ifsccode').val('');
return; return;
} }
} }

View File

@ -25,18 +25,19 @@ if (!empty($master)) {
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title --> <!-- start page title -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Config <?= ' - ' . $ConfigName; ?> Details</h4> <h4 class="page-title">Edit Config <?= ' - ' . $ConfigName; ?> Details</h4>
<a class="btn btn-secondary" href="<?php echo base_url(); ?>configlisting"><span class="bold">Back</span></a> <a class="btn btn-secondary" href="<?php echo base_url(); ?>configlisting"><span
</div> class="bold">Back</span></a>
</div> </div>
</div> </div>
</div>
<?php <?php
helper('form'); helper('form');
$error = session()->getFlashdata('error'); $error = session()->getFlashdata('error');
if ($error) { if ($error) {
?> ?>
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?> <?php echo session()->getFlashdata('error'); ?>
@ -46,7 +47,7 @@ if (!empty($master)) {
<?php <?php
$success = session()->getFlashdata('success'); $success = session()->getFlashdata('success');
if ($success) { if ($success) {
?> ?>
<div class="alert alert-info alert-dismissable"> <div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?> <?php echo session()->getFlashdata('success'); ?>
@ -93,13 +94,34 @@ if (!empty($master)) {
<div class="form-row" style="margin-top:10px"> <div class="form-row" style="margin-top:10px">
<div class="col-md-12 text-right"> <div class="col-md-12 text-right">
<a data-toggle="modal" href="#AddConfiguration" style="margin-right: 10px;" class="btn btn-success"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add Configuration</a> <a data-toggle="modal" href="#AddConfiguration" style="margin-right: 10px;"
class="btn btn-success"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add
Configuration</a>
</div> </div>
</div> </div>
<br>
<div>
<div align="right">
<div class="form-check" style="margin-right: 25px;">
<input class="form-check-input" type="checkbox" id="showChildArchiveId"
name="showChildArchive" value="1" onchange="showChildArchiveList()"
style="width: 18px; height: 18px;">
<label class="form-check-label" for="showChildArchiveId"
style="font-size: 1rem; margin-left: 8px;">
Show Archive
</label>
</div>
</div>
</div>
<div class="form-row" style="margin-top:10px"> <div class="form-row" style="margin-top:10px">
<div class="col-md-12"> <div class="col-md-12">
<table id="configtable" class="table table-bordered table-hover responsive-utilities jambo_table" style="background-color:#fff;font-size:12px;"> <table id="configtable"
class="table table-bordered table-hover responsive-utilities jambo_table"
style="background-color:#fff;font-size:12px;">
<thead> <thead>
<tr> <tr>
<th>S.NO</th> <th>S.NO</th>
@ -112,17 +134,57 @@ if (!empty($master)) {
$index = 0; $index = 0;
foreach ($child as $con) { foreach ($child as $con) {
$index++; $index++;
?> ?>
<input type="hidden" name="DbKey<?php echo $index ?>" id="DbKey<?php echo $index ?>" value="<?php echo $con->Key ?>">
<input type="hidden" name="configVal<?php echo $index ?>" id="configVal<?php echo $index ?>" value="<?php echo $con->ConfigValue ?>"> <input type="hidden" name="DbKey<?php echo $index ?>"
<tr> id="DbKey<?php echo $index ?>" value="<?php echo $con->Key ?>">
<input type="hidden" name="configVal<?php echo $index ?>"
id="configVal<?php echo $index ?>"
value="<?php echo $con->ConfigValue ?>">
<tr class="<?php if ($con->isActive == 0) {
echo "deactivatedRow";
} ?>" style="<?php if ($con->isActive == 0) {
echo "display:none";
} ?>">
<td><?php echo $index; ?></td> <td><?php echo $index; ?></td>
<td><?php echo $con->ConfigValue; ?></td> <td><?php echo $con->ConfigValue; ?></td>
<td><a data-target='#Edit' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#Edit"><i class="fas fa-pencil-alt" data-toggle="tooltip" title="Click here to view/Edit the Budget details"></i>&nbsp;&nbsp;&nbsp;</a></td> <td>
<?php if ($con->isActive == 0) { ?>
<a onclick="confirmReActivateConfig(event)" href="<?php echo base_url() . 'configurationctrl/reActivateConfigValue
?ConfigValue=' . $con->ConfigValue . '
&ConfigID=' . $con->Config_ID; ?>"
data-toggle="tooltip" title="<?php echo $con->Config_ID ?> - Click here to Re
activate Config Details"><i class="fas fa-key"></i>
</a>
<?php } else { ?>
<a data-target='#Edit' data-id="<?php echo $index; ?>"
data-userid="<?php echo $index; ?>" data-toggle="modal"
href="#Edit"><i class="fas fa-edit" data-toggle="tooltip"
title="Click here to Edit Config Value"></i>&nbsp;&nbsp;&nbsp;
</a>
&nbsp;&nbsp;
&nbsp;&nbsp;
<a onclick="confirmDeleteConfig(event)" href="<?php echo base_url() . 'configurationctrl/deleteConfigValue
?ConfigValue=' . $con->ConfigValue . '
&ConfigID=' . $con->Config_ID; ?>">
<i class="fas fa-trash" data-toggle="tooltip"
title="Click here to Delete the Config Value"></i>&nbsp;&nbsp;&nbsp;
</a>
<?php } ?>
</td>
</tr> </tr>
<?php } <?php }
} ?> } ?>
<input type="hidden" name="txtRowCount" id="txtRowCount" value="<?php echo $index ?>" /> <input type="hidden" name="txtRowCount" id="txtRowCount"
value="<?php echo $index ?>" />
</tbody> </tbody>
</table> </table>
</div> </div>
@ -140,14 +202,14 @@ if (!empty($master)) {
</div> </div>
<!-- Modal For Add Configuration --> <!-- Modal For Add Configuration -->
<div class="modal fade" id="AddConfiguration" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal fade" id="AddConfiguration" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<!-- Modal Header --> <!-- Modal Header -->
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Add Configuration</h4> <h4 class="modal-title" id="myModalLabel">Add Configuration</h4>
<button type="button" class="close" data-dismiss="modal" <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
aria-hidden="true">×</button>
</div> </div>
<!-- Modal Body --> <!-- Modal Body -->
@ -159,7 +221,8 @@ if (!empty($master)) {
Configuration Value : Configuration Value :
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<input class="form-control" name="AddConfigValue" id="AddConfigValue" type="text"> <input class="form-control" name="AddConfigValue" id="AddConfigValue"
type="text">
</div> </div>
</div> </div>
</div> </div>
@ -168,22 +231,24 @@ if (!empty($master)) {
<!-- Modal Footer --> <!-- Modal Footer -->
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px" data-dismiss="modal">Cancel</a> <a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px"
<a class="btn btn-success font tempClickAdd" id="tempClickAdd"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add</a> data-dismiss="modal">Cancel</a>
<a class="btn btn-success font tempClickAdd" id="tempClickAdd"><i
class="fa fa-plus"></i>&nbsp;&nbsp;Add</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Modal For Edit Configuration --> <!-- Modal For Edit Configuration -->
<div class="modal fade" id="Edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal fade" id="Edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<!-- Modal Header --> <!-- Modal Header -->
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Edit Config</h4> <h4 class="modal-title" id="myModalLabel">Edit Config</h4>
<button type="button" class="close" data-dismiss="modal" <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
aria-hidden="true">×</button>
</div> </div>
<!-- Modal Body --> <!-- Modal Body -->
@ -235,8 +300,10 @@ if (!empty($master)) {
<!-- Modal Footer --> <!-- Modal Footer -->
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px" data-dismiss="modal">Cancel</a> <a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px"
<a class="btn btn-success font tempClickUpdate" id="tempClickUpdate"><i class="fa fa-pencil"></i>&nbsp;&nbsp;Update</a> data-dismiss="modal">Cancel</a>
<a class="btn btn-success font tempClickUpdate" id="tempClickUpdate"><i
class="fa fa-pencil"></i>&nbsp;&nbsp;Update</a>
</div> </div>
</div> </div>
</div> </div>
@ -250,7 +317,7 @@ if (!empty($master)) {
<tr id="<%=index%>"> <tr id="<%=index%>">
<?php <?php
$data = array('name' => '"configVal[<%=index%>][index]"', 'value' => set_value('<%=index%>'), 'id' => '"configVal[<%=index%>][index]"', 'class' => 'form-control', 'type' => 'hidden'); $data = array('name' => '"configVal[<%=index%>][index]"', 'value' => set_value('<%=index%>'), 'id' => '"configVal[<%=index%>][index]"', 'class' => 'form-control', 'type' => 'hidden');
echo form_input($data); echo form_input($data);
?> ?>
<td align="left"><%=index%></td> <td align="left"><%=index%></td>
@ -263,12 +330,12 @@ if (!empty($master)) {
</tr> </tr>
</script> </script>
<script> <script>
$(document).ready(function() { $(document).ready(function () {
var index = $('#txtRowCount').val(); var index = $('#txtRowCount').val();
var userid = ''; var userid = '';
$("#Edit").on("shown.bs.modal", function(e) { $("#Edit").on("shown.bs.modal", function (e) {
userid = $(e.relatedTarget).data('userid'); userid = $(e.relatedTarget).data('userid');
$('#key').val($('#configtable tr:eq(' + userid + ') td:eq(0)').text()); $('#key').val($('#configtable tr:eq(' + userid + ') td:eq(0)').text());
$('#Config_ID').val($('#ConfigId').val()); $('#Config_ID').val($('#ConfigId').val());
@ -277,10 +344,10 @@ if (!empty($master)) {
}); });
$('.tempClickAdd').click(function() { $('.tempClickAdd').click(function () {
var cid = $('#ConfigId').val() var cid = $('#ConfigId').val()
if ($("#AddConfigValue").val() != '-1' && $("#AddConfigValue").val() != null && $("#AddConfigValue").val() != '') { if ($("#AddConfigValue").val() != '-1' && $("#AddConfigValue").val() != null && $("#AddConfigValue").val() != '') {
$('#AddConfigValue').show(); $('#AddConfigValue').show();
@ -295,7 +362,7 @@ if (!empty($master)) {
var template = jQuery("#tempList").html(); var template = jQuery("#tempList").html();
var html = ` var html = `
<tr id="${temp}"> <tr id="${temp}">
<td>${temp}</td> <td>${temp}</td>
<td>${ConfigValue}</td> <td>${ConfigValue}</td>
<td> <td>
@ -335,7 +402,7 @@ if (!empty($master)) {
theForm.append(input); theForm.append(input);
} }
$('.tempClickUpdate').click(function() { $('.tempClickUpdate').click(function () {
if ($("#configValue").val() != '') { if ($("#configValue").val() != '') {
@ -381,7 +448,7 @@ if (!empty($master)) {
} }
//var baseurl = "<?php print base_url(); ?>"; //var baseurl = "<?php print base_url(); ?>";
$(".editConfig").submit(function(e) { $(".editConfig").submit(function (e) {
if (validate()) { if (validate()) {
$('#loader').show(); $('#loader').show();
@ -389,7 +456,7 @@ if (!empty($master)) {
data: $('.editConfig').serialize(), data: $('.editConfig').serialize(),
type: 'POST', type: 'POST',
url: "<?php echo base_url(); ?>configurationctrl/configedit", url: "<?php echo base_url(); ?>configurationctrl/configedit",
success: function(data) { success: function (data) {
//alert(data); //alert(data);
$('#loader').hide(); $('#loader').hide();
@ -399,7 +466,7 @@ if (!empty($master)) {
$('#txtSelectedDepartment').val(''); $('#txtSelectedDepartment').val('');
$('#txtRowCount').val(''); $('#txtRowCount').val('');
//window.location = baseurl + 'CostCenter/CostListing'; window.location = baseurl + 'CostCenter/CostListing';
} }
@ -421,4 +488,121 @@ if (!empty($master)) {
} }
}); });
</script>
<script>
$('#ConfigName').change(function () {
$('#loader').show();
$.ajax({
data: { configName: $('#ConfigName').val() },
type: 'POST',
url: "<?php echo base_url(); ?>configurationctrl/configNameCheck",
success: function (data) {
if (data && data.length > 0) {
if (data[0].isActive == 1) {
alert("This Configuration Name is already present. kindly change it..!!");
$('#ConfigName').val('');
return;
} else {
alert("This Configuration Name is already present in deleted section. kindly reactivate it If needed..!!");
$('#ConfigName').val('');
return;
}
}
},
error: function (error) {
console.log("error occured..!!", error);
},
complete: function () {
$('#loader').hide();
console.log('ajax call completed..!!');
}
});
});
</script>
<script>
$('#AddConfigValue').change(function () {
$('#loader').show();
$.ajax({
data: {
configId: $('#ConfigId').val(),
ConfigValue: $('#AddConfigValue').val()
},
type: 'POST',
url: "<?php echo base_url(); ?>configurationctrl/configValueCheck",
success: function (data) {
if (data && data.length > 0) {
if (data[0].isActive == 1) {
alert("This Configuration Value is already present. kindly change it..!!");
$('#AddConfigValue').val('');
return;
} else {
alert("This Configuration Value is already present in deleted section. kindly reactivate it If needed..!!");
$('#AddConfigValue').val('');
return;
}
} else {
$('.tempClickAdd').click();
}
},
error: function (error) {
console.log("error occured..!!", error);
},
complete: function () {
$('#loader').hide();
console.log('ajax call completed..!!');
}
});
})
</script>
<script>
function showChildArchiveList() {
let isChecked = $("#showChildArchiveId").prop('checked');
// Show or hide the rows based on checkbox status
$(".deactivatedRow").each(function () {
if (isChecked) {
$(this).show();
} else {
$(this).hide();
}
});
}
$(document).ready(function () {
let table = $('#configtable');
showChildArchiveList();
table.on('draw', function () {
showChildArchiveList();
});
});
function confirmDeleteConfig(event) {
let result = confirm("Do You want to delete this configuration ?");
if (result) { return; } else { event.preventDefault(); }
}
function confirmReActivateConfig(event) {
let result = confirm("Do You want to Re activate deleted configuration ?");
if (result) { return; } else { event.preventDefault(); }
}
</script> </script>

View File

@ -73,7 +73,7 @@
<!-- Start Content--> <!-- Start Content-->
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title --> <!-- start page title -->
<div> <div class="mt-3">
<?php <?php
helper('form'); helper('form');
$error = session()->getFlashdata('error'); $error = session()->getFlashdata('error');

View File

@ -1,83 +1,91 @@
<?php <?php
$machineName=$masterData['machine_name']??''; $machineName = $masterData['machine_name'] ?? '';
$machineType=$masterData['machine_type']??''; $machineType = $masterData['machine_type'] ?? '';
$energyType=$masterData['energy_type']??''; $energyType = $masterData['energy_type'] ?? '';
?> ?>
<style> <style>
.btn-soft-primary { .btn-soft-primary {
color: white; color: white;
background-color: rgb(42, 206, 150); background-color: rgb(42, 206, 150);
border-color: rgb(42, 206, 150); border-color: rgb(42, 206, 150);
} }
.btn-soft-primary:hover { .btn-soft-primary:hover {
background-color: rgb(32, 176, 130); /* Slightly darker shade for hover */ background-color: rgb(32, 176, 130);
border-color: rgb(32, 176, 130); /* Slightly darker shade for hover */
} border-color: rgb(32, 176, 130);
}
.th{ .th {
font-size: 14px; font-size: 14px;
text-align:center !important ; text-align: center !important;
} }
.btn-custom {
width: 100px; /* or any desired width */
padding: 10px; /* adjust padding */
}
.btn-custom {
width: 100px;
/* or any desired width */
padding: 10px;
/* adjust padding */
}
</style> </style>
<div class="content-page"> <div class="content-page">
<div class="content"> <div class="content">
<!-- Start Content--> <!-- Start Content-->
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title --> <!-- start page title -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4><?= trim(explode(":", $pageTitle)[1]) ?></h4> <h4><?= trim(explode(":", $pageTitle)[1]) ?></h4>
<button type="button" onclick="window.history.back();" class="btn btn-secondary">Back</button> <button type="button" onclick="window.history.back();" class="btn btn-secondary">Back</button>
</div> </div>
</div> </div>
</div> </div>
<!-- end page title --> <!-- end page title -->
<!-- Form row --> <!-- Form row -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<form action="<?= base_url() ?> <form action="<?= empty($masterData)
<?php if(empty($masterData)) ? base_url('createFactoryMachineMasterDetails')
{echo "createFactoryMachineMasterDetails";} : base_url('updateFactoryMachineMasterDetails?id=' . $masterData['id']); ?>" method="post"
else{echo "updateFactoryMachineMasterDetails?id=".$masterData['id'];} ?>" method="post" class="form-label-left " > class="form-label-left">
<div class="form-row"> <div class="form-row">
<div class="form-group col"> <div class="form-group col">
<label for="machineName" class="col-form-label">Machine Name</label> <label for="machineName" class="col-form-label">Machine Name</label>
<span class="text-danger">*</span></label> <span class="text-danger">*</span></label>
<input type="text" name="machineName" id="machineName" class="form-control" value="<?= set_value('machineName', $machineName) ?>" required > <input type="text" name="machineName" id="machineName" class="form-control"
value="<?= set_value('machineName', $machineName) ?>" required>
</div> </div>
<div class="form-group col"> <div class="form-group col">
<label for="machineType" class="col-form-label">Machine Type</label> <label for="machineType" class="col-form-label">Machine Type</label>
<span class="text-danger">*</span></label> <span class="text-danger">*</span></label>
<input type="text" name="machineType" id="machineType" class="form-control" value="<?= set_value('machineType', $machineType) ?>" required> <input type="text" name="machineType" id="machineType" class="form-control"
value="<?= set_value('machineType', $machineType) ?>" required>
</div> </div>
<div class="form-group col"> <div class="form-group col">
<label for="energyType" class="col-form-label">Energy Type<span class="text-danger">*</span></label> <label for="energyType" class="col-form-label">Energy Type<span
<select name="energyType" id="energyType" class="form-control searchabledropdown" data-toggle="select2" required > class="text-danger">*</span></label>
<select name="energyType" id="energyType"
class="form-control searchabledropdown" data-toggle="select2" required>
<option value="-1">Select Energy Type</option> <option value="-1">Select Energy Type</option>
<option value="diesel" <?= $energyType == 'diesel' ? 'selected' : '' ?> > Diesel</option> <option value="diesel" <?= $energyType == 'diesel' ? 'selected' : '' ?>> Diesel
<option value="petrol" <?= $energyType == 'petrol' ? 'selected' : '' ?> > Petrol</option> </option>
<option value="gas" <?= $energyType == 'gas' ? 'selected' : '' ?> > Gas</option> <option value="petrol" <?= $energyType == 'petrol' ? 'selected' : '' ?>> Petrol
<option value="electric" <?= $energyType == 'electric' ? 'selected' : '' ?> >Electric</option> </option>
<option value="gas" <?= $energyType == 'gas' ? 'selected' : '' ?>> Gas</option>
<option value="electric" <?= $energyType == 'electric' ? 'selected' : '' ?>>
Electric</option>
</select> </select>
</div> </div>
</div> </div>
@ -85,58 +93,60 @@ $energyType=$masterData['energy_type']??'';
<br> <br>
<!-- submit and cancel button section --> <!-- submit and cancel button section -->
<div class="form-row" align="right" > <div class="form-row" align="right">
<div class="form-group col" > <div class="form-group col">
<button type="submit" class="btn btn-info waves-effect waves-light">Submit</button> <button type="submit"
&nbsp; class="btn btn-info waves-effect waves-light">Submit</button>
<button type="button" class="btn btn-secondary" onclick="window.history.back();"> &nbsp;
Cancel</button> <button type="button" class="btn btn-secondary"
onclick="window.history.back();">
Cancel</button>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- end row --> <!-- end row -->
</div> <!-- container --> </div> <!-- container -->
</div> <!-- content --> </div> <!-- content -->
</div> </div>
<script> <script>
$('#machineName').on('change',function(){ $('#machineName').on('change', function () {
let machineName = $(this).val(); let machineName = $(this).val();
$('#loader').show(); $('#loader').show();
$.ajax({ $.ajax({
type:"POST", type: "POST",
url:"<?php echo base_url();?>/checkMachineName", url: "<?php echo base_url(); ?>/checkMachineName",
data:{machineName}, data: { machineName },
success : function(data){ success: function (data) {
if(data && data.length > 0 ){ if (data && data.length > 0) {
let isActive = data[0].is_active; let isActive = data[0].is_active;
if(isActive == 1){ if (isActive == 1) {
alert("Machine Name already existing ..!!"); alert("Machine Name already existing ..!!");
$('#machineName').val(''); $('#machineName').val('');
}else{ } else {
alert("Machine Name already existing in the deleted section ..!!"); alert("Machine Name already existing in the deleted section ..!!");
$('#machineName').val(''); $('#machineName').val('');
} }
} }
}, },
error : function (error){ error: function (error) {
console.log("error ocurred..!!"); console.log("error ocurred..!!");
console.error(error); console.error(error);
}, },
complete : function (){ complete: function () {
$('#loader').hide(); $('#loader').hide();
console.log("ajax call is finished..!!"); console.log("ajax call is finished..!!");
} }