chore: update
This commit is contained in:
@@ -118,8 +118,6 @@ const getStatusColor = (status: string): string => {
|
||||
return 'linear-gradient(135deg, #ddd6fe 0%, #a78bfa 50%, #7c3aed 100%)';
|
||||
case 'assigned':
|
||||
return 'linear-gradient(135deg, #fef3c7 0%, #fbbf24 50%, #f59e0b 100%)';
|
||||
case 'support':
|
||||
return 'linear-gradient(135deg, #e9d5ff 0%, #c084fc 50%, #9333ea 100%)';
|
||||
case 'en_route':
|
||||
return 'linear-gradient(135deg, #bfdbfe 0%, #60a5fa 50%, #3b82f6 100%)';
|
||||
case 'arrived':
|
||||
@@ -139,7 +137,6 @@ const getStatusLabel = (status: string): string => {
|
||||
const statusMap: Record<string, string> = {
|
||||
'pending': 'En attente d\'assignation',
|
||||
'assigned': 'Livreur assigné',
|
||||
'support': 'Pris en charge par le livreur',
|
||||
'en_route': 'En route vers vous',
|
||||
'arrived': 'Livreur arrivé',
|
||||
'livre': 'Livré - À confirmer',
|
||||
@@ -154,7 +151,6 @@ const getStatusIcon = (status: string): any => {
|
||||
const iconMap: Record<string, any> = {
|
||||
'pending': faHourglassHalf,
|
||||
'assigned': faBiking,
|
||||
'support': faTruck,
|
||||
'en_route': faTruck,
|
||||
'arrived': faMapMarkerAlt,
|
||||
'livre': faBox,
|
||||
@@ -169,7 +165,6 @@ const getStatusProgress = (status: string): number => {
|
||||
const progressMap: Record<string, number> = {
|
||||
'pending': 0,
|
||||
'assigned': 10,
|
||||
'support': 25,
|
||||
'en_route': 50,
|
||||
'arrived': 80,
|
||||
'livre': 90,
|
||||
@@ -444,14 +439,15 @@ function SuiviLivraison() {
|
||||
|
||||
if (response.success) {
|
||||
const pointsEarned = response.points_earned || selectedOrderPoints;
|
||||
const responseData = (response as any).data || {};
|
||||
const apiCategory = responseData.category || '';
|
||||
|
||||
const apiCategory = response.category || (response as any).data?.category || '';
|
||||
|
||||
let displayCategory = selectedOrderCategoryDisplay;
|
||||
if (apiCategory.toLowerCase().includes('zipette')) {
|
||||
if (apiCategory === 'total') {
|
||||
displayCategory = '🏆 Total';
|
||||
} else if (apiCategory.toLowerCase().includes('zipette')) {
|
||||
displayCategory = '💨 Zipette&Co';
|
||||
} else if (apiCategory.toLowerCase().includes('weed') || apiCategory.toLowerCase().includes('hash')) {
|
||||
displayCategory = '🌿 Weeds&Hash';
|
||||
displayCategory = '🌿 Weed&Hash';
|
||||
}
|
||||
|
||||
showToast(
|
||||
@@ -604,12 +600,21 @@ function SuiviLivraison() {
|
||||
>
|
||||
<div className="order-header-left">
|
||||
<h3>Commande #{order.id}</h3>
|
||||
<div
|
||||
<div
|
||||
className="status-badge"
|
||||
style={{ backgroundImage: getStatusColor(order.status) }}
|
||||
>
|
||||
<FontAwesomeIcon icon={getStatusIcon(order.status)} /> {getStatusLabel(order.status)}
|
||||
</div>
|
||||
{order.eta?.eta_available && order.eta.eta_minutes > 0 && (
|
||||
<div className={`eta-badge${order.status?.toLowerCase() === 'assigned' ? ' eta-badge--preRoute' : ''}`}>
|
||||
<FontAwesomeIcon icon={faClock} />
|
||||
{order.status?.toLowerCase() === 'assigned'
|
||||
? ` Arrivée estimée ~${order.eta.eta_minutes} min`
|
||||
: ` ~${order.eta.eta_minutes} min`}
|
||||
{order.eta.estimated_arrival && ` (${order.eta.estimated_arrival})`}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="order-header-right">
|
||||
@@ -660,12 +665,20 @@ function SuiviLivraison() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{order.eta && (
|
||||
{order.eta?.eta_available && order.eta.eta_minutes > 0 && (
|
||||
<div className="detail-section">
|
||||
<h4><FontAwesomeIcon icon={faClock} /> Heure estimée d'arrivée</h4>
|
||||
<p>{order.eta.estimated_arrival || `${order.eta.eta_minutes} minutes`}</p>
|
||||
{order.eta.updated_at && (
|
||||
<small>Mise à jour: {new Date(order.eta.updated_at * 1000).toLocaleTimeString()}</small>
|
||||
<h4>
|
||||
<FontAwesomeIcon icon={faClock} />
|
||||
{order.status?.toLowerCase() === 'assigned'
|
||||
? ' Temps d\'arrivée estimé'
|
||||
: ' Heure estimée d\'arrivée'}
|
||||
</h4>
|
||||
<p>~{order.eta.eta_minutes} min{order.eta.estimated_arrival ? ` — arrivée vers ${order.eta.estimated_arrival}` : ''}</p>
|
||||
{order.status?.toLowerCase() === 'assigned' && (
|
||||
<small>Le livreur n'a pas encore démarré — estimation basée sur sa position actuelle</small>
|
||||
)}
|
||||
{order.eta.livreur_distance != null && (
|
||||
<small>Distance : {typeof order.eta.livreur_distance === 'number' ? order.eta.livreur_distance.toFixed(1) : order.eta.livreur_distance} km</small>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user