feat(loans): confirm declared material state changes
This commit is contained in:
@@ -7,8 +7,6 @@ import "../models/anomalie_retour.dart";
|
||||
import "../widgets/ensup_top_bar.dart";
|
||||
import "../widgets/brand_corners.dart";
|
||||
|
||||
/// Résultat de la restitution (RG17-RG20) : conforme (succès) ou non conforme
|
||||
/// (anomalie détectée + notification au responsable).
|
||||
class ResultatRetourScreen extends StatelessWidget {
|
||||
const ResultatRetourScreen({
|
||||
super.key,
|
||||
@@ -19,7 +17,8 @@ class ResultatRetourScreen extends StatelessWidget {
|
||||
final EmpruntItem emprunt;
|
||||
final List<AnomalieRetour> anomalies;
|
||||
|
||||
bool get _conforme => anomalies.isEmpty;
|
||||
bool get _conforme => emprunt.statut == "CLOTURE";
|
||||
bool get _enAttente => emprunt.statut == "EN_ATTENTE_VALIDATION_RETOUR";
|
||||
|
||||
static String _deux(int valeur) => valeur.toString().padLeft(2, "0");
|
||||
|
||||
@@ -27,6 +26,8 @@ class ResultatRetourScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final fond = _conforme
|
||||
? const [Color(0xFFF0FDF4), Color(0xFFF8FAFC)]
|
||||
: _enAttente
|
||||
? const [Color(0xFFFFF7ED), Color(0xFFF8FAFC)]
|
||||
: const [Color(0xFFFFF5F5), Color(0xFFF8FAFC)];
|
||||
|
||||
return Scaffold(
|
||||
@@ -75,7 +76,12 @@ class ResultatRetourScreen extends StatelessWidget {
|
||||
constraints: const BoxConstraints(maxWidth: 560),
|
||||
child: Column(
|
||||
children: [
|
||||
if (_conforme) _succes() else _anomalie(),
|
||||
if (_conforme)
|
||||
_succes()
|
||||
else if (_enAttente)
|
||||
_attente()
|
||||
else
|
||||
_anomalie(),
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
@@ -280,6 +286,81 @@ class ResultatRetourScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _attente() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(22),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFF7ED),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: const Color(0xFFFED7AA), width: 1.5),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.pending_actions_outlined,
|
||||
color: Color(0xFFD97706),
|
||||
size: 42,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
"Changement en attente",
|
||||
style: GoogleFonts.darkerGrotesque(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: const Color(0xFF9A3412),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
"Le responsable a été alerté. Le changement reste provisoire "
|
||||
"et aucune anomalie n'est créée avant sa confirmation.",
|
||||
textAlign: TextAlign.center,
|
||||
style: GoogleFonts.titilliumWeb(
|
||||
fontSize: 14,
|
||||
color: EnsupColors.text2,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(18),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: EnsupColors.line),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"MODIFICATIONS DÉCLARÉES",
|
||||
style: GoogleFonts.darkerGrotesque(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: EnsupColors.muted,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
for (final anomalie in anomalies)
|
||||
_drow(
|
||||
anomalie.element,
|
||||
anomalie.etatRetour,
|
||||
valeurCouleur: const Color(0xFFD97706),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _drow(String cle, String valeur, {Color? valeurCouleur}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 7),
|
||||
|
||||
Reference in New Issue
Block a user