index.blade.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. @extends('views.layouts.master')
  2. <!-- Flatpickr CSS -->
  3. <link rel="stylesheet" href="{{ asset('/themes/kbgolf/pro/resources/js/swiper/swiper-bundle.min.css') }}"/>
  4. <script src="{{ asset('/themes/kbgolf/pro/resources/js/swiper/swiper-bundle.min.js') }}"></script>
  5. <!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
  6. <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
  7. <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
  8. <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/moment/min/moment.min.js"></script> -->
  9. @section('content')
  10. <!-- page-title -->
  11. @push('meta')
  12. {!! $seoHtml !!}
  13. @endpush
  14. <!-- popup -->
  15. <div id="dabory-banner"></div>
  16. <!-- main slice -->
  17. <!-- main visual 시작 -->
  18. <div class="main_visual">
  19. <div class="swiper">
  20. <div class="swiper-wrapper">
  21. <!-- Slides -->
  22. @forelse($maMainSlider ?? [] as $widget)
  23. <div class="swiper-slide" style="background-image:url({{ asset($widget['C4']) }})">
  24. <div>
  25. <strong>
  26. 신뢰할 수 있는 회원권 거래소
  27. <em>KB MEMBERSHIP CLUB</em>
  28. </strong>
  29. <p>{!! $widget['C6'] !!}</p>
  30. </div>
  31. </div>
  32. @empty
  33. @endforelse
  34. </div>
  35. <!-- If we need pagination -->
  36. <div class="swiper-pagination"></div>
  37. </div>
  38. </div>
  39. <!--// main visual 끝 -->
  40. <!-- 회원권 매매 신청 시작 -->
  41. <div class="m_sell">
  42. <div class="container">
  43. <label>회원권 매매신청</label>
  44. <input type="text" id="membership-name" placeholder="회원권명">
  45. <button type="button" class="btn" onclick="contactForMembership()">상담신청하기</button>
  46. </div>
  47. </div>
  48. <!--// 회원권 매매 신청 끝 -->
  49. <!-- 시세 시작 -->
  50. <div class="m_quote">
  51. <div class="container">
  52. <ul class="tabs nav nav-tabs">
  53. <li class="active"><a data-toggle="tab" data-sise="golf" href="#" onclick="changeSiseList(this)">골프 시세</a></li>
  54. <li><a data-toggle="tab" href="#" data-sise="condo" onclick="changeSiseList(this)">콘도 시세</a></li>
  55. <li><a data-toggle="tab" href="#" data-sise="fitness" onclick="changeSiseList(this)">휘트니스 시세</a></li>
  56. </ul>
  57. @php date_default_timezone_set('Asia/Seoul'); $today = date('Y-m-d'); @endphp
  58. <div class="tabs">
  59. <input type="text" id="search_date" readonly>
  60. </div>
  61. <div class="tab-content">
  62. <div id="golf" class="tab-pane fade in active show">
  63. <div class="tb_res tb_vertical">
  64. <table cellspacing="0" cellpadding="0">
  65. <caption>단위: 만원</caption>
  66. <thead>
  67. <tr>
  68. <th>회원권명</th>
  69. <th>금일시세</th>
  70. <th>전일시세</th>
  71. <th>등락</th>
  72. <th>상담</th>
  73. </tr>
  74. </thead>
  75. <tbody id="sise-list"></tbody>
  76. </table>
  77. </div>
  78. <div class="btn_wrap">
  79. <button type="button" class="btn m_more" onclick="loadMoreSise()">더보기</button>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <!--// 시세 끝 -->
  86. <!-- 유투브 시작 -->
  87. <div class="m_youtube">
  88. <div class="container">
  89. <div class="tit_main">
  90. <em>KB Membership Club</em>
  91. <h2>YOUTUBE</h2>
  92. </div>
  93. <ul class="list">
  94. @for ($i = 0; $i < 3; $i++)
  95. @foreach (['golf', 'condo', 'fitness'] as $type)
  96. @if(isset($youtubeTypes['Page'][$type][$i]))
  97. @php
  98. $mainYoutube = $youtubeTypes['Page'][$type][$i];
  99. $href = '';
  100. if($mainYoutube){
  101. $src = $mainYoutube['Pt1'];
  102. $parts = explode('embed/', $src);
  103. if(count($parts) == 2) {
  104. $href = $parts[0].'watch?v='.$parts[1];
  105. }
  106. }
  107. @endphp
  108. <li data-category="{{ $type }}">
  109. <div class="img_box">
  110. <a href="{{ $href }}" target="_blank"></a>
  111. <iframe src="{{ $mainYoutube['Pt1'] }}" title="YouTube video player" frameborder="0"
  112. allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
  113. referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
  114. </div>
  115. </li>
  116. @else
  117. <li>
  118. <div class="img_box">{{ $type }}유튜브</div>
  119. </li>
  120. @endif
  121. @endforeach
  122. @endfor
  123. </ul>
  124. <div class="btn_wrap">
  125. <button type="button" class="btn m_more" onclick="loadMoreYoutube()">더보기</button>
  126. </div>
  127. </div>
  128. </div>
  129. <!--// 유투브 끝 -->
  130. <!-- 블로그 시작 -->
  131. <div class="m_blog">
  132. <div class="container">
  133. <div class="tit_main">
  134. <em>KB Membership Club</em>
  135. <h2>BLOG</h2>
  136. </div>
  137. <ul class="list">
  138. @for ($i = 0; $i < 3; $i++)
  139. @foreach (['golf', 'condo', 'fitness'] as $type)
  140. @if(isset($blogTypes['Page'][$type][$i]))
  141. @php
  142. $mainBlog = $blogTypes['Page'][$type][$i];
  143. $href = $mainBlog['Pt1'];
  144. $date = DateTime::createFromFormat('Ymd', $mainBlog['OfficialDate']);
  145. $formattedDate = $date->format('Y.m.d');
  146. @endphp
  147. <li data-category="{{ $type }}">
  148. <!-- <a href="{{ route('dbrbbs.details', [$mainBlog['PostCode'], $mainBlog['PostSlug']]) }}"> -->
  149. <a href="{{ $href }}" target="_blank">
  150. <div class="img_box">
  151. <img src="{{ asset($mainBlog['TurboThumb']) }}"class="w-md-50" alt="blog">
  152. </div>
  153. <div class="conts_box">
  154. <!-- <h4 class="ellipsis">{!! strip_tags(mb_strimwidth($mainBlog['PostTitle'], 0, 25, '...')) !!}</h4>
  155. <p class="ellipsis_multi desc">{!! strip_tags(mb_strimwidth($mainBlog['PostContents'], 0, 550, '...')) !!}</p> -->
  156. <p class="date">{{ $formattedDate }}</p>
  157. </div>
  158. </a>
  159. </li>
  160. @else
  161. <li>
  162. <div class="img_box" style="display:none">데이터가 존재하지 않습니다.</div>
  163. </li>
  164. @endif
  165. @endforeach
  166. @endfor
  167. </ul>
  168. <div class="btn_wrap">
  169. <button type="button" class="btn m_more blog" onclick="loadMoreBlog()">더보기</button>
  170. </div>
  171. </div>
  172. </div>
  173. <!--// 블로그 끝 -->
  174. @push('js')
  175. <script src="/dabory/js/widget.js"></script>
  176. <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
  177. <script src="https://cdn.jsdelivr.net/npm/flatpickr/dist/l10n/ko.js"></script>
  178. <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css" />
  179. <script>
  180. currentSiseType = 'golf';
  181. $(document).ready(function() {
  182. $('#search_date').flatpickr({
  183. dateFormat: 'Y-m-d', // 날짜 및 시간 형식 설정 (예: 2023-09-12 15:30)
  184. defaultDate: 'today', // 초기 날짜 설정 (현재 날짜와 시간)
  185. locale: 'ko', // 한국어로 지역화
  186. disableMobile: true,
  187. // onOpen: function(selectedDates, dateStr, instance) {
  188. // console.log('test');
  189. // },
  190. // onClose: function(selectedDates, dateStr, instance) {
  191. // // 위젯이 닫힐 때 실행할 코드
  192. // },
  193. // onChange: function(selectedDates, dateStr, instance) {
  194. // console.log('change');
  195. // },
  196. });
  197. @if (session()->get('ConnectionDevice'))
  198. const connectionDevice = "{{ session()->get('ConnectionDevice') }}";
  199. @endif
  200. $.fn.widget.loadModule(function () {
  201. const bannerWidth = (connectionDevice === 'mobile') ? 300 : 500;
  202. $('#dabory-banner').bannerPopup({
  203. width: bannerWidth,
  204. hide: false,
  205. connectionDevice : connectionDevice
  206. })
  207. $('#dabory-banner').find('.dabory-bannermanager').show()
  208. })
  209. const cook = $.cookie('multi-popup');
  210. if (cook === 'ok') {
  211. $('.main_notice_pop').hide()
  212. }
  213. else {
  214. $('.main_notice_pop').show()
  215. }
  216. // 닫기버튼 클릭 이벤트
  217. $('.pop_cls').click(function () {
  218. $(this).parent('.main_notice_pop').fadeOut();
  219. // 오늘하루 보지않기 체크 확인
  220. if ($("input:checkbox[name=today_close1]").is(":checked") == true) {
  221. $.cookie('multi-popup', 'ok', { expires: 1, path: '/' });
  222. }
  223. // name으로 해당 팝업창 닫기
  224. $(this).parent("div[name=" + 'popup1' + "]").fadeOut();
  225. })
  226. function adjustListForMobile() {
  227. if (connectionDevice == 'mobile') { // mobile
  228. if($('.m_youtube .list li')){
  229. showLimitedItemsForCategory('golf', 1, $('.m_youtube .list li[data-category="golf"]'));
  230. showLimitedItemsForCategory('condo', 1, $('.m_youtube .list li[data-category="condo"]'));
  231. showLimitedItemsForCategory('fitness', 1, $('.m_youtube .list li[data-category="fitness"]'));
  232. }
  233. if($('.m_blog .list li')){
  234. showLimitedItemsForCategory('golf', 1, $('.m_blog .list li[data-category="golf"]'));
  235. showLimitedItemsForCategory('condo', 1, $('.m_blog .list li[data-category="condo"]'));
  236. showLimitedItemsForCategory('fitness', 1, $('.m_blog .list li[data-category="fitness"]'));
  237. }
  238. // $('.flatpickr-input').attr('type', 'text');
  239. } else {
  240. $('.list li').show(); // PC
  241. }
  242. }
  243. function showLimitedItemsForCategory(category, limit, $items) {
  244. $items.each(function(index) {
  245. if (index >= limit) {
  246. $(this).hide();
  247. }
  248. });
  249. }
  250. $(window).resize(adjustListForMobile);
  251. adjustListForMobile();
  252. changeSiseListByDefault(currentSiseType);
  253. $('.main-header').addClass('main_header');
  254. $('.main-header .logo img').attr("src", "/themes/kbgolf/pro/resources/images/logo_wh.png");
  255. });
  256. // siseType별로 tbody 생성
  257. function changeSiseList(e) {
  258. // 다른 li태그 active class 제거
  259. $('.tabs li').removeClass('active');
  260. // 클릭한 태그의 li active class 추가
  261. $(e).parent().addClass('active');
  262. currentSiseType = $(e).attr('data-sise');
  263. if(currentSiseType === 'golf'){
  264. if(!mainSiseList || mainSiseList.length ===0){
  265. var tbody = $('#sise-list');
  266. tbody.html('<tr><td colspan="5">회원권이 존재하지 않습니다.</td></tr>');
  267. return;
  268. }else{
  269. var filteredSiseList = mainSiseList.filter(function(mainsise) {
  270. return mainsise['Pc5'].includes(currentSiseType);
  271. });
  272. }
  273. }else{
  274. if(!filteredSiseList || filteredSiseList.length === 0){
  275. let date = document.getElementById('search_date').value;
  276. var monday = formatDate(date);
  277. // console.log('monday : ', monday);
  278. findMondayData(monday);
  279. }
  280. }
  281. renderMainSiseList(filteredSiseList);
  282. // sise 더보기 버튼 list를 change할 때마다 활성화
  283. $('.m_quote .btn_wrap .m_more').show();
  284. }
  285. // defalut 가져오기
  286. function changeSiseListByDefault(currentSiseType) {
  287. if(!mainSiseList || mainSiseList.length ===0){
  288. // console.log('no mainSise');
  289. }
  290. var filteredSiseList = mainSiseList.filter(function(mainsise) {
  291. return mainsise['Pc5'].includes(currentSiseType);
  292. });
  293. renderMainSiseList(filteredSiseList);
  294. // sise 더보기 버튼 list를 change할 때마다 활성화
  295. $('.m_quote .btn_wrap .m_more').show();
  296. }
  297. // tbody 생성
  298. function renderMainSiseList(siseList){
  299. console.log(siseList);
  300. var tbody = $('#sise-list');
  301. fluctuationClass='';
  302. tbody.empty();
  303. if(!siseList || siseList.length === 0){
  304. tbody.html('<tr><td colspan="5">회원권이 존재하지 않습니다.</td></tr>');
  305. return;
  306. }
  307. // Pc1:회원권 코드 중복값 체크
  308. var uniquePc1Values = new Set();
  309. var uniqueSiseList = [];
  310. siseList.forEach(function(sise) {
  311. if (!uniquePc1Values.has(sise['Pc1'])) {
  312. uniquePc1Values.add(sise['Pc1']);
  313. uniqueSiseList.push(sise);
  314. }
  315. });
  316. uniqueSiseList.forEach(function(sise){
  317. if (sise['fluctuation'] > 0) {
  318. fluctuationClass = 'up';
  319. fluctuationIcon = 'fa-sort-up';
  320. } else if (sise['fluctuation'] < 0) {
  321. fluctuationClass = 'down';
  322. fluctuationIcon = 'fa-sort-down';
  323. }
  324. var fluctuationText = sise['fluctuation'] !== 0 ?
  325. `<i class="fa-solid ${fluctuationIcon}"></i> ${number_format(Math.abs(sise['fluctuation']))}`
  326. : `${number_format(sise['fluctuation'])}`;
  327. var tr = $('<tr>');
  328. tr.html(`
  329. <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
  330. <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
  331. <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
  332. <td data-label="등락" class="${fluctuationClass}">
  333. ${fluctuationText}
  334. </td>
  335. <td data-label="상담신청">
  336. <button type="button" class="btn consult-btn"
  337. data-post-title="${sise['PostTitle']}"
  338. data-pc5="${sise['Pc5']}"
  339. onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
  340. </button>
  341. </td>
  342. `);
  343. tbody.append(tr);
  344. })
  345. }
  346. function findMondayData(date){
  347. siseType = currentSiseType;
  348. var siseDate = dateFormat(date);
  349. var offset = 0;
  350. var limit = 30;
  351. $.ajax({
  352. url: '/load-more-sise',
  353. method: 'GET',
  354. data: { offset: offset, limit: limit, siseType: currentSiseType, siseDate:siseDate },
  355. success: function(response) {
  356. console.log(response);
  357. var siseList = response.Page;
  358. if (siseList!=null) {
  359. // appendMainSiseList(siseList);
  360. renderMainSiseList(siseList);
  361. } else {
  362. $('.m_quote .btn_wrap .m_more').hide();
  363. }
  364. },
  365. error: function(error) {
  366. console.error('Error loading more sise:', error);
  367. }
  368. });
  369. }
  370. // 시세 더보기
  371. function loadMoreSise(){
  372. siseType = currentSiseType;
  373. var url = '';
  374. if (siseType === 'golf') {
  375. url = '/sise/golf/all';
  376. } else if (siseType === 'condo') {
  377. url = '/sise/condo/all';
  378. } else if (siseType === 'fitness') {
  379. url = '/sise/fitness/all';
  380. }
  381. window.location.href = url;
  382. // var offset = $('#sise-list tr').length;
  383. // var limit = 12;
  384. // $.ajax({
  385. // url: '/load-more-sise',
  386. // method: 'GET',
  387. // data: { offset: offset, limit: limit, siseType: currentSiseType },
  388. // success: function(response) {
  389. // var siseList = response.Page;
  390. // if (siseList!=null) {
  391. // appendMainSiseList(siseList);
  392. // } else {
  393. // alert('더이상 데이터가 없습니다.')
  394. // $('.m_quote .btn_wrap .m_more').hide();
  395. // }
  396. // },
  397. // error: function(error) {
  398. // console.error('Error loading more sise:', error);
  399. // }
  400. // });
  401. }
  402. // 유튜브 더보기
  403. function loadMoreYoutube(){
  404. var url = "/kb-bbs/list/golf-youtube";
  405. window.location.href = url;
  406. // var offset = $('.m_youtube .list li').length;
  407. // var limit = 12;
  408. // $.ajax({
  409. // url: '/load-more-youtube',
  410. // method: 'GET',
  411. // data: { offset: offset, limit: limit},
  412. // success: function(response) {
  413. // var youtubeList = response.Page;
  414. // if (youtubeList!=null) {
  415. // appendMainYoutubeList(youtubeList);
  416. // } else {
  417. // alert('더이상 데이터가 없습니다.')
  418. // $('.m_youtube .btn_wrap .m_more').hide();
  419. // }
  420. // },
  421. // error: function(error) {
  422. // console.error('Error loading more sise:', error);
  423. // }
  424. // });
  425. }
  426. // 블로그 더보기
  427. function loadMoreBlog() {
  428. var url = "/kb-bbs/list/golf-blog";
  429. window.location.href = url;
  430. // var offset = $('.m_blog .list li').length;
  431. // var limit = 12;
  432. // $.ajax({
  433. // url: '/load-more-blog',
  434. // method: 'GET',
  435. // data: { offset: offset, limit: limit },
  436. // success: function(response) {
  437. // var blogList = response.Page;
  438. // if (blogList!=null) {
  439. // appendMainBlogList(blogList);
  440. // } else {
  441. // alert('더이상 데이터가 없습니다.');
  442. // $('.m_blog .btn_wrap .m_more').hide();
  443. // }
  444. // },
  445. // error: function(error) {
  446. // console.error('Error loading more blogs:', error);
  447. // }
  448. // });
  449. }
  450. // sise 더보기 list add (사용안함 x)
  451. // function appendMainSiseList(siseList) {
  452. // var tbody = $('#sise-list');
  453. // siseList.forEach(function(sise) {
  454. // if (sise['fluctuation'] > 0) {
  455. // fluctuationClass = 'up';
  456. // fluctuationIcon = 'fa-sort-up';
  457. // } else if (sise['fluctuation'] < 0) {
  458. // fluctuationClass = 'down';
  459. // fluctuationIcon = 'fa-sort-down';
  460. // } else {
  461. // fluctuationClass = '';
  462. // fluctuationIcon = '';
  463. // }
  464. // var fluctuationText = sise['fluctuation'] !== 0 ?
  465. // `<i class="fa-solid ${fluctuationIcon}"></i> ${number_format(Math.abs(sise['fluctuation']))}`
  466. // : `${number_format(sise['fluctuation'])}`;
  467. // var tr = $('<tr>');
  468. // tr.html(`
  469. // <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
  470. // <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
  471. // <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
  472. // <td data-label="등락" class="${fluctuationClass}">
  473. // ${fluctuationText}
  474. // </td>
  475. // <td data-label="상담신청">
  476. // <button type="button" class="btn consult-btn"
  477. // data-post-title="${sise['PostTitle']}"
  478. // data-pc5="${sise['Pc5']}"
  479. // onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
  480. // </button>
  481. // </td>
  482. // `);
  483. // tbody.append(tr);
  484. // });
  485. // }
  486. // youtube 더보기 list add (사용안함 x)
  487. // function appendMainYoutubeList(youtubeList) {
  488. // var ul = $('.m_youtube .list');
  489. // youtubeList.forEach(function(youtube) {
  490. // var li = $('<li>');
  491. // li.html(`
  492. // <div class="img_box">
  493. // <a href="${youtube['Pt1']}" target="_blank"></a>
  494. // <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>
  495. // </div>
  496. // `);
  497. // ul.append(li);
  498. // });
  499. // }
  500. // blog 더보기 리스트 add (사용안함 x)
  501. // function appendMainBlogList(blogList) {
  502. // var ul = $('.m_blog .list');
  503. // blogList.forEach(function(blog) {
  504. // var li = $('<li>');
  505. // li.html(`
  506. // <a href="/bbs/details/${blog['PostCode']}/${blog['PostSlug']}">
  507. // <h4 class="ellipsis_multi">${blog['PostTitle']}</h4>
  508. // <p class="ellipsis_multi">${stripTags(truncateText(blog['PostContents'], 1500))}</p>
  509. // </a>
  510. // `);
  511. // ul.append(li);
  512. // });
  513. // }
  514. // 회원권명으로 상담신청
  515. function contactForMembership(){
  516. var membershipName = $('#membership-name').val();
  517. var url = '{{ route('contactus-custom', ':membershipName') }}';
  518. url = url.replace(':membershipName', membershipName);
  519. // console.log('url :', url);
  520. window.location.href = url;
  521. }
  522. var swiper = new Swiper(".main_visual .swiper", {
  523. loop: true,
  524. autoplay: {
  525. delay: 5000,
  526. disableOnInteraction: false,
  527. },
  528. pagination: {
  529. el: ".swiper-pagination",
  530. clickable: true,
  531. },
  532. });
  533. // format 함수
  534. function number_format(number) {
  535. return new Intl.NumberFormat().format(number);
  536. }
  537. function dateFormat(date) {
  538. var formattedDate = '';
  539. if (date) {
  540. var parts = date.split('-');
  541. formattedDate = parts.join('');
  542. }
  543. return formattedDate;
  544. }
  545. function formatDate(date) {
  546. const selectedDate = new Date(date); // Date 객체로 변환
  547. const dayOfWeek = selectedDate.getDay(); // (0: 일요일, 1: 월요일, ..., 6: 토요일)
  548. const monday = new Date(selectedDate); // 해당 주의 월요일
  549. monday.setDate(selectedDate.getDate() - (dayOfWeek === 0 ? 6 : dayOfWeek - 1));
  550. const year = monday.getFullYear();
  551. const month = String(monday.getMonth() + 1).padStart(2, '0');
  552. const day = String(monday.getDate()).padStart(2, '0');
  553. return `${year}-${month}-${day}`;
  554. }
  555. // HTML 태그 제거
  556. function stripTags(html) {
  557. return html.replace(/(<([^>]+)>)/gi, "");
  558. }
  559. // 글자수 maxLength
  560. function truncateText(text, maxLength, suffix = '...') {
  561. if (text.length <= maxLength) {
  562. return text;
  563. }
  564. return text.substr(0, maxLength) + suffix;
  565. }
  566. const mainSiseList = {!! json_encode($mainSiseList['Page']) !!};
  567. const mainYoutubeList = {!! json_encode($mainYoutubeList['Page']) !!};
  568. const youtubeTypes = {!! json_encode($youtubeTypes['Page']) !!};
  569. const mainBlogList = {!! json_encode($mainBlogList['Page']) !!};
  570. </script>
  571. @endpush
  572. @endsection