index.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. @extends('views.layouts.master')
  2. <link rel="stylesheet" href="{{ asset('/themes/kbgolf/pro/resources/js/swiper/swiper-bundle.min.css') }}"/>
  3. <script src="{{ asset('/themes/kbgolf/pro/resources/js/swiper/swiper-bundle.min.js') }}"></script>
  4. @section('content')
  5. <!-- page-title -->
  6. @push('meta')
  7. {!! $seoHtml !!}
  8. @endpush
  9. <!-- main slice -->
  10. <!-- main visual 시작 -->
  11. <div class="main_visual">
  12. <div class="swiper">
  13. <div class="swiper-wrapper">
  14. <!-- Slides -->
  15. @forelse($maMainSlider ?? [] as $widget)
  16. <div class="swiper-slide" style="background-image:url({{ asset($widget['C4']) }})">
  17. <div>
  18. <strong>
  19. 신뢰할 수 있는 회원권 거래소
  20. <em>KB MEMBERSHIP CLUB</em>
  21. </strong>
  22. <p>{!! $widget['C6'] !!}</p>
  23. </div>
  24. </div>
  25. @empty
  26. @endforelse
  27. </div>
  28. <!-- If we need pagination -->
  29. <div class="swiper-pagination"></div>
  30. </div>
  31. </div>
  32. <!--// main visual 끝 -->
  33. <!-- 회원권 매매 신청 시작 -->
  34. <div class="m_sell">
  35. <div class="container">
  36. <label>회원권 매매신청</label>
  37. <input type="text" id="membership-name" placeholder="회원권명">
  38. <button type="button" class="btn" onclick="contactForMembership()">상담신청하기</button>
  39. </div>
  40. </div>
  41. <!--// 회원권 매매 신청 끝 -->
  42. @php $today = date('Y-m-d'); @endphp
  43. <!-- 시세 시작 -->
  44. <div class="m_quote">
  45. <div class="container">
  46. <div class="tabs today">
  47. <input type="date" id="search_date" value="{{$today}}" autocomplete="off">
  48. </div>
  49. <ul class="tabs nav nav-tabs">
  50. <li class="active"><a data-toggle="tab" data-sise="golf" href="#" onclick="changeSiseList(this)">골프 시세</a></li>
  51. <li><a data-toggle="tab" href="#" data-sise="condo" onclick="changeSiseList(this)">콘도 시세</a></li>
  52. <li><a data-toggle="tab" href="#" data-sise="fitness" onclick="changeSiseList(this)">휘트니스 시세</a></li>
  53. </ul>
  54. <div class="tab-content">
  55. <div id="golf" class="tab-pane fade in active show">
  56. <div class="tb_res tb_vertical">
  57. <table cellspacing="0" cellpadding="0">
  58. <caption>단위: 만원</caption>
  59. <thead>
  60. <tr>
  61. <th>회원권명</th>
  62. <th>금일시세</th>
  63. <th>전일시세</th>
  64. <th>등락</th>
  65. <th>상담</th>
  66. </tr>
  67. </thead>
  68. <tbody id="sise-list"></tbody>
  69. </table>
  70. </div>
  71. <div class="btn_wrap">
  72. <button type="button" class="btn m_more" onclick="loadMoreSise()">더보기</button>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <!--// 시세 끝 -->
  79. <!-- 유투브 시작 -->
  80. <div class="m_youtube">
  81. <div class="container">
  82. <div class="tit_main">
  83. <em>KB Membership Club</em>
  84. <h2>YOUTUBE</h2>
  85. </div>
  86. <ul class="list">
  87. @forelse($mainYoutubeList['Page'] ?? [] as $mainYoutube)
  88. <li>
  89. <div class="img_box">
  90. <a href="{{ $mainYoutube['Pt1'] }}" target="_blak"></a>
  91. <iframe src="{{ $mainYoutube['Pt1'] }}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
  92. </div>
  93. </li>
  94. @empty
  95. <li>
  96. <div class="img_box">데이터가 존재하지 않습니다.</div>
  97. </li>
  98. @endforelse
  99. </ul>
  100. <div class="btn_wrap">
  101. <button type="button" class="btn m_more" onclick="loadMoreYoutube()">더보기</button>
  102. </div>
  103. </div>
  104. </div>
  105. <!--// 유투브 끝 -->
  106. <!-- 블로그 시작 -->
  107. <div class="m_blog">
  108. <div class="container">
  109. <div class="tit_main">
  110. <em>KB Membership Club</em>
  111. <h2>BLOG</h2>
  112. </div>
  113. <ul class="list">
  114. @forelse($mainBlogList['Page'] ?? [] as $mainBlog)
  115. <li>
  116. <a href="{{ route('dbrbbs.details', [$mainBlog['PostCode'], $mainBlog['PostSlug']]) }}">
  117. <h4 class="ellipsis_multi">{{ $mainBlog['PostTitle'] }}</h4>
  118. <p class="ellipsis_multi">{!! strip_tags(mb_strimwidth($mainBlog['PostContents'], 0, 1500, '...')) !!}</p>
  119. </a>
  120. </li>
  121. @empty
  122. <li>데이터가 존재하지 않습니다.</li>
  123. @endforelse
  124. </ul>
  125. <div class="btn_wrap">
  126. <button type="button" class="btn m_more blog" onclick="loadMoreBlog()">더보기</button>
  127. </div>
  128. </div>
  129. </div>
  130. <!--// 블로그 끝 -->
  131. <script>
  132. var currentSiseType = 'golf';
  133. var filteredSiseList = [];
  134. $(document).ready(function() {
  135. var date = dateFormat(document.getElementById('search_date').value);
  136. console.log('date: ', date);
  137. filteredSiseList = searchDate(date, currentSiseType);
  138. renderMainSiseList(filteredSiseList);
  139. // console.log('초기값 : ', filteredSiseList);
  140. // console.log('mainYoutubeList : ',mainYoutubeList);
  141. // 필터링된 리스트를 렌더링하는 함수 호출
  142. // changeSiseListByDefault(currentSiseType);
  143. $('.main-header').addClass('main_header');
  144. $('.main-header .logo img').attr("src", "/themes/kbgolf/pro/resources/images/logo_wh.png");
  145. });
  146. document.getElementById('search_date').addEventListener('change', function() {
  147. var date = dateFormat(document.getElementById('search_date').value);
  148. console.log('date: ', date);
  149. //currentSiseType = $(e).attr('data-sise');
  150. filteredSiseList = searchDate(date, currentSiseType);
  151. // console.log('filteredSiseList : ', filteredSiseList);
  152. renderMainSiseList(filteredSiseList);
  153. });
  154. // siseType별로 tbody 생성
  155. function changeSiseList(e) {
  156. $('.tabs li').removeClass('active');
  157. $(e).parent().addClass('active');
  158. currentSiseType = $(e).attr('data-sise');
  159. filteredSiseList_with_sise = filteredSiseList.filter(function(mainsise) {
  160. return mainsise['Pc5'].includes(currentSiseType);
  161. });
  162. renderMainSiseList(filteredSiseList_with_sise);
  163. // sise 더보기 버튼 list를 change할 때마다 활성화
  164. $('.m_quote .btn_wrap .m_more').show();
  165. }
  166. // defalut 가져오기
  167. // function changeSiseListByDefault(currentSiseType) {
  168. // filteredSiseList_with_sise = filteredSiseList.filter(function(mainsise) {
  169. // return mainsise['Pc5'].includes(currentSiseType);
  170. // });
  171. // renderMainSiseList(filteredSiseList_with_sise);
  172. // // sise 더보기 버튼 list를 change할 때마다 활성화
  173. // $('.m_quote .btn_wrap .m_more').show();
  174. // }
  175. // tbody 생성
  176. function renderMainSiseList(siseList){
  177. // console.log('siseList : ', siseList);
  178. var tbody = $('#sise-list');
  179. fluctuationClass='';
  180. tbody.empty();
  181. if(siseList.length === 0){
  182. tbody.html('<tr><td colspan="5">데이터가 존재하지 않습니다.</td></tr>');
  183. return;
  184. }
  185. siseList.forEach(function(sise){
  186. if (sise['fluctuation'] > 0) {
  187. fluctuationClass = 'up';
  188. fluctuationIcon = 'fa-sort-up';
  189. } else if (sise['fluctuation'] < 0) {
  190. fluctuationClass = 'down';
  191. fluctuationIcon = 'fa-sort-down';
  192. }
  193. var fluctuationText = sise['fluctuation'] !== 0 ?
  194. `<i class="fa-solid ${fluctuationIcon}"></i> ${number_format(Math.abs(sise['fluctuation']))}`
  195. : `${number_format(sise['fluctuation'])}`;
  196. var tr = $('<tr>');
  197. tr.html(`
  198. <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
  199. <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
  200. <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
  201. <td data-label="등락" class="${fluctuationClass}">
  202. ${fluctuationText}
  203. </td>
  204. <td data-label="상담신청">
  205. <button type="button" class="btn consult-btn"
  206. data-post-title="${sise['PostTitle']}"
  207. data-pc5="${sise['Pc5']}"
  208. onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
  209. </button>
  210. </td>
  211. `);
  212. tbody.append(tr);
  213. })
  214. }
  215. // 시세 더보기
  216. function loadMoreSise(){
  217. var offset = $('#sise-list tr').length;
  218. var limit = 12;
  219. $.ajax({
  220. url: '/load-more-sise',
  221. method: 'GET',
  222. data: { offset: offset, limit: limit, siseType: currentSiseType },
  223. success: function(response) {
  224. var siseList = response.Page;
  225. if (siseList!=null) {
  226. appendMainSiseList(siseList);
  227. } else {
  228. alert('더이상 데이터가 없습니다.')
  229. $('.m_quote .btn_wrap .m_more').hide();
  230. }
  231. },
  232. error: function(error) {
  233. console.error('Error loading more sise:', error);
  234. }
  235. });
  236. }
  237. // 유튜브 더보기
  238. function loadMoreYoutube(){
  239. var offset = $('.m_youtube .list li').length;
  240. var limit = 12;
  241. $.ajax({
  242. url: '/load-more-youtube',
  243. method: 'GET',
  244. data: { offset: offset, limit: limit},
  245. success: function(response) {
  246. var youtubeList = response.Page;
  247. if (youtubeList!=null) {
  248. appendMainYoutubeList(youtubeList);
  249. } else {
  250. alert('더이상 데이터가 없습니다.')
  251. $('.m_youtube .btn_wrap .m_more').hide();
  252. }
  253. },
  254. error: function(error) {
  255. console.error('Error loading more sise:', error);
  256. }
  257. });
  258. }
  259. // 블로그 더보기
  260. function loadMoreBlog() {
  261. var offset = $('.m_blog .list li').length;
  262. var limit = 12;
  263. $.ajax({
  264. url: '/load-more-blog',
  265. method: 'GET',
  266. data: { offset: offset, limit: limit },
  267. success: function(response) {
  268. var blogList = response.Page;
  269. if (blogList!=null) {
  270. appendMainBlogList(blogList);
  271. } else {
  272. alert('더이상 데이터가 없습니다.');
  273. $('.m_blog .btn_wrap .m_more').hide();
  274. }
  275. },
  276. error: function(error) {
  277. console.error('Error loading more blogs:', error);
  278. }
  279. });
  280. }
  281. // sise 더보기 list add
  282. function appendMainSiseList(siseList) {
  283. var tbody = $('#sise-list');
  284. siseList.forEach(function(sise) {
  285. if (sise['fluctuation'] > 0) {
  286. fluctuationClass = 'up';
  287. fluctuationIcon = 'fa-sort-up';
  288. } else if (sise['fluctuation'] < 0) {
  289. fluctuationClass = 'down';
  290. fluctuationIcon = 'fa-sort-down';
  291. } else {
  292. fluctuationClass = '';
  293. fluctuationIcon = '';
  294. }
  295. var fluctuationText = sise['fluctuation'] !== 0 ?
  296. `<i class="fa-solid ${fluctuationIcon}"></i> ${number_format(Math.abs(sise['fluctuation']))}`
  297. : `${number_format(sise['fluctuation'])}`;
  298. var tr = $('<tr>');
  299. tr.html(`
  300. <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
  301. <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
  302. <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
  303. <td data-label="등락" class="${fluctuationClass}">
  304. ${fluctuationText}
  305. </td>
  306. <td data-label="상담신청">
  307. <button type="button" class="btn consult-btn"
  308. data-post-title="${sise['PostTitle']}"
  309. data-pc5="${sise['Pc5']}"
  310. onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
  311. </button>
  312. </td>
  313. `);
  314. tbody.append(tr);
  315. });
  316. }
  317. // youtube 더보기 list add
  318. function appendMainYoutubeList(youtubeList) {
  319. var ul = $('.m_youtube .list');
  320. youtubeList.forEach(function(youtube) {
  321. var li = $('<li>');
  322. li.html(`
  323. <div class="img_box">
  324. <a href="${youtube['Pt1']}" target="_blank"></a>
  325. <iframe src="${youtube['Pt1']}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
  326. </div>
  327. `);
  328. ul.append(li);
  329. });
  330. }
  331. // blog 더보기 리스트 add
  332. function appendMainBlogList(blogList) {
  333. var ul = $('.m_blog .list');
  334. blogList.forEach(function(blog) {
  335. var li = $('<li>');
  336. li.html(`
  337. <a href="/bbs/details/${blog['PostCode']}/${blog['PostSlug']}">
  338. <h4 class="ellipsis_multi">${blog['PostTitle']}</h4>
  339. <p class="ellipsis_multi">${stripTags(truncateText(blog['PostContents'], 1500))}</p>
  340. </a>
  341. `);
  342. ul.append(li);
  343. });
  344. }
  345. // 회원권명으로 상담신청
  346. function contactForMembership(){
  347. var membershipName = $('#membership-name').val();
  348. var url = '{{ route('contactus-custom', ':membershipName') }}';
  349. url = url.replace(':membershipName', membershipName);
  350. // console.log('url :', url);
  351. window.location.href = url;
  352. }
  353. function searchDate(date, currentSiseType){
  354. if(currentSiseType){
  355. return mainSiseList.filter(function(siseFormDate) {
  356. var dateMatch = date ? (siseFormDate['Pc6'] && siseFormDate['Pc6'] === date) : true;
  357. var typeMatch = siseFormDate['Pc5'].toLowerCase().includes(currentSiseType);
  358. return dateMatch && typeMatch;
  359. });
  360. }
  361. return mainSiseList.filter(function(siseFormDate) {
  362. var dateMatch = date ? (siseFormDate['Pc6'] && siseFormDate['Pc6'] === date) : true;
  363. return dateMatch;
  364. });
  365. }
  366. var swiper = new Swiper(".main_visual .swiper", {
  367. loop: true,
  368. autoplay: {
  369. delay: 5000,
  370. disableOnInteraction: false,
  371. },
  372. pagination: {
  373. el: ".swiper-pagination",
  374. clickable: true,
  375. },
  376. });
  377. // format 함수
  378. function number_format(number) {
  379. return new Intl.NumberFormat().format(number);
  380. }
  381. // HTML 태그 제거
  382. function stripTags(html) {
  383. return html.replace(/(<([^>]+)>)/gi, "");
  384. }
  385. // 글자수 maxLength
  386. function truncateText(text, maxLength, suffix = '...') {
  387. if (text.length <= maxLength) {
  388. return text;
  389. }
  390. return text.substr(0, maxLength) + suffix;
  391. }
  392. function dateFormat(date){
  393. var formattedDate = '';
  394. if (date) {
  395. var parts = date.split('-');
  396. formattedDate = parts.join('');
  397. }
  398. return formattedDate;
  399. }
  400. const mainSiseList = {!! json_encode($mainSiseList['Page']) !!};
  401. const mainYoutubeList = {!! json_encode($mainYoutubeList['Page']) !!};
  402. const mainBlogList = {!! json_encode($mainBlogList['Page']) !!};
  403. </script>
  404. @endsection