Skip to content

Commit

Permalink
feat: remove save state
Browse files Browse the repository at this point in the history
  • Loading branch information
RezenkovD committed Aug 14, 2023
1 parent ce0b6ed commit 95595d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
15 changes: 13 additions & 2 deletions vr_club_site/templates/site/js/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ document.addEventListener("DOMContentLoaded", function () {
var popupScrollPosition;
function openPopup(day, month, year) {
popupScrollPosition = window.scrollY;
const state = { popupOpen: true, day: day, month: month, year: year };
history.pushState(state, null, ''); // Збереження стану в історії браузера
const dateDiv = document.querySelector('.booking-date');
const monthsNames = [
"січня",
Expand All @@ -145,6 +143,18 @@ function openPopup(day, month, year) {
dateDiv.textContent = `${parseInt(day, 10)} ${monthsNames[parseInt(month) - 1]} ${year}`;

getAvailableSlots(`${year}-${parseInt(month, 10)}-${parseInt(day, 10)}`)
const checkboxes = document.querySelectorAll('input[type="checkbox"]');
checkboxes.forEach(checkbox => {
checkbox.checked = false;
});
const inputElements = document.querySelectorAll('input[type="text"]');
inputElements.forEach(input => {
input.value = '';
});
const peopleCountInput = document.getElementById('id_people_count');
peopleCountInput.value = 1;
const totalCostSpan = document.getElementById('total_cost');
totalCostSpan.textContent = '0.00 грн';

const dateInput = document.getElementById('id_date');
dateInput.value = `${day}-${month}-${year}`;
Expand All @@ -153,6 +163,7 @@ function openPopup(day, month, year) {
const body = document.querySelector('body');
popup.style.display = 'block';
body.style.overflow = 'hidden';
history.pushState(null, null, '');
}

function closePopup() {
Expand Down
5 changes: 3 additions & 2 deletions vr_club_site/templates/site/style/booking.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@
text-align: left;
font: 500 24px/170% "Montserrat", sans-serif;
position: relative;
width: 45%;
}

.people-count-2 {
gap: 124px;
gap: 115px;
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
}

.btn-booking {
Expand Down Expand Up @@ -241,7 +243,6 @@ input[type=number]::-webkit-outer-spin-button {
}

.number-input {
margin-left: 24px;
order: 0;
display: inline-flex;
flex-direction: row;
Expand Down

0 comments on commit 95595d6

Please sign in to comment.