sise.blade.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. @extends('views.layouts.master')
  2. @section('content')
  3. @php
  4. //var_dump($siseList['Page']);
  5. //var_dump($siseItems)
  6. $today = date('Y-m-d');
  7. @endphp
  8. <div class="sub golf">
  9. <div class="container">
  10. <div class="navi">
  11. <a href="/"><i class="fa-solid fa-house"></i> 홈</a> > {{ $title_dir }} > {{ $title }}
  12. </div>
  13. <div class="title">
  14. <h2> {{ $title }} </h2>
  15. </div>
  16. </div>
  17. <!-- 회원권 검색 시작 -->
  18. <div class="search_ticket">
  19. <div class="container">
  20. <label>회원권 검색</label>
  21. <input type="text" id="membership-name" placeholder="회원권명">
  22. <input type="date" id="date" value="{{$today}}">
  23. <button type="button" class="btn" onclick="searchMemberShip()">검색</button>
  24. </div>
  25. </div>
  26. <!--// 회원권 검색 끝 -->
  27. <!-- 시세 시작 -->
  28. <div class="quote">
  29. <div class="container">
  30. <ul class="tabs nav nav-tabs">
  31. <li class="{{ request('area', 'all') === 'all' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, 'all']) }}">전체</a></li>
  32. @if($siseType === 'golf')
  33. <li class="{{ request('area', 'all') === '100' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '100']) }}">수도권/강원/충청권</a></li>
  34. <li class="{{ request('area', 'all') === '200' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '200']) }}">영남/제주권</a></li>
  35. <li class="{{ request('area', 'all') === '300' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '300']) }}">호남권</a></li>
  36. @elseif($siseType === 'condo')
  37. <li class="{{ request('area', 'all') === '400' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '400']) }}">체인형콘도</a></li>
  38. <li class="{{ request('area', 'all') === '500' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '500']) }}">스키장콘도</a></li>
  39. @else
  40. <li class="{{ request('area', 'all') === '600' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '600']) }}">강남권</a></li>
  41. <li class="{{ request('area', 'all') === '700' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '700']) }}">강북권</a></li>
  42. @endif
  43. </ul>
  44. <div class="tab-content">
  45. <div class="tab-pane fade in active show">
  46. <div class="tb_res tb_vertical">
  47. <table cellspacing="0" cellpadding="0">
  48. <caption>단위: 만원</caption>
  49. <thead>
  50. <tr>
  51. <th>회원권명</th>
  52. <th>금일시세</th>
  53. <th>전일시세</th>
  54. <th>등락</th>
  55. <th>상담</th>
  56. </tr>
  57. </thead>
  58. <tbody id="sise-list">
  59. @forelse($siseItems['Page'] ?? [] as $sise)
  60. <tr>
  61. <td scope="row "data-label="{{ $sise['PostTitle'] }}"> {{ $sise['PostTitle'] }} </td>
  62. <td data-label="{{$sise['Pc3']}}"> {{ number_format($sise['Pc3']) }} </td>
  63. <td data-label="{{$sise['Pc4']}}"> {{ number_format($sise['Pc4']) }} </td>
  64. <td data-label="등락" class="{{ isset($sise['fluctuation']) && $sise['fluctuation'] > 0 ? 'up' : (isset($sise['fluctuation']) && $sise['fluctuation'] < 0 ? 'down' : '') }}">
  65. @if (isset($sise['fluctuation']) && $sise['fluctuation'] != 0)
  66. <i class="fa-solid {{ $sise['fluctuation'] > 0 ? 'fa-sort-up' : 'fa-sort-down' }}"></i>
  67. {{ number_format(abs($sise['fluctuation'])) }}
  68. @else
  69. {{ number_format(abs($sise['fluctuation'])) }}
  70. @endif
  71. </td>
  72. <td data-label="상담신청">
  73. <button type="button" class="btn consult-btn"
  74. onclick="window.location.href = '{{ route('contactus-custom', [$sise['Pc5'], $sise['PostTitle']]) }}'">상담신청
  75. </button>
  76. </td>
  77. </tr>
  78. @empty
  79. <tr>
  80. <td colspan="5">회원권이 존재하지 않습니다</td>
  81. </tr>
  82. @endforelse
  83. </tbody>
  84. </table>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- 페이지네이션 -->
  90. <div class="row">
  91. <div class="col-lg-12">
  92. <div class="bottom-paginate">
  93. {{ $siseItems['Page']->appends(['limit' => request('limit'), 'sort' => request('sort')])->links() }}
  94. </div>
  95. </div>
  96. </div>
  97. <!--// 페이지네이션 끝 -->
  98. </div>
  99. <!--// 시세 끝 -->
  100. </div>
  101. @push('js')
  102. <script>
  103. $(document).ready(function() {
  104. console.log('siseList : ', siseList);
  105. if ($('div').hasClass('chatbot') == true) {
  106. $('.main-footer').addClass('chatbot');
  107. }
  108. });
  109. // 회원권 검색
  110. function searchMemberShip() {
  111. var membershipName = document.getElementById('membership-name').value.toLowerCase();
  112. var date = document.getElementById('date').value;
  113. // console.log('date : ', date);
  114. // if (!membershipName) {
  115. // alert('회원권명을 입력해주세요.');
  116. // return;
  117. // }
  118. var formattedDate = '';
  119. if (date) {
  120. var parts = date.split('-');
  121. formattedDate = parts.join('');
  122. }
  123. // console.log('siseList : ', siseList);
  124. var filteredSiseList = siseList.filter(function(sise) {
  125. var postTitleMatch = sise['PostTitle'].toLowerCase().includes(membershipName);
  126. // var dateMatch = sise['Pc6'] && sise['Pc6'] === formattedDate;
  127. var dateMatch = date ? (sise['Pc6'] && sise['Pc6'] === formattedDate) : true;
  128. console.log('dateMatch : ', dateMatch);
  129. if(membershipName == ''){
  130. return dateMatch
  131. }else{
  132. return postTitleMatch && dateMatch;
  133. }
  134. });
  135. // console.log('filteredSiseList : ', filteredSiseList);
  136. renderSiseList(filteredSiseList);
  137. }
  138. // 동적으로 tbody 생ㄱ성
  139. function renderSiseList(siseList) {
  140. var tbody = $('#sise-list');
  141. tbody.empty(); // Clear existing rows
  142. console.log('siseList.length : ', siseList.length);
  143. if (siseList.length === 0) {
  144. tbody.html('<tr><td colspan="5">회원권이 존재하지 않습니다.</td></tr>');
  145. return;
  146. }
  147. siseList.forEach(function(sise) {
  148. var fluctuationClass = '';
  149. var fluctuationIcon = '';
  150. if (sise['fluctuation'] > 0) {
  151. fluctuationClass = 'up';
  152. fluctuationIcon = 'fa-sort-up';
  153. } else if (sise['fluctuation'] < 0) {
  154. fluctuationClass = 'down';
  155. fluctuationIcon = 'fa-sort-down';
  156. }
  157. var fluctuationText = sise['fluctuation'] !== 0 ? `
  158. <i class="fa-solid ${fluctuationIcon}"></i>
  159. ${number_format(Math.abs(sise['fluctuation']))}
  160. ` : `${number_format(sise['fluctuation'])}`;
  161. var tr = $('<tr>');
  162. tr.html(`
  163. <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
  164. <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
  165. <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
  166. <td data-label="등락" class="${fluctuationClass}">
  167. ${fluctuationText}
  168. </td>
  169. <td data-label="상담신청">
  170. <button type="button" class="btn consult-btn"
  171. data-post-title="${sise['PostTitle']}"
  172. data-pc5="${sise['Pc5']}"
  173. onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
  174. </button>
  175. </td>
  176. `);
  177. tbody.append(tr);
  178. });
  179. }
  180. function number_format(number) {
  181. return new Intl.NumberFormat().format(number);
  182. }
  183. const siseList = {!! json_encode($siseList['Page']) !!}; // JavaScript에서 PHP 배열을 변환하여 변수에 할당
  184. </script>
  185. @endpush
  186. @endsection