index.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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('/themes/kbgolf/pro/resources/images/main_visual.webp') }})">
  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. <!-- 시세 시작 -->
  43. <div class="m_quote">
  44. <div class="container">
  45. <ul class="tabs nav nav-tabs">
  46. <li class="active"><a data-toggle="tab" data-sise="golf" href="#" onclick="changeSiseList(this)">골프 시세</a></li>
  47. <li><a data-toggle="tab" href="#" data-sise="condo" onclick="changeSiseList(this)">콘도 시세</a></li>
  48. <li><a data-toggle="tab" href="#" data-sise="fitness" onclick="changeSiseList(this)">휘트니스 시세</a></li>
  49. </ul>
  50. <div class="tab-content">
  51. <!-- 골프 -->
  52. <div id="golf" class="tab-pane fade in active show">
  53. <div class="tb_res tb_vertical">
  54. <table cellspacing="0" cellpadding="0">
  55. <caption>단위: 만원</caption>
  56. <thead>
  57. <tr>
  58. <th>회원권명</th>
  59. <th>금일시세</th>
  60. <th>전일시세</th>
  61. <th>등락</th>
  62. <th>상담</th>
  63. </tr>
  64. </thead>
  65. <tbody id="sise-list"></tbody>
  66. </table>
  67. </div>
  68. <div class="btn_wrap">
  69. <button type="button" class="btn m_more sise" onclick="loadMoreSise()">더보기</button>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <!--// 시세 끝 -->
  76. <!-- 유투브 시작 -->
  77. <div class="m_youtube">
  78. <div class="container">
  79. <div class="tit_main">
  80. <em>KB Membership Club</em>
  81. <h2>YOUTUBE</h2>
  82. </div>
  83. <ul class="list">
  84. @forelse($mainYoutubeList['Page'] ?? [] as $mainYoutube)
  85. <li>
  86. <div class="img_box">
  87. <a href="{{ $mainYoutube['Pt1'] }}" target="_blak"></a>
  88. <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>
  89. </div>
  90. </li>
  91. @empty
  92. <li>
  93. <div class="img_box">데이터가 존재하지 않습니다.</div>
  94. </li>
  95. @endforelse
  96. </ul>
  97. <div class="btn_wrap">
  98. <button type="button" class="btn m_more youtube" onclick="loadMoreYoutube()">더보기</button>
  99. </div>
  100. </div>
  101. </div>
  102. <!--// 유투브 끝 -->
  103. <!-- 블로그 시작 -->
  104. <div class="m_blog">
  105. <div class="container">
  106. <div class="tit_main">
  107. <em>KB Membership Club</em>
  108. <h2>BLOG</h2>
  109. </div>
  110. <ul class="list">
  111. @forelse($mainBlogList['Page'] ?? [] as $mainBlog)
  112. <li>
  113. <a href="{{ route('dbrbbs.details', [$mainBlog['PostCode'], $mainBlog['PostSlug']]) }}">
  114. <h4 class="ellipsis_multi">{{ $mainBlog['PostTitle'] }}</h4>
  115. <p class="ellipsis_multi">{!! strip_tags(mb_strimwidth($mainBlog['PostContents'], 0, 1500, '...')) !!}</p>
  116. </a>
  117. </li>
  118. @empty
  119. <li>데이터가 존재하지 않습니다.</li>
  120. @endforelse
  121. </ul>
  122. <div class="btn_wrap">
  123. <button type="button" class="btn m_more blog" onclick="loadMoreBlog()">더보기</button>
  124. </div>
  125. </div>
  126. </div>
  127. <!--// 블로그 끝 -->
  128. <script>
  129. currentSiseType = 'golf';
  130. $(document).ready(function() {
  131. // 필터링된 리스트를 렌더링하는 함수 호출
  132. changeSiseListByDefault(currentSiseType);
  133. $('.main-header').addClass('main_header');
  134. $('.main-header .logo img').attr("src", "/themes/kbgolf/pro/resources/images/logo_wh.png");
  135. });
  136. // siseType별로 tbody 생성
  137. function changeSiseList(e) {
  138. // 다른 li태그 active class 제거
  139. $('.tabs li').removeClass('active');
  140. // 클릭한 태그의 li active class 추가
  141. $(e).parent().addClass('active');
  142. currentSiseType = $(e).attr('data-sise');
  143. var filteredSiseList = mainSiseList.filter(function(mainsise) {
  144. return mainsise['Pc1'].includes(currentSiseType);
  145. });
  146. renderMainSiseList(filteredSiseList);
  147. // sise 더보기 버튼 list를 change할 때마다 활성화
  148. $('.m_quote .btn_wrap .m_more').show();
  149. }
  150. // defalut 가져오기
  151. function changeSiseListByDefault(currentSiseType) {
  152. var filteredSiseList = mainSiseList.filter(function(mainsise) {
  153. return mainsise['Pc1'].includes(currentSiseType);
  154. });
  155. renderMainSiseList(filteredSiseList);
  156. // sise 더보기 버튼 list를 change할 때마다 활성화
  157. $('.m_quote .btn_wrap .m_more').show();
  158. }
  159. // tbody 생성
  160. function renderMainSiseList(siseList){
  161. // console.log('siseList : ', siseList);
  162. var tbody = $('#sise-list');
  163. fluctuationClass='';
  164. tbody.empty();
  165. if(siseList.length === 0){
  166. tbody.html('<tr><td colspan="5">데이터가 존재하지 않습니다.</td></tr>');
  167. return;
  168. }
  169. siseList.forEach(function(sise){
  170. if (sise['fluctuation'] > 0) {
  171. fluctuationClass = 'up';
  172. fluctuationIcon = 'fa-sort-up';
  173. } else if (sise['fluctuation'] < 0) {
  174. fluctuationClass = 'down';
  175. fluctuationIcon = 'fa-sort-down';
  176. }
  177. var fluctuationText = sise['fluctuation'] !== 0 ?
  178. `<i class="fa-solid ${fluctuationIcon}"></i> ${number_format(Math.abs(sise['fluctuation']))}`
  179. : `${number_format(sise['fluctuation'])}`;
  180. var tr = $('<tr>');
  181. tr.html(`
  182. <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
  183. <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
  184. <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
  185. <td data-label="등락" class="${fluctuationClass}">
  186. ${fluctuationText}
  187. </td>
  188. <td data-label="상담신청">
  189. <button type="button" class="btn consult-btn"
  190. data-post-title="${sise['PostTitle']}"
  191. data-pc1="${sise['Pc1']}"
  192. onclick="window.location.href = '/contactus-custom/${sise['Pc1']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
  193. </button>
  194. </td>
  195. `);
  196. tbody.append(tr);
  197. })
  198. }
  199. // 시세 더보기
  200. function loadMoreSise(){
  201. var offset = $('#sise-list tr').length;
  202. var limit = 12;
  203. $.ajax({
  204. url: '/load-more-sise',
  205. method: 'GET',
  206. data: { offset: offset, limit: limit, siseType: currentSiseType },
  207. success: function(response) {
  208. var siseList = response.Page;
  209. if (siseList!=null) {
  210. appendMainSiseList(siseList);
  211. } else {
  212. alert('더이상 데이터가 없습니다.')
  213. $('.m_quote .btn_wrap .m_more').hide();
  214. }
  215. },
  216. error: function(error) {
  217. console.error('Error loading more sise:', error);
  218. }
  219. });
  220. }
  221. // 유튜브 더보기
  222. function loadMoreYoutube(){
  223. var offset = $('.m_youtube .list li').length;
  224. console.log('offset : ', offset);
  225. var limit = 12;
  226. $.ajax({
  227. url: '/load-more-youtube',
  228. method: 'GET',
  229. data: { offset: offset, limit: limit},
  230. success: function(response) {
  231. var youtubeList = response.Page;
  232. if (youtubeList!=null) {
  233. appendMainYoutubeList(youtubeList);
  234. } else {
  235. alert('더이상 데이터가 없습니다.')
  236. $('.m_youtube .btn_wrap .m_more').hide();
  237. }
  238. },
  239. error: function(error) {
  240. console.error('Error loading more sise:', error);
  241. }
  242. });
  243. }
  244. // 블로그 더보기
  245. function loadMoreBlog() {
  246. var offset = $('.m_blog .list li').length;
  247. var limit = 12;
  248. $.ajax({
  249. url: '/load-more-blog',
  250. method: 'GET',
  251. data: { offset: offset, limit: limit },
  252. success: function(response) {
  253. console.log('response :', response);
  254. var blogList = response.Page;
  255. if (blogList!=null) {
  256. appendMainBlogList(blogList);
  257. } else {
  258. alert('더이상 데이터가 없습니다.');
  259. $('.m_blog .btn_wrap .m_more').hide();
  260. }
  261. },
  262. error: function(error) {
  263. console.error('Error loading more blogs:', error);
  264. }
  265. });
  266. }
  267. // sise 더보기 list add
  268. function appendMainSiseList(siseList) {
  269. var tbody = $('#sise-list');
  270. siseList.forEach(function(sise) {
  271. if (sise['fluctuation'] > 0) {
  272. fluctuationClass = 'up';
  273. fluctuationIcon = 'fa-sort-up';
  274. } else if (sise['fluctuation'] < 0) {
  275. fluctuationClass = 'down';
  276. fluctuationIcon = 'fa-sort-down';
  277. } else {
  278. fluctuationClass = '';
  279. fluctuationIcon = '';
  280. }
  281. var fluctuationText = sise['fluctuation'] !== 0 ?
  282. `<i class="fa-solid ${fluctuationIcon}"></i> ${number_format(Math.abs(sise['fluctuation']))}`
  283. : `${number_format(sise['fluctuation'])}`;
  284. var tr = $('<tr>');
  285. tr.html(`
  286. <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
  287. <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
  288. <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
  289. <td data-label="등락" class="${fluctuationClass}">
  290. ${fluctuationText}
  291. </td>
  292. <td data-label="상담신청">
  293. <button type="button" class="btn consult-btn"
  294. data-post-title="${sise['PostTitle']}"
  295. data-pc1="${sise['Pc1']}"
  296. onclick="window.location.href = '/contactus-custom/${sise['Pc1']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
  297. </button>
  298. </td>
  299. `);
  300. tbody.append(tr);
  301. });
  302. }
  303. // youtube 더보기 list add
  304. function appendMainYoutubeList(youtubeList) {
  305. var ul = $('.m_youtube .list');
  306. youtubeList.forEach(function(youtube) {
  307. var li = $('<li>');
  308. li.html(`
  309. <div class="img_box">
  310. <a href="${youtube['Pt1']}" target="_blank"></a>
  311. <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>
  312. </div>
  313. `);
  314. ul.append(li);
  315. });
  316. }
  317. // blog 더보기 리스트 add
  318. function appendMainBlogList(blogList) {
  319. var ul = $('.m_blog .list');
  320. blogList.forEach(function(blog) {
  321. var li = $('<li>');
  322. li.html(`
  323. <a href="/bbs/details/${blog['PostCode']}/${blog['PostSlug']}">
  324. <h4 class="ellipsis_multi">${blog['PostTitle']}</h4>
  325. <p class="ellipsis_multi">${stripTags(truncateText(blog['PostContents'], 1500))}</p>
  326. </a>
  327. `);
  328. ul.append(li);
  329. });
  330. }
  331. // 회원권명으로 상담신청
  332. function contactForMembership(){
  333. var membershipName = $('#membership-name').val();
  334. var url = '{{ route('contactus-custom', ':membershipName') }}';
  335. url = url.replace(':membershipName', membershipName);
  336. // console.log('url :', url);
  337. window.location.href = url;
  338. }
  339. var swiper = new Swiper(".main_visual .swiper", {
  340. loop: true,
  341. autoplay: {
  342. delay: 5000,
  343. disableOnInteraction: false,
  344. },
  345. pagination: {
  346. el: ".swiper-pagination",
  347. clickable: true,
  348. },
  349. });
  350. // format 함수
  351. function number_format(number) {
  352. return new Intl.NumberFormat().format(number);
  353. }
  354. // HTML 태그 제거
  355. function stripTags(html) {
  356. return html.replace(/(<([^>]+)>)/gi, "");
  357. }
  358. // 글자수 maxLength
  359. function truncateText(text, maxLength, suffix = '...') {
  360. if (text.length <= maxLength) {
  361. return text;
  362. }
  363. return text.substr(0, maxLength) + suffix;
  364. }
  365. const mainSiseList = {!! json_encode($mainSiseList['Page']) !!};
  366. const mainYoutubeList = {!! json_encode($mainYoutubeList['Page']) !!};
  367. const mainBlogList = {!! json_encode($mainBlogList['Page']) !!};
  368. </script>
  369. @endsection