From 712d667d8678f6f8e7a72184dcd183f01adb8aba Mon Sep 17 00:00:00 2001 From: Xor290 Date: Sun, 8 Mar 2026 15:11:28 +0100 Subject: [PATCH] chore: update --- mobile/src/api/api.ts | 3 ++- mobile/src/api/api_types.ts | 3 ++- mobile/src/screens/client/OrderHistoryScreen.tsx | 2 +- mobile/src/screens/client/OrderTrackingScreen.tsx | 7 ++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mobile/src/api/api.ts b/mobile/src/api/api.ts index 2055013b..22ebb687 100644 --- a/mobile/src/api/api.ts +++ b/mobile/src/api/api.ts @@ -381,7 +381,8 @@ export const confirmReception = async ( return { success: true, message: "Commande confirmée avec succès", - points_earned: data.points_earned || 10, + points_earned: data.points_earned || 0, + category: data.category, data, }; } catch (error: any) { diff --git a/mobile/src/api/api_types.ts b/mobile/src/api/api_types.ts index f48a34bb..a12e0783 100644 --- a/mobile/src/api/api_types.ts +++ b/mobile/src/api/api_types.ts @@ -769,8 +769,9 @@ export interface ConfirmReceptionResponse { success: boolean; message: string; points_earned?: number; + category?: string; // 'total', 'zipette&co', 'weed&hash', 'mixed' data?: { - category?: string; // ✅ Catégorie de points ('zipette&co', 'weed&hash', etc.) + category?: string; points_earned?: number; [key: string]: any; }; diff --git a/mobile/src/screens/client/OrderHistoryScreen.tsx b/mobile/src/screens/client/OrderHistoryScreen.tsx index 35404528..a6309f34 100644 --- a/mobile/src/screens/client/OrderHistoryScreen.tsx +++ b/mobile/src/screens/client/OrderHistoryScreen.tsx @@ -45,7 +45,7 @@ export default function OrderHistoryScreen() { const [orders, setOrders] = useState([]); const [stats, setStats] = useState(null); const [penalties, setPenalties] = useState(null); - const [appSettings, setAppSettings] = useState({ penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true, referral_enabled: true }); + const [appSettings, setAppSettings] = useState({ penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true, referral_enabled: false }); const [referralBalance, setReferralBalance] = useState(0); const [loading, setLoading] = useState(true); const [refreshing, setRefreshing] = useState(false); diff --git a/mobile/src/screens/client/OrderTrackingScreen.tsx b/mobile/src/screens/client/OrderTrackingScreen.tsx index c04d3a37..99f1df68 100644 --- a/mobile/src/screens/client/OrderTrackingScreen.tsx +++ b/mobile/src/screens/client/OrderTrackingScreen.tsx @@ -130,8 +130,13 @@ export default function OrderTrackingScreen() { try { const res = await confirmReception(orderId); if (res.success) { + const cat = res.category || ''; + let catLabel = ''; + if (cat === 'total') catLabel = ' (Total)'; + else if (cat.includes('zipette')) catLabel = ' (Zipette&Co)'; + else if (cat.includes('weed') || cat.includes('hash')) catLabel = ' (Weed&Hash)'; showToast( - `Livraison confirmee ! +${res.points_earned || 0} points`, + `Livraison confirmee ! +${res.points_earned || 0} points${catLabel}`, "success", ); fetchOrders();