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('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');

View File

@ -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();
}
}

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(){
@ -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);

View File

@ -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;
}
}

View File

@ -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]',
];

View File

@ -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 @@
<input type="text" id="passportno" maxlength="9"
onchange="ValidatePassport();" name="passportno"
style="text-transform:uppercase" class="form-control"
pattern="^[A-Z][1-9]\d\s?\d{4}[1-9]$"
title="
The first character must be an uppercase alphabet.
The next two characters should be numbers,
@ -1540,14 +1546,23 @@
<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) {
// Define the regex pattern for a valid IFSC code
const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/;
// Check if the value matches the pattern
if (ifscPattern.test(value)) {
if (ifscPattern.test(capitalizeFirstFourLetters(value))) {
return;
} else {
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">
<div class="form-row" style="margin-top:10px">
<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
$data = array('name' => 'configurationname', 'value' => set_value('configurationname'), 'id' => 'configurationname', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
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>

View File

@ -109,13 +109,13 @@ if (!empty($EmpDetails)) {
}
$isactive = $Emp->IsActive;
$ProfilePicPath='';
$ProfilePicPath = '';
if (!empty($Emp->ProfilePic)) {
$ProfilePicPath = base_url().'public/uploads/images/' . $Emp->ProfilePic;
$ProfilePicPath = base_url() . 'public/uploads/images/' . $Emp->ProfilePic;
} 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_ContactNumber = $Emp->Reference_ContactNumber;
@ -202,9 +202,8 @@ if (!empty($EmpDetails)) {
<div class="tab-pane active" id="first">
<form id="accountForm" method="post" action="#"
enctype="multipart/form-data"
class="form-horizontal">
<form id="accountForm" method="post" action="#" enctype="multipart/form-data"
class="form-horizontal">
<div class="row">
<div class="col-md-2">
@ -213,8 +212,8 @@ if (!empty($EmpDetails)) {
<div class="box-header">
<img id="profilepicture"
src="<?php echo $ProfilePicPath; ?>"
alt="your image" style="width: 139px;" />
src="<?php echo $ProfilePicPath; ?>" alt="your image"
style="width: 139px;" />
@ -239,8 +238,8 @@ if (!empty($EmpDetails)) {
<input type="hidden" name="oldImageName" id="Image"
value="<?php echo $Emp->ProfilePic; ?>" class="form-control"
readonly>
readonly>
</div>
@ -1004,34 +1003,33 @@ if (!empty($EmpDetails)) {
maxlength="14" onchange="ValidateAadhar();"
class="form-control"
onkeypress="return isNumberKey(event)" required
value="<?=$AadharNo?>">
value="<?= $AadharNo ?>">
</div>
<div class="col-md-3">
<label>Aadhar File Name</label>
<input type="text" id="file_name" name="file_name1"
maxlength="255" class="form-control"
value="Aadhar" readonly>
maxlength="255" class="form-control" value="Aadhar"
readonly>
</div>
<?php
if(!empty($aadharFile)){ ?>
if (!empty($aadharFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $aadharFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $aadharFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update Aadhar File</label><br>
<input type="file" name="emp_file1" class=""
value="">
<label>Update Aadhar File</label><br>
<input type="file" name="emp_file1" class="" value="">
</div>
</div>
<div class="row">
@ -1042,33 +1040,32 @@ if (!empty($EmpDetails)) {
onchange="validatePAN();" class="form-control"
pattern="([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}"
title=" 5 character,4 Digit Numbers,1 character (ex:ABCDE1234A) "
onkeypress="return alpha(event);"
value="<?=$PANNo?>"
>
onkeypress="return alpha(event);" value="<?= $PANNo ?>">
</div>
<div class="col-md-3">
<label>PAN File Name</label>
<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>
<?php if(!empty($panFile)) { ?>
<?php if (!empty($panFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $panFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $panFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update PAN File</label><br>
<input type="file" name="emp_file2" class="">
</div>
</div>
<div class="row">
@ -1077,36 +1074,35 @@ if (!empty($EmpDetails)) {
<input type="text" id="passportno" maxlength="9"
onchange="ValidatePassport();" name="passportno"
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
The first character cannot be Q, X or Z. (eg:A12 34567)"
(eg:A12 34567)"
onkeypress="return alpha(event);"
value="<?=$PassportNo?>"
>
value="<?= $PassportNo ?>">
</div>
<div class="col-md-3">
<label>Passport File Name</label>
<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>
<?php if(!empty($passportFile)){?>
<?php if (!empty($passportFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $passportFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $passportFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update Passport File</label><br>
<input type="file" name="emp_file3" class="">
</div>
</div>
@ -1118,23 +1114,23 @@ if (!empty($EmpDetails)) {
maxlength="255" class="form-control"
value="Bank Passbook" readonly>
</div>
<?php if(!empty($bankPassBookFile)){?>
<?php if (!empty($bankPassBookFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $bankPassBookFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $bankPassBookFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update Bank PassBok File</label><br>
<input type="file" name="emp_file4" class="">
</div>
</div>
<div class="row">
@ -1143,25 +1139,25 @@ if (!empty($EmpDetails)) {
<label> Other Document File Name</label>
<input type="text" id="file_name" name="file_name5"
maxlength="255" class="form-control"
value="<?= $otherDocumentFileName?>" >
value="<?= $otherDocumentFileName ?>">
</div>
<?php if(!empty($otherDocumentFile)){?>
<?php if (!empty($otherDocumentFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $otherDocumentFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $otherDocumentFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update Other Document File </label><br>
<input type="file" name="emp_file5" class="">
</div>
</div>
@ -1211,8 +1207,8 @@ if (!empty($EmpDetails)) {
<div class="col-md-4"><label>Passport Number</label>
<input type="text" id="passportno" maxlength="9"
name="passportno"
style="text-transform:uppercase" class="form-control"
name="passportno" style="text-transform:uppercase"
class="form-control"
pattern="^[A-Z][1-9]\d\s?\d{4}[1-9]$"
title="
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.
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 last character should be any number from 1 to 9.">
</div>
<div class="col-md-4">
<label>Passport File Name</label>
@ -1698,17 +1693,16 @@ if (!empty($EmpDetails)) {
}
function ValidatePassport() {
var regsaid = /^[A-Z][1-9]\d\s?\d{4}[1-9]$/ig;
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.');
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."`);
return;
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."`);
return (false);
} else {
return true;
}
}
@ -2063,16 +2057,25 @@ if (!empty($EmpDetails)) {
</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) {
// Define the regex pattern for a valid IFSC code
const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/;
// Check if the value matches the pattern
if (ifscPattern.test(value)) {
return;
if (ifscPattern.test(capitalizeFirstFourLetters(value))) {
return;
} else {
alert("Invalid IFSC Code. Please enter a valid one.");
$('#ifsccode').val('<?=$IFSCCode?>');
$('#ifsccode').val('');
return;
}
}

View File

@ -25,18 +25,19 @@ if (!empty($master)) {
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<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>
</div>
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<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>
</div>
</div>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
@ -46,7 +47,7 @@ if (!empty($master)) {
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
@ -93,13 +94,34 @@ if (!empty($master)) {
<div class="form-row" style="margin-top:10px">
<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>
<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="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>
<tr>
<th>S.NO</th>
@ -112,17 +134,57 @@ if (!empty($master)) {
$index = 0;
foreach ($child as $con) {
$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 ?>">
<tr>
?>
<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 ?>">
<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 $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>
<?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>
</table>
</div>
@ -140,14 +202,14 @@ if (!empty($master)) {
</div>
<!-- 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-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Add Configuration</h4>
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<!-- Modal Body -->
@ -159,7 +221,8 @@ if (!empty($master)) {
Configuration Value :
</div>
<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>
@ -168,22 +231,24 @@ if (!empty($master)) {
<!-- 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 font tempClickAdd" id="tempClickAdd"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add</a>
<a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px"
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>
<!-- 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-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Edit Config</h4>
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<!-- Modal Body -->
@ -235,8 +300,10 @@ if (!empty($master)) {
<!-- 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 font tempClickUpdate" id="tempClickUpdate"><i class="fa fa-pencil"></i>&nbsp;&nbsp;Update</a>
<a class="btn btn-success" style="background-color: grey;border: none;margin-right:10px"
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>
@ -250,7 +317,7 @@ if (!empty($master)) {
<tr id="<%=index%>">
<?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);
?>
<td align="left"><%=index%></td>
@ -263,12 +330,12 @@ if (!empty($master)) {
</tr>
</script>
<script>
$(document).ready(function() {
$(document).ready(function () {
var index = $('#txtRowCount').val();
var userid = '';
$("#Edit").on("shown.bs.modal", function(e) {
$("#Edit").on("shown.bs.modal", function (e) {
userid = $(e.relatedTarget).data('userid');
$('#key').val($('#configtable tr:eq(' + userid + ') td:eq(0)').text());
$('#Config_ID').val($('#ConfigId').val());
@ -277,10 +344,10 @@ if (!empty($master)) {
});
$('.tempClickAdd').click(function() {
$('.tempClickAdd').click(function () {
var cid = $('#ConfigId').val()
if ($("#AddConfigValue").val() != '-1' && $("#AddConfigValue").val() != null && $("#AddConfigValue").val() != '') {
if ($("#AddConfigValue").val() != '-1' && $("#AddConfigValue").val() != null && $("#AddConfigValue").val() != '') {
$('#AddConfigValue').show();
@ -295,7 +362,7 @@ if (!empty($master)) {
var template = jQuery("#tempList").html();
var html = `
<tr id="${temp}">
<tr id="${temp}">
<td>${temp}</td>
<td>${ConfigValue}</td>
<td>
@ -335,7 +402,7 @@ if (!empty($master)) {
theForm.append(input);
}
$('.tempClickUpdate').click(function() {
$('.tempClickUpdate').click(function () {
if ($("#configValue").val() != '') {
@ -381,7 +448,7 @@ if (!empty($master)) {
}
//var baseurl = "<?php print base_url(); ?>";
$(".editConfig").submit(function(e) {
$(".editConfig").submit(function (e) {
if (validate()) {
$('#loader').show();
@ -389,7 +456,7 @@ if (!empty($master)) {
data: $('.editConfig').serialize(),
type: 'POST',
url: "<?php echo base_url(); ?>configurationctrl/configedit",
success: function(data) {
success: function (data) {
//alert(data);
$('#loader').hide();
@ -399,7 +466,7 @@ if (!empty($master)) {
$('#txtSelectedDepartment').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>

View File

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

View File

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