Update templates/seller.html
Browse files- templates/seller.html +30 -62
templates/seller.html
CHANGED
|
@@ -4,83 +4,67 @@
|
|
| 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 |
-
<!-- Car Details -->
|
| 8 |
-
<div class="bg-blue-50 p-4 rounded-lg mb-6">
|
| 9 |
-
<h3 class="text-xl font-bold text-blue-600">Car Details:</h3>
|
| 10 |
-
<p><strong>Name:</strong> {{ car.name }}</p>
|
| 11 |
-
<p><strong>Year:</strong> {{ car.year }}</p>
|
| 12 |
-
<p><strong>Price:</strong> {{ car.price|format_price }}</p>
|
| 13 |
-
</div>
|
| 14 |
-
|
| 15 |
{% if appointments %}
|
| 16 |
<div class="overflow-x-auto">
|
| 17 |
-
<table class="min-w-full bg-white
|
| 18 |
<thead>
|
| 19 |
-
<tr class="bg-gray-
|
| 20 |
-
<th class="py-
|
| 21 |
-
<th class="py-
|
| 22 |
-
<th class="py-
|
| 23 |
-
<th class="py-
|
| 24 |
-
<th class="py-
|
| 25 |
-
<th class="py-
|
| 26 |
</tr>
|
| 27 |
</thead>
|
| 28 |
<tbody>
|
| 29 |
{% for appointment in appointments %}
|
| 30 |
-
<tr
|
| 31 |
-
<td class="py-
|
| 32 |
-
<td class="py-
|
| 33 |
-
<td class="py-
|
| 34 |
-
<td class="py-
|
| 35 |
-
<td class="py-
|
| 36 |
-
<span class="px-
|
| 37 |
{% if appointment.status == 'approved' %}bg-green-100 text-green-800
|
| 38 |
{% else %}bg-yellow-100 text-yellow-800{% endif %}">
|
| 39 |
{{ appointment.status|title }}
|
| 40 |
</span>
|
| 41 |
</td>
|
| 42 |
-
<td class="py-
|
| 43 |
{% if appointment.status == 'pending' %}
|
| 44 |
<button onclick="openModal('{{ appointment._id }}')"
|
| 45 |
-
class="bg-green-600 text-white px-
|
| 46 |
-
|
| 47 |
</button>
|
| 48 |
{% else %}
|
| 49 |
-
<span class="text-green-600
|
| 50 |
{% endif %}
|
| 51 |
</td>
|
| 52 |
</tr>
|
| 53 |
|
| 54 |
<!-- Modal for each appointment -->
|
| 55 |
-
<div id="modal-{{ appointment._id }}" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50
|
| 56 |
-
<div class="bg-white p-6 rounded-lg w-
|
| 57 |
-
<h3 class="text-xl font-bold mb-4">Schedule Meeting
|
| 58 |
<form method="POST" action="{{ url_for('approve_appointment', appointment_id=appointment._id) }}">
|
| 59 |
<div class="mb-4">
|
| 60 |
<label class="block text-gray-700 mb-2">Meeting Date</label>
|
| 61 |
-
<input type="date" name="meeting_date" required
|
| 62 |
-
class="w-full px-3 py-2 border border-gray-300 rounded-md">
|
| 63 |
</div>
|
| 64 |
<div class="mb-4">
|
| 65 |
<label class="block text-gray-700 mb-2">Meeting Time</label>
|
| 66 |
-
<input type="time" name="meeting_time" required
|
| 67 |
-
class="w-full px-3 py-2 border border-gray-300 rounded-md">
|
| 68 |
</div>
|
| 69 |
<div class="mb-4">
|
| 70 |
-
<label class="block text-gray-700 mb-2">Meeting
|
| 71 |
-
<input type="text" name="meeting_place" required
|
| 72 |
-
|
| 73 |
-
placeholder="Enter meeting location/address">
|
| 74 |
</div>
|
| 75 |
<div class="flex justify-end space-x-2">
|
| 76 |
<button type="button" onclick="closeModal('{{ appointment._id }}')"
|
| 77 |
-
class="px-4 py-2 border
|
| 78 |
-
|
| 79 |
-
</button>
|
| 80 |
-
<button type="submit"
|
| 81 |
-
class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700 transition duration-300">
|
| 82 |
-
Confirm & Send Email
|
| 83 |
-
</button>
|
| 84 |
</div>
|
| 85 |
</form>
|
| 86 |
</div>
|
|
@@ -90,16 +74,8 @@
|
|
| 90 |
</table>
|
| 91 |
</div>
|
| 92 |
{% else %}
|
| 93 |
-
<
|
| 94 |
-
<i class="fas fa-calendar-times text-6xl text-gray-300 mb-4"></i>
|
| 95 |
-
<p class="text-gray-600 text-xl">No appointments for this car yet.</p>
|
| 96 |
-
<p class="text-gray-500">Buyers will appear here when they book appointments.</p>
|
| 97 |
-
</div>
|
| 98 |
{% endif %}
|
| 99 |
-
|
| 100 |
-
<div class="mt-6 text-center">
|
| 101 |
-
<a href="{{ url_for('seller_dashboard') }}" class="text-blue-600 hover:underline">← Back to Dashboard</a>
|
| 102 |
-
</div>
|
| 103 |
</div>
|
| 104 |
|
| 105 |
<script>
|
|
@@ -112,13 +88,5 @@ function closeModal(appointmentId) {
|
|
| 112 |
document.getElementById('modal-' + appointmentId).classList.add('hidden');
|
| 113 |
document.getElementById('modal-' + appointmentId).classList.remove('flex');
|
| 114 |
}
|
| 115 |
-
|
| 116 |
-
// Close modal when clicking outside
|
| 117 |
-
window.onclick = function(event) {
|
| 118 |
-
if (event.target.classList.contains('fixed')) {
|
| 119 |
-
event.target.classList.add('hidden');
|
| 120 |
-
event.target.classList.remove('flex');
|
| 121 |
-
}
|
| 122 |
-
}
|
| 123 |
</script>
|
| 124 |
{% endblock %}
|
|
|
|
| 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>
|
|
|
|
| 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>
|
|
|
|
| 88 |
document.getElementById('modal-' + appointmentId).classList.add('hidden');
|
| 89 |
document.getElementById('modal-' + appointmentId).classList.remove('flex');
|
| 90 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
</script>
|
| 92 |
{% endblock %}
|