App : onglets Scan | Configuration pour le Dirigeant
Scan : scanner, chiffres du jour, campagne, statistiques, historique. Configuration : modules, employés, carte de fidélité (espace web), mon compte. L'employé garde un écran unique sans onglets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a1f6db8819
commit
a510efc496
1 changed files with 93 additions and 39 deletions
|
|
@ -59,6 +59,7 @@ function Counter() {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const [summary, setSummary] = useState<Summary | null>(null);
|
const [summary, setSummary] = useState<Summary | null>(null);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
|
const [tab, setTab] = useState<'scan' | 'config'>('scan');
|
||||||
|
|
||||||
const load = useCallback(async () => {
|
const load = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -113,49 +114,102 @@ function Counter() {
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Pressable
|
{isManager && (
|
||||||
accessibilityRole="button"
|
<View accessibilityRole="tablist" style={{ flexDirection: 'row', backgroundColor: c.surface, borderRadius: 14, padding: 4, borderWidth: 1, borderColor: c.border }}>
|
||||||
accessibilityLabel="Scanner une carte"
|
{(
|
||||||
onPress={() => router.push('/scan')}
|
[
|
||||||
style={({ pressed }) => ({
|
['scan', 'Scan'],
|
||||||
backgroundColor: pressed ? c.primaryPressed : c.primary,
|
['config', 'Configuration'],
|
||||||
borderRadius: 24,
|
] as const
|
||||||
paddingVertical: 48,
|
).map(([k, label]) => (
|
||||||
alignItems: 'center',
|
<Pressable
|
||||||
gap: 14,
|
key={k}
|
||||||
})}
|
accessibilityRole="tab"
|
||||||
>
|
accessibilityState={{ selected: tab === k }}
|
||||||
<View style={{ width: 64, height: 64, borderRadius: 32, backgroundColor: 'rgba(255,255,255,0.18)', alignItems: 'center', justifyContent: 'center' }}>
|
onPress={() => setTab(k)}
|
||||||
<ScanIcon color={c.onPrimary} />
|
style={{ flex: 1, paddingVertical: 10, borderRadius: 10, alignItems: 'center', backgroundColor: tab === k ? c.primary : 'transparent' }}
|
||||||
</View>
|
>
|
||||||
<T style={{ color: c.onPrimary, fontFamily: font.bold, fontSize: 24 }}>Scanner une carte</T>
|
<T style={{ fontFamily: font.bold, fontSize: 15, color: tab === k ? c.onPrimary : c.text }}>{label}</T>
|
||||||
<T style={{ color: c.onPrimary, opacity: 0.85, fontSize: 15 }}>QR code du Wallet du client</T>
|
</Pressable>
|
||||||
</Pressable>
|
|
||||||
|
|
||||||
<View style={{ gap: 10 }}>
|
|
||||||
<T v="h2">{isManager ? "Aujourd'hui au magasin" : "Mes opérations aujourd'hui"}</T>
|
|
||||||
<View style={{ flexDirection: 'row', gap: 12 }}>
|
|
||||||
{[
|
|
||||||
[summary?.operations ?? '—', 'opérations'],
|
|
||||||
[summary?.pointsGiven ?? '—', `${u} donnés`],
|
|
||||||
[summary?.rewards ?? '—', 'récompenses'],
|
|
||||||
].map(([n, l]) => (
|
|
||||||
<Card key={String(l)} style={{ flex: 1, padding: 14, gap: 2 }}>
|
|
||||||
<T style={{ fontFamily: font.extrabold, fontSize: 26 }}>{n}</T>
|
|
||||||
<T v="muted" style={{ fontSize: 13 }}>{l}</T>
|
|
||||||
</Card>
|
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
)}
|
||||||
|
|
||||||
<View style={{ flex: 1 }} />
|
{tab === 'config' && isManager ? (
|
||||||
{isManager && <Button label="Modules" variant="secondary" onPress={() => router.push('/loyalty')} />}
|
<ConfigTab />
|
||||||
{isManager && <Button label="Campagnes" variant="secondary" onPress={() => router.push('/campaigns')} />}
|
) : (
|
||||||
{isManager && <Button label="Employés" variant="secondary" onPress={() => router.push('/team')} />}
|
<>
|
||||||
{isManager && <Button label="Statistiques" variant="secondary" onPress={() => router.push('/stats')} />}
|
<Pressable
|
||||||
<Button label="Historique des opérations" variant="secondary" onPress={() => router.push('/history')} />
|
accessibilityRole="button"
|
||||||
<Button label="Mon compte" variant="secondary" onPress={() => router.push('/account')} />
|
accessibilityLabel="Scanner une carte"
|
||||||
|
onPress={() => router.push('/scan')}
|
||||||
|
style={({ pressed }) => ({
|
||||||
|
backgroundColor: pressed ? c.primaryPressed : c.primary,
|
||||||
|
borderRadius: 24,
|
||||||
|
paddingVertical: 48,
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: 14,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<View style={{ width: 64, height: 64, borderRadius: 32, backgroundColor: 'rgba(255,255,255,0.18)', alignItems: 'center', justifyContent: 'center' }}>
|
||||||
|
<ScanIcon color={c.onPrimary} />
|
||||||
|
</View>
|
||||||
|
<T style={{ color: c.onPrimary, fontFamily: font.bold, fontSize: 24 }}>Scanner une carte</T>
|
||||||
|
<T style={{ color: c.onPrimary, opacity: 0.85, fontSize: 15 }}>QR code du Wallet du client</T>
|
||||||
|
</Pressable>
|
||||||
|
|
||||||
|
<View style={{ gap: 10 }}>
|
||||||
|
<T v="h2">{isManager ? "Aujourd'hui au magasin" : "Mes opérations aujourd'hui"}</T>
|
||||||
|
<View style={{ flexDirection: 'row', gap: 12 }}>
|
||||||
|
{[
|
||||||
|
[summary?.operations ?? '—', 'opérations'],
|
||||||
|
[summary?.pointsGiven ?? '—', `${u} donnés`],
|
||||||
|
[summary?.rewards ?? '—', 'récompenses'],
|
||||||
|
].map(([n, l]) => (
|
||||||
|
<Card key={String(l)} style={{ flex: 1, padding: 14, gap: 2 }}>
|
||||||
|
<T style={{ fontFamily: font.extrabold, fontSize: 26 }}>{n}</T>
|
||||||
|
<T v="muted" style={{ fontSize: 13 }}>{l}</T>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
{isManager && <Button label="Envoyer une campagne" variant="secondary" onPress={() => router.push('/campaigns')} />}
|
||||||
|
{isManager && <Button label="Statistiques" variant="secondary" onPress={() => router.push('/stats')} />}
|
||||||
|
<Button label="Historique des opérations" variant="secondary" onPress={() => router.push('/history')} />
|
||||||
|
{!isManager && <Button label="Mon compte" variant="secondary" onPress={() => router.push('/account')} />}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Onglet Configuration (Dirigeant) : tout ce qui se règle. */
|
||||||
|
function ConfigTab() {
|
||||||
|
const c = useColors();
|
||||||
|
const rows: [string, string, () => void][] = [
|
||||||
|
['Modules', 'Campagnes, relances, anniversaire, avis Google, parrainage : activation, textes et récompenses', () => router.push('/loyalty')],
|
||||||
|
['Employés', 'Comptes, rôles Employé / Dirigeant, mots de passe', () => router.push('/team')],
|
||||||
|
['Carte de fidélité', 'Logo, couleurs, règle de points, récompenses (espace web)', () => Linking.openURL(ESPACE_URL)],
|
||||||
|
['Mon compte', 'Mot de passe', () => router.push('/account')],
|
||||||
|
];
|
||||||
|
return (
|
||||||
|
<View style={{ gap: 12 }}>
|
||||||
|
{rows.map(([title, sub, go]) => (
|
||||||
|
<Pressable key={title} accessibilityRole="button" onPress={go}>
|
||||||
|
{({ pressed }) => (
|
||||||
|
<Card style={{ padding: 16, gap: 4, opacity: pressed ? 0.7 : 1 }}>
|
||||||
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||||
|
<T style={{ fontFamily: font.bold, fontSize: 17 }}>{title}</T>
|
||||||
|
<T style={{ color: c.text3, fontSize: 20 }}>›</T>
|
||||||
|
</View>
|
||||||
|
<T v="muted" style={{ fontSize: 14 }}>{sub}</T>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
</Pressable>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue