PHP Classes

File: frontend/js/componentes/views/reservationsView.js

Recommend this page to a friend!
  Classes of Rodrigo Faustino   Livraria   frontend/js/componentes/views/reservationsView.js   Download  
File: frontend/js/componentes/views/reservationsView.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Livraria
Manage a bookstore using micro-services
Author: By
Last change:
Date: 2 months ago
Size: 1,824 bytes
 

Contents

Class file image Download
export function renderReservationsView(adminContent, reservations) { const reservationsContainer = document.createElement('div'); reservationsContainer.classList.add('reservations-container'); reservations.forEach(reservation => { const reservationCard = document.createElement('div'); reservationCard.classList.add('reservation-card'); reservationCard.innerHTML = ` <img src="${reservation.imageSrc}" alt="${reservation.altText}" class="reservation-image"> <h3>${reservation.name}</h3> <p>${reservation.description}</p> <p>Price: R$ ${parseFloat(reservation.price).toFixed(2)}</p> <p>Status: ${reservation.status}</p> <button class="confirm-sale" data-id="${reservation.id}">Confirm Sale</button> <button class="remove-reservation" data-id="${reservation.id}">Remove Reservation</button> `; reservationsContainer.appendChild(reservationCard); }); adminContent.appendChild(reservationsContainer); return reservationsContainer; } export function setupReservationButtons(reservationsContainer, onConfirmSale, onRemoveReservation) { const confirmSaleButtons = reservationsContainer.querySelectorAll('.confirm-sale'); confirmSaleButtons.forEach(button => { button.addEventListener('click', () => { const reservationId = button.getAttribute('data-id'); onConfirmSale(reservationId); }); }); const removeReservationButtons = reservationsContainer.querySelectorAll('.remove-reservation'); removeReservationButtons.forEach(button => { button.addEventListener('click', () => { const reservationId = button.getAttribute('data-id'); onRemoveReservation(reservationId); }); }); }