Create templates/seller.html
Browse files- templates/seller.html +92 -0
templates/seller.html
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends "base.html" %}
|
| 2 |
+
|
| 3 |
+
{% block content %}
|
| 4 |
+
<div class="bg-white rounded-lg shadow-lg p-8">
|
| 5 |
+
<h2 class="text-3xl font-bold text-center mb-8">Appointments for {{ car.name }}</h2>
|
| 6 |
+
|
| 7 |
+
{% if appointments %}
|
| 8 |
+
<div class="overflow-x-auto">
|
| 9 |
+
<table class="min-w-full bg-white">
|
| 10 |
+
<thead>
|
| 11 |
+
<tr class="bg-gray-200">
|
| 12 |
+
<th class="py-2 px-4 border">Buyer Name</th>
|
| 13 |
+
<th class="py-2 px-4 border">Email</th>
|
| 14 |
+
<th class="py-2 px-4 border">Phone</th>
|
| 15 |
+
<th class="py-2 px-4 border">Preferred Date</th>
|
| 16 |
+
<th class="py-2 px-4 border">Status</th>
|
| 17 |
+
<th class="py-2 px-4 border">Actions</th>
|
| 18 |
+
</tr>
|
| 19 |
+
</thead>
|
| 20 |
+
<tbody>
|
| 21 |
+
{% for appointment in appointments %}
|
| 22 |
+
<tr>
|
| 23 |
+
<td class="py-2 px-4 border">{{ appointment.buyer_name }}</td>
|
| 24 |
+
<td class="py-2 px-4 border">{{ appointment.buyer_email }}</td>
|
| 25 |
+
<td class="py-2 px-4 border">{{ appointment.buyer_phone }}</td>
|
| 26 |
+
<td class="py-2 px-4 border">{{ appointment.preferred_date }}</td>
|
| 27 |
+
<td class="py-2 px-4 border">
|
| 28 |
+
<span class="px-2 py-1 rounded text-sm
|
| 29 |
+
{% if appointment.status == 'approved' %}bg-green-100 text-green-800
|
| 30 |
+
{% else %}bg-yellow-100 text-yellow-800{% endif %}">
|
| 31 |
+
{{ appointment.status|title }}
|
| 32 |
+
</span>
|
| 33 |
+
</td>
|
| 34 |
+
<td class="py-2 px-4 border">
|
| 35 |
+
{% if appointment.status == 'pending' %}
|
| 36 |
+
<button onclick="openModal('{{ appointment._id }}')"
|
| 37 |
+
class="bg-green-600 text-white px-3 py-1 rounded hover:bg-green-700">
|
| 38 |
+
Approve
|
| 39 |
+
</button>
|
| 40 |
+
{% else %}
|
| 41 |
+
<span class="text-green-600">Approved</span>
|
| 42 |
+
{% endif %}
|
| 43 |
+
</td>
|
| 44 |
+
</tr>
|
| 45 |
+
|
| 46 |
+
<!-- Modal for each appointment -->
|
| 47 |
+
<div id="modal-{{ appointment._id }}" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50">
|
| 48 |
+
<div class="bg-white p-6 rounded-lg w-96">
|
| 49 |
+
<h3 class="text-xl font-bold mb-4">Schedule Meeting</h3>
|
| 50 |
+
<form method="POST" action="{{ url_for('approve_appointment', appointment_id=appointment._id) }}">
|
| 51 |
+
<div class="mb-4">
|
| 52 |
+
<label class="block text-gray-700 mb-2">Meeting Date</label>
|
| 53 |
+
<input type="date" name="meeting_date" required class="w-full px-3 py-2 border rounded">
|
| 54 |
+
</div>
|
| 55 |
+
<div class="mb-4">
|
| 56 |
+
<label class="block text-gray-700 mb-2">Meeting Time</label>
|
| 57 |
+
<input type="time" name="meeting_time" required class="w-full px-3 py-2 border rounded">
|
| 58 |
+
</div>
|
| 59 |
+
<div class="mb-4">
|
| 60 |
+
<label class="block text-gray-700 mb-2">Meeting Place</label>
|
| 61 |
+
<input type="text" name="meeting_place" required class="w-full px-3 py-2 border rounded"
|
| 62 |
+
placeholder="Enter meeting location">
|
| 63 |
+
</div>
|
| 64 |
+
<div class="flex justify-end space-x-2">
|
| 65 |
+
<button type="button" onclick="closeModal('{{ appointment._id }}')"
|
| 66 |
+
class="px-4 py-2 border rounded">Cancel</button>
|
| 67 |
+
<button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded">Confirm</button>
|
| 68 |
+
</div>
|
| 69 |
+
</form>
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
{% endfor %}
|
| 73 |
+
</tbody>
|
| 74 |
+
</table>
|
| 75 |
+
</div>
|
| 76 |
+
{% else %}
|
| 77 |
+
<p class="text-gray-600 text-center">No appointments for this car yet.</p>
|
| 78 |
+
{% endif %}
|
| 79 |
+
</div>
|
| 80 |
+
|
| 81 |
+
<script>
|
| 82 |
+
function openModal(appointmentId) {
|
| 83 |
+
document.getElementById('modal-' + appointmentId).classList.remove('hidden');
|
| 84 |
+
document.getElementById('modal-' + appointmentId).classList.add('flex');
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
function closeModal(appointmentId) {
|
| 88 |
+
document.getElementById('modal-' + appointmentId).classList.add('hidden');
|
| 89 |
+
document.getElementById('modal-' + appointmentId).classList.remove('flex');
|
| 90 |
+
}
|
| 91 |
+
</script>
|
| 92 |
+
{% endblock %}
|