index.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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. <!-- 시세 시작 -->
  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. <div id="golf" class="tab-pane fade in active show">
  52. <div class="tb_res tb_vertical">
  53. <table cellspacing="0" cellpadding="0">
  54. <caption>단위: 만원</caption>
  55. <thead>
  56. <tr>
  57. <th>회원권명</th>
  58. <th>금일시세</th>
  59. <th>전일시세</th>
  60. <th>등락</th>
  61. <th>상담</th>
  62. </tr>
  63. </thead>
  64. <tbody id="sise-list"></tbody>
  65. </table>
  66. </div>
  67. <div class="btn_wrap">
  68. <button type="button" class="btn m_more" onclick="loadMoreSise()">더보기</button>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <!--// 시세 끝 -->
  75. <!-- 유투브 시작 -->
  76. <div class="m_youtube">
  77. <div class="container">
  78. <div class="tit_main">
  79. <em>KB Membership Club</em>
  80. <h2>YOUTUBE</h2>
  81. </div>
  82. <ul class="list">
  83. @forelse($mainYoutubeList['Page'] ?? [] as $mainYoutube)
  84. <li>
  85. <div class="img_box">
  86. <a href="{{ $mainYoutube['Pt1'] }}" target="_blak"></a>
  87. <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>
  88. </div>
  89. </li>
  90. @empty
  91. <li>
  92. <div class="img_box">데이터가 존재하지 않습니다.</div>
  93. </li>
  94. @endforelse
  95. </ul>
  96. <div class="btn_wrap">
  97. <button type="button" class="btn m_more" onclick="loadMoreYoutube()">더보기</button>
  98. </div>
  99. </div>
  100. </div>
  101. <!--// 유투브 끝 -->
  102. <!-- 블로그 시작 -->
  103. <div class="m_blog">
  104. <div class="container">
  105. <div class="tit_main">
  106. <em>KB Membership Club</em>
  107. <h2>BLOG</h2>
  108. </div>
  109. <ul class="list">
  110. @forelse($mainBlogList['Page'] ?? [] as $mainBlog)
  111. <li>
  112. <a href="{{ route('dbrbbs.details', [$mainBlog['PostCode'], $mainBlog['PostSlug']]) }}">
  113. <h4 class="ellipsis_multi">{{ $mainBlog['PostTitle'] }}</h4>
  114. <p class="ellipsis_multi">{!! strip_tags(mb_strimwidth($mainBlog['PostContents'], 0, 1500, '...')) !!}</p>
  115. </a>
  116. </li>
  117. @empty
  118. <li>데이터가 존재하지 않습니다.</li>
  119. @endforelse
  120. </ul>
  121. <div class="btn_wrap">
  122. <button type="button" class="btn m_more blog" onclick="loadMoreBlog()">더보기</button>
  123. </div>
  124. </div>
  125. </div>
  126. <!--// 블로그 끝 -->
  127. <script>
  128. currentSiseType = 'golf';
  129. $(document).ready(function() {
  130. // console.log('mainYoutubeList : ',mainYoutubeList);
  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['Pc5'].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['Pc5'].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-pc5="${sise['Pc5']}"
  192. onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${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. var limit = 12;
  225. $.ajax({
  226. url: '/load-more-youtube',
  227. method: 'GET',
  228. data: { offset: offset, limit: limit},
  229. success: function(response) {
  230. var youtubeList = response.Page;
  231. if (youtubeList!=null) {
  232. appendMainYoutubeList(youtubeList);
  233. } else {
  234. alert('더이상 데이터가 없습니다.')
  235. $('.m_youtube .btn_wrap .m_more').hide();
  236. }
  237. },
  238. error: function(error) {
  239. console.error('Error loading more sise:', error);
  240. }
  241. });
  242. }
  243. // 블로그 더보기
  244. function loadMoreBlog() {
  245. var offset = $('.m_blog .list li').length;
  246. var limit = 12;
  247. $.ajax({
  248. url: '/load-more-blog',
  249. method: 'GET',
  250. data: { offset: offset, limit: limit },
  251. success: function(response) {
  252. var blogList = response.Page;
  253. if (blogList!=null) {
  254. appendMainBlogList(blogList);
  255. } else {
  256. alert('더이상 데이터가 없습니다.');
  257. $('.m_blog .btn_wrap .m_more').hide();
  258. }
  259. },
  260. error: function(error) {
  261. console.error('Error loading more blogs:', error);
  262. }
  263. });
  264. }
  265. // sise 더보기 list add
  266. function appendMainSiseList(siseList) {
  267. var tbody = $('#sise-list');
  268. siseList.forEach(function(sise) {
  269. if (sise['fluctuation'] > 0) {
  270. fluctuationClass = 'up';
  271. fluctuationIcon = 'fa-sort-up';
  272. } else if (sise['fluctuation'] < 0) {
  273. fluctuationClass = 'down';
  274. fluctuationIcon = 'fa-sort-down';
  275. } else {
  276. fluctuationClass = '';
  277. fluctuationIcon = '';
  278. }
  279. var fluctuationText = sise['fluctuation'] !== 0 ?
  280. `<i class="fa-solid ${fluctuationIcon}"></i> ${number_format(Math.abs(sise['fluctuation']))}`
  281. : `${number_format(sise['fluctuation'])}`;
  282. var tr = $('<tr>');
  283. tr.html(`
  284. <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
  285. <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
  286. <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
  287. <td data-label="등락" class="${fluctuationClass}">
  288. ${fluctuationText}
  289. </td>
  290. <td data-label="상담신청">
  291. <button type="button" class="btn consult-btn"
  292. data-post-title="${sise['PostTitle']}"
  293. data-pc5="${sise['Pc5']}"
  294. onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
  295. </button>
  296. </td>
  297. `);
  298. tbody.append(tr);
  299. });
  300. }
  301. // youtube 더보기 list add
  302. function appendMainYoutubeList(youtubeList) {
  303. var ul = $('.m_youtube .list');
  304. youtubeList.forEach(function(youtube) {
  305. var li = $('<li>');
  306. li.html(`
  307. <div class="img_box">
  308. <a href="${youtube['Pt1']}" target="_blank"></a>
  309. <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>
  310. </div>
  311. `);
  312. ul.append(li);
  313. });
  314. }
  315. // blog 더보기 리스트 add
  316. function appendMainBlogList(blogList) {
  317. var ul = $('.m_blog .list');
  318. blogList.forEach(function(blog) {
  319. var li = $('<li>');
  320. li.html(`
  321. <a href="/bbs/details/${blog['PostCode']}/${blog['PostSlug']}">
  322. <h4 class="ellipsis_multi">${blog['PostTitle']}</h4>
  323. <p class="ellipsis_multi">${stripTags(truncateText(blog['PostContents'], 1500))}</p>
  324. </a>
  325. `);
  326. ul.append(li);
  327. });
  328. }
  329. // 회원권명으로 상담신청
  330. function contactForMembership(){
  331. var membershipName = $('#membership-name').val();
  332. var url = '{{ route('contactus-custom', ':membershipName') }}';
  333. url = url.replace(':membershipName', membershipName);
  334. // console.log('url :', url);
  335. window.location.href = url;
  336. }
  337. var swiper = new Swiper(".main_visual .swiper", {
  338. loop: true,
  339. autoplay: {
  340. delay: 5000,
  341. disableOnInteraction: false,
  342. },
  343. pagination: {
  344. el: ".swiper-pagination",
  345. clickable: true,
  346. },
  347. });
  348. // format 함수
  349. function number_format(number) {
  350. return new Intl.NumberFormat().format(number);
  351. }
  352. // HTML 태그 제거
  353. function stripTags(html) {
  354. return html.replace(/(<([^>]+)>)/gi, "");
  355. }
  356. // 글자수 maxLength
  357. function truncateText(text, maxLength, suffix = '...') {
  358. if (text.length <= maxLength) {
  359. return text;
  360. }
  361. return text.substr(0, maxLength) + suffix;
  362. }
  363. const mainSiseList = {!! json_encode($mainSiseList['Page']) !!};
  364. const mainYoutubeList = {!! json_encode($mainYoutubeList['Page']) !!};
  365. const mainBlogList = {!! json_encode($mainBlogList['Page']) !!};
  366. </script>
  367. @endsection