| [7517a3a] | 1 | <%- include('../partials/header', { title: 'Book Appointment' }) %>
|
|---|
| 2 |
|
|---|
| 3 | <h1>Book Viewing Appointment</h1>
|
|---|
| 4 |
|
|---|
| 5 | <div class="list-item">
|
|---|
| 6 | <h2>Unit Details</h2>
|
|---|
| 7 | <p><strong>Unit:</strong> <%= unit.unit_number %> - <%= unit.building_name %></p>
|
|---|
| 8 | <p><strong>Floor:</strong> <%= unit.floor_number %></p>
|
|---|
| 9 | <p><strong>Rooms:</strong> <%= unit.room_number %> | <strong>Area:</strong> <%= unit.floor_area %> m²</p>
|
|---|
| 10 | <p><strong>Price:</strong> €<%= unit.price.toLocaleString() %></p>
|
|---|
| 11 | </div>
|
|---|
| 12 |
|
|---|
| 13 | <form action="/units/<%= unit.unit_id %>/book" method="POST">
|
|---|
| 14 | <h2>Your Information</h2>
|
|---|
| 15 |
|
|---|
| 16 | <div>
|
|---|
| 17 | <label for="client_name">Full Name:</label>
|
|---|
| 18 | <input type="text" id="client_name" name="client_name" required placeholder="Enter your name">
|
|---|
| 19 | </div>
|
|---|
| 20 |
|
|---|
| 21 | <div>
|
|---|
| 22 | <label for="client_email">Email:</label>
|
|---|
| 23 | <input type="email" id="client_email" name="client_email" required placeholder="Enter your email">
|
|---|
| 24 | </div>
|
|---|
| 25 |
|
|---|
| 26 | <div>
|
|---|
| 27 | <label for="client_phone">Phone Number:</label>
|
|---|
| 28 | <input type="tel" id="client_phone" name="client_phone" required placeholder="Enter your phone number">
|
|---|
| 29 | </div>
|
|---|
| 30 |
|
|---|
| 31 | <h2>Select Agent & Time</h2>
|
|---|
| 32 |
|
|---|
| 33 | <% if (agents && agents.length > 0) { %>
|
|---|
| 34 | <div>
|
|---|
| 35 | <label for="timeslot_id">Available Time Slots *</label>
|
|---|
| 36 | <select id="timeslot_id" name="timeslot_id" required>
|
|---|
| 37 | <option value="">-- Select a time slot --</option>
|
|---|
| 38 | <% agents.forEach(agent => { %>
|
|---|
| 39 | <optgroup label="<%= agent.name %> (<%= agent.email %>)">
|
|---|
| 40 | <% agent.timeslots.forEach(slot => { %>
|
|---|
| 41 | <option value="<%= slot.id %>">
|
|---|
| 42 | <%= new Date(slot.date).toLocaleDateString('en-GB') %>
|
|---|
| 43 | at <%= slot.time_start. substring(0, 5) %> - <%= slot.time_end.substring(0, 5) %>
|
|---|
| 44 | </option>
|
|---|
| 45 | <% }); %>
|
|---|
| 46 | </optgroup>
|
|---|
| 47 | <% }); %>
|
|---|
| 48 | </select>
|
|---|
| 49 | </div>
|
|---|
| 50 | <% } else { %>
|
|---|
| 51 | <p>No available time slots at the moment. Please check back later.</p>
|
|---|
| 52 | <% } %>
|
|---|
| 53 |
|
|---|
| 54 | <div>
|
|---|
| 55 | <% if (agents && agents.length > 0) { %>
|
|---|
| 56 | <button type="submit" class="book-btn">Confirm Appointment</button>
|
|---|
| 57 | <% } %>
|
|---|
| 58 | <a href="/units/<%= unit.unit_id %>">Cancel</a>
|
|---|
| 59 | </div>
|
|---|
| 60 | </form>
|
|---|
| 61 |
|
|---|
| 62 | |
|---|