This commit is contained in:
Tomas Dvorak
2025-06-18 07:10:35 +02:00
parent d7d59ee571
commit ab45bd0d1b
+23 -21
View File
@@ -617,21 +617,22 @@
} }
.vehicle-filter-btn { .vehicle-filter-btn {
background: none;
border: none;
padding: 0;
margin: 0 0.25rem 0.25rem 0;
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; outline: none;
opacity: 0.7;
border: 2px solid transparent;
border-radius: 9999px;
} }
.vehicle-filter-btn:hover { .vehicle-filter-btn:hover .vehicle-badge {
opacity: 1; opacity: 0.9;
transform: translateY(-1px); transform: translateY(-1px);
} }
.vehicle-filter-btn.active { .vehicle-filter-btn.active .vehicle-badge {
opacity: 1; border: 2px solid #004990;
border-color: #004990; box-shadow: 0 0 0 1px white;
} }
.reservation-item.hidden-vehicle { .reservation-item.hidden-vehicle {
@@ -1718,27 +1719,28 @@
return new Date(date).toLocaleString('cs-CZ', options); return new Date(date).toLocaleString('cs-CZ', options);
} }
// Function to check for high traffic // Function to check for high traffic in the selected month
async function checkHighTraffic(vehicle, date) { function checkHighTraffic(vehicle, date) {
if (!vehicle || !date) return; if (!vehicle || !date) return;
const startOfDay = new Date(date); // Get first day of the month
startOfDay.setHours(0, 0, 0, 0); const startOfMonth = new Date(date.getFullYear(), date.getMonth(), 1);
const endOfDay = new Date(date); // Get last day of the month
endOfDay.setHours(23, 59, 59, 999); const endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0);
endOfMonth.setHours(23, 59, 59, 999);
const events = calendar.getEvents(); const events = calendar.getEvents();
const vehicleEventsCount = events.filter(event => const vehicleEventsCount = events.filter(event =>
event.extendedProps.vehicle === vehicle && event.extendedProps.vehicle === vehicle &&
event.start >= startOfDay && event.start >= startOfMonth &&
event.start <= endOfDay event.start <= endOfMonth
).length; ).length;
const warningEl = document.getElementById('highTrafficWarning'); const warningEl = document.getElementById('highTrafficWarning');
if (vehicleEventsCount >= 3) { if (vehicleEventsCount >= 10) { // Increased threshold for monthly check
warningEl.querySelector('.warning-message').textContent = warningEl.querySelector('.warning-message').textContent =
`Toto vozidlo má v daný den již ${vehicleEventsCount} rezervací.`; `Upozornění: Toto vozidlo má v tomto měsíci již ${vehicleEventsCount} rezervací.`;
warningEl.classList.remove('hidden'); warningEl.classList.remove('hidden');
} else { } else {
warningEl.classList.add('hidden'); warningEl.classList.add('hidden');