/**
* js/ui.js
* Handles all UI rendering and DOM manipulations.
*/
import {formatDate} from './utils.js'; // Import utility for date formatting
const ui = {
// DOM Elements
carListContainer: document.getElementById('car-list'),
notificationContainer: document.getElementById('notification'),
loadingSpinner: document.getElementById('loading-spinner'),
mobileMenuButton: document.getElementById('mobile-menu-btn'),
navMenu: document.getElementById('nav-menu'),
heroSection: document.getElementById('home'), // For scroll to
carsSection: document.getElementById('cars'), // For scroll to
howItWorksSection: document.getElementById('how-it-works'), // For scroll to
contactSection: document.getElementById('contact'), // For scroll to
/**
* Creates and returns a DOM element for a single car card.
* @param {object} car - Car data object.
* @returns {HTMLElement} The car card element.
*/
renderCarCard(car) {
const card = document.createElement('div');
card.className = 'car-card';
card.innerHTML = `
${car.type} | ${car.seats} ที่นั่ง
฿${car.pricePerDay.toLocaleString()} / วัน