Old UniVate Website
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

my-residential-properties.blade.php 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. @extends('master')
  2. @section('title', 'My Residential Properties')
  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 listing?");
  98. }
  99. </script>
  100. <div class="container-fluid">
  101. <div class="row mb-4">
  102. <div class="col-md-10 offset-md-1">
  103. <!--<form id="mainForm" method="POST" action="/search-residential-admin" 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. <div class="col-md-12">
  118. <h1 class="my-4">My Residential Properties</h1>
  119. </div>
  120. </div>
  121. </div>
  122. <div class="row">
  123. <div class="col-md-10 offset-md-1 table-responsive">
  124. <table class="table table-bordered table-hover table-striped">
  125. <thead>
  126. <tr>
  127. <th>Reference</th>
  128. <th>Property</th>
  129. <th>Unit</th>
  130. <th>Size</th>
  131. <th>Region</th>
  132. <th>Town</th>
  133. <th>Suburb</th>
  134. <th>Status</th>
  135. <th>Type</th>
  136. <th>Published</th>
  137. <th>Status</th>
  138. <th>Edit</th>
  139. </tr>
  140. </thead>
  141. <tbody>
  142. @foreach($residentials as $residential)
  143. <tr>
  144. <td>{{ $residential->contact_person }}</td>
  145. <td>{{ $residential->ref }}</td>
  146. <td> {{ $residential->name }}</td>
  147. <td>{{ $residential->unit }}</td>
  148. <td>{{ $residential->size }}</td>
  149. <td>{{ ucfirst(trans($residential->region)) }}</td>
  150. <td>{{ $residential->town }}</td>
  151. <td>{{ $residential->surburb }}</td>
  152. <td>{{ $residential->status2 }}</td>
  153. <td>{{ ucfirst(trans($residential->propertType)) }}</td>
  154. @if($residential->published==1)
  155. <td class="text-center">
  156. <i class="fas fa-cloud-upload-alt fa-2x text-success"></i>
  157. </td>
  158. @else
  159. <td class="text-center">
  160. <i class="fas fa-cloud-upload-alt fa-2x text-danger"></i>
  161. </td>
  162. @endif
  163. <td>{{ $residential->status2 }}</td>
  164. <td class="text-center">
  165. <i class="far fa-edit blue-text fa-2x"></i>
  166. </td>
  167. <td class="text-center">
  168. <a href="/edit-my-residential/{{ $residential->id }}">
  169. <i class="far fa-edit blue-text fa-2x"></i>
  170. </a>
  171. </td>
  172. </tr>
  173. @endforeach
  174. </tbody>
  175. </table>
  176. </div>
  177. <div class="col-md-6 offset-md-3 mb-4 d-flex justify-content-center">
  178. <?php echo $residentials->links(); ?>
  179. </div>
  180. </div>
  181. </div>
  182. @stop