feat(loans): confirm declared material state changes
This commit is contained in:
@@ -17,18 +17,22 @@ class EmpruntService {
|
||||
"materielId": materielId,
|
||||
"posteEmpruntId": posteEmpruntId,
|
||||
"modeIdentification": "MAIL_ENSUP",
|
||||
if (commentaireDepart.trim().isNotEmpty) "commentaireDepart": commentaireDepart.trim(),
|
||||
if (commentaireDepart.trim().isNotEmpty)
|
||||
"commentaireDepart": commentaireDepart.trim(),
|
||||
"elements": elements,
|
||||
});
|
||||
|
||||
final data = (reponse as Map<String, dynamic>)["data"] as Map<String, dynamic>;
|
||||
final data =
|
||||
(reponse as Map<String, dynamic>)["data"] as Map<String, dynamic>;
|
||||
return EmpruntResponse.fromJson(data);
|
||||
}
|
||||
|
||||
static Future<List<EmpruntItem>> getMesEmprunts() async {
|
||||
final reponse = await ApiClient.get("/mes-emprunts");
|
||||
final data = (reponse as Map<String, dynamic>)["data"] as List<dynamic>;
|
||||
return data.map((json) => EmpruntItem.fromJson(json as Map<String, dynamic>)).toList();
|
||||
return data
|
||||
.map((json) => EmpruntItem.fromJson(json as Map<String, dynamic>))
|
||||
.toList();
|
||||
}
|
||||
|
||||
static Future<EmpruntResponse> restituerEmprunt({
|
||||
@@ -38,11 +42,31 @@ class EmpruntService {
|
||||
}) async {
|
||||
final reponse = await ApiClient.post("/emprunts/$empruntId/restitution", {
|
||||
"modeIdentification": "MAIL_ENSUP",
|
||||
if (commentaireRetour.trim().isNotEmpty) "commentaireRetour": commentaireRetour.trim(),
|
||||
if (commentaireRetour.trim().isNotEmpty)
|
||||
"commentaireRetour": commentaireRetour.trim(),
|
||||
"elements": elements,
|
||||
});
|
||||
|
||||
final data = (reponse as Map<String, dynamic>)["data"] as Map<String, dynamic>;
|
||||
final data =
|
||||
(reponse as Map<String, dynamic>)["data"] as Map<String, dynamic>;
|
||||
return EmpruntResponse.fromJson(data);
|
||||
}
|
||||
|
||||
static Future<bool> signalerTentativeRetour({
|
||||
required int empruntId,
|
||||
required String nomElement,
|
||||
required String etatInitial,
|
||||
required String etatDemande,
|
||||
}) async {
|
||||
final reponse = await ApiClient.post(
|
||||
"/emprunts/$empruntId/alerte-changement-retour",
|
||||
{
|
||||
"nomElement": nomElement,
|
||||
"etatInitial": etatInitial,
|
||||
"etatDemande": etatDemande,
|
||||
},
|
||||
);
|
||||
final data = Map<String, dynamic>.from(reponse["data"] as Map);
|
||||
return data["alerteCreee"] as bool;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user