fixed placement of note fuction
This commit is contained in:
parent
5e506e5ab6
commit
74b0cb4cbb
@ -341,6 +341,18 @@
|
|||||||
const username = selected.options[selected.selectedIndex].dataset.username;
|
const username = selected.options[selected.selectedIndex].dataset.username;
|
||||||
const punchInTime = new Date(e.target.elements['add-punch-in'].value).toISOString();
|
const punchInTime = new Date(e.target.elements['add-punch-in'].value).toISOString();
|
||||||
|
|
||||||
|
|
||||||
|
// Handle the optional punch-out time
|
||||||
|
const punchOutValue = e.target.elements['add-punch-out'].value;
|
||||||
|
const punchOutTime = punchOutValue ? new Date(punchOutValue).toISOString() : null;
|
||||||
|
|
||||||
|
const res = await apiCall('/admin/add-punch', 'POST', { userId, username, punchInTime, punchOutTime });
|
||||||
|
if (res.success) {
|
||||||
|
showMessage(res.data.message, 'success');
|
||||||
|
e.target.reset();
|
||||||
|
renderAdminDashboard();
|
||||||
|
}
|
||||||
|
}
|
||||||
async function handleAddNote(e) {
|
async function handleAddNote(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const userId = e.target.elements['note-user-select'].value;
|
const userId = e.target.elements['note-user-select'].value;
|
||||||
@ -356,17 +368,7 @@
|
|||||||
e.target.reset();
|
e.target.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Handle the optional punch-out time
|
async function handleTimeOffRequest(e) { e.preventDefault(); const startDate = e.target.elements['start-date'].value; const endDate = e.target.elements['end-date'].value; const reason = e.target.elements['reason'].value; if (new Date(endDate) < new Date(startDate)) { return showMessage('End date cannot be before start date.', 'error'); } const res = await apiCall('/user/request-time-off', 'POST', { startDate, endDate, reason }); if (res.success) { showMessage(res.data.message, 'success'); e.target.reset(); renderEmployeeDashboard(); } }
|
||||||
const punchOutValue = e.target.elements['add-punch-out'].value;
|
|
||||||
const punchOutTime = punchOutValue ? new Date(punchOutValue).toISOString() : null;
|
|
||||||
|
|
||||||
const res = await apiCall('/admin/add-punch', 'POST', { userId, username, punchInTime, punchOutTime });
|
|
||||||
if (res.success) {
|
|
||||||
showMessage(res.data.message, 'success');
|
|
||||||
e.target.reset();
|
|
||||||
renderAdminDashboard();
|
|
||||||
}
|
|
||||||
} async function handleTimeOffRequest(e) { e.preventDefault(); const startDate = e.target.elements['start-date'].value; const endDate = e.target.elements['end-date'].value; const reason = e.target.elements['reason'].value; if (new Date(endDate) < new Date(startDate)) { return showMessage('End date cannot be before start date.', 'error'); } const res = await apiCall('/user/request-time-off', 'POST', { startDate, endDate, reason }); if (res.success) { showMessage(res.data.message, 'success'); e.target.reset(); renderEmployeeDashboard(); } }
|
|
||||||
|
|
||||||
// --- Initializer ---
|
// --- Initializer ---
|
||||||
signOutBtn.addEventListener('click', () => handleSignOut('You have been signed out.'));
|
signOutBtn.addEventListener('click', () => handleSignOut('You have been signed out.'));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user