From 59bd705d89adc003b860485d13b8c460a2e18c89 Mon Sep 17 00:00:00 2001 From: frederikpyt Date: Mon, 31 Aug 2020 10:15:12 +0200 Subject: [PATCH] v0.10.16a - Various fixes --- .../views/app/washing-reservations/create.blade.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/skolehjem/resources/views/app/washing-reservations/create.blade.php b/skolehjem/resources/views/app/washing-reservations/create.blade.php index 170f2dd..f7aa6fe 100644 --- a/skolehjem/resources/views/app/washing-reservations/create.blade.php +++ b/skolehjem/resources/views/app/washing-reservations/create.blade.php @@ -86,8 +86,6 @@ let date = moment().locale("da").day(weekDay).week(week); var datetext = moment().locale("da").day(weekDay).week(week).year() + "-" + prependZero((moment().locale("da").day(weekDay).week(week).month() + 1)) + "-" + prependZero(moment().locale("da").day(weekDay).week(week).date()); - - let dayHolder = document.createElement("div"); dayHolder.classList.add("calendar-table__col"); @@ -95,6 +93,11 @@ day.classList.add("calendar-table__item"); day.innerText = date.date(); + //If any date is selected, Add selected class to the selected day + if(momentDate !== null) + if(date.diff(momentDate, 'hours') == 0) + dayHolder.classList.add("selected"); + dayHolder.appendChild(day); //If date hasn't already happened @@ -175,7 +178,7 @@ fillMachines(data["washingmachines"], machine_id); //Fill events (times) and remove unavailable_times - fillTimes(data["unavailable_times"], datetext); + fillTimes(data["unavailable_times"], datetext, date); }); } @@ -281,7 +284,7 @@ } //Fill events (times) and remove unavailable_times - function fillTimes(unavailable_times, datetext) { + function fillTimes(unavailable_times, datetext, date) { var element; //If a events (times) select exists, set element to the select element @@ -311,7 +314,7 @@ //Add times 8:00-20:00 for (let hour = 8; hour < 20; hour++) { - if(hour < new Date().getHours()) + if(hour < new Date().getHours() && moment().locale("da").diff(date, 'hours') == 0) continue; let value = datetext + " " + prependZero(hour) + ":00:00";