sise.blade.php 7.0 KB

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