|
@@ -1,11 +1,7 @@
|
|
@extends('views.layouts.master')
|
|
@extends('views.layouts.master')
|
|
@section('content')
|
|
@section('content')
|
|
|
|
|
|
-@php
|
|
|
|
- //var_dump($siseList['Page']);
|
|
|
|
- //var_dump($siseItems)
|
|
|
|
- $today = date('Y-m-d');
|
|
|
|
-@endphp
|
|
|
|
|
|
+@php $today = date('Y-m-d'); @endphp
|
|
|
|
|
|
<div class="sub golf">
|
|
<div class="sub golf">
|
|
<div class="container">
|
|
<div class="container">
|
|
@@ -22,7 +18,7 @@
|
|
<div class="container">
|
|
<div class="container">
|
|
<label>회원권 검색</label>
|
|
<label>회원권 검색</label>
|
|
<input type="text" id="membership-name" placeholder="회원권명">
|
|
<input type="text" id="membership-name" placeholder="회원권명">
|
|
- <input type="date" id="date" value="{{$today}}">
|
|
|
|
|
|
+ <!-- <input type="date" id="date" value="{{$today}}"> -->
|
|
<button type="button" class="btn" onclick="searchMemberShip()">검색</button>
|
|
<button type="button" class="btn" onclick="searchMemberShip()">검색</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -45,6 +41,11 @@
|
|
<li class="{{ request('area', 'all') === '700' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '700']) }}">강북권</a></li>
|
|
<li class="{{ request('area', 'all') === '700' ? 'active' : '' }}"><a href="{{ route('sise', [$siseType, '700']) }}">강북권</a></li>
|
|
@endif
|
|
@endif
|
|
</ul>
|
|
</ul>
|
|
|
|
+
|
|
|
|
+ <div class="tabs today">
|
|
|
|
+ <input type="date" id="search_date" value="{{$today}}" autocomplete="off">
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<div class="tab-content">
|
|
<div class="tab-content">
|
|
<div class="tab-pane fade in active show">
|
|
<div class="tab-pane fade in active show">
|
|
<div class="tb_res tb_vertical">
|
|
<div class="tb_res tb_vertical">
|
|
@@ -108,100 +109,109 @@
|
|
|
|
|
|
@push('js')
|
|
@push('js')
|
|
<script>
|
|
<script>
|
|
|
|
+ var filteredSiseList = [];
|
|
$(document).ready(function() {
|
|
$(document).ready(function() {
|
|
- console.log('siseList : ', siseList);
|
|
|
|
|
|
+ var date = dateFormat(document.getElementById('search_date').value);
|
|
|
|
+ filteredSiseList = searchDate(date);
|
|
|
|
+ renderSiseList(filteredSiseList);
|
|
|
|
+
|
|
if ($('div').hasClass('chatbot') == true) {
|
|
if ($('div').hasClass('chatbot') == true) {
|
|
$('.main-footer').addClass('chatbot');
|
|
$('.main-footer').addClass('chatbot');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ document.getElementById('search_date').addEventListener('change', function() {
|
|
|
|
+ var date = dateFormat(document.getElementById('search_date').value);
|
|
|
|
+ filteredSiseList = searchDate(date);
|
|
|
|
+ renderSiseList(filteredSiseList);
|
|
|
|
+ });
|
|
|
|
+
|
|
// 회원권 검색
|
|
// 회원권 검색
|
|
function searchMemberShip() {
|
|
function searchMemberShip() {
|
|
var membershipName = document.getElementById('membership-name').value.toLowerCase();
|
|
var membershipName = document.getElementById('membership-name').value.toLowerCase();
|
|
- var date = document.getElementById('date').value;
|
|
|
|
|
|
+ var date = dateFormat(document.getElementById('search_date').value);
|
|
// console.log('date : ', date);
|
|
// console.log('date : ', date);
|
|
- // if (!membershipName) {
|
|
|
|
- // alert('회원권명을 입력해주세요.');
|
|
|
|
- // return;
|
|
|
|
- // }
|
|
|
|
|
|
|
|
- var formattedDate = '';
|
|
|
|
- if (date) {
|
|
|
|
- var parts = date.split('-');
|
|
|
|
- formattedDate = parts.join('');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- console.log('siseList : ', siseList);
|
|
|
|
- if(siseList == null){
|
|
|
|
- alert('회원권이 존재하지 않습니다');
|
|
|
|
|
|
+ if (!membershipName) {
|
|
|
|
+ alert('회원권명을 입력해주세요.');
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
|
|
|
|
var filteredSiseList = siseList.filter(function(sise) {
|
|
var filteredSiseList = siseList.filter(function(sise) {
|
|
- var postTitleMatch = sise['PostTitle'].toLowerCase().includes(membershipName);
|
|
|
|
- // var dateMatch = sise['Pc6'] && sise['Pc6'] === formattedDate;
|
|
|
|
- var dateMatch = date ? (sise['Pc6'] && sise['Pc6'] === formattedDate) : true;
|
|
|
|
- console.log('dateMatch : ', dateMatch);
|
|
|
|
-
|
|
|
|
- if(membershipName == ''){
|
|
|
|
- return dateMatch
|
|
|
|
- }else{
|
|
|
|
- return postTitleMatch && dateMatch;
|
|
|
|
- }
|
|
|
|
|
|
+ var postTitleMatch = sise['PostTitle'].toLowerCase().includes(membershipName);
|
|
|
|
+ var dateMatch = date ? (sise['Pc6'] && sise['Pc6'] === date) : true;
|
|
|
|
+ return postTitleMatch && dateMatch;
|
|
});
|
|
});
|
|
// console.log('filteredSiseList : ', filteredSiseList);
|
|
// console.log('filteredSiseList : ', filteredSiseList);
|
|
renderSiseList(filteredSiseList);
|
|
renderSiseList(filteredSiseList);
|
|
}
|
|
}
|
|
// 동적으로 tbody 생ㄱ성
|
|
// 동적으로 tbody 생ㄱ성
|
|
function renderSiseList(siseList) {
|
|
function renderSiseList(siseList) {
|
|
- var tbody = $('#sise-list');
|
|
|
|
- tbody.empty(); // Clear existing rows
|
|
|
|
- console.log('siseList.length : ', siseList.length);
|
|
|
|
|
|
+ var tbody = $('#sise-list');
|
|
|
|
+ tbody.empty(); // Clear existing rows
|
|
|
|
+ // console.log('siseList.length : ', siseList.length);
|
|
|
|
|
|
- if (siseList.length === 0) {
|
|
|
|
- tbody.html('<tr><td colspan="5">회원권이 존재하지 않습니다.</td></tr>');
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ if (siseList.length === 0) {
|
|
|
|
+ tbody.html('<tr><td colspan="5">회원권이 존재하지 않습니다.</td></tr>');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
- siseList.forEach(function(sise) {
|
|
|
|
- var fluctuationClass = '';
|
|
|
|
- var fluctuationIcon = '';
|
|
|
|
|
|
+ siseList.forEach(function(sise) {
|
|
|
|
+ var fluctuationClass = '';
|
|
|
|
+ var fluctuationIcon = '';
|
|
|
|
|
|
- if (sise['fluctuation'] > 0) {
|
|
|
|
- fluctuationClass = 'up';
|
|
|
|
- fluctuationIcon = 'fa-sort-up';
|
|
|
|
- } else if (sise['fluctuation'] < 0) {
|
|
|
|
- fluctuationClass = 'down';
|
|
|
|
- fluctuationIcon = 'fa-sort-down';
|
|
|
|
- }
|
|
|
|
|
|
+ if (sise['fluctuation'] > 0) {
|
|
|
|
+ fluctuationClass = 'up';
|
|
|
|
+ fluctuationIcon = 'fa-sort-up';
|
|
|
|
+ } else if (sise['fluctuation'] < 0) {
|
|
|
|
+ fluctuationClass = 'down';
|
|
|
|
+ fluctuationIcon = 'fa-sort-down';
|
|
|
|
+ }
|
|
|
|
|
|
- var fluctuationText = sise['fluctuation'] !== 0 ? `
|
|
|
|
- <i class="fa-solid ${fluctuationIcon}"></i>
|
|
|
|
- ${number_format(Math.abs(sise['fluctuation']))}
|
|
|
|
- ` : `${number_format(sise['fluctuation'])}`;
|
|
|
|
-
|
|
|
|
- var tr = $('<tr>');
|
|
|
|
- tr.html(`
|
|
|
|
- <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
|
|
|
|
- <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
|
|
|
|
- <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
|
|
|
|
- <td data-label="등락" class="${fluctuationClass}">
|
|
|
|
- ${fluctuationText}
|
|
|
|
- </td>
|
|
|
|
- <td data-label="상담신청">
|
|
|
|
- <button type="button" class="btn consult-btn"
|
|
|
|
- data-post-title="${sise['PostTitle']}"
|
|
|
|
- data-pc5="${sise['Pc5']}"
|
|
|
|
- onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
|
|
|
|
- </button>
|
|
|
|
- </td>
|
|
|
|
- `);
|
|
|
|
- tbody.append(tr);
|
|
|
|
- });
|
|
|
|
-}
|
|
|
|
|
|
+ var fluctuationText = sise['fluctuation'] !== 0 ? `
|
|
|
|
+ <i class="fa-solid ${fluctuationIcon}"></i>
|
|
|
|
+ ${number_format(Math.abs(sise['fluctuation']))}
|
|
|
|
+ ` : `${number_format(sise['fluctuation'])}`;
|
|
|
|
+
|
|
|
|
+ var tr = $('<tr>');
|
|
|
|
+ tr.html(`
|
|
|
|
+ <td scope="row" data-label="${sise['PostTitle']}">${sise['PostTitle']}</td>
|
|
|
|
+ <td data-label="${sise['Pc3']}">${number_format(sise['Pc3'])}</td>
|
|
|
|
+ <td data-label="${sise['Pc4']}">${number_format(sise['Pc4'])}</td>
|
|
|
|
+ <td data-label="등락" class="${fluctuationClass}">
|
|
|
|
+ ${fluctuationText}
|
|
|
|
+ </td>
|
|
|
|
+ <td data-label="상담신청">
|
|
|
|
+ <button type="button" class="btn consult-btn"
|
|
|
|
+ data-post-title="${sise['PostTitle']}"
|
|
|
|
+ data-pc5="${sise['Pc5']}"
|
|
|
|
+ onclick="window.location.href = '/contactus-custom/${sise['Pc5']}/${encodeURIComponent(sise['PostTitle'])}'">상담신청
|
|
|
|
+ </button>
|
|
|
|
+ </td>
|
|
|
|
+ `);
|
|
|
|
+ tbody.append(tr);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function searchDate(date){
|
|
|
|
+ return siseList.filter(function(siseFormDate) {
|
|
|
|
+ var dateMatch = date ? (siseFormDate['Pc6'] && siseFormDate['Pc6'] === date) : true;
|
|
|
|
+ return dateMatch;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
function number_format(number) {
|
|
function number_format(number) {
|
|
return new Intl.NumberFormat().format(number);
|
|
return new Intl.NumberFormat().format(number);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ function dateFormat(date){
|
|
|
|
+ var formattedDate = '';
|
|
|
|
+ if (date) {
|
|
|
|
+ var parts = date.split('-');
|
|
|
|
+ formattedDate = parts.join('');
|
|
|
|
+ }
|
|
|
|
+ return formattedDate;
|
|
|
|
+ }
|
|
const siseList = {!! json_encode($siseList['Page']) !!}; // JavaScript에서 PHP 배열을 변환하여 변수에 할당
|
|
const siseList = {!! json_encode($siseList['Page']) !!}; // JavaScript에서 PHP 배열을 변환하여 변수에 할당
|
|
</script>
|
|
</script>
|
|
@endpush
|
|
@endpush
|