changes in master details-4 vadivel J 21-11-2024

This commit is contained in:
vadivelJ96 2024-11-22 11:15:28 +05:30
parent bd0a29ea95
commit dd515fafb6
4 changed files with 183 additions and 80 deletions

View File

@ -420,6 +420,7 @@ $routes->get('readFactoryMachineMasterDetails', 'FactoryMachineController::readF
$routes->get('readFactoryMachineMasterDetailsById', 'FactoryMachineController::readFactoryMachineMasterDetailsById');
$routes->post('updateFactoryMachineMasterDetails', 'FactoryMachineController::updateFactoryMachineMasterDetails');
$routes->get('deleteFactoryMachineMasterDetails', 'FactoryMachineController::deleteFactoryMachineMasterDetails');
$routes->get('reActivateFactoryMachineMasterDetails', 'FactoryMachineController::reActivateFactoryMachineMasterDetails');
$routes->get('loadView_createFactoryMachineMasterDetail', 'FactoryMachineController::loadView_createFactoryMachineMasterDetail');
$routes->get('loadView_updateFactoryMachineMasterDetail', 'FactoryMachineController::loadView_updateFactoryMachineMasterDetail');

View File

@ -82,7 +82,6 @@ class FactoryMachineController extends BaseController
$this->global['pageTitle'] = 'Factory Machine Master Details';
$data['masterData'] = $this->factoryMachineMaster_model
->where('is_active', 1)
->orderBy('created_at','DESC')
->findAll();
@ -153,4 +152,24 @@ class FactoryMachineController extends BaseController
}
public function reActivateFactoryMachineMasterDetails(){
$this->global['pageTitle'] = 'Re Activate Factory Machine Master Details';
$id = $this->request->getGet('id');
$data['is_active']=1;
$updated = $this->factoryMachineMaster_model->update($id,$data);
if ($updated) {
// Set flashdata for success message
return redirect()->to('/readFactoryMachineMasterDetails')->with('success', 'Re Activated Factory Machine Master Details');
} else {
// Set flashdata for error message
return redirect()->back()->with('error', 'Failed to Re Activate machine details');
}
}
}

View File

@ -156,21 +156,26 @@
<td>
<?php if ($record->IsActive == 0) { ?>
<a href="<?php echo base_url() . 'reActivateDepartment/?SID=' . $record->DEPCode ?>"
<a
onclick="confirmReActivateDepartment(event)"
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>
<?php } else { ?>
<a href="<?php echo base_url() . 'editOlddepartment/?SID=' . $record->DEPCode ?>"
<a
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>
&nbsp;&nbsp;
<a href="<?php echo base_url() . 'deleteDepartment/?SID=' . $record->DEPCode ?>"
<a
onclick="confirmDeleteDepartment(event)"
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>
@ -318,4 +323,14 @@
});
function confirmDeleteDepartment(event){
let result = confirm("Do You want to delete department ?");
if(result){return;}else{event.preventDefault();}
}
function confirmReActivateDepartment(event){
let result = confirm("Do You want to Re activate deleted department ?");
if(result){return;}else{event.preventDefault();}
}
</script>

View File

@ -74,7 +74,7 @@
<div class="container-fluid">
<!-- start page title -->
<div>
<?php
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
@ -89,17 +89,19 @@
?>
<div class="row">
<div class="col-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"> <?= trim(explode(":", $pageTitle)[1]) ?> </h4>
</li>
</ol>
</div>
<a class="btn btn-success" href="<?php echo base_url(); ?>loadView_createFactoryMachineMasterDetail">Add New Factory Machine</a>
</div>
<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"> <?= trim(explode(":", $pageTitle)[1]) ?> </h4>
</li>
</ol>
</div>
<a class="btn btn-success"
href="<?php echo base_url(); ?>loadView_createFactoryMachineMasterDetail">Add New
Factory Machine</a>
</div>
</div>
</div>
@ -107,61 +109,95 @@
<div class="row">
<div class="col-12">
<div class="card">
<br>
<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="card-body" style="overflow-x:scroll;">
<table id="datatable" class="table table-hover table-bordered" style="background-color:#fff;">
<thead>
<tr>
<th >Machine Name</th>
<th >Machine Type</th>
<th >Energy Type</th>
<th style="text-align:center !important;">Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($masterData)) {
foreach ($masterData as $record) {
?>
<td ><?php echo $record['machine_name']; ?></td>
<td ><?php echo $record['machine_type'] ?></td>
<td ><?php echo $record['energy_type'] ?></td>
<td align="center">
<a data-toggle="tooltip"
href="<?php echo base_url()?>loadView_updateFactoryMachineMasterDetail?id=<?php echo $record['id'] ?>"
>
<i class="fa fa-pencil-alt" data-toggle="tooltip"
title="Click here to Edit "></i>
&nbsp;&nbsp;&nbsp;
</a>
<table id="datatable" class="table table-hover table-bordered"
style="background-color:#fff;">
<a data-toggle="tooltip" onclick="confirmDelete(event)"
href="<?php echo base_url(); ?>deleteFactoryMachineMasterDetails?id=<?php echo $record['id'] ?>"
>
<i class="fa fa-trash" data-toggle="tooltip"
title="Click here to Delete "></i>
&nbsp;&nbsp;&nbsp;
</a>
<thead>
<tr>
</td>
<th>Machine Name</th>
<th>Machine Type</th>
<th>Energy Type</th>
<th style="text-align:center !important;">Action</th>
</tr>
<?php
}
}
?>
</tbody>
</table>
</thead>
<tbody>
<?php
if (!empty($masterData)) {
foreach ($masterData as $record) {
?>
<tr class="<?php if ($record['is_active'] == 0) {
echo "deactivatedRow";
} ?>" style="<?php if ($record['is_active'] == 0) {
echo "display:none";
} ?>">
<td><?php echo $record['machine_name']; ?></td>
<td><?php echo $record['machine_type'] ?></td>
<td><?php echo $record['energy_type'] ?></td>
<td align="center">
<?php if ($record['is_active'] == 0) { ?>
<a data-toggle="tooltip"
onclick="confirmReActivateMachineDetail(event)"
href="<?php echo base_url(); ?>reActivateFactoryMachineMasterDetails?id=<?php echo $record['id'] ?>">
<i class="fa fa-key" data-toggle="tooltip"
title="Click here to Re activate machine detail "></i>
&nbsp;&nbsp;&nbsp;
</a>
<?php } else { ?>
<a data-toggle="tooltip"
href="<?php echo base_url() ?>loadView_updateFactoryMachineMasterDetail?id=<?php echo $record['id'] ?>">
<i class="fa fa-pencil-alt" data-toggle="tooltip"
title="Click here to Edit machine detail "></i>
&nbsp;&nbsp;&nbsp;
</a>
<a data-toggle="tooltip" onclick="confirmDelete(event)"
href="<?php echo base_url(); ?>deleteFactoryMachineMasterDetails?id=<?php echo $record['id'] ?>">
<i class="fa fa-trash" data-toggle="tooltip"
title="Click here to Delete machine detail"></i>
&nbsp;&nbsp;&nbsp;
</a>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
@ -174,22 +210,22 @@
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<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 = $('#datatable').DataTable({
dom: 'Blfrtip',
buttons: [
'excel', 'pdf'
],
pageLength: 10,
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ],
responsive: false,
order: false,
pageLength: 10,
lengthMenu: [[10, 20, 30, 50, -1], [10, 20, 30, 50, "All"]],
responsive: false,
order: false,
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
@ -200,7 +236,7 @@
// Handle form submission
$("#DateRangeFilter").submit(function(e) {
$("#DateRangeFilter").submit(function (e) {
e.preventDefault();
table.draw();
});
@ -208,11 +244,43 @@
</script>
<script>
function confirmDelete(event){
let result= confirm(` Do you Confirm to Delete the Factory Machine?`);
if(result){return result; }else{event.preventDefault();}
}
function confirmDelete(event) {
let result = confirm(` Do you Confirm to Delete the Factory Machine?`);
if (result) { return result; } else { event.preventDefault(); }
}
function confirmReActivateMachineDetail(event) {
let result = confirm(` Do you Confirm to Re Activate Factory Machine Detail?`);
if (result) { return result; } else { event.preventDefault(); }
}
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 = $('#datatable').DataTable();
showArchiveList();
table.on('draw', function () {
showArchiveList();
});
});
</script>