284 lines
7.7 KiB
PHP
284 lines
7.7 KiB
PHP
<?php
|
|
$sub_menu = '000812';
|
|
include_once('./_common.php');
|
|
|
|
auth_check_menu($auth, $sub_menu, "r");
|
|
|
|
$g5['title'] = '예약내역(캘린더)';
|
|
|
|
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
|
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
|
|
|
|
add_javascript('<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/core@4.3.1/main.min.js"></script>');
|
|
add_javascript('<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/core@4.3.1/locales-all.min.js"></script>');
|
|
add_javascript('<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/daygrid@4.3.0/main.min.js"></script>');
|
|
add_javascript('<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/timegrid@4.3.0/main.min.js"></script>');
|
|
add_javascript('<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/list@4.3.0/main.min.js"></script>');
|
|
add_javascript('<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/bootstrap@4.3.0/main.min.js"></script>');
|
|
add_javascript('<script src="https://cdn.jsdelivr.net/npm/@fullcalendar/interaction@4.3.0/main.min.js"></script>');
|
|
add_stylesheet('<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fullcalendar/core@4.3.1/main.min.css">');
|
|
add_stylesheet('<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fullcalendar/daygrid@4.3.0/main.min.css">');
|
|
add_stylesheet('<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fullcalendar/bootstrap@4.3.0/main.min.css">');
|
|
?>
|
|
|
|
<style>
|
|
.fc-head {
|
|
background: #eee;
|
|
}
|
|
|
|
.fc-day-header {
|
|
padding: 0.5rem !important;
|
|
}
|
|
|
|
.fc-sun span,
|
|
.fc-sun a.fc-day-number {
|
|
color: red;
|
|
}
|
|
|
|
.fc-sat span,
|
|
.fc-sat a.fc-day-number {
|
|
color: blue;
|
|
}
|
|
|
|
.fc td,
|
|
.fc th {
|
|
border-color: #eee;
|
|
}
|
|
|
|
.fc th {
|
|
background-color: #f9f9f9;
|
|
padding: 20px !important;
|
|
}
|
|
|
|
.fc-day-number {
|
|
font-size: 11px !important;
|
|
padding-top: 10px !important;
|
|
padding-right: 10px !important;
|
|
padding-bottom: 10px !important;
|
|
color: #999 !important;
|
|
}
|
|
|
|
.fc-content {
|
|
font-size: 12px;
|
|
padding: 7px;
|
|
}
|
|
|
|
.fc-day-grid-event {
|
|
margin: 2px 3px 2px 3px;
|
|
}
|
|
|
|
.fc-today {
|
|
background-color: #f9f9f9;
|
|
}
|
|
|
|
.fc-today span {
|
|
color: #002268 !important;
|
|
}
|
|
|
|
.fc-right button {
|
|
font-size: 14px;
|
|
display: inline-block;
|
|
background-color: #fff;
|
|
border: 1px solid #eee;
|
|
box-sizing: border-box;
|
|
margin-left: 5px;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
.fc-right .btn-group {
|
|
display: inline-block;
|
|
margin-left: 0px;
|
|
}
|
|
|
|
.fc-toolbar h2 {
|
|
font-family: 'font-B', sans-serif;
|
|
font-size: 16px;
|
|
}
|
|
|
|
/* 팝업 스타일 */
|
|
#eventDetailPopup {
|
|
display: none;
|
|
position: fixed;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
background: rgba(0, 0, 0, 0.85);
|
|
color: white;
|
|
padding: 15px 20px;
|
|
border-radius: 10px;
|
|
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
|
|
z-index: 1000;
|
|
min-width: 250px;
|
|
max-width: 350px;
|
|
text-align: left;
|
|
}
|
|
|
|
/* 제목 스타일 */
|
|
#popupTitle {
|
|
font-size: 14px;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
/* 금액 강조 */
|
|
#popupAmount {
|
|
font-size: 20px;
|
|
color: #ffcc00;
|
|
}
|
|
|
|
/* 상세 내용 스타일 */
|
|
#popupContent {
|
|
font-size: 12px;
|
|
margin-top: 10px;
|
|
line-height: 1.4;
|
|
color:#999;
|
|
}
|
|
|
|
/* 닫기 버튼 */
|
|
.close-btn {
|
|
display: block;
|
|
margin-top: 10px;
|
|
padding: 10px 10px;
|
|
background: rgba(255,255,255,0.1);;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 5px;
|
|
font-size: 14px;
|
|
cursor: pointer;
|
|
width: 100%;
|
|
}
|
|
|
|
/* 오버레이 */
|
|
#overlay {
|
|
display: none;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: rgba(0, 0, 0, 0.4);
|
|
z-index: 999;
|
|
}
|
|
|
|
.fc-event {
|
|
cursor: pointer;
|
|
color: #fff !important;
|
|
}
|
|
</style>
|
|
|
|
<div>
|
|
<div id="calendar"></div>
|
|
</div>
|
|
|
|
<!-- 팝업 레이어 -->
|
|
<div id="overlay"></div>
|
|
<div id="eventDetailPopup">
|
|
<ul id="popupTitle"></ul>
|
|
<ul id="popupAmount" class="font-B"></ul>
|
|
<ul id="popupContent"></ul>
|
|
<button id="DetailBtn" class="close-btn">예약상세정보</button>
|
|
<button id="closePopupBtn" class="close-btn">닫기</button>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
function openPopup(title, amount, content) {
|
|
$("#popupTitle").text(title);
|
|
$("#popupAmount").html(amount);
|
|
$("#popupContent").html(content);
|
|
$("#overlay, #eventDetailPopup").fadeIn(200);
|
|
}
|
|
|
|
function closePopup() {
|
|
$("#overlay, #eventDetailPopup").fadeOut(200);
|
|
}
|
|
|
|
// 닫기 버튼에 클릭 이벤트 연결
|
|
$(document).on("click", "#closePopupBtn", closePopup);
|
|
$(document).on("click", "#overlay", closePopup);
|
|
|
|
var calendarEl = $("#calendar").get(0);
|
|
var calendar = new FullCalendar.Calendar(calendarEl, {
|
|
plugins: ['dayGrid', 'interaction', 'bootstrap'],
|
|
editable: false,
|
|
droppable: false,
|
|
defaultDate: '<?php echo G5_TIME_YMD?>', // 초기 날짜
|
|
locale: 'ko',
|
|
height: 'auto',
|
|
themeSystem: 'bootstrap',
|
|
weekNumbers: false,
|
|
eventLimit: false,
|
|
headerToolbar: {
|
|
left: 'prev,next today',
|
|
center: 'title',
|
|
right: 'dayGridMonth,dayGridWeek,dayGridDay'
|
|
},
|
|
events: function(fetchInfo, successCallback, failureCallback) {
|
|
$.ajax({
|
|
url: './reservation_list.json.php',
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
if (!data || !Array.isArray(data)) {
|
|
console.error("Invalid JSON response:", data);
|
|
alert("이벤트 데이터를 불러올 수 없습니다.");
|
|
failureCallback("Invalid data format");
|
|
return;
|
|
}
|
|
successCallback(data);
|
|
},
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
console.error("AJAX 요청 실패:", textStatus, errorThrown);
|
|
console.error("응답 데이터:", jqXHR.responseText);
|
|
alert("이벤트 데이터를 불러오는 중 오류가 발생했습니다.");
|
|
failureCallback(errorThrown);
|
|
}
|
|
});
|
|
},
|
|
eventClick: function(info) {
|
|
// FullCalendar 이벤트 객체
|
|
var event = info.event.extendedProps || {};
|
|
|
|
// DB 원본 날짜 (팝업용)
|
|
var db_start = event.db_start || "";
|
|
var db_end = event.db_end || "";
|
|
|
|
// 그 외 예약 정보
|
|
var od_name = event.od_name || "예약자 없음";
|
|
var od_status = event.od_status || "상태 미정";
|
|
var od_hp = event.od_hp || "연락처 없음";
|
|
var od_id = event.od_id || "주문번호 없음";
|
|
var ct_item = event.ct_item || "상품 없음";
|
|
var points = Number(event.price) || 0;
|
|
|
|
// 팝업 내용 (DB 원본 날짜 그대로 표시)
|
|
var details = `
|
|
<li><strong>예약현황 :</strong> ${od_status}</li>
|
|
<li><strong>연락처 :</strong> ${od_hp}</li>
|
|
<li><strong>상품명 :</strong> ${ct_item}</li>
|
|
`;
|
|
|
|
// 팝업 열기
|
|
openPopup(
|
|
db_start + (db_end && db_end !== db_start ? " ~ " + db_end : ""), // 제목 영역에 날짜 범위 표시 가능
|
|
od_name,
|
|
`<ul>${details}</ul>`
|
|
);
|
|
|
|
// 예약 상세정보 버튼
|
|
$("#DetailBtn").off("click").on("click", function() {
|
|
if (od_id) {
|
|
window.location.href = "../shop_admin/orderform.php?od_id=" + od_id;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
});
|
|
|
|
calendar.render();
|
|
});
|
|
</script>
|
|
|
|
|
|
<?php
|
|
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|