mirror of
https://github.com/siop-spelev/siop2.git
synced 2026-08-08 12:41:54 +00:00
feat(r6): R6.3 — Ressources sur mobile (Stock, Tiers, Fichiers)
api/ressources.ts (usePartners, useParts/usePart, useCreatePurchaseOrder, useDocuments). Écran Stock (sous-seuil en tête) + fiche pièce + "Commander" pré-rempli en une ligne (fournisseur figé, quantité = manquant jusqu'au seuil, prix = dernier connu — BC multi-lignes détaillé réservé au web, D4). Tiers en lecture seule (création/édition réservées au web). Fichiers en métadonnées seules — l'ouverture demande expo-sharing (dépendance native absente, donc un nouveau build natif) : différée explicitement plutôt qu'ajoutée à la légère au milieu de cette passe. Menu : Stock & achats / Tiers / Fichiers routent réellement. Typecheck propre, 17 tests Jest, lint 5/5 paquets. Contrat non touché, toutes les opérations utilisées existaient déjà depuis R3. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
67
apps/mobile/app/tiers/index.tsx
Normal file
67
apps/mobile/app/tiers/index.tsx
Normal file
@@ -0,0 +1,67 @@
|
||||
import { FlatList, Text, View } from 'react-native';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { usePartners } from '@/api/ressources';
|
||||
import { EnteteFiche } from '@/composants/ui';
|
||||
import { useTokens } from '@/theme/tokens';
|
||||
|
||||
/** Tiers — R6.3 (Ressources). Consultation seule sur mobile (D4) : la
|
||||
* création/édition de fournisseurs et clients reste au web pour l'instant. */
|
||||
export default function PageTiers() {
|
||||
const t = useTokens();
|
||||
const { data: partners } = usePartners();
|
||||
const tiers = [...(partners ?? [])].sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: t.fond }} edges={['top']}>
|
||||
<View style={{ flex: 1, padding: 14, gap: 10 }}>
|
||||
<EnteteFiche titre="Tiers" />
|
||||
<FlatList
|
||||
data={tiers}
|
||||
keyExtractor={(p) => p.id}
|
||||
contentContainerStyle={{ gap: 8, paddingBottom: 12 }}
|
||||
ListEmptyComponent={
|
||||
<Text style={{ color: t.encre3, fontFamily: 'Manrope_600SemiBold', padding: 16, textAlign: 'center' }}>
|
||||
Aucun tiers accessible.
|
||||
</Text>
|
||||
}
|
||||
renderItem={({ item: p }) => (
|
||||
<View
|
||||
style={{
|
||||
backgroundColor: t.surface,
|
||||
borderColor: t.bordure,
|
||||
borderWidth: 1,
|
||||
borderRadius: 12,
|
||||
padding: 12,
|
||||
gap: 2,
|
||||
opacity: p.isActive ? 1 : 0.55,
|
||||
}}
|
||||
>
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
|
||||
<Text style={{ flex: 1, fontFamily: 'Manrope_700Bold', fontSize: 14, color: t.encre }}>
|
||||
{p.name}
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
fontFamily: 'Manrope_700Bold',
|
||||
fontSize: 10.5,
|
||||
color: p.kind === 'SUPPLIER' ? t.stOuvert : t.stEncours,
|
||||
backgroundColor: p.kind === 'SUPPLIER' ? t.stOuvertFond : t.stEncoursFond,
|
||||
paddingHorizontal: 8,
|
||||
paddingVertical: 2,
|
||||
borderRadius: 999,
|
||||
}}
|
||||
>
|
||||
{p.kind === 'SUPPLIER' ? 'Fournisseur' : 'Client'}
|
||||
</Text>
|
||||
</View>
|
||||
<Text style={{ fontFamily: 'Manrope_400Regular', fontSize: 12, color: t.encre2 }}>
|
||||
{[p.contactName, p.phone, p.city].filter(Boolean).join(' · ') || '—'}
|
||||
{p.kind === 'SUPPLIER' && p.openOrders ? ` · ${p.openOrders} BC en cours` : ''}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
/>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user