master detail module changes-1 vadivel J 09-12-2024

This commit is contained in:
vadivelJ96 2024-12-09 16:34:03 +05:30
parent 25515a7104
commit bcea9f851a
8 changed files with 516 additions and 135 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

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

@ -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,60 @@ 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 +205,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 +224,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 +234,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 +303,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>
@ -263,12 +333,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 +347,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 +365,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 +405,7 @@ if (!empty($master)) {
theForm.append(input);
}
$('.tempClickUpdate').click(function() {
$('.tempClickUpdate').click(function () {
if ($("#configValue").val() != '') {
@ -381,7 +451,7 @@ if (!empty($master)) {
}
//var baseurl = "<?php print base_url(); ?>";
$(".editConfig").submit(function(e) {
$(".editConfig").submit(function (e) {
if (validate()) {
$('#loader').show();
@ -389,7 +459,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 +469,7 @@ if (!empty($master)) {
$('#txtSelectedDepartment').val('');
$('#txtRowCount').val('');
//window.location = baseurl + 'CostCenter/CostListing';
window.location = baseurl + 'CostCenter/CostListing';
}
@ -421,4 +491,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

@ -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..!!");
}