mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-05 04:52:58 +00:00
test
This commit is contained in:
+15
-8
@@ -4306,16 +4306,23 @@ function displayReservations(reservations) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tbody.innerHTML = reservations.map(res => `
|
tbody.innerHTML = reservations.map(res => {
|
||||||
|
const startDate = new Date(res.start);
|
||||||
|
const endDate = new Date(res.end);
|
||||||
|
const formattedStart = startDate.toLocaleString('cs-CZ');
|
||||||
|
const formattedEnd = endDate.toLocaleString('cs-CZ');
|
||||||
|
|
||||||
|
return `
|
||||||
<tr class="hover:bg-gray-50">
|
<tr class="hover:bg-gray-50">
|
||||||
<td class="px-6 py-4">${res.driverName}</td>
|
<td class="px-6 py-4">${res.driverName || '-'}</td>
|
||||||
<td class="px-6 py-4">${res.vehicle}</td>
|
<td class="px-6 py-4">${res.vehicle || '-'}</td>
|
||||||
<td class="px-6 py-4">${formatDateTime(res.startDate, res.startTime)}</td>
|
<td class="px-6 py-4">${formattedStart}</td>
|
||||||
<td class="px-6 py-4">${formatDateTime(res.endDate, res.endTime)}</td>
|
<td class="px-6 py-4">${formattedEnd}</td>
|
||||||
<td class="px-6 py-4">${res.purpose || '-'}</td>
|
<td class="px-6 py-4">${res.purpose || '-'}</td>
|
||||||
<td class="px-6 py-4">${calculateDuration(res)}</td>
|
<td class="px-6 py-4">${calculateDuration(res)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
`).join('');
|
`;
|
||||||
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to filter reservations
|
// Function to filter reservations
|
||||||
@@ -4391,8 +4398,8 @@ function formatDateTime(date, time) {
|
|||||||
|
|
||||||
// Helper function to calculate duration
|
// Helper function to calculate duration
|
||||||
function calculateDuration(reservation) {
|
function calculateDuration(reservation) {
|
||||||
const start = new Date(`${reservation.startDate}T${reservation.startTime}`);
|
const start = new Date(reservation.start);
|
||||||
const end = new Date(`${reservation.endDate}T${reservation.endTime}`);
|
const end = new Date(reservation.end);
|
||||||
const diff = end - start;
|
const diff = end - start;
|
||||||
|
|
||||||
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
|
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
|
||||||
|
|||||||
Reference in New Issue
Block a user