diff --git a/frontend-admin/src/navigation/CabineNavigator.tsx b/frontend-admin/src/navigation/CabineNavigator.tsx index c3fc22c7..30136cd0 100644 --- a/frontend-admin/src/navigation/CabineNavigator.tsx +++ b/frontend-admin/src/navigation/CabineNavigator.tsx @@ -25,6 +25,7 @@ import OrdersScreen from "../screens/cabine/OrdersScreen"; import DeliveryScreen from "../screens/cabine/DeliveryScreen"; import UsersScreen from "../screens/cabine/UsersScreen"; import AlertsScreen from "../screens/cabine/AlertsScreen"; +import AddressScreen from "../screens/cabine/AddressScreen"; const Tab = createBottomTabNavigator(); @@ -42,7 +43,9 @@ export default function CabineNavigator() { const res = await getCabineNotifications(); setNotifications(res.notifications ?? []); setUnreadCount(res.unread_count ?? 0); - } catch { /* ignore */ } + } catch { + /* ignore */ + } }, []); useEffect(() => { @@ -59,8 +62,12 @@ export default function CabineNavigator() { try { await markCabineNotificationsRead(); setUnreadCount(0); - setNotifications((prev) => prev.map((n) => ({ ...n, read: true }))); - } catch { /* ignore */ } + setNotifications((prev) => + prev.map((n) => ({ ...n, read: true })), + ); + } catch { + /* ignore */ + } } }; @@ -106,11 +113,16 @@ export default function CabineNavigator() { - {unreadCount > 9 ? "9+" : unreadCount} + {unreadCount > 9 + ? "9+" + : unreadCount} )} @@ -121,7 +133,11 @@ export default function CabineNavigator() { style={{ marginRight: spacing.m }} > @@ -151,7 +167,11 @@ export default function CabineNavigator() { options={{ title: "Dashboard", tabBarIcon: ({ color, size }) => ( - + ), }} /> @@ -161,7 +181,11 @@ export default function CabineNavigator() { options={{ title: "Commandes", tabBarIcon: ({ color, size }) => ( - + ), }} /> @@ -171,7 +195,11 @@ export default function CabineNavigator() { options={{ title: "Livreurs", tabBarIcon: ({ color, size }) => ( - + ), }} /> @@ -181,7 +209,11 @@ export default function CabineNavigator() { options={{ title: "Clients", tabBarIcon: ({ color, size }) => ( - + ), }} /> @@ -191,7 +223,25 @@ export default function CabineNavigator() { options={{ title: "Alertes", tabBarIcon: ({ color, size }) => ( - + + ), + }} + /> + ( + ), }} /> @@ -211,16 +261,32 @@ export default function CabineNavigator() { ]} > - + Notifications - setModalVisible(false)}> - + setModalVisible(false)} + > + {notifications.length === 0 ? ( - + Aucune notification ) : ( @@ -235,7 +301,8 @@ export default function CabineNavigator() { : colors.info, backgroundColor: n.read ? "transparent" - : colors.bgPrimary ?? colors.bgSecondary, + : (colors.bgPrimary ?? + colors.bgSecondary), }, ]} > @@ -248,7 +315,10 @@ export default function CabineNavigator() { {n.message} {formatTime(n.created_at)} diff --git a/frontend-admin/src/navigation/types.ts b/frontend-admin/src/navigation/types.ts index e1bffc92..51cd5bdc 100644 --- a/frontend-admin/src/navigation/types.ts +++ b/frontend-admin/src/navigation/types.ts @@ -1,37 +1,38 @@ export type AuthStackParamList = { - RoleSelect: undefined; - AdminLogin: undefined; - CabineLogin: undefined; - DeliveryLogin: undefined; + RoleSelect: undefined; + AdminLogin: undefined; + CabineLogin: undefined; + DeliveryLogin: undefined; }; export type AdminTabParamList = { - Dashboard: undefined; - Orders: undefined; - Users: undefined; - Products: undefined; - Categories: undefined; - Delivery: undefined; - Alerts: undefined; - Addresses: undefined; + Dashboard: undefined; + Orders: undefined; + Users: undefined; + Products: undefined; + Categories: undefined; + Delivery: undefined; + Alerts: undefined; + Addresses: undefined; }; export type AdminStackParamList = { - AdminTabs: undefined; - OrderDetail: { orderId: number }; - Settings: undefined; + AdminTabs: undefined; + OrderDetail: { orderId: number }; + Settings: undefined; }; export type CabineTabParamList = { - Dashboard: undefined; - Orders: undefined; - Delivery: undefined; - Users: undefined; - Alerts: undefined; + Dashboard: undefined; + Orders: undefined; + Delivery: undefined; + Users: undefined; + Alerts: undefined; + Adresses: undefined; }; export type DeliveryTabParamList = { - Dashboard: undefined; - Stats: undefined; - Alerts: undefined; + Dashboard: undefined; + Stats: undefined; + Alerts: undefined; }; diff --git a/frontend-admin/src/screens/admin/SettingsScreen.tsx b/frontend-admin/src/screens/admin/SettingsScreen.tsx index 1d9c416d..7af7f051 100644 --- a/frontend-admin/src/screens/admin/SettingsScreen.tsx +++ b/frontend-admin/src/screens/admin/SettingsScreen.tsx @@ -319,15 +319,10 @@ export default function SettingsScreen() { const ZIP_COLOR = "#9333ea"; const TOTAL_COLOR = "#f97316"; - // Le mode séparé nécessite que W ET Z aient au moins une catégorie - const hasBothPools = - (settings.points_categories_weed ?? []).length > 0 && - (settings.points_categories_zipette ?? []).length > 0; - // Chips disponibles selon le mode const availableChips: PoolAssignment[] = settings.points_separated - ? ["weed", "zipette", "none"] // mode séparé : T désactivé - : ["total", "none"]; // mode non-séparé : W/Z désactivés + ? ["weed", "zipette", "none"] // mode séparé : T désactivé + : ["total", "none"]; // mode non-séparé : W/Z désactivés return ( @@ -411,20 +406,16 @@ export default function SettingsScreen() { thumbColor="#fff" /> - + Points séparés par pool - Activé : Weed → point / Zipette → point_zipette{"\n"} - Désactivé : Barème Total sur la somme W+Z{"\n"} - {!hasBothPools && ( - "⚠️ Nécessite des catégories W ET Z configurées" - )} + Activé : barèmes Weed + Zipette utilisés séparément{"\n"} + Désactivé : barème Total utilisé (catégorie T) setSettings((prev) => ({ ...prev, points_separated: v })) } @@ -542,36 +533,31 @@ export default function SettingsScreen() { )} - {/* Barème de points — conditionnel selon le mode */} - {settings.points_separated ? ( - <> - setSettings((p) => ({ ...p, points_weed_tiers: tiers }))} - colors={colors} - s={s} - accentColor={WEED_COLOR} - /> - setSettings((p) => ({ ...p, points_zipette_tiers: tiers }))} - colors={colors} - s={s} - accentColor={ZIP_COLOR} - /> - - ) : ( - setSettings((p) => ({ ...p, points_total_tiers: tiers }))} - colors={colors} - s={s} - accentColor={TOTAL_COLOR} - /> - )} + {/* Barèmes de points — toujours présents */} + setSettings((p) => ({ ...p, points_weed_tiers: tiers }))} + colors={colors} + s={s} + accentColor={WEED_COLOR} + /> + setSettings((p) => ({ ...p, points_zipette_tiers: tiers }))} + colors={colors} + s={s} + accentColor={ZIP_COLOR} + /> + setSettings((p) => ({ ...p, points_total_tiers: tiers }))} + colors={colors} + s={s} + accentColor={TOTAL_COLOR} + />