Old UniVate Website
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

timeshare-agents.blade.php 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. @extends('master')
  2. @section('title', 'Timeshare Agents')
  3. @section('description', '')
  4. @section('keywords', '')
  5. @section('content')
  6. <script>
  7. let rt = {};
  8. rt.adjustCount = 0;
  9. rt.firstRowValues = [];
  10. rt.MOBILE_SCREEN_WIDTH = 480;
  11. function reset() {
  12. rt.tableContainer = document.querySelector(".table-container");
  13. rt.initialState = rt.tableContainer.innerHTML;
  14. rt.table = document.querySelector(".responsive-table > tbody");
  15. rt.tableTitle = document.querySelector(".table-title");
  16. rt.firstRow = document.querySelector(".responsive-table tr:first-of-type");
  17. rt.firstRowValues = [];
  18. }
  19. reset();
  20. function getFirstRowValues() {
  21. for (let cell = 0; cell < rt.firstRow.children.length; cell++) {
  22. rt.firstRowValues.push(rt.firstRow.children[cell].textContent);
  23. }
  24. }
  25. function concatFirstRowValuesWithMainValues() {
  26. for (let row = 1; row < rt.table.children.length; row++) {
  27. for (let cell = 0; cell < rt.table.children[row].children.length; cell++) {
  28. rt.table.children[row].children[cell].textContent =
  29. rt.firstRowValues[cell] +
  30. ": " +
  31. rt.table.children[row].children[cell].textContent;
  32. }
  33. }
  34. }
  35. function consolidateCells() {
  36. for (let row = 1; row < rt.table.children.length; row++) {
  37. let rowValues = [];
  38. for (let cell = 0; cell < rt.table.children[row].children.length; cell++) {
  39. // Saving row values.
  40. rowValues.push(rt.table.children[row].children[cell].textContent);
  41. }
  42. rt.table.children[row].children[0].innerHTML = "";
  43. for (let value = 0; value < rowValues.length; value++) {
  44. // Inserting row values into first cell.
  45. let newValueFragment = document.createElement("div");
  46. let newValueFragmentContent = document.createTextNode(rowValues[value]);
  47. newValueFragment.appendChild(newValueFragmentContent);
  48. rt.table.children[row].children[0].appendChild(newValueFragment);
  49. }
  50. }
  51. }
  52. function removeExtraCells() {
  53. for (let row = 1; row < rt.table.children.length; row++) {
  54. for (let cell = 0; cell < rt.table.children[row].children.length; cell++) {
  55. // rt.table.children[row].children[cell].remove();
  56. }
  57. while (rt.table.children[row].children.length > 1) {
  58. rt.table.children[row].lastElementChild.remove();
  59. }
  60. }
  61. }
  62. function addTitleToTable() {
  63. rt.table.children[0].innerHTML = "<th>" + rt.tableTitle.textContent + "</th>";
  64. rt.tableTitle.remove();
  65. }
  66. function adjustTable() {
  67. rt.table.parentElement.classList.add("mobile");
  68. getFirstRowValues();
  69. concatFirstRowValuesWithMainValues();
  70. consolidateCells();
  71. removeExtraCells();
  72. addTitleToTable();
  73. }
  74. function restoreTable() {
  75. rt.tableContainer.innerHTML = rt.initialState;
  76. reset(); // Rebinding newly drawn elements.
  77. rt.table.parentElement.classList.remove("mobile");
  78. }
  79. document.addEventListener("DOMContentLoaded", () => {
  80. if (window.innerWidth <= rt.MOBILE_SCREEN_WIDTH) {
  81. rt.adjustCount++;
  82. adjustTable();
  83. }
  84. });
  85. window.addEventListener("resize", () => {
  86. if (window.innerWidth < rt.MOBILE_SCREEN_WIDTH) {
  87. if (!rt.adjustCount) {
  88. rt.adjustCount++;
  89. adjustTable();
  90. }
  91. } else {
  92. restoreTable();
  93. rt.adjustCount = 0;
  94. }
  95. });
  96. function Conform_Delete() {
  97. return confirm("Are you sure want to delete this timeshare agent?");
  98. }
  99. </script>
  100. <div class="container-fluid">
  101. <div class="row mb-4 mt-5">
  102. <div class="col-md-10 offset-md-1">
  103. <!--<form id="mainForm" method="POST" action="/search" accept-charset="UTF-8" enctype="multipart/form-data">
  104. @csrf
  105. <div class="form-row">
  106. <div class="col-md-5 offset-md-3">
  107. <input class="form-control" name="search" type="text">
  108. </div>
  109. <div class="col-md-2">
  110. <button class="btn btn-blue" type="submit">
  111. <i class="fas fa-search-plus"></i>
  112. SEARCH
  113. </button>
  114. </div>
  115. </div>
  116. </form> -->
  117. <!--
  118. <form id="mainForm" method="POST" action="/upload-timeshares" accept-charset="UTF-8" enctype="multipart/form-data">
  119. @csrf
  120. <div style="margin-left: 18rem;" class="col-md-10 offset-md-1">
  121. <label for="file">Excel Upload</label>
  122. <input type="file" id="file" name="ex_file">
  123. <button class="btn btn-blue" type="submit">
  124. LOAD
  125. </button>
  126. </div>
  127. </form> -->
  128. <h1>Timeshare Agents under {{ Auth::user()->agency }}</h1>
  129. </div>
  130. </div>
  131. <div class="row">
  132. <div class="col-md-10 offset-md-1 table-responsive">
  133. <a class="btn btn-blue" href="/register-timeshare-agent">Add an agent</a>
  134. <br><br>
  135. <table class="table table-bordered table-hover table-striped">
  136. <thead>
  137. <tr>
  138. <th>Name</th>
  139. <th>Email</th>
  140. <th>Phone</th>
  141. <th>Verified</th>
  142. <th>Edit</th>
  143. <th>Delete</th>
  144. </tr>
  145. </thead>
  146. <tbody>
  147. @foreach($agents as $agent)
  148. <tr>
  149. <td>{{ $agent->name }}</td>
  150. <td>{{ $agent->email }}</td>
  151. <td>{{ $agent->phone }}</td>
  152. @if($agent->timeshare_publish==1)
  153. <td class="text-center">
  154. <a href="/publishTimeshareAgent/{{ $agent->id }}">
  155. <i class="fas fa-cloud-upload-alt fa-2x text-success"></i>
  156. </a>
  157. </td>
  158. @else
  159. <td class="text-center">
  160. <a href="/publishTimeshareAgent/{{ $agent->id }}">
  161. <i class="fas fa-cloud-upload-alt fa-2x text-danger"></i>
  162. </a>
  163. </td>
  164. @endif
  165. <td class="text-center">
  166. <a href="/edit-timeshare-agent/{{ $agent->id }}">
  167. <i class="far fa-edit blue-text fa-2x"></i>
  168. </a>
  169. </td>
  170. <td class="text-center">
  171. <a onclick="return Conform_Delete()" href="/deleteTimeshareAgent/{{ $agent->id }}">
  172. <i class="fas fa-times fa-2x text-danger"></i>
  173. </a>
  174. </td>
  175. </tr>
  176. @endforeach
  177. </tbody>
  178. </table>
  179. </div>
  180. <div class="col-md-6 offset-md-3 mb-4 d-flex justify-content-center">
  181. <?php echo $agents->links(); ?>
  182. </div>
  183. </div>
  184. </div>
  185. @stop