193 lines
5.7 KiB
Dart
193 lines
5.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
import '../../../members/data/models/membre_complete_model.dart';
|
|
|
|
/// Widget d'affichage du statut KYC (Know Your Customer) d'un membre.
|
|
/// Affiche en lecture seule le niveau de vigilance, le statut de vérification,
|
|
/// et la date de vérification d'identité (conformité LCB-FT).
|
|
class KycStatusWidget extends StatelessWidget {
|
|
final NiveauVigilanceKyc? niveauVigilance;
|
|
final StatutKyc? statutKyc;
|
|
final DateTime? dateVerification;
|
|
|
|
const KycStatusWidget({
|
|
super.key,
|
|
this.niveauVigilance,
|
|
this.statutKyc,
|
|
this.dateVerification,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final colorScheme = theme.colorScheme;
|
|
|
|
return Card(
|
|
margin: const EdgeInsets.all(16),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
Icons.verified_user,
|
|
color: colorScheme.primary,
|
|
size: 24,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'Vérification KYC (Anti-blanchiment)',
|
|
style: theme.textTheme.titleMedium?.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
color: colorScheme.primary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
'Conformité LCB-FT (Lutte contre le Blanchiment)',
|
|
style: theme.textTheme.bodySmall?.copyWith(
|
|
color: colorScheme.onSurfaceVariant,
|
|
fontStyle: FontStyle.italic,
|
|
),
|
|
),
|
|
const Divider(height: 24),
|
|
_buildInfoRow(
|
|
context,
|
|
'Statut de vérification',
|
|
_getStatutKycLabel(statutKyc),
|
|
_getStatutKycColor(statutKyc),
|
|
),
|
|
const SizedBox(height: 12),
|
|
_buildInfoRow(
|
|
context,
|
|
'Niveau de vigilance',
|
|
_getNiveauVigilanceLabel(niveauVigilance),
|
|
_getNiveauVigilanceColor(niveauVigilance),
|
|
),
|
|
if (dateVerification != null) ...[
|
|
const SizedBox(height: 12),
|
|
_buildInfoRow(
|
|
context,
|
|
'Date de vérification',
|
|
DateFormat('dd/MM/yyyy').format(dateVerification!),
|
|
colorScheme.onSurface,
|
|
),
|
|
],
|
|
const SizedBox(height: 16),
|
|
Container(
|
|
padding: const EdgeInsets.all(12),
|
|
decoration: BoxDecoration(
|
|
color: colorScheme.primaryContainer.withOpacity(0.3),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
Icons.info_outline,
|
|
size: 16,
|
|
color: colorScheme.primary,
|
|
),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
child: Text(
|
|
'Ces informations sont gérées par l\'administrateur et permettent de garantir la conformité aux normes BCEAO/OHADA.',
|
|
style: theme.textTheme.bodySmall?.copyWith(
|
|
color: colorScheme.onSurface,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildInfoRow(
|
|
BuildContext context,
|
|
String label,
|
|
String value,
|
|
Color valueColor,
|
|
) {
|
|
return Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
flex: 2,
|
|
child: Text(
|
|
label,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 3,
|
|
child: Text(
|
|
value,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
color: valueColor,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
String _getStatutKycLabel(StatutKyc? statut) {
|
|
if (statut == null) return 'Non renseigné';
|
|
switch (statut) {
|
|
case StatutKyc.nonVerifie:
|
|
return '⏸️ Non vérifié';
|
|
case StatutKyc.enCours:
|
|
return '⏳ En cours de vérification';
|
|
case StatutKyc.verifie:
|
|
return '✅ Vérifié';
|
|
case StatutKyc.refuse:
|
|
return '❌ Refusé';
|
|
}
|
|
}
|
|
|
|
Color _getStatutKycColor(StatutKyc? statut) {
|
|
if (statut == null) return Colors.grey;
|
|
switch (statut) {
|
|
case StatutKyc.nonVerifie:
|
|
return Colors.orange;
|
|
case StatutKyc.enCours:
|
|
return Colors.blue;
|
|
case StatutKyc.verifie:
|
|
return Colors.green;
|
|
case StatutKyc.refuse:
|
|
return Colors.red;
|
|
}
|
|
}
|
|
|
|
String _getNiveauVigilanceLabel(NiveauVigilanceKyc? niveau) {
|
|
if (niveau == null) return 'Non renseigné';
|
|
switch (niveau) {
|
|
case NiveauVigilanceKyc.simplifie:
|
|
return '🔵 Simplifiée';
|
|
case NiveauVigilanceKyc.renforce:
|
|
return '🔴 Renforcée';
|
|
}
|
|
}
|
|
|
|
Color _getNiveauVigilanceColor(NiveauVigilanceKyc? niveau) {
|
|
if (niveau == null) return Colors.grey;
|
|
switch (niveau) {
|
|
case NiveauVigilanceKyc.simplifie:
|
|
return Colors.blue;
|
|
case NiveauVigilanceKyc.renforce:
|
|
return Colors.deepOrange;
|
|
}
|
|
}
|
|
}
|