sise.blade.php 7.8 KB

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