feat(sprint-13.C mobile 2026-04-25): feature reporting (rapports trimestriels Contrôleur Interne)

Mobile mirror du backend P2-NEW-3. DRY strict — Clean Architecture identique aux autres features (compliance, devise).

Domain
- StatutRapport enum (draft, signe, archive, inconnu) + extension StatutRapportX (code/libelle/severite/fromCode)
- RapportTrimestriel entity (Equatable) + helpers libellePeriode, scoreSeverite (>=80 success, >=60 warning, <60 danger)

Data
- RapportTrimestrielModel.fromJson (parsing tolérant null + dates ISO)
- ReportingRemoteDataSourceImpl (Dio) : lister/generer/signer/archiver/telechargerPdf
- ReportingRepositoryImpl @Injectable

Presentation
- ReportingBloc : Load/Generer/Signer/Archiver events, 4 states (Initial/Loading/Loaded/Error)
- RapportsTrimestrielsPage : Material 3 ListView avec cards (period, score coloré, tag statut, hash tronqué) + EmptyView + ErrorView

Tests (10/10 verts)
- StatutRapportX × 2 (fromCode parse/null/inconnu, libelle/severite/code)
- RapportTrimestriel × 5 (libellePeriode, estDraft/estSigne/estArchive, scoreSeverite × 3)
- RapportTrimestrielModel.fromJson × 3 (complet, fallbacks, date invalide)

Note : viewer PDF interne reporté à un sprint dédié (intégration pdfx + permission storage Android). Téléchargement bytes via API exposé dans datasource pour usage futur.
This commit is contained in:
dahoud
2026-04-25 15:28:17 +00:00
parent 8c1a254e80
commit 6ba71fb014
8 changed files with 717 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import '../../domain/entities/rapport_trimestriel.dart';
class RapportTrimestrielModel extends RapportTrimestriel {
const RapportTrimestrielModel({
required super.id,
required super.organisationId,
required super.annee,
required super.trimestre,
required super.dateGeneration,
required super.statut,
required super.scoreConformite,
super.signataireId,
super.dateSignature,
super.hashSha256,
});
factory RapportTrimestrielModel.fromJson(Map<String, dynamic> json) {
return RapportTrimestrielModel(
id: json['id']?.toString() ?? '',
organisationId: json['organisationId']?.toString() ?? '',
annee: (json['annee'] as num?)?.toInt() ?? 0,
trimestre: (json['trimestre'] as num?)?.toInt() ?? 0,
dateGeneration: _parseDate(json['dateGeneration']),
statut: StatutRapportX.fromCode(json['statut']?.toString()),
scoreConformite: (json['scoreConformite'] as num?)?.toInt() ?? 0,
signataireId: json['signataireId']?.toString(),
dateSignature: _parseDate(json['dateSignature']),
hashSha256: json['hashSha256']?.toString(),
);
}
static DateTime? _parseDate(dynamic raw) {
if (raw == null) return null;
try {
return DateTime.parse(raw.toString());
} catch (_) {
return null;
}
}
}