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.

190 lines
6.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/modules/base/head :: head}">
  4. <style>
  5. #AttendanceDatatable td {
  6. vertical-align: middle !important;
  7. }
  8. #AttendanceDatatable td:last-child {
  9. text-align: center;
  10. }
  11. .mark-present,
  12. .mark-absent {
  13. width: 90px;
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <div class="wrapper">
  19. <!-- header top menu Start -->
  20. <header th:replace="~{fragments/modules/base/header :: header}"></header>
  21. <!-- header top menu end -->
  22. <div class="page-wrap">
  23. <!--=============== Left Menu side Start ================-->
  24. <div th:replace="~{fragments/modules/base/menu :: menu}"></div>
  25. <!--=============== Left side End ================-->
  26. <div class="main-content">
  27. <div class="container-fluid">
  28. <div class="row mt-1">
  29. <div class="col-md-12">
  30. <div class="card mt-2">
  31. <div class="card-header" style="font-weight: bold;">
  32. Order Copy Data
  33. </div>
  34. <div class="card-body d-flex align-items-end">
  35. <!-- SL No -->
  36. <div class="col-sm-3">
  37. <label for="slNoInput">Search by Unique No</label>
  38. <input type="text" id="slNoInput" class="form-control"
  39. placeholder="Enter Unique No">
  40. </div>
  41. <div class="col-md-1 col-sm-12 text-center pt-4">
  42. <span style="font-weight: bold;">OR</span>
  43. </div>
  44. <!-- Mobile Number -->
  45. <div class="col-sm-3">
  46. <label for="mobileInput">Search by Mobile No</label>
  47. <input type="text" id="mobileInput" class="form-control"
  48. placeholder="Enter Mobile Number" maxlength="10">
  49. </div>
  50. <!-- Button (hidden initially) -->
  51. <div class="col-sm-4 d-flex align-items-end">
  52. <button id="searchBtn" class="btn btn-success mr-2">
  53. Search
  54. </button>
  55. <button id="clearSearchBtn" class="btn btn-danger">
  56. Clear
  57. </button>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. <div id="pageLoader" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.8); z-index: 9999; text-align: center;">
  66. <div style="position: relative; top: 50%; transform: translateY(-50%);">
  67. <div class="spinner-border text-primary" role="status" style="width: 3rem; height: 3rem;">
  68. <span class="sr-only">Loading...</span>
  69. </div>
  70. <!-- Add the 'Please wait' text below the spinner -->
  71. <p style="margin-top: 1rem; font-size: 1.2rem; color: #007bff;">Please wait...</p>
  72. </div>
  73. </div>
  74. <div th:replace="~{fragments/modules/base/app_module_menu_box :: div}"></div>
  75. <footer th:replace="~{fragments/modules/base/footer :: footer}"></footer>
  76. </div>
  77. </div>
  78. <script th:replace="~{fragments/modules/base/script :: script}"></script>
  79. <script>
  80. $('#searchBtn').click(function () {
  81. let slNo = $('#slNoInput').val().trim();
  82. let mobileNo = $('#mobileInput').val().trim();
  83. if (slNo === '' && mobileNo === '') {
  84. Swal.fire('Missing Input', 'Please enter SL No or Mobile Number', 'warning');
  85. return;
  86. }
  87. if (slNo !== '' && mobileNo !== '') {
  88. Swal.fire('Invalid Input', 'Enter either SL No OR Mobile Number, not both', 'error');
  89. return;
  90. }
  91. let url = '/election/api/mobile/first-order?';
  92. if (slNo !== '') {
  93. url += 'slNo=' + slNo;
  94. } else {
  95. url += 'mobileNo=' + mobileNo;
  96. }
  97. $('#pageLoader').show();
  98. fetch(url)
  99. .then(response => {
  100. if (response.status === 404) {
  101. throw new Error("No data found for given input");
  102. }
  103. if (response.status === 400) {
  104. throw new Error("Invalid input");
  105. }
  106. if (!response.ok) {
  107. throw new Error("Something went wrong");
  108. }
  109. return response.blob();
  110. })
  111. .then(blob => {
  112. let downloadUrl = window.URL.createObjectURL(blob);
  113. let a = document.createElement("a");
  114. a.href = downloadUrl;
  115. a.download = "FirstOrder.pdf"; // you can make dynamic
  116. document.body.appendChild(a);
  117. a.click();
  118. a.remove();
  119. })
  120. .catch(err => {
  121. Swal.fire({
  122. icon: 'warning',
  123. title: 'No data',
  124. text: err.message,
  125. allowOutsideClick: false,
  126. allowEscapeKey:false,
  127. allowEnterKey:false
  128. });
  129. })
  130. .finally(() => {
  131. $('#pageLoader').hide();
  132. });
  133. });
  134. $('#clearSearchBtn').click(function () {
  135. // Clear input fields
  136. $('#slNoInput').val('');
  137. $('#mobileInput').val('');
  138. // Optional: hide loader if visible
  139. $('#pageLoader').hide();
  140. });
  141. </script>
  142. </body>
  143. </html>