Victoria Hall Booking for Events
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

396 lines
12 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head-admin :: head}"></head>
  4. <body>
  5. <!-- Page Container -->
  6. <div id="page-container"
  7. class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
  8. <!-- Sidebar Nav-->
  9. <aside th:replace="~{fragments/aside-right :: aside}"></aside>
  10. <!-- END Side Overlay (right)-->
  11. <!-- Sidebar Nav-->
  12. <nav th:replace="~{fragments/nav-pensioner :: nav}"></nav>
  13. <!-- END Sidebar -->
  14. <!-- Header -->
  15. <header th:replace="~{fragments/header-department :: header}"></header>
  16. <!-- END Header -->
  17. <!-- Main Container -->
  18. <main id="main-container">
  19. <div class="content">
  20. <div class="block block-rounded">
  21. <div class="block-header block-header-default">
  22. <h3 class="block-title">List of Pending Users</h3>
  23. </div>
  24. <div class="block-content p-0">
  25. <div class="p-sm-4 p-0">
  26. <div class="table-responsive">
  27. <table id="userPendingTable"
  28. class="table table-bordered table-striped table-vcenter js-dataTable-responsive">
  29. <thead class="thead-light">
  30. <tr>
  31. <th>S.no</th>
  32. <th>Usertype</th>
  33. <th>Name</th>
  34. <th>Mobile Number</th>
  35. <th>Email</th>
  36. <th>Area</th>
  37. <th>Pincode</th>
  38. <th>User Status</th>
  39. <th>Action</th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. <!--<tbody th:each="registration, i : ${registrations}">-->
  44. <!--<tr>-->
  45. <tr th:each="users, rowStat : ${pensionerPendingList}">
  46. <!--<td class="text-center" th:text="${i.index + 1}"></td>-->
  47. <td class="text-center" th:text="${rowStat.index + 1}"></td>
  48. <td class="text-center" th:text="${users.usertype}"></td>
  49. <td class="text-center" th:text="${users.name}"></td>
  50. <td class="text-center" th:text="${users.mobileNo}"></td>
  51. <td class="text-center" th:text="${users.email}"></td>
  52. <td class="text-center" th:text="${users.area}"></td>
  53. <td class="text-center" th:text="${users.pinCode}"></td>
  54. <td class="text-center" th:text="${users.userstatus}"></td>
  55. <td>
  56. <p>
  57. <span class="badge bg-warning" style="cursor: pointer;"
  58. th:onclick="pending([[${users.userId}]])">pending</span>
  59. </p>
  60. </td>
  61. </tr>
  62. </tbody>
  63. </table>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </main>
  70. <!-- END Main Container -->
  71. <!--modal for pening-->
  72. <div class="modal fade backdrop" id="pendingForm" data-backdrop="static" tabindex="-1" role="dialog"
  73. aria-labelledby="staticBackdropLabel" aria-hidden="true">
  74. <div class="modal-dialog modal-lg" role="document">
  75. <div class="modal-content">
  76. <form id="ownform" onsubmit="return rejectsubmit();">
  77. <div class="block block-rounded block-themed block-transparent mb-0">
  78. <div class="block-header bg-primary-dark">
  79. <h3 class="block-title" id="2mtitle">User Information</h3>
  80. <div class="block-options">
  81. <button type="button" class="btn-block-option" data-bs-dismiss="modal"
  82. aria-label="Close">
  83. <i class="fa fa-fw fa-times"></i>
  84. </button>
  85. </div>
  86. </div>
  87. <div class="block-content row">
  88. <!-- <div class="col-sm-4"> -->
  89. <!-- <label class="form-label">Pet ID:<span class="text-danger">*</span></label> -->
  90. <input type="hidden" class="form-control text-center" name="userid" id="userid"
  91. disabled />
  92. <!--<input type="hidden" class="form-control text-center" name="Mobii" id="Mobii"
  93. disabled />-->
  94. <!-- </div> -->
  95. <div class="col-sm-4">
  96. <label class="form-label">Name:<span class="text-danger"></span></label>
  97. <input type="text" class="form-control text-center" name="name" id="name"
  98. readonly />
  99. </div>
  100. <div class="col-sm-4">
  101. <label class="form-label">Mobile No:<span class="text-danger"></span></label>
  102. <input type="text" class="form-control text-center" name="mobile" id="mobile"
  103. readonly />
  104. </div>
  105. <div class="col-sm-4">
  106. <label class="form-label">Email:<span class="text-danger"></span></label>
  107. <input type="text" class="form-control text-center" name="email" id="email"
  108. readonly />
  109. </div>
  110. <div class="col-sm-4">
  111. <label class="form-label">Street:<span class="text-danger"></span></label>
  112. <input type="text" class="form-control text-center" name="street" id="street"
  113. readonly />
  114. </div>
  115. <div class="col-sm-4">
  116. <label class="form-label">Area:<span class="text-danger"></span></label>
  117. <input type="text" class="form-control text-center" name="area" id="area"
  118. readonly />
  119. </div>
  120. <div class="col-sm-4">
  121. <label class="form-label">Location:<span class="text-danger"></span></label>
  122. <input type="text" class="form-control text-center" name="location" id="location"
  123. readonly />
  124. </div>
  125. <div class="col-sm-4">
  126. <label class="form-label">Pincode:<span class="text-danger"></span></label>
  127. <input type="text" class="form-control text-center" name="pincode" id="pincode"
  128. readonly />
  129. </div>
  130. <div class="col-sm-4">
  131. <label class="form-label">UserType:<span class="text-danger"></span></label>
  132. <input type="text" class="form-control text-center" name="usertype" id="usertype"
  133. readonly />
  134. </div>
  135. <div class="col-sm-4" style="display:none" id="idField">
  136. <label class="form-label">User Type Id:<span class="text-danger"></span></label>
  137. <input type="text" class="form-control text-center" name="governmentId" id="governmentId"
  138. readonly />
  139. </div>
  140. <div class="col-sm-4" style="display:none" id="departmentField">
  141. <label class="form-label">Department:<span class="text-danger"></span></label>
  142. <input type="text" class="form-control text-center" name="department" id="department"
  143. readonly />
  144. </div>
  145. <div class="mb-4">
  146. <label class="form-label">Reason:<span class="text-danger"></span></label>
  147. <textarea class="form-control " name="reason" id="reason" required></textarea>
  148. </div>
  149. </div>
  150. </div>
  151. <div class="block-content block-content-full text-end bg-body" id="mbutton2">
  152. <button type="button" class="btn btn-sm btn-alt-success"
  153. th:onclick="accept()">Accept</button>
  154. <button type="button" class="btn btn-sm btn-alt-secondary"
  155. data-bs-dismiss="modal">Close</button>
  156. <button type="submit" class="btn btn-sm btn-primary">Reject</button>
  157. </div>
  158. </form>
  159. </div>
  160. </div>
  161. </div>
  162. <footer th:replace="~{fragments/footer2 :: footer}"></footer>
  163. <!-- END Footer -->
  164. </div>
  165. <script th:replace="~{fragments/loginscript :: script}"></script>
  166. <script>
  167. $(document).ready(
  168. function () {
  169. // DataTables buttons configuration
  170. var buttons = [{
  171. extend: 'pageLength',
  172. className: 'btn btn-primary'
  173. }, {
  174. title: 'Data export',
  175. extend: 'copyHtml5',
  176. text: 'Copy',
  177. className: 'btn btn-primary',
  178. id: 'copyBtn'
  179. }, {
  180. extend: 'excelHtml5',
  181. text: 'Excel',
  182. className: 'btn btn-primary',
  183. id: 'excelBtn'
  184. }, {
  185. extend: 'csvHtml5',
  186. text: 'CSV',
  187. className: 'btn btn-primary',
  188. id: 'csvBtn'
  189. }, {
  190. extend: 'pdfHtml5',
  191. text: 'PDF',
  192. className: 'btn btn-primary',
  193. id: 'pdfBtn'
  194. },
  195. ];
  196. $('#userPendingTable').DataTable(
  197. {
  198. dom: 'Bftip',
  199. columnDefs: [{
  200. targets: 'no-sort',
  201. orderable: false
  202. }],
  203. lengthMenu: [
  204. [50, 100, 200, 500, -1],
  205. ['50 rows', '100 rows', '200 rows',
  206. '500 rows', 'Show all']],
  207. scrollY: '50vh',
  208. fixedColumns: {
  209. left: 1,
  210. right: 1
  211. },
  212. buttons: [buttons],
  213. responsive: true,
  214. searching: true, // Enable search
  215. select: false,
  216. processing: false,
  217. });
  218. // Link the search input to DataTable
  219. $('#searchInput').on('keyup', function () {
  220. dataTable.search(this.value).draw();
  221. });
  222. });
  223. //script to open pending form
  224. function pending(userId) {
  225. $.ajax({
  226. type: "GET",
  227. url: '/victoriahallbooking/api/officer/getUserDetails',
  228. data: {
  229. 'usersid': userId
  230. },
  231. success: function (x) {
  232. // console.log(x);
  233. showUserInfo(x)
  234. }
  235. });
  236. }
  237. function showUserInfo(list) {
  238. $('#pendingForm').modal({
  239. backdrop: 'static',
  240. keyboard: false
  241. });
  242. $('#pendingForm').modal('show');
  243. document.getElementById("userid").value = list.userId;
  244. document.getElementById("name").value = list.name;
  245. document.getElementById("mobile").value = list.mobileNo;
  246. document.getElementById("email").value = list.email;
  247. document.getElementById("street").value = list.street;
  248. document.getElementById("area").value = list.area;
  249. document.getElementById("location").value = list.location;
  250. document.getElementById("pincode").value = list.pinCode;
  251. document.getElementById("usertype").value = list.usertype;
  252. document.getElementById("governmentId").value=list.governmentId
  253. document.getElementById("department").value=list.department
  254. if (list.usertype === 'GCC_EMPLOYEE' || list.usertype === 'PENSIONER') {
  255. idField.style.display = 'block';
  256. departmentField.style.display = 'block';
  257. } else {
  258. idField.style.display = 'none';
  259. departmentField.style.display = 'none';
  260. }
  261. }
  262. function accept() {
  263. let id = document.getElementById("userid").value;
  264. Swal.fire({
  265. title: 'Do you want to Accept this User ?',
  266. showDenyButton: true,
  267. showCancelButton: true,
  268. confirmButtonText: 'YES',
  269. denyButtonText: `NO`,
  270. }).then((result) => {
  271. /* Read more about isConfirmed, isDenied below */
  272. if (result.isConfirmed) {
  273. $.ajax({
  274. type: "POST",
  275. url: '/victoriahallbooking/api/officer/updateApprovedStatus/' + id,
  276. data: {
  277. 'status': 'APPROVED',
  278. 'comments': 'Accepted',
  279. 'userId': id
  280. },
  281. success: function (data, textStatus, xhr) {
  282. if (xhr.status === 200) { // Check if the response status is OK
  283. Swal.fire(
  284. 'Done',
  285. 'Successfully Accepted to the ID:' + id,
  286. 'success'
  287. ).then(() => {
  288. location.reload();
  289. });
  290. } else {
  291. Swal.fire(
  292. 'Error',
  293. 'Failed to accept the user',
  294. 'error'
  295. );
  296. }
  297. },
  298. error: function (xhr, textStatus, errorThrown) {
  299. Swal.fire(
  300. 'Error',
  301. 'Failed to accept the user',
  302. 'error'
  303. );
  304. }
  305. });
  306. } else if (result.isDenied) {
  307. Swal.fire('Changes are not saved', '', 'info')
  308. }
  309. });
  310. }
  311. function rejectsubmit() {
  312. let id = document.getElementById("userid").value;
  313. let reason = $("#reason").val();
  314. Swal.fire({
  315. title: 'Do you want to Reject this User ?',
  316. showDenyButton: true,
  317. showCancelButton: true,
  318. confirmButtonText: 'YES',
  319. denyButtonText: `NO`,
  320. }).then((result) => {
  321. /* Read more about isConfirmed, isDenied below */
  322. if (result.isConfirmed) {
  323. // console.log("Submitting rejection...");
  324. $.ajax({
  325. type: "POST",
  326. url: '/victoriahallbooking/api/officer/updateRejectStatus/' + id,
  327. data: {
  328. 'status': 'REJECTED',
  329. 'comments': reason,
  330. 'userId': id
  331. },
  332. success: function (data, textStatus, xhr) {
  333. // console.log("Rejection successful");
  334. if (xhr.status === 200) { // Check if the response status is OK
  335. Swal.fire(
  336. 'Done',
  337. 'Successfully Rejected to the ID:' + id,
  338. 'success'
  339. ).then(() => {
  340. location.reload();
  341. });
  342. } else {
  343. Swal.fire(
  344. 'Error',
  345. 'Failed to reject the user',
  346. 'error'
  347. );
  348. }
  349. },
  350. error: function (xhr, textStatus, errorThrown) {
  351. console.error("Error:", errorThrown);
  352. Swal.fire(
  353. 'Error',
  354. 'Failed to reject the user',
  355. 'error'
  356. );
  357. }
  358. });
  359. } else if (result.isDenied) {
  360. Swal.fire('Changes are not saved', '', 'info')
  361. }
  362. });
  363. return false; // Prevent form submission
  364. }
  365. </script>
  366. </body>
  367. </html>