#26 - Loading animation + success message fix
This commit was merged in pull request #31.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Renders an array of slot objects into <li> DOM nodes for display in summary lists.
|
||||
* Each slot must have start_utc, end_utc, price fields.
|
||||
*/
|
||||
export function render_slot_items(slots, locale, currency) {
|
||||
const time_opts = { hour: '2-digit', minute: '2-digit' };
|
||||
return slots.map(slot => {
|
||||
const start = new Date(slot.start_utc);
|
||||
const end = new Date(slot.end_utc);
|
||||
const li = document.createElement('li');
|
||||
li.className = 'rsv-summary-item';
|
||||
li.innerHTML = `
|
||||
<div class="rsv-summary-item-info">
|
||||
<span class="rsv-summary-item-date">${start.toLocaleDateString(locale, { weekday: 'long', day: 'numeric', month: 'long' })}</span>
|
||||
<span class="rsv-summary-item-time">${start.toLocaleTimeString(locale, time_opts)} – ${end.toLocaleTimeString(locale, time_opts)}</span>
|
||||
</div>
|
||||
${slot.price > 0 ? `<span class="rsv-summary-item-price">${slot.price} ${currency}</span>` : ''}
|
||||
`;
|
||||
return li;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user