piccoli fix
This commit is contained in:
@@ -75,7 +75,7 @@ const ModalLogic = {
|
||||
},
|
||||
|
||||
openModal(data) {
|
||||
const { dateStr, userName, presence, parking, userId, isReadOnly } = data;
|
||||
const { dateStr, userName, presence, parking, userId, isParkingOnly } = data;
|
||||
|
||||
this.currentDate = dateStr;
|
||||
this.currentUserId = userId; // Optional, for team view
|
||||
@@ -84,8 +84,9 @@ const ModalLogic = {
|
||||
const modal = document.getElementById('dayModal');
|
||||
const title = document.getElementById('dayModalTitle');
|
||||
const userLabel = document.getElementById('dayModalUser');
|
||||
const statusButtons = document.querySelector('#dayModal .status-buttons');
|
||||
const clearBtn = document.getElementById('clearDayBtn');
|
||||
|
||||
title.textContent = utils.formatDateDisplay(dateStr);
|
||||
|
||||
// Show/Hide User Name (for Team Calendar)
|
||||
if (userName && userLabel) {
|
||||
@@ -95,22 +96,26 @@ const ModalLogic = {
|
||||
userLabel.style.display = 'none';
|
||||
}
|
||||
|
||||
// Highlight status
|
||||
document.querySelectorAll('#dayModal .status-btn').forEach(btn => {
|
||||
const status = btn.dataset.status;
|
||||
if (presence && presence.status === status) {
|
||||
btn.classList.add('active');
|
||||
} else {
|
||||
btn.classList.remove('active');
|
||||
}
|
||||
});
|
||||
|
||||
// Clear button visibility
|
||||
const clearBtn = document.getElementById('clearDayBtn');
|
||||
if (presence) {
|
||||
clearBtn.style.display = 'block';
|
||||
// Presence Logic
|
||||
if (isParkingOnly) {
|
||||
if (statusButtons) statusButtons.style.display = 'none';
|
||||
if (clearBtn) clearBtn.style.display = 'none';
|
||||
title.textContent = `Gestione Parcheggio - ${utils.formatDateDisplay(dateStr)}`;
|
||||
} else {
|
||||
clearBtn.style.display = 'none';
|
||||
if (statusButtons) statusButtons.style.display = 'grid';
|
||||
if (clearBtn) clearBtn.style.display = presence ? 'block' : 'none';
|
||||
|
||||
title.textContent = utils.formatDateDisplay(dateStr);
|
||||
|
||||
// Highlight status
|
||||
document.querySelectorAll('#dayModal .status-btn').forEach(btn => {
|
||||
const status = btn.dataset.status;
|
||||
if (presence && presence.status === status) {
|
||||
btn.classList.add('active');
|
||||
} else {
|
||||
btn.classList.remove('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Parking Section & Reset Form
|
||||
@@ -122,7 +127,8 @@ const ModalLogic = {
|
||||
if (parking) {
|
||||
parkingSection.style.display = 'block';
|
||||
const spotName = parking.spot_display_name || parking.spot_id;
|
||||
parkingInfo.innerHTML = `<strong>Parcheggio:</strong> Posto ${spotName}`;
|
||||
const occupantInfo = userName ? ` (Occupato da ${userName})` : '';
|
||||
parkingInfo.innerHTML = `<strong>Posto ${spotName}</strong>${occupantInfo}`;
|
||||
} else {
|
||||
parkingSection.style.display = 'none';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user