master module changes latest vadivel J 06-12-2024
This commit is contained in:
parent
3835154bf0
commit
67407c10a9
@ -122,9 +122,8 @@ $routes->get('addconfig', 'Configurationctrl::addconfig');
|
||||
$routes->post('configurationctrl/saveconfig', 'Configurationctrl::saveconfig');
|
||||
$routes->get('configurationctrl/editconfig', 'Configurationctrl::editconfig');
|
||||
$routes->post('configurationctrl/updateconfig', 'Configurationctrl::updateconfig');
|
||||
|
||||
|
||||
|
||||
$routes->get('configurationctrl/deleteConfig','configurationctrl::deleteConfig');
|
||||
$routes->get('configurationctrl/reActivateConfig','configurationctrl::reActivateConfig');
|
||||
|
||||
// Department Master Routes
|
||||
$routes->get('departmentListing', 'Department::index');
|
||||
|
||||
@ -41,11 +41,7 @@ class Configurationctrl extends BaseController
|
||||
$data['searchText'] = $searchText;
|
||||
|
||||
|
||||
//$count = $this->configmodel->departmentListingCount($searchText);
|
||||
|
||||
//$returns = $this->paginationCompress ( "configlisting/", $count, 20 );
|
||||
|
||||
$data['userRecords'] = $this->configmodel->configlisting();
|
||||
$data['userRecords'] = $this->configmodel->Configlisting();
|
||||
|
||||
$this->global['pageTitle'] = 'Config Listing';
|
||||
|
||||
@ -130,4 +126,37 @@ class Configurationctrl extends BaseController
|
||||
}
|
||||
return redirect()->route('configlisting');
|
||||
}
|
||||
|
||||
|
||||
function deleteConfig(){
|
||||
|
||||
$ConfigID = $this->request->getVar('ConfigID');
|
||||
$result = $this->configmodel->updateconfig(['isActive' => 0],$ConfigID);
|
||||
|
||||
if ($result > 0) {
|
||||
$this->session->setFlashdata('success', 'Configuration Deleted successfully!');
|
||||
} else {
|
||||
$this->session->setFlashdata('error', 'Configuration Record Not Deleted!');
|
||||
}
|
||||
|
||||
return redirect()->route('configlisting');
|
||||
|
||||
}
|
||||
|
||||
function reActivateConfig(){
|
||||
|
||||
$ConfigID = $this->request->getVar('ConfigID');
|
||||
$result = $this->configmodel->updateconfig(['isActive' => 1],$ConfigID);
|
||||
|
||||
if ($result > 0) {
|
||||
$this->session->setFlashdata('success', 'Configuration Re Activated successfully!');
|
||||
} else {
|
||||
$this->session->setFlashdata('error', 'Configuration Record Not Re Activated!');
|
||||
}
|
||||
|
||||
return redirect()->route('configlisting');
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -17,8 +17,7 @@ class Config_model extends Model
|
||||
function Configlisting()
|
||||
{
|
||||
$builder = $this->db->table('t_configmaster as Config')
|
||||
->select('Config.Config_ID, Config.ConfigName ,Config.Comments,Config.CreatedDate')
|
||||
|
||||
->select('Config.Config_ID, Config.ConfigName ,Config.Comments,Config.CreatedDate,Config.isActive')
|
||||
// ->join('t_configdetails as Con','Con.Config_ID=Config.Config_ID')
|
||||
->orderBy('Config.CreatedDate', 'desc');
|
||||
//->orderBy('hourlyid','desc');
|
||||
|
||||
@ -64,111 +64,158 @@
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
<div>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Master Details</a></li>
|
||||
<li class="breadcrumb-item active">
|
||||
<h4 class="page-title">Configuration Details</h4>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a>
|
||||
</div>
|
||||
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Master Details</a></li>
|
||||
<li class="breadcrumb-item active">
|
||||
<h4 class="page-title">Configuration Details</h4>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a>
|
||||
</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'); ?>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?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'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
|
||||
<input type="hidden" name="table" value="requisition">
|
||||
<label for="fromDate">From:</label>
|
||||
<input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
|
||||
|
||||
<label for="toDate">To:</label>
|
||||
<input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
|
||||
|
||||
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
|
||||
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
|
||||
<div class="error" id="error"></div>
|
||||
</form>
|
||||
<div class="card-body" style="overflow-x:scroll;">
|
||||
<table id="config_list_table" class="table dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Create Date</th>
|
||||
<th class="configIdTh">Configuration ID</th>
|
||||
<th>Configuration Name</th>
|
||||
<th>Description</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if (!empty($userRecords)) {
|
||||
foreach ($userRecords as $record) {
|
||||
?>
|
||||
<tr>
|
||||
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
|
||||
$cdate = '00-00-0000';
|
||||
} else {
|
||||
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
|
||||
} ?>
|
||||
<td><?php echo $cdate; ?> </td>
|
||||
<td class="configIdTd"><?php echo $record->Config_ID ?></td>
|
||||
<td><?php echo $record->ConfigName ?></td>
|
||||
<td><?php echo $record->Comments ?> </td>
|
||||
<!-- <td><?php echo $record->CreatedDate ?></td> -->
|
||||
|
||||
<!-- <td align="right"><?php $dt = new DateTime($record->CreatedDate);
|
||||
$CreatedDate = $dt->format('d-m-Y');
|
||||
echo $CreatedDate ?> </td> -->
|
||||
|
||||
|
||||
|
||||
<td>
|
||||
<a href="<?php echo base_url() . 'configurationctrl/editconfig?ConfigID=' . $record->Config_ID; ?>"><i class="fas fa-pencil-alt"></i> </a>
|
||||
<!-- <a><i class="fa fa-trash"></i> </a> -->
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- container -->
|
||||
</div> <!-- content -->
|
||||
<?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'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?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'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<form class="Date-filter-form" id="DateRangeFilter"
|
||||
style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
|
||||
<input type="hidden" name="table" value="requisition">
|
||||
<label for="fromDate">From:</label>
|
||||
<input class="form-control date_range form-date-search" id="fromDate" name="fromDate"
|
||||
placeholder="Select From Date" autocomplete="off" required>
|
||||
|
||||
<label for="toDate">To:</label>
|
||||
<input class="form-control date_range to-date-search" id="toDate" name="toDate"
|
||||
placeholder="Select To Date" autocomplete="off" required>
|
||||
|
||||
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true"
|
||||
class="icon-button" title="Search"></i></button>
|
||||
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton"
|
||||
title="Reset"></i>
|
||||
|
||||
|
||||
<div style="margin-left:auto">
|
||||
<div class="form-check" style="margin-right: 25px;">
|
||||
<input class="form-check-input" type="checkbox" id="showArchiveId" name="showArchive" value="1"
|
||||
onchange="showArchiveList()" style="width: 18px; height: 18px;">
|
||||
<label class="form-check-label" for="showArchiveId" style="font-size: 1rem; margin-left: 8px;">
|
||||
Show Archive
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="error" id="error"></div>
|
||||
</form>
|
||||
<div class="card-body" style="overflow-x:scroll;">
|
||||
<table id="config_list_table" class="table dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Create Date</th>
|
||||
<th class="configIdTh">Configuration ID</th>
|
||||
<th>Configuration Name</th>
|
||||
<th>Description</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if (!empty($userRecords)) {
|
||||
foreach ($userRecords as $record) {
|
||||
?>
|
||||
<tr
|
||||
class="<?php if ($record->isActive == 0) {
|
||||
echo "deactivatedRow";
|
||||
} ?>"
|
||||
style="<?php if ($record->isActive == 0) {
|
||||
echo "display:none";
|
||||
} ?>">
|
||||
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
|
||||
$cdate = '00-00-0000';
|
||||
} else {
|
||||
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
|
||||
} ?>
|
||||
<td><?php echo $cdate; ?> </td>
|
||||
<td class="configIdTd"><?php echo $record->Config_ID ?></td>
|
||||
<td><?php echo $record->ConfigName ?></td>
|
||||
<td><?php echo $record->Comments ?> </td>
|
||||
|
||||
<td><?= $record->isActive == 1 ? 'Active' : 'InActive'; ?></td>
|
||||
<td>
|
||||
<?php if ($record->isActive == 0) { ?>
|
||||
|
||||
<a onclick="confirmReActivateConfig(event)"
|
||||
href="<?php echo base_url() . 'configurationctrl/reActivateConfig?ConfigID=' . $record->Config_ID; ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->Config_ID ?> - Click here to Re activate Config Details"><i
|
||||
class="fas fa-key"></i>
|
||||
</a>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<a href="<?php echo base_url() . 'configurationctrl/editconfig?ConfigID=' . $record->Config_ID; ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->Config_ID ?> - Click here to Edit Config Details">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
<a onclick="confirmDeleteConfig(event)"
|
||||
href="<?php echo base_url() . 'configurationctrl/deleteConfig?ConfigID=' . $record->Config_ID; ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->Config_ID ?> - Click here to Delete Config Details">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- container -->
|
||||
</div> <!-- content -->
|
||||
</div>
|
||||
|
||||
</section>
|
||||
@ -178,25 +225,25 @@
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
|
||||
$(document).ready(function () {
|
||||
$.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) {
|
||||
var dateSplit = date.split('-');
|
||||
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
|
||||
};
|
||||
|
||||
// Initialize the DataTable
|
||||
var table = $('#config_list_table').DataTable({
|
||||
dom: 'Blfrtip',
|
||||
dom: 'Blfrtip',
|
||||
buttons: [
|
||||
'excel', 'pdf'
|
||||
],
|
||||
pageLength: 10,
|
||||
pageLength: 10,
|
||||
lengthMenu: [
|
||||
[10, 20, 30, 50, -1],
|
||||
[10, 20, 30, 50, "All"]
|
||||
],
|
||||
responsive: false,
|
||||
order: false,
|
||||
],
|
||||
responsive: false,
|
||||
order: false,
|
||||
language: {
|
||||
paginate: {
|
||||
next: '<i class="fas fa-angle-right"></i>', // Next button icon
|
||||
@ -207,7 +254,7 @@
|
||||
|
||||
// Date range filter function
|
||||
$.fn.dataTable.ext.search.push(
|
||||
function(settings, data, dataIndex) {
|
||||
function (settings, data, dataIndex) {
|
||||
var fromDate = $('#fromDate').val();
|
||||
var toDate = $('#toDate').val();
|
||||
console.log(fromDate); // e.g., 01-09-2024
|
||||
@ -241,20 +288,20 @@
|
||||
);
|
||||
|
||||
// Handle form submission for the date range filter
|
||||
$("#DateRangeFilter").submit(function(e) {
|
||||
$("#DateRangeFilter").submit(function (e) {
|
||||
e.preventDefault();
|
||||
table.draw(); // Redraw the table to apply the filter
|
||||
});
|
||||
|
||||
// Reset button functionality
|
||||
$("#resetButton").click(function() {
|
||||
$("#resetButton").click(function () {
|
||||
$("#fromDate").val('');
|
||||
$("#toDate").val('');
|
||||
table.draw(); // Redraw the table to clear the filter
|
||||
});
|
||||
|
||||
// Automatically focus and open the To Date picker when From Date is selected
|
||||
document.getElementById('fromDate').addEventListener('change', function() {
|
||||
document.getElementById('fromDate').addEventListener('change', function () {
|
||||
var fromDate = this.value;
|
||||
var toDateInput = document.getElementById('toDate');
|
||||
|
||||
@ -267,4 +314,45 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function showArchiveList() {
|
||||
let isChecked = $("#showArchiveId").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 = $('#config_list_table').DataTable();
|
||||
|
||||
showArchiveList();
|
||||
|
||||
table.on('draw', function () {
|
||||
showArchiveList();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
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>
|
||||
@ -139,9 +139,11 @@
|
||||
if (!empty($userRecords)) {
|
||||
foreach ($userRecords as $record) {
|
||||
?>
|
||||
<tr class="<?php if ($record->IsActive == 0) {
|
||||
<tr
|
||||
class="<?php if ($record->IsActive == 0) {
|
||||
echo "deactivatedRow";
|
||||
} ?>" style="<?php if ($record->IsActive == 0) {
|
||||
} ?>"
|
||||
style="<?php if ($record->IsActive == 0) {
|
||||
echo "display:none";
|
||||
} ?>">
|
||||
<!-- <td title=" - Click here to view department details"> </td> -->
|
||||
@ -163,7 +165,8 @@
|
||||
href="<?php echo base_url() . 'reActivateDepartment/?SID=' . $record->DEPCode ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->DEPCode ?> - Click here to Re activate Department Details"><i
|
||||
class="fas fa-key"></i></a></u>
|
||||
class="fas fa-key"></i>
|
||||
</a>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
@ -171,7 +174,7 @@
|
||||
href="<?php echo base_url() . 'editOlddepartment/?SID=' . $record->DEPCode ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->DEPCode ?> - Click here to View Department Details"><i
|
||||
class="fas fa-edit"></i></a></u>
|
||||
class="fas fa-edit"></i></a>
|
||||
|
||||
|
||||
|
||||
@ -180,7 +183,8 @@
|
||||
href="<?php echo base_url() . 'deleteDepartment/?SID=' . $record->DEPCode ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->DEPCode ?> - Click here to Delete Department Details"><i
|
||||
class="fas fa-trash"></i></a></u>
|
||||
class="fas fa-trash"></i>
|
||||
</a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user