Synchronize order and delivery statuses and dates in the calendar view

Fixes an issue where orders linked to delivered deliveries were not displaying the correct delivery date or status in the calendar. This includes updating the OrderDetailModal to show the correct dates, automatically updating order statuses when deliveries are marked as delivered, and providing a SQL script to correct existing data inconsistencies.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a8a78c07-e900-425c-a577-5b4c5894379d
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a8a78c07-e900-425c-a577-5b4c5894379d/0tRkXvo
This commit is contained in:
michaelschal committed 2025-08-11 20:24:42 +00:00
1 parent 0e2f017305
commit d14a4a31f6
6 files changed
+128 -2

No files matched your search

@@ -292,7 +292,12 @@ export default function OrderDetailModal({
<div>
<p className="font-medium text-gray-900">#LIV-{delivery.id}</p>
<p className="text-sm text-gray-600">
{safeFormat(delivery.plannedDate, 'dd MMMM yyyy')}
{delivery.status === 'delivered' && delivery.deliveredDate
? `Livré le ${safeFormat(delivery.deliveredDate, 'dd MMMM yyyy')}`
: delivery.scheduledDate
? `Prévu le ${safeFormat(delivery.scheduledDate, 'dd MMMM yyyy')}`
: 'Date non disponible'
}
</p>
</div>
</div>