Initial commit: unionflow-mobile-apps
Application Flutter complète (sans build artifacts). Signed-off-by: lions dev Team
This commit is contained in:
96
lib/features/solidarity/data/models/demande_aide_model.dart
Normal file
96
lib/features/solidarity/data/models/demande_aide_model.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
/// Modèle pour les demandes d'aide (solidarité)
|
||||
/// Correspond à l'API /api/demandes-aide (DemandeAideDTO)
|
||||
library demande_aide_model;
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'demande_aide_model.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class DemandeAideModel extends Equatable {
|
||||
final String? id;
|
||||
final String? numeroReference;
|
||||
final String? type;
|
||||
final String? titre;
|
||||
final String? description;
|
||||
final String? justification;
|
||||
final double? montantDemande;
|
||||
final double? montantAccorde;
|
||||
final String? statut;
|
||||
final String? urgence;
|
||||
final String? localisation;
|
||||
final String? motif;
|
||||
final String? demandeurId;
|
||||
final String? demandeur;
|
||||
final String? telephone;
|
||||
final String? email;
|
||||
final DateTime? dateDemande;
|
||||
final DateTime? dateLimite;
|
||||
final String? responsableTraitement;
|
||||
final String? organisationId;
|
||||
final DateTime? dateCreation;
|
||||
|
||||
const DemandeAideModel({
|
||||
this.id,
|
||||
this.numeroReference,
|
||||
this.type,
|
||||
this.titre,
|
||||
this.description,
|
||||
this.justification,
|
||||
this.montantDemande,
|
||||
this.montantAccorde,
|
||||
this.statut,
|
||||
this.urgence,
|
||||
this.localisation,
|
||||
this.motif,
|
||||
this.demandeurId,
|
||||
this.demandeur,
|
||||
this.telephone,
|
||||
this.email,
|
||||
this.dateDemande,
|
||||
this.dateLimite,
|
||||
this.responsableTraitement,
|
||||
this.organisationId,
|
||||
this.dateCreation,
|
||||
});
|
||||
|
||||
factory DemandeAideModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$DemandeAideModelFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$DemandeAideModelToJson(this);
|
||||
|
||||
String get statutLibelle {
|
||||
switch (statut) {
|
||||
case 'BROUILLON':
|
||||
return 'Brouillon';
|
||||
case 'SOUMISE':
|
||||
return 'Soumise';
|
||||
case 'EN_ATTENTE':
|
||||
return 'En attente';
|
||||
case 'APPROUVEE':
|
||||
return 'Approuvée';
|
||||
case 'REJETEE':
|
||||
return 'Rejetée';
|
||||
case 'EN_COURS_TRAITEMENT':
|
||||
return 'En cours de traitement';
|
||||
case 'TERMINEE':
|
||||
return 'Terminée';
|
||||
default:
|
||||
return statut ?? '—';
|
||||
}
|
||||
}
|
||||
|
||||
String get typeLibelle => type ?? '—';
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
id,
|
||||
numeroReference,
|
||||
titre,
|
||||
statut,
|
||||
type,
|
||||
dateDemande,
|
||||
montantDemande,
|
||||
organisationId,
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'demande_aide_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
DemandeAideModel _$DemandeAideModelFromJson(Map<String, dynamic> json) =>
|
||||
DemandeAideModel(
|
||||
id: json['id'] as String?,
|
||||
numeroReference: json['numeroReference'] as String?,
|
||||
type: json['type'] as String?,
|
||||
titre: json['titre'] as String?,
|
||||
description: json['description'] as String?,
|
||||
justification: json['justification'] as String?,
|
||||
montantDemande: (json['montantDemande'] as num?)?.toDouble(),
|
||||
montantAccorde: (json['montantAccorde'] as num?)?.toDouble(),
|
||||
statut: json['statut'] as String?,
|
||||
urgence: json['urgence'] as String?,
|
||||
localisation: json['localisation'] as String?,
|
||||
motif: json['motif'] as String?,
|
||||
demandeurId: json['demandeurId'] as String?,
|
||||
demandeur: json['demandeur'] as String?,
|
||||
telephone: json['telephone'] as String?,
|
||||
email: json['email'] as String?,
|
||||
dateDemande: json['dateDemande'] == null
|
||||
? null
|
||||
: DateTime.parse(json['dateDemande'] as String),
|
||||
dateLimite: json['dateLimite'] == null
|
||||
? null
|
||||
: DateTime.parse(json['dateLimite'] as String),
|
||||
responsableTraitement: json['responsableTraitement'] as String?,
|
||||
organisationId: json['organisationId'] as String?,
|
||||
dateCreation: json['dateCreation'] == null
|
||||
? null
|
||||
: DateTime.parse(json['dateCreation'] as String),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$DemandeAideModelToJson(DemandeAideModel instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'numeroReference': instance.numeroReference,
|
||||
'type': instance.type,
|
||||
'titre': instance.titre,
|
||||
'description': instance.description,
|
||||
'justification': instance.justification,
|
||||
'montantDemande': instance.montantDemande,
|
||||
'montantAccorde': instance.montantAccorde,
|
||||
'statut': instance.statut,
|
||||
'urgence': instance.urgence,
|
||||
'localisation': instance.localisation,
|
||||
'motif': instance.motif,
|
||||
'demandeurId': instance.demandeurId,
|
||||
'demandeur': instance.demandeur,
|
||||
'telephone': instance.telephone,
|
||||
'email': instance.email,
|
||||
'dateDemande': instance.dateDemande?.toIso8601String(),
|
||||
'dateLimite': instance.dateLimite?.toIso8601String(),
|
||||
'responsableTraitement': instance.responsableTraitement,
|
||||
'organisationId': instance.organisationId,
|
||||
'dateCreation': instance.dateCreation?.toIso8601String(),
|
||||
};
|
||||
Reference in New Issue
Block a user