97 lines
2.3 KiB
Dart
97 lines
2.3 KiB
Dart
/// 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,
|
|
];
|
|
}
|