Meech888 commited on
Commit
c4825ac
·
verified ·
1 Parent(s): 16dd7cd

Promote version 8a2ae57 to main

Browse files

Promoted commit 8a2ae576f179c5dfce78024af003a69aba268562 to main branch

Files changed (1) hide show
  1. client-dashboard.html +359 -7
client-dashboard.html CHANGED
@@ -57,14 +57,192 @@
57
  </div>
58
  </div>
59
  </nav>
60
- <!-- Main Content -->
61
  <main class="container mx-auto px-4 py-8">
62
  <div class="text-center mb-10">
63
- <h2 class="text-3xl font-bold text-blue-600 mb-2">Track Your Cake Delivery</h2>
64
- <p class="text-slate-600 max-w-2xl mx-auto">Monitor your existing cake delivery with real-time tracking and updates.</p>
65
  </div>
66
 
67
- <div class="grid grid-cols-1 lg:grid-cols-1 gap-8">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  <!-- Tracking Section -->
69
  <div class="order-1 lg:order-2">
70
  <div class="bg-white rounded-xl shadow-md p-6 mb-8">
@@ -175,7 +353,8 @@
175
  </div>
176
  </div>
177
  </main>
178
- <!-- Floating Chat Button -->
 
179
  <div class="fixed bottom-6 right-6 z-50">
180
  <button id="chatButton" class="bg-blue-600 text-white rounded-full p-4 shadow-lg hover:bg-blue-700 transition duration-300">
181
  <i data-feather="message-circle" class="w-6 h-6"></i>
@@ -254,9 +433,19 @@
254
 
255
  // Initialize Maps
256
  document.addEventListener('DOMContentLoaded', function() {
 
 
 
 
 
 
 
 
 
 
257
  // Map for tracking
258
  const trackingMap = L.map('trackingMap').setView([40.7128, -74.0060], 14);
259
- L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
260
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
261
  }).addTo(trackingMap);
262
 
@@ -280,6 +469,7 @@ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
280
  iconSize: [24, 24]
281
  })
282
  }).addTo(trackingMap);
 
283
  // Animate rider movement
284
  let currentIndex = 1;
285
  setInterval(() => {
@@ -288,8 +478,170 @@ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
288
  riderMarker.setLatLng(routePoints[currentIndex]);
289
  }
290
  }, 3000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  });
292
- // Chat functionality
 
293
  document.addEventListener('DOMContentLoaded', function() {
294
  const chatButton = document.getElementById('chatButton');
295
  const chatWindow = document.getElementById('chatWindow');
 
57
  </div>
58
  </div>
59
  </nav>
60
+ <!-- Main Content -->
61
  <main class="container mx-auto px-4 py-8">
62
  <div class="text-center mb-10">
63
+ <h2 class="text-3xl font-bold text-blue-600 mb-2">Schedule Your Cake Delivery</h2>
64
+ <p class="text-slate-600 max-w-2xl mx-auto">Schedule delivery for your existing cake with real-time tracking and secure transport.</p>
65
  </div>
66
 
67
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
68
+ <!-- Order Form -->
69
+ <div class="bg-white rounded-xl shadow-md p-6 order-2 lg:order-1">
70
+ <h3 class="text-xl font-bold mb-6 text-blue-600">Delivery Details</h3>
71
+
72
+ <form id="orderForm" class="space-y-6">
73
+ <!-- Pickup Location -->
74
+ <div>
75
+ <label class="block text-sm font-medium text-slate-700 mb-1">Pickup Location</label>
76
+ <input type="text" id="pickupLocation" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Enter pickup address" required>
77
+ </div>
78
+
79
+ <!-- Delivery Destination -->
80
+ <div>
81
+ <label class="block text-sm font-medium text-slate-700 mb-1">Delivery Address</label>
82
+ <textarea id="deliveryAddress" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" rows="2" placeholder="Enter delivery address" required></textarea>
83
+ </div>
84
+
85
+ <!-- Map Preview -->
86
+ <div class="map-container" id="mapPreview"></div>
87
+
88
+ <!-- Cake Details -->
89
+ <div>
90
+ <h3 class="text-xl font-bold mb-4 text-blue-600">Cake Details</h3>
91
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
92
+ <div>
93
+ <label class="block text-sm font-medium text-slate-700 mb-1">Size</label>
94
+ <select id="cakeSize" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
95
+ <option value="small">Small (6 inches)</option>
96
+ <option value="medium" selected>Medium (8 inches)</option>
97
+ <option value="large">Large (10 inches)</option>
98
+ <option value="extra-large">Extra Large (12 inches)</option>
99
+ </select>
100
+ </div>
101
+ <div>
102
+ <label class="block text-sm font-medium text-slate-700 mb-1">Weight (kg)</label>
103
+ <input type="number" id="cakeWeight" min="0.5" max="10" step="0.5" value="2" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
104
+ </div>
105
+ </div>
106
+ </div>
107
+
108
+ <!-- Delivery Date/Time -->
109
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
110
+ <div>
111
+ <label class="block text-sm font-medium text-slate-700 mb-1">Delivery Date</label>
112
+ <input type="date" id="deliveryDate" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required>
113
+ </div>
114
+ <div>
115
+ <label class="block text-sm font-medium text-slate-700 mb-1">Delivery Time</label>
116
+ <input type="time" id="deliveryTime" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required>
117
+ </div>
118
+ </div>
119
+
120
+ <!-- Recipient Info -->
121
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
122
+ <div>
123
+ <label class="block text-sm font-medium text-slate-700 mb-1">Recipient Name</label>
124
+ <input type="text" id="recipientName" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="John Doe" required>
125
+ </div>
126
+ <div>
127
+ <label class="block text-sm font-medium text-slate-700 mb-1">Contact Number</label>
128
+ <input type="tel" id="contactNumber" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="+1 (555) 123-4567" required>
129
+ </div>
130
+ </div>
131
+
132
+ <!-- Pricing Summary -->
133
+ <div class="bg-blue-50 rounded-lg p-5 border border-blue-100">
134
+ <h4 class="font-bold text-lg mb-3 text-blue-700">Order Summary</h4>
135
+ <div class="space-y-2">
136
+ <div class="flex justify-between">
137
+ <span>Base Delivery Fee:</span>
138
+ <span id="basePrice">$15.00</span>
139
+ </div>
140
+ <div class="flex justify-between">
141
+ <span>Distance Fee:</span>
142
+ <span id="distancePrice">$8.50</span>
143
+ </div>
144
+ <div class="flex justify-between">
145
+ <span>Size Adjustment:</span>
146
+ <span id="sizePrice">$5.00</span>
147
+ </div>
148
+ <div class="flex justify-between">
149
+ <span>Weight Fee:</span>
150
+ <span id="weightPrice">$4.00</span>
151
+ </div>
152
+ <div class="flex justify-between">
153
+ <span>Service Fee:</span>
154
+ <span id="serviceFee">$3.25</span>
155
+ </div>
156
+ <div class="border-t border-slate-300 pt-2 mt-2 flex justify-between font-bold">
157
+ <span>Total:</span>
158
+ <span id="totalPrice" class="text-blue-600">$35.75</span>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <!-- Payment Method Selection -->
164
+ <div class="bg-white rounded-lg p-5 border border-slate-200">
165
+ <h4 class="font-bold text-lg mb-3 text-blue-700">Payment Method</h4>
166
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-3 mb-4">
167
+ <button class="payment-method border-2 border-slate-200 rounded-lg p-3 flex flex-col items-center cursor-pointer hover:border-blue-500" data-method="card">
168
+ <i data-feather="credit-card" class="w-6 h-6 mb-1"></i>
169
+ <span>Card</span>
170
+ </button>
171
+ <button class="payment-method border-2 border-slate-200 rounded-lg p-3 flex flex-col items-center cursor-pointer hover:border-blue-500" data-method="mobile">
172
+ <i data-feather="smartphone" class="w-6 h-6 mb-1"></i>
173
+ <span>Mobile Money</span>
174
+ </button>
175
+ <button class="payment-method border-2 border-slate-200 rounded-lg p-3 flex flex-col items-center cursor-pointer hover:border-blue-500" data-method="wallet">
176
+ <i data-feather="wallet" class="w-6 h-6 mb-1"></i>
177
+ <span>Wallet</span>
178
+ </button>
179
+ </div>
180
+
181
+ <!-- Card Payment Form -->
182
+ <div id="cardPaymentForm" class="hidden">
183
+ <div id="card-element" class="p-3 border border-slate-300 rounded-lg mb-3"></div>
184
+ <div id="card-errors" class="text-red-500 text-sm mb-3"></div>
185
+ </div>
186
+
187
+ <!-- Mobile Money Form -->
188
+ <div id="mobilePaymentForm" class="hidden">
189
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-3">
190
+ <div>
191
+ <label class="block text-sm font-medium text-slate-700 mb-1">Phone Number</label>
192
+ <input type="tel" id="mobileNumber" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="+1 (555) 123-4567">
193
+ </div>
194
+ <div>
195
+ <label class="block text-sm font-medium text-slate-700 mb-1">Provider</label>
196
+ <select id="mobileProvider" class="w-full px-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
197
+ <option value="mpesa">M-Pesa</option>
198
+ <option value="airtel">Airtel Money</option>
199
+ <option value="paypal">PayPal</option>
200
+ </select>
201
+ </div>
202
+ </div>
203
+ </div>
204
+
205
+ <!-- Wallet Payment -->
206
+ <div id="walletPaymentForm" class="hidden">
207
+ <div class="bg-blue-50 rounded-lg p-4 mb-3">
208
+ <div class="flex justify-between items-center">
209
+ <span>Wallet Balance:</span>
210
+ <span class="font-bold">$125.50</span>
211
+ </div>
212
+ <div class="flex justify-between items-center mt-2">
213
+ <span>Amount to Pay:</span>
214
+ <span id="walletAmount" class="font-bold text-blue-600">$35.75</span>
215
+ </div>
216
+ </div>
217
+ <div class="text-sm text-slate-600 mb-3">
218
+ <p>By confirming, $35.75 will be deducted from your wallet balance.</p>
219
+ </div>
220
+ </div>
221
+
222
+ <!-- Payment Options -->
223
+ <div class="mt-4">
224
+ <label class="flex items-center">
225
+ <input type="checkbox" id="payOnDelivery" class="rounded border-slate-300 text-blue-600 focus:ring-blue-500">
226
+ <span class="ml-2">Pay on Delivery (requires card authorization)</span>
227
+ </label>
228
+ </div>
229
+ </div>
230
+
231
+ <!-- Security Badge -->
232
+ <div class="flex items-center bg-green-50 border border-green-200 rounded-lg p-4">
233
+ <i data-feather="shield" class="text-green-500 mr-3"></i>
234
+ <div>
235
+ <h4 class="font-bold text-green-700">Safe Handling Guaranteed</h4>
236
+ <p class="text-sm text-green-600">Temperature-controlled packaging ensures your cake arrives fresh</p>
237
+ </div>
238
+ </div>
239
+
240
+ <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded-lg transition duration-300">
241
+ Pay $35.75 & Confirm Delivery
242
+ </button>
243
+ </form>
244
+ </div>
245
+
246
  <!-- Tracking Section -->
247
  <div class="order-1 lg:order-2">
248
  <div class="bg-white rounded-xl shadow-md p-6 mb-8">
 
353
  </div>
354
  </div>
355
  </main>
356
+
357
+ <!-- Floating Chat Button -->
358
  <div class="fixed bottom-6 right-6 z-50">
359
  <button id="chatButton" class="bg-blue-600 text-white rounded-full p-4 shadow-lg hover:bg-blue-700 transition duration-300">
360
  <i data-feather="message-circle" class="w-6 h-6"></i>
 
433
 
434
  // Initialize Maps
435
  document.addEventListener('DOMContentLoaded', function() {
436
+ // Map for client view
437
+ const mapPreview = L.map('mapPreview').setView([40.7128, -74.0060], 13);
438
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
439
+ attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
440
+ }).addTo(mapPreview);
441
+
442
+ L.marker([40.7128, -74.0060]).addTo(mapPreview)
443
+ .bindPopup('Pickup Location')
444
+ .openPopup();
445
+
446
  // Map for tracking
447
  const trackingMap = L.map('trackingMap').setView([40.7128, -74.0060], 14);
448
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
449
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
450
  }).addTo(trackingMap);
451
 
 
469
  iconSize: [24, 24]
470
  })
471
  }).addTo(trackingMap);
472
+
473
  // Animate rider movement
474
  let currentIndex = 1;
475
  setInterval(() => {
 
478
  riderMarker.setLatLng(routePoints[currentIndex]);
479
  }
480
  }, 3000);
481
+
482
+ // Payment method selection
483
+ const paymentMethods = document.querySelectorAll('.payment-method');
484
+ const cardPaymentForm = document.getElementById('cardPaymentForm');
485
+ const mobilePaymentForm = document.getElementById('mobilePaymentForm');
486
+ const walletPaymentForm = document.getElementById('walletPaymentForm');
487
+ const payOnDelivery = document.getElementById('payOnDelivery');
488
+ const payButton = document.querySelector('button[type="submit"]');
489
+
490
+ let selectedPaymentMethod = 'card';
491
+
492
+ // Initialize Stripe Elements
493
+ elements = stripe.elements();
494
+ const cardElement = elements.create('card');
495
+ cardElement.mount('#card-element');
496
+
497
+ // Payment method selection
498
+ paymentMethods.forEach(method => {
499
+ method.addEventListener('click', () => {
500
+ paymentMethods.forEach(m => m.classList.remove('border-blue-500'));
501
+ method.classList.add('border-blue-500');
502
+ selectedPaymentMethod = method.dataset.method;
503
+
504
+ // Show appropriate form
505
+ cardPaymentForm.classList.add('hidden');
506
+ mobilePaymentForm.classList.add('hidden');
507
+ walletPaymentForm.classList.add('hidden');
508
+
509
+ if (selectedPaymentMethod === 'card') {
510
+ cardPaymentForm.classList.remove('hidden');
511
+ } else if (selectedPaymentMethod === 'mobile') {
512
+ mobilePaymentForm.classList.remove('hidden');
513
+ } else if (selectedPaymentMethod === 'wallet') {
514
+ walletPaymentForm.classList.remove('hidden');
515
+ }
516
+ });
517
+ });
518
+
519
+ // Pay on delivery toggle
520
+ payOnDelivery.addEventListener('change', function() {
521
+ if (this.checked) {
522
+ payButton.textContent = 'Confirm Delivery (Pay on Delivery)';
523
+ } else {
524
+ payButton.textContent = 'Pay $35.75 & Confirm Delivery';
525
+ }
526
+ });
527
+
528
+ // Real-time pricing calculation
529
+ const cakeWeight = document.getElementById('cakeWeight');
530
+ const cakeSize = document.getElementById('cakeSize');
531
+ const basePrice = document.getElementById('basePrice');
532
+ const distancePrice = document.getElementById('distancePrice');
533
+ const sizePrice = document.getElementById('sizePrice');
534
+ const weightPrice = document.getElementById('weightPrice');
535
+ const serviceFee = document.getElementById('serviceFee');
536
+ const totalPrice = document.getElementById('totalPrice');
537
+
538
+ function calculatePrice() {
539
+ const base = 15;
540
+ const distance = 8.50;
541
+ const sizePrices = {
542
+ 'small': 0,
543
+ 'medium': 5,
544
+ 'large': 10,
545
+ 'extra-large': 15
546
+ };
547
+
548
+ const weightFee = parseFloat(cakeWeight.value) * 2;
549
+ const sizeFee = sizePrices[cakeSize.value];
550
+ const serviceFeeValue = 3.25;
551
+
552
+ basePrice.textContent = `$${base.toFixed(2)}`;
553
+ distancePrice.textContent = `$${distance.toFixed(2)}`;
554
+ sizePrice.textContent = `$${sizeFee.toFixed(2)}`;
555
+ weightPrice.textContent = `$${weightFee.toFixed(2)}`;
556
+ serviceFee.textContent = `$${serviceFeeValue.toFixed(2)}`;
557
+
558
+ const total = base + distance + sizeFee + weightFee + serviceFeeValue;
559
+ totalPrice.textContent = `$${total.toFixed(2)}`;
560
+ document.getElementById('walletAmount').textContent = `$${total.toFixed(2)}`;
561
+ }
562
+
563
+ cakeWeight.addEventListener('input', calculatePrice);
564
+ cakeSize.addEventListener('change', calculatePrice);
565
+
566
+ // Initial calculation
567
+ calculatePrice();
568
+
569
+ // Order form submission
570
+ const orderForm = document.getElementById('orderForm');
571
+ orderForm.addEventListener('submit', async function(e) {
572
+ e.preventDefault();
573
+
574
+ // Simulate order processing
575
+ setTimeout(() => {
576
+ // Update status indicators
577
+ document.getElementById('statusPickedUp').querySelector('div').className = 'w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center mb-1';
578
+ document.getElementById('progressBar').style.width = '33%';
579
+
580
+ // Add notification
581
+ const notificationsContainer = document.getElementById('notificationsContainer');
582
+ const newNotification = document.createElement('div');
583
+ newNotification.className = 'p-3 bg-blue-50 rounded-lg border border-blue-100';
584
+ newNotification.innerHTML = `
585
+ <div class="flex">
586
+ <i data-feather="package" class="text-blue-500 mr-2"></i>
587
+ <div>
588
+ <h4 class="font-medium">Cake Picked Up</h4>
589
+ <p class="text-sm text-slate-600">Michael has picked up your cake and is on the way to the delivery location.</p>
590
+ <p class="text-xs text-slate-500 mt-1">Just now</p>
591
+ </div>
592
+ </div>
593
+ `;
594
+ notificationsContainer.prepend(newNotification);
595
+ feather.replace();
596
+
597
+ // Simulate next status update
598
+ setTimeout(() => {
599
+ document.getElementById('statusEnRoute').querySelector('div').className = 'w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center mb-1';
600
+ document.getElementById('progressBar').style.width = '66%';
601
+
602
+ // Add notification
603
+ const newNotification2 = document.createElement('div');
604
+ newNotification2.className = 'p-3 bg-green-50 rounded-lg border border-green-100';
605
+ newNotification2.innerHTML = `
606
+ <div class="flex">
607
+ <i data-feather="navigation" class="text-green-500 mr-2"></i>
608
+ <div>
609
+ <h4 class="font-medium">En Route to Delivery</h4>
610
+ <p class="text-sm text-slate-600">Michael is 10 minutes away from the delivery location.</p>
611
+ <p class="text-xs text-slate-500 mt-1">5 mins ago</p>
612
+ </div>
613
+ </div>
614
+ `;
615
+ notificationsContainer.prepend(newNotification2);
616
+ feather.replace();
617
+
618
+ // Final status update
619
+ setTimeout(() => {
620
+ document.getElementById('statusDelivered').querySelector('div').className = 'w-8 h-8 rounded-full bg-green-500 flex items-center justify-center mb-1';
621
+ document.getElementById('progressBar').style.width = '100%';
622
+
623
+ // Add final notification
624
+ const newNotification3 = document.createElement('div');
625
+ newNotification3.className = 'p-3 bg-green-50 rounded-lg border border-green-100';
626
+ newNotification3.innerHTML = `
627
+ <div class="flex">
628
+ <i data-feather="check-circle" class="text-green-500 mr-2"></i>
629
+ <div>
630
+ <h4 class="font-medium">Delivery Successful</h4>
631
+ <p class="text-sm text-slate-600">Your cake has been delivered safely. Thank you for choosing Pastry Delivery!</p>
632
+ <p class="text-xs text-slate-500 mt-1">Just now</p>
633
+ </div>
634
+ </div>
635
+ `;
636
+ notificationsContainer.prepend(newNotification3);
637
+ feather.replace();
638
+ }, 5000);
639
+ }, 4000);
640
+ }, 2000);
641
+ });
642
  });
643
+
644
+ // Chat functionality
645
  document.addEventListener('DOMContentLoaded', function() {
646
  const chatButton = document.getElementById('chatButton');
647
  const chatWindow = document.getElementById('chatWindow');