- Note: If you provide a Check-In Time, the entry will be saved as Closed.
- If you leave Check-In empty, it will be saved as Open.
+ Note: New entries are created as Open. You can close them later when the student returns.
@@ -112,15 +109,19 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -136,43 +137,17 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -208,9 +183,7 @@
const detailsModalEl = document.getElementById('detailsModal');
const getDetailsModal = () => bootstrap.Modal.getOrCreateInstance(detailsModalEl);
- // Clean up any stray backdrops if there were multiple instances created earlier
detailsModalEl.addEventListener('hidden.bs.modal', () => {
- // Defensive cleanup (usually not needed when using getOrCreateInstance)
document.querySelectorAll('.modal-backdrop').forEach(el => el.remove());
document.body.classList.remove('modal-open');
document.body.style.removeProperty('padding-right');
@@ -223,7 +196,8 @@
const r = document.getElementById('rollNumber').value || '—';
const e = document.getElementById('outlookEmail').value || '—';
document.getElementById('modalSummary').textContent = `Submitting for ${n} (${r}) • ${e}`;
- document.getElementById('m_destination').focus();
+ // focus first destination button label for easy selection
+ document.querySelector('label[for="dest_city"]').focus();
});
// Hidden form setters
@@ -279,7 +253,7 @@
roomNumber: data.roomNumber
});
- // Open modal using a SINGLE instance (prevents stuck backdrops)
+ // Open modal
getDetailsModal().show();
} catch (err) {
showAlert('danger', `Failed to fetch details: ${err.message}`);
@@ -300,37 +274,23 @@
// ----- SUBMIT from modal -----
document.getElementById('modalSubmitBtn').addEventListener('click', () => {
- const dest = document.getElementById('m_destination').value; // SELECT value (City/Khoka/Other)
+ const destNode = document.querySelector('input[name="m_destination"]:checked');
const cout = document.getElementById('m_checkOutTime').value;
const cg = document.querySelector('input[name="m_checkOutGate"]:checked');
- if (!dest) return showAlert('warning', 'Destination is required.');
+ if (!destNode) return showAlert('warning', 'Please choose a destination.');
if (!cout) return showAlert('warning', 'Check-Out Time is required.');
if (!cg) return showAlert('warning', 'Please select an Exit Gate.');
- document.getElementById('f_destination').value = dest;
+ document.getElementById('f_destination').value = destNode.value;
document.getElementById('f_checkOutTime').value = cout;
document.getElementById('f_checkOutGate').value = cg.value;
- const igNode = document.querySelector('input[name="m_checkInGate"]:checked');
- const ig = igNode ? igNode.value : '';
- let cin = document.getElementById('m_checkInTime').value || '';
-
- // If In Gate chosen but no Check-In Time, auto-fill now (local)
- if (ig && !cin) {
- const now = new Date();
- now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
- cin = now.toISOString().slice(0,16);
- }
-
- document.getElementById('f_checkInTime').value = cin;
- document.getElementById('f_checkInGate').value = ig;
-
- // Hide modal BEFORE posting to avoid any lingering overlay during redirect
+ // Hide modal BEFORE posting to avoid overlay during redirect
const inst = bootstrap.Modal.getInstance(detailsModalEl);
if (inst) inst.hide();
- // Submit the hidden form
+ // Submit the hidden form (no check-in fields anymore)
document.getElementById('entryForm').submit();
});