feat: Version 3.3.4 - Nouvelle architecture pages, optimisations widgets Flutter et API
- Mise à jour VERSION vers 3.3.4 - Optimisations et révisions architecture API (deploy-api.sh, scripts de migration) - Ajout documentation Stripe Tap to Pay complète - Migration vers polices Inter Variable pour Flutter - Optimisations build Android et nettoyage fichiers temporaires - Amélioration système de déploiement avec gestion backups - Ajout scripts CRON et migrations base de données 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:geosector_app/core/data/models/passage_model.dart';
|
||||
import 'package:geosector_app/core/constants/app_keys.dart';
|
||||
import 'package:geosector_app/core/utils/api_exception.dart';
|
||||
import 'package:geosector_app/core/services/current_amicale_service.dart';
|
||||
import 'package:geosector_app/presentation/widgets/passage_form_dialog.dart';
|
||||
import 'package:geosector_app/app.dart';
|
||||
|
||||
class PassageMapDialog extends StatelessWidget {
|
||||
@@ -24,78 +25,14 @@ class PassageMapDialog extends StatelessWidget {
|
||||
// Récupérer le type de passage
|
||||
final String typePassage =
|
||||
AppKeys.typesPassages[type]?['titre'] ?? 'Inconnu';
|
||||
// Utiliser couleur2 pour le badge (couleur1 peut être blanche pour type 2)
|
||||
final Color typeColor =
|
||||
Color(AppKeys.typesPassages[type]?['couleur1'] ?? 0xFF9E9E9E);
|
||||
Color(AppKeys.typesPassages[type]?['couleur2'] ?? 0xFF9E9E9E);
|
||||
|
||||
// Construire l'adresse complète
|
||||
final String adresse =
|
||||
'${passage.numero} ${passage.rueBis} ${passage.rue}'.trim();
|
||||
|
||||
// Informations sur l'étage, l'appartement et la résidence (si habitat = 2)
|
||||
String? etageInfo;
|
||||
String? apptInfo;
|
||||
String? residenceInfo;
|
||||
if (passage.fkHabitat == 2) {
|
||||
if (passage.niveau.isNotEmpty) {
|
||||
etageInfo = 'Étage ${passage.niveau}';
|
||||
}
|
||||
if (passage.appt.isNotEmpty) {
|
||||
apptInfo = 'Appt. ${passage.appt}';
|
||||
}
|
||||
if (passage.residence.isNotEmpty) {
|
||||
residenceInfo = passage.residence;
|
||||
}
|
||||
}
|
||||
|
||||
// Formater la date (uniquement si le type n'est pas 2 et si la date existe)
|
||||
String? dateInfo;
|
||||
if (type != 2 && passage.passedAt != null) {
|
||||
final date = passage.passedAt!;
|
||||
dateInfo =
|
||||
'${_formatDate(date)} à ${date.hour}h${date.minute.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
// Récupérer le nom du passage (si le type n'est pas 6 - Maison vide)
|
||||
String? nomInfo;
|
||||
if (type != 6 && passage.name.isNotEmpty) {
|
||||
nomInfo = passage.name;
|
||||
}
|
||||
|
||||
// Récupérer les informations de règlement si le type est 1 (Effectué) ou 5 (Lot)
|
||||
Widget? reglementInfo;
|
||||
if ((type == 1 || type == 5) && passage.fkTypeReglement > 0) {
|
||||
final int typeReglementId = passage.fkTypeReglement;
|
||||
final String montant = passage.montant;
|
||||
|
||||
// Récupérer les informations du type de règlement
|
||||
if (AppKeys.typesReglements.containsKey(typeReglementId)) {
|
||||
final Map<String, dynamic> typeReglement =
|
||||
AppKeys.typesReglements[typeReglementId]!;
|
||||
final String titre = typeReglement['titre'] as String;
|
||||
final Color couleur = Color(typeReglement['couleur'] as int);
|
||||
final IconData iconData = typeReglement['icon_data'] as IconData;
|
||||
|
||||
reglementInfo = Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
margin: const EdgeInsets.only(top: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: couleur.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(color: couleur.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(iconData, color: couleur, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text('$titre: $montant €',
|
||||
style:
|
||||
TextStyle(color: couleur, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Vérifier si l'utilisateur peut supprimer (admin ou user avec permission)
|
||||
bool canDelete = isAdmin;
|
||||
if (!isAdmin) {
|
||||
@@ -122,93 +59,39 @@ class PassageMapDialog extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Passage #${passage.id}',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: typeColor.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
typePassage,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: typeColor,
|
||||
),
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Afficher en premier si le passage n'est pas affecté à un secteur
|
||||
if (passage.fkSector == null) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.withValues(alpha: 0.1),
|
||||
border: Border.all(color: Colors.red, width: 1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.warning, color: Colors.red, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
const Expanded(
|
||||
child: Text(
|
||||
'Ce passage n\'est plus affecté à un secteur',
|
||||
style: TextStyle(
|
||||
color: Colors.red, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Adresse
|
||||
_buildInfoRow(Icons.location_on, 'Adresse',
|
||||
adresse.isEmpty ? 'Non renseignée' : adresse),
|
||||
|
||||
// Adresse
|
||||
_buildInfoRow(Icons.location_on, 'Adresse',
|
||||
adresse.isEmpty ? 'Non renseignée' : adresse),
|
||||
|
||||
// Résidence
|
||||
if (residenceInfo != null)
|
||||
_buildInfoRow(Icons.apartment, 'Résidence', residenceInfo),
|
||||
|
||||
// Étage et appartement
|
||||
if (etageInfo != null || apptInfo != null)
|
||||
_buildInfoRow(Icons.stairs, 'Localisation',
|
||||
[etageInfo, apptInfo].where((e) => e != null).join(' - ')),
|
||||
|
||||
// Date
|
||||
if (dateInfo != null)
|
||||
_buildInfoRow(Icons.calendar_today, 'Date', dateInfo),
|
||||
|
||||
// Nom
|
||||
if (nomInfo != null) _buildInfoRow(Icons.person, 'Nom', nomInfo),
|
||||
|
||||
// Ville
|
||||
if (passage.ville.isNotEmpty)
|
||||
_buildInfoRow(Icons.location_city, 'Ville', passage.ville),
|
||||
|
||||
// Remarque
|
||||
if (passage.remarque.isNotEmpty)
|
||||
_buildInfoRow(Icons.note, 'Remarque', passage.remarque),
|
||||
|
||||
// Règlement
|
||||
if (reglementInfo != null) reglementInfo,
|
||||
],
|
||||
),
|
||||
// Ville
|
||||
if (passage.ville.isNotEmpty)
|
||||
_buildInfoRow(Icons.location_city, 'Ville', passage.ville),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
// Bouton de modification
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
_showEditDialog(context);
|
||||
},
|
||||
icon: const Icon(Icons.edit, size: 20),
|
||||
label: const Text('Modifier'),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: Colors.blue,
|
||||
),
|
||||
),
|
||||
// Bouton de suppression si autorisé
|
||||
if (canDelete)
|
||||
TextButton.icon(
|
||||
@@ -259,9 +142,25 @@ class PassageMapDialog extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// Formater une date
|
||||
String _formatDate(DateTime date) {
|
||||
return '${date.day.toString().padLeft(2, '0')}/${date.month.toString().padLeft(2, '0')}/${date.year}';
|
||||
// Afficher le dialog de modification
|
||||
void _showEditDialog(BuildContext context) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext dialogContext) {
|
||||
return PassageFormDialog(
|
||||
passage: passage,
|
||||
title: 'Modifier le passage',
|
||||
passageRepository: passageRepository,
|
||||
userRepository: userRepository,
|
||||
operationRepository: operationRepository,
|
||||
amicaleRepository: amicaleRepository,
|
||||
onSuccess: () {
|
||||
// Appeler le callback si fourni pour rafraîchir l'affichage
|
||||
onDeleted?.call();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Afficher le dialog de confirmation de suppression
|
||||
|
||||
Reference in New Issue
Block a user