changes in master details-5 vadivel J 20-11-2024
This commit is contained in:
parent
23f90d518d
commit
76ca4b7ab0
@ -73,6 +73,7 @@ $routes->get('costListing', 'CostCenter::index');
|
||||
$routes->post('fetchCostCenterDetails', 'CostCenter::fetchCostCenterDetails');// for Ajax both add and edit....
|
||||
$routes->get('reActivateCostCenter','CostCenter::reActivateCostCenter');
|
||||
$routes->get('deleteCostCenter', 'CostCenter::deleteCostCenter');
|
||||
$routes->post('checkCostCenter', 'CostCenter::checkCostCenter');
|
||||
$routes->get('exportcost', 'CostCenter::exportcost');
|
||||
|
||||
// Asset Detail Routes
|
||||
|
||||
@ -129,6 +129,21 @@ class CostCenter extends BaseController
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* checkCostCenter
|
||||
*/
|
||||
|
||||
function checkCostCenter(){
|
||||
$data = $this->request->getPost();
|
||||
$result = $this->costcenter_model->checkCostCenter( $data['CostCenterName']);
|
||||
if(empty($result)){
|
||||
echo false;
|
||||
}else{
|
||||
echo true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* export the Cost
|
||||
*/
|
||||
|
||||
@ -428,5 +428,17 @@ where Dept.DEPCode not in
|
||||
|
||||
return "Cost center $CostCenterCode deactivated successfully.";
|
||||
}
|
||||
|
||||
function checkCostCenter($CostCenterName){
|
||||
$builder = $this->db->table('t_costcenter_master')
|
||||
->where('IsActive',1)
|
||||
->where('CostCenterName', $CostCenterName);
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getResult();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@ -214,21 +214,51 @@
|
||||
id: $('#id').val(),
|
||||
CostCenterName: $('#CostCenterName').val()
|
||||
};
|
||||
|
||||
console.log(formData);
|
||||
$('#loader').show();
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url(); ?>fetchCostCenterDetails",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
url: "<?php echo base_url(); ?>checkCostCenter",
|
||||
data: {
|
||||
CostCenterName: $('#CostCenterName').val()
|
||||
},
|
||||
success: function (response) {
|
||||
$('#loader').hide();
|
||||
|
||||
if (response.status) {
|
||||
alert(response.message);
|
||||
if (response) {
|
||||
alert("Cost Center Name Already Exists..!!");
|
||||
$('#ccwizard').modal('hide');
|
||||
location.reload();
|
||||
} else {
|
||||
alert(response.message);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url(); ?>fetchCostCenterDetails",
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
$('#loader').hide();
|
||||
|
||||
if (response.status) {
|
||||
alert(response.message);
|
||||
$('#ccwizard').modal('hide');
|
||||
location.reload();
|
||||
} else {
|
||||
alert(response.message);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
$('#loader').hide();
|
||||
console.error('An error occurred: ' + error);
|
||||
},
|
||||
complete: function () {
|
||||
$('#loader').hide();
|
||||
console.log("ajax call completed");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
@ -240,6 +270,8 @@
|
||||
console.log("ajax call completed");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@ -337,7 +369,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
$(window).on('load', function () {
|
||||
$(window).on('load', function () {
|
||||
function flashMessage() {
|
||||
|
||||
// Fetch the flash data from PHP and encode it for JavaScript
|
||||
@ -348,7 +380,7 @@ $(window).on('load', function () {
|
||||
}
|
||||
|
||||
flashMessage();
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user