-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
308 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable no-unused-vars */ | ||
|
||
async function showDeleteConfirmation() { | ||
return await Swal.fire({ | ||
title: "ต้องการที่จะยกเลิกวันจองทั้งหมดในวันนี้", | ||
showCancelButton: true, | ||
confirmButtonText: "ยืนยัน", | ||
cancelButtonText: "ยกเลิก", | ||
}); | ||
} | ||
|
||
async function showReservationForm() { | ||
const HTML = ` | ||
<select class="swal2-select" id="goto_slot_1" required> | ||
<option value="ไปแม่ริม">ไปแม่ริม</option> | ||
<option value="ไปเวียงบัว">ไปเวียงบัว</option> | ||
</select><br/> | ||
<select class="swal2-select" id="time_slot_1" required> | ||
<option value="07:30">07:30</option> | ||
<option value="10:00">10:00</option> | ||
<option value="15:00">15:00</option> | ||
<option value="16:30">16:30</option> | ||
<option value="17:45">17:45</option> | ||
</select><br/> | ||
<select class="swal2-select" id="goto_slot_2"> | ||
<option value="">-</option> | ||
<option value="ไปแม่ริม">ไปแม่ริม</option> | ||
<option value="ไปเวียงบัว">ไปเวียงบัว</option> | ||
</select><br/> | ||
<select class="swal2-select" id="time_slot_2"> | ||
<option value="">-</option> | ||
<option value="07:30">07:30</option> | ||
<option value="10:00">10:00</option> | ||
<option value="15:00">15:00</option> | ||
<option value="16:30">16:30</option> | ||
<option value="17:45">17:45</option> | ||
</select><br/> | ||
`; | ||
|
||
return await Swal.fire({ | ||
title: "", | ||
html: HTML, | ||
focusConfirm: false, | ||
preConfirm: () => [ | ||
document.getElementById("time_slot_1").value, | ||
document.getElementById("goto_slot_1").value, | ||
document.getElementById("time_slot_2").value, | ||
document.getElementById("goto_slot_2").value, | ||
], | ||
}); | ||
} | ||
|
||
function showSuccessMessage(title, text) { | ||
Swal.fire(title, text, "success"); | ||
} | ||
|
||
function showErrorMessage(title, text) { | ||
Swal.fire(title, text, "error"); | ||
} | ||
|
||
export { showDeleteConfirmation, showErrorMessage, showReservationForm, showSuccessMessage }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* eslint-disable no-undef */ | ||
import { handleEventClick, handleSelect } from "./events.js"; | ||
import { fetchEvents } from "./fetch.js"; | ||
|
||
let calendar; | ||
|
||
document.addEventListener("DOMContentLoaded", function () { | ||
const calendarEl = document.getElementById("calendar"); | ||
calendar = new FullCalendar.Calendar(calendarEl, { | ||
locale: "th", | ||
initialView: "dayGridMonth", | ||
selectable: true, | ||
selectMirror: true, | ||
selectAllow: (selectInfo) => { | ||
const day = new Date(selectInfo.start).getDay(); | ||
return day !== 0 && day !== 6; | ||
}, | ||
events: fetchEvents, | ||
eventClick: handleEventClick, | ||
select: handleSelect, | ||
}); | ||
calendar.render(); | ||
}); | ||
|
||
export { calendar }; |
Oops, something went wrong.