|
|
<!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head-admin :: head}"></head>
<body> <!-- Page Container --> <div id="page-container" class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark"> <!-- Sidebar Nav--> <aside th:replace="~{fragments/aside-right :: aside}"></aside> <!-- END Side Overlay (right)--> <!-- Sidebar Nav--> <nav th:replace="~{fragments/nav-admin :: nav}"></nav> <!-- END Sidebar --> <!-- Header --> <header th:replace="~{fragments/header-admin :: header}"></header> <!-- END Header --> <!-- Main Container --> <main id="main-container"> <!-- END Hero --> <!-- Page Content --> <div class="content"> <div class="block block-rounded"> <div class="block-header block-header-default"> <h3 class="block-title"> List of Rejected Users</h3> <!--<div class="block-options">
<button type="button" class="btn-block-option" onclick="callAdd();"><i class="far fa-plus-square"></i> Register New Hall</button> </div>--> </div> <div class="block-content p-0"> <div class="p-sm-4 p-0"> <div class="table-responsive"> <table id="userRejectedList" class="table table-bordered table-striped table-vcenter js-dataTable-responsive"> <thead class="thead-light"> <tr class="table-bordered"> <th class="text-center no-sort">S.No</th> <th class="text-center" width="20%">Usertype</th> <th class="text-center">Name</th> <th class="text-center">Mobile Number</th> <th class="text-center">E-Mail ID</th> <th class="text-center">User Status</th> <th class="text-center">Action</th> </tr> </thead> <tbody> <!-- Use Thymeleaf to loop through the bookingList --> <tr th:each="users, rowStat : ${rejectedlist}"> <!--<td class="text-center" th:text="${i.index + 1}"></td>--> <td class="text-center" th:text="${rowStat.index + 1}"></td> <td class="text-center" th:text="${users.usertype}"></td> <td class="text-center" th:text="${users.name}"></td> <td class="text-center" th:text="${users.mobileNo}"></td> <td class="text-center" th:text="${users.email}"></td> <td class="text-center" th:text="${users.userstatus}"></td> <td> <p>
<span class="badge bg-danger" style="cursor: pointer;" th:onclick="reject([[${users.userId}]])">Rejected</span>
</p>
</td> </tr> </tbody> </table> </div> </div> </div> </div> </div> <!-- END Page Content --> </main> <!-- END Main Container -->
<!-- END Main Container --> <!--modal for pening--> <div class="modal fade backdrop" id="rejectForm" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="staticBackdropLabel" aria-hidden="true"> <div class="modal-dialog modal-lg" role="document"> <div class="modal-content"> <form id="ownform"> <div class="block block-rounded block-themed block-transparent mb-0"> <div class="block-header bg-primary-dark"> <h3 class="block-title" id="2mtitle">User Reject Information</h3> <div class="block-options"> <button type="button" class="btn-block-option" data-bs-dismiss="modal" aria-label="Close"> <i class="fa fa-fw fa-times"></i> </button> </div> </div> <div class="block-content row"> <!-- <div class="col-sm-4"> --> <!-- <label class="form-label">Pet ID:<span class="text-danger">*</span></label> --> <input type="hidden" class="form-control text-center" name="userid" id="userid" disabled /> <!--<input type="hidden" class="form-control text-center" name="Mobii" id="Mobii"
disabled />-->
<!-- </div> --> <div class="col-sm-4"> <label class="form-label">Name:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="name" id="name" disabled /> </div> <div class="col-sm-4"> <label class="form-label">Mobile No:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="mobile" id="mobile" disabled /> </div> <div class="col-sm-4"> <label class="form-label">E-Mail ID:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="email" id="email" disabled /> </div> <div class="col-sm-4"> <label class="form-label">Street:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="street" id="street" disabled /> </div> <div class="col-sm-4"> <label class="form-label">Area:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="area" id="area" disabled /> </div> <div class="col-sm-4"> <label class="form-label">Location:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="location" id="location" disabled /> </div>
<div class="col-sm-4"> <label class="form-label">Pincode:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="pincode" id="pincode" disabled /> </div> <div class="col-sm-4"> <label class="form-label">UserType:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="usertype" id="usertype" disabled /> </div>
<div class="col-sm-4"> <label class="form-label">User Status:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="userstatus" id="userstatus" disabled /> </div> <div class="col-sm-4" style="display:none" id="idField"> <label class="form-label">Usertype Id:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="governmentId" id="governmentId" readonly /> </div> <div class="col-sm-4" style="display:none" id="departmentField"> <label class="form-label">Department:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="department" id="department" readonly /> </div> <div class="col-sm-4"> <label class="form-label">Reject Reason:<span class="text-danger"></span></label> <input type="text" class="form-control text-center" name="userreject" id="userreject" disabled /> </div> </div> </div> <div class="block-content block-content-full text-end bg-body" id="mbutton2"> <button type="button" class="btn btn-sm btn-alt-success" th:onclick="accept()">Accept</button> <button type="button" class="btn btn-sm btn-alt-secondary" data-bs-dismiss="modal">Close</button> <!--<button type="submit" class="btn btn-sm btn-primary">Reject</button>--> </div> </form> </div> </div> </div> <div th:replace="~{fragments/resetpassword :: div}"></div> <footer th:replace="~{fragments/footer2 :: footer}"></footer>
<!-- Scripts --> <script th:replace="~{fragments/loginscript :: script}"></script> <script type="text/javascript"> $(document).ready( function () { var buttons = [{ extend: 'pageLength', className: 'btn btn-primary' }, { title: 'Data export', extend: 'copyHtml5', text: 'Copy', className: 'btn btn-primary', id: 'copyBtn' }, { extend: 'excelHtml5', text: 'Excel', className: 'btn btn-primary', id: 'excelBtn' }, { extend: 'csvHtml5', text: 'CSV', className: 'btn btn-primary', id: 'csvBtn' }, { extend: 'pdfHtml5', text: 'PDF', className: 'btn btn-primary', id: 'pdfBtn' },
];
$('#userRejectedList').DataTable( { dom: 'Bftip', columnDefs: [{ targets: 'no-sort', orderable: false }], lengthMenu: [ [50, 100, 200, 500, -1], ['50 rows', '100 rows', '200 rows', '500 rows', 'Show all']], scrollY: '50vh', fixedColumns: { left: 1, right: 1 }, buttons: [buttons], responsive: true, searching: true, // Enable search select: false, processing: false, });
// Link the search input to DataTable $('#searchInput').on('keyup', function () { dataTable.search(this.value).draw(); });
});
function reject(userId) { $.ajax({ type: "GET", url: '/communityhall/api/officer/getUserDetails', data: { 'usersid': userId }, success: function (x) { showUserInfo(x) } });
}
function showUserInfo(list) { $('#rejectForm').modal({ backdrop: 'static', keyboard: false }); $('#rejectForm').modal('show'); document.getElementById("userid").value = list.userId; document.getElementById("name").value = list.name; document.getElementById("mobile").value = list.mobileNo; document.getElementById("email").value = list.email; document.getElementById("street").value = list.street; document.getElementById("area").value = list.area; document.getElementById("location").value = list.location; document.getElementById("pincode").value = list.pinCode; document.getElementById("usertype").value = list.usertype; document.getElementById("userstatus").value = list.userstatus; document.getElementById("governmentId").value=list.governmentId document.getElementById("department").value=list.department if (list.userHistories && list.userHistories.length > 0) { // Get the latest comment from the last element in userHistories var latestComment = list.userHistories[list.userHistories.length - 1].comments; document.getElementById("userreject").value = latestComment; } else { document.getElementById("userreject").value = "No comments available"; } //document.getElementById("userreject").value =list.userHistories[userHistories.length-1].comments; if (list.usertype === 'GCC_EMPLOYEE' || list.usertype === 'PENSIONER') { idField.style.display = 'block'; departmentField.style.display = 'block'; } else { idField.style.display = 'none'; departmentField.style.display = 'none'; } }
function accept() { let id = document.getElementById("userid").value;
Swal.fire({ title: 'Do you want to Accept this User ?', showDenyButton: true, showCancelButton: true, confirmButtonText: 'YES', denyButtonText: `NO`, }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { $.ajax({ type: "POST", url: '/communityhall/api/officer/updateApprovedStatus/' + id, data: { 'status': 'APPROVED', 'comments': 'Accepted', 'userId': id }, success: function (data, textStatus, xhr) { if (xhr.status === 200) { // Check if the response status is OK Swal.fire( 'Done', 'Successfully Accepted to the ID:' + id, 'success' ).then(() => { location.reload(); }); } else { Swal.fire( 'Error', 'Failed to accept the user', 'error' ); } }, error: function (xhr, textStatus, errorThrown) { Swal.fire( 'Error', 'Failed to accept the user', 'error' ); } }); } else if (result.isDenied) { Swal.fire('Changes are not saved', '', 'info') } }); } </script></body>
</html>
|