changes in master details-final vadivel J 21-11-2024
This commit is contained in:
parent
dd515fafb6
commit
387c2af713
@ -39,7 +39,8 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'userListing/(:num)', 'User::us
|
|||||||
$routes->get('user/editOld', 'User::editOld');
|
$routes->get('user/editOld', 'User::editOld');
|
||||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'editUser', 'User::editUser');
|
$routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'editUser', 'User::editUser');
|
||||||
$routes->post('user/Deleteuserdepartment', 'User::Deleteuserdepartment');
|
$routes->post('user/Deleteuserdepartment', 'User::Deleteuserdepartment');
|
||||||
$routes->post('user/deleteUser', 'User::deleteUser');
|
$routes->get('user/deleteUser', 'User::deleteUser');
|
||||||
|
$routes->get('user/reActivateUser', 'User::reActivateUser');
|
||||||
|
|
||||||
// Supplier Routes
|
// Supplier Routes
|
||||||
$routes->get('supplierlisting', 'Supplier::index'); // list supplier
|
$routes->get('supplierlisting', 'Supplier::index'); // list supplier
|
||||||
|
|||||||
@ -1157,16 +1157,32 @@ class User extends BaseController
|
|||||||
*/
|
*/
|
||||||
function deleteUser()
|
function deleteUser()
|
||||||
{
|
{
|
||||||
echo 'Delete';
|
|
||||||
$Uid = $this->request->getPost('id');
|
$Uid = $this->request->getGet('UID');
|
||||||
|
|
||||||
$updatedDate = get_current_date_time();
|
$updatedDate = get_current_date_time();
|
||||||
|
|
||||||
$userInfo = array('isDeleted' => 1, 'updatedBy' => $this->vendorId, 'updatedDtm' => $updatedDate);
|
$updateInfo = array('isDeleted' => 1, 'updatedBy' => $this->vendorId, 'updatedDtm' => $updatedDate);
|
||||||
|
|
||||||
|
$result = $this->user_model->userActivation($Uid, $updateInfo);
|
||||||
|
|
||||||
$result = $this->user_model->deleteUser($Uid, $userInfo);
|
return redirect()->route('userListing');
|
||||||
|
}
|
||||||
|
|
||||||
echo 'Succssfully change the user status to InAcive';
|
function reActivateUser()
|
||||||
|
{
|
||||||
|
|
||||||
|
$Uid = $this->request->getGet('UID');
|
||||||
|
|
||||||
|
$updatedDate = get_current_date_time();
|
||||||
|
|
||||||
|
$updateInfo = array('isDeleted' => 0, 'updatedBy' => $this->vendorId, 'updatedDtm' => $updatedDate);
|
||||||
|
|
||||||
|
|
||||||
|
$result = $this->user_model->userActivation($Uid, $updateInfo);
|
||||||
|
|
||||||
|
|
||||||
|
return redirect()->route('userListing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -18,13 +18,12 @@ class User_model extends Model
|
|||||||
function userListing()
|
function userListing()
|
||||||
{
|
{
|
||||||
$builder = $this->db->table('t_employee_details EMP')
|
$builder = $this->db->table('t_employee_details EMP')
|
||||||
->select('user.createdDtm,EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,user.email as EmailId,EMP.ContactNumber,
|
->select('user.isDeleted,user.createdDtm,EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,user.email as EmailId,EMP.ContactNumber,
|
||||||
DEPT.DEPCode,DEPT.DepartmentName,role.role,user.userId')
|
DEPT.DEPCode,DEPT.DepartmentName,role.role,user.userId')
|
||||||
->join('t_departmentdetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode')
|
->join('t_departmentdetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode')
|
||||||
->join('tbl_users user', 'user.EmpID = EMP.EmpID')
|
->join('tbl_users user', 'user.EmpID = EMP.EmpID')
|
||||||
->join('tbl_roles role', 'user.roleId = role.roleId')
|
->join('tbl_roles role', 'user.roleId = role.roleId')
|
||||||
->orderBy('user.createdDtm', 'desc')
|
->orderBy('user.createdDtm', 'desc');
|
||||||
->where('user.isDeleted !=', 1);
|
|
||||||
|
|
||||||
$query = $builder->get();
|
$query = $builder->get();
|
||||||
|
|
||||||
@ -134,13 +133,13 @@ class User_model extends Model
|
|||||||
* @param number $userId : This is user id
|
* @param number $userId : This is user id
|
||||||
* @return boolean $result : TRUE / FALSE
|
* @return boolean $result : TRUE / FALSE
|
||||||
*/
|
*/
|
||||||
function deleteUser($userId)
|
function userActivation($Uid, $updateInfo)
|
||||||
{
|
{
|
||||||
// Delete the user record
|
// Delete the user record
|
||||||
$this->db->table('tbl_users')
|
$this->db->table('tbl_users')
|
||||||
->where('userId', $userId)
|
->where('userId', $Uid)
|
||||||
->delete();
|
->update($updateInfo);
|
||||||
|
|
||||||
// Return the number of affected rows to confirm the deletion
|
// Return the number of affected rows to confirm the deletion
|
||||||
return $this->db->affectedRows();
|
return $this->db->affectedRows();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -172,7 +172,7 @@
|
|||||||
|
|
||||||
<a data-toggle="tooltip"
|
<a data-toggle="tooltip"
|
||||||
href="<?php echo base_url() ?>loadView_updateFactoryMachineMasterDetail?id=<?php echo $record['id'] ?>">
|
href="<?php echo base_url() ?>loadView_updateFactoryMachineMasterDetail?id=<?php echo $record['id'] ?>">
|
||||||
<i class="fa fa-pencil-alt" data-toggle="tooltip"
|
<i class="fa fa-edit" data-toggle="tooltip"
|
||||||
title="Click here to Edit machine detail "></i>
|
title="Click here to Edit machine detail "></i>
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
@ -198,6 +198,7 @@
|
|||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<p>( Note :The entries count includes archived data... )</p>
|
||||||
</div> <!-- end card body-->
|
</div> <!-- end card body-->
|
||||||
</div> <!-- end card -->
|
</div> <!-- end card -->
|
||||||
</div><!-- end col-->
|
</div><!-- end col-->
|
||||||
|
|||||||
@ -97,7 +97,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="error" id="error"></div>
|
<div class="error" id="error"></div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -87,6 +87,21 @@
|
|||||||
|
|
||||||
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
|
<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>
|
<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>
|
<div class="error" id="error"></div>
|
||||||
</form>
|
</form>
|
||||||
<div class="card-body" style="overflow-x:scroll;">
|
<div class="card-body" style="overflow-x:scroll;">
|
||||||
@ -109,8 +124,16 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!empty($userRecords)) {
|
if (!empty($userRecords)) {
|
||||||
foreach ($userRecords as $record) {
|
foreach ($userRecords as $record) {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<tr>
|
|
||||||
|
<tr class="<?php if ($record->isDeleted == 1) {
|
||||||
|
echo "deactivatedRow";
|
||||||
|
} ?>"
|
||||||
|
style="<?php if ($record->isDeleted == 1) {
|
||||||
|
echo "display:none";
|
||||||
|
} ?>">
|
||||||
|
|
||||||
<?php if (date('d-m-Y', strtotime($record->createdDtm)) == "30-11--0001") {
|
<?php if (date('d-m-Y', strtotime($record->createdDtm)) == "30-11--0001") {
|
||||||
$cdate = '00-00-0000';
|
$cdate = '00-00-0000';
|
||||||
} else {
|
} else {
|
||||||
@ -125,9 +148,30 @@
|
|||||||
<td><?php echo $record->DepartmentName ?></td>
|
<td><?php echo $record->DepartmentName ?></td>
|
||||||
<td><?php echo $record->role ?></td>
|
<td><?php echo $record->role ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>"><i class="fas fa-pencil-alt"></i> </a>
|
<?php if ($record->isDeleted == 1) { ?>
|
||||||
|
|
||||||
|
<a onclick="confirmReActivateUser(event)"
|
||||||
|
href="<?php echo base_url() . 'user/reActivateUser?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>">
|
||||||
|
<i class="fas fa-key"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<?php } else { ?>
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>">
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a onclick="confirmDeleteUser(event)"
|
||||||
|
href="<?php echo base_url() . 'user/deleteUser?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>">
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<a onclick="deleteUser(<?php echo $record->userId; ?>)"><i class="fa fa-trash"></i> </a>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
@ -137,6 +181,7 @@
|
|||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<p>( Note :The entries count includes archived data... )</p>
|
||||||
</div> <!-- end card body-->
|
</div> <!-- end card body-->
|
||||||
</div> <!-- end card -->
|
</div> <!-- end card -->
|
||||||
</div><!-- end col-->
|
</div><!-- end col-->
|
||||||
@ -150,32 +195,14 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
|
function confirmReActivateUser(event) {
|
||||||
|
var answer = confirm(" Do you want to Re activate the user from the List?")
|
||||||
|
if (answer) {return;}else{event.preventDefault();}
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmDeleteUser(event) {
|
||||||
function deleteUser(userid) {
|
|
||||||
var answer = confirm(" Do you want to delete the user from the List?")
|
var answer = confirm(" Do you want to delete the user from the List?")
|
||||||
if (answer) {
|
if (answer) {return;}else{event.preventDefault();}
|
||||||
$.ajax({
|
|
||||||
data: {
|
|
||||||
id: userid
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
url: "<?php echo base_url() ?>user/deleteUser",
|
|
||||||
success: function(data) {
|
|
||||||
if (data) {
|
|
||||||
// $('#content').loader('hide');
|
|
||||||
// alert(data);
|
|
||||||
|
|
||||||
location.reload();
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
alert("Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
@ -265,4 +292,30 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
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 = $('#user_list_table').DataTable();
|
||||||
|
|
||||||
|
showArchiveList();
|
||||||
|
|
||||||
|
table.on('draw', function () {
|
||||||
|
showArchiveList();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user