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.

188 lines
6.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head-admin :: head}">
  4. <meta charset="ISO-8859-1">
  5. <!-- Include DataTables CSS -->
  6. </head>
  7. <style>
  8. .block-content {
  9. padding-bottom: 10px;
  10. }
  11. .small-input {
  12. width: 150px;
  13. /* Adjust the width as needed */
  14. }
  15. .small-table th,
  16. .small-table td {
  17. font-size: 14px;
  18. /* Adjust font size as needed */
  19. }
  20. /* Reduce padding for table cells */
  21. .small-table td,
  22. .small-table th {
  23. padding: 5px;
  24. /* Adjust padding as needed */
  25. }
  26. </style>
  27. <body>
  28. <!-- Page Container -->
  29. <div id="page-container"
  30. class="sidebar-o sidebar-dark enable-page-overlay side-scroll page-header-fixed page-header-dark">
  31. <!-- Side Overlay aside (right)-->
  32. <aside th:replace="~{fragments/aside-right :: aside}"></aside>
  33. <!-- END Side Overlay (right)-->
  34. <!-- Sidebar Nav-->
  35. <nav th:replace="~{fragments/nav-admin :: nav}"></nav>
  36. <!-- END Sidebar -->
  37. <!-- Header -->
  38. <header th:replace="~{fragments/header-admin :: header}"></header>
  39. <!-- END Header -->
  40. <!-- Main Container -->
  41. <main id="main-container">
  42. <!-- Page Content -->
  43. <div class="content">
  44. <div class="block block-rounded">
  45. <form id="userdetailsform">
  46. <div class="block-header bg-primary text-white">
  47. <h3 class="block-title">Manual Refund</h3>
  48. </div>
  49. <div class="block-content">
  50. <div class="row">
  51. <div class="col-sm-3">
  52. <label class="form-label" for="bookingId">Booking Id:<span
  53. class="text-danger">*</span></label>
  54. <input type="text" class="form-control" name="bookingId" id="bookingId"
  55. placeholder="Booking Id"/>
  56. </div>
  57. <div class="col-sm-3">
  58. <label class="form-label" for="transactionId">Transaction Id:<span
  59. class="text-danger">*</span></label>
  60. <input type="text" class="form-control" name="transactionId" id="transactionId"
  61. placeholder="TransactionId Id"/>
  62. </div>
  63. <div class="col-sm-3">
  64. <label class="form-label" for="userId">User Id:<span
  65. class="text-danger">*</span></label>
  66. <input type="text" class="form-control" name="userId" id="userId"
  67. placeholder="User Id"/>
  68. </div>
  69. <div class="col-sm-3">
  70. <label class="form-label" for="code">Code:<span
  71. class="text-danger">*</span></label>
  72. <input type="password" class="form-control" name="code" id="code"
  73. placeholder="Code"/>
  74. </div>
  75. <div class="col-sm-3">
  76. <label class="form-label" for="amount">Amount:<span
  77. class="text-danger">*</span></label>
  78. <input type="text" class="form-control" name="amount" id="amount"
  79. placeholder="Amount"/>
  80. </div>
  81. <div class="col-sm-3">
  82. <br>
  83. <button type="submit" class="btn btn-sm btn-primary" name="submit"
  84. id="submit">Submit</button>
  85. <button class="btn btn-danger" onclick="resetDate()" name="reset"
  86. type="reset">Reset</button>
  87. </div>
  88. </div>
  89. </div>
  90. </form>
  91. </div>
  92. </div>
  93. </main>
  94. <footer th:replace="~{fragments/footer2 :: footer}"></footer>
  95. </div>
  96. <div th:replace="~{fragments/resetpassword :: div}"></div>
  97. <script th:replace="~{fragments/loginscript :: script}"></script>
  98. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  99. <script>
  100. $(document).ready(function() {
  101. // Handle submit button click
  102. $('#submit').click(function(event) {
  103. // Prevent default form submission (if button is of type "submit")
  104. event.preventDefault();
  105. // Collect form input values
  106. var bookingId = $('#bookingId').val();
  107. var transactionId = $('#transactionId').val(); // Corrected variable name
  108. var userId = $('#userId').val();
  109. var code = $('#code').val();
  110. var amount = $('#amount').val();
  111. // Check if required fields are filled
  112. if (!bookingId || !transactionId || !userId || !code || !amount) {
  113. Swal.fire({
  114. icon: 'warning',
  115. title: 'Warning',
  116. text: 'Please fill all the required fields.'
  117. });
  118. return;
  119. }
  120. // Show loading popup before AJAX request
  121. const loadingSwal = Swal.fire({
  122. title: 'Processing...',
  123. text: 'Please wait while we submit the refund request.',
  124. allowOutsideClick: false, // Prevent closing the popup
  125. didOpen: () => {
  126. Swal.showLoading(); // Show the loading spinner
  127. },
  128. showConfirmButton: false, // Hide the confirm button during loading
  129. });
  130. // AJAX request
  131. $.ajax({
  132. url: '/victoriahallbooking/admin/api/manualrefund',
  133. type: 'POST',
  134. //contentType: 'application/x-www-form-urlencoded',
  135. data: {
  136. bookingId: bookingId,
  137. txansactionId: transactionId, // Use the correct variable
  138. userId: userId,
  139. code: code,
  140. amount: amount
  141. },
  142. success: function(response) {
  143. loadingSwal.close(); // Close the loading popup
  144. Swal.fire({
  145. icon: 'success',
  146. title: 'Success',
  147. text: 'Refund request submitted successfully.'
  148. }).then(() => {
  149. // Reload the page after the success message
  150. window.location.reload();
  151. });
  152. },
  153. error: function(xhr) {
  154. loadingSwal.close(); // Close the loading popup
  155. // Handle error response
  156. var responseText = xhr.responseText || 'An error occurred';
  157. // Check if the response contains specific error for code mismatch
  158. if (xhr.status === 400 && responseText.includes("Code is wrong")) {
  159. Swal.fire({
  160. icon: 'error',
  161. title: 'Error',
  162. text: 'The code you entered is wrong. Please try again.'
  163. });
  164. } else {
  165. // Generic error message
  166. Swal.fire({
  167. icon: 'error',
  168. title: 'Error',
  169. text: responseText // This will show other error messages
  170. });
  171. }
  172. }
  173. });
  174. });
  175. });
  176. </script>
  177. </body>
  178. </html>