From 34c2b5d3221cb0aa34e3fe79ddb2e493b2ab210d Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sat, 6 Jul 2024 00:10:12 +0200 Subject: [PATCH] fix date and orga --- covas_mobile/lib/pages/ItemMenu.dart | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/covas_mobile/lib/pages/ItemMenu.dart b/covas_mobile/lib/pages/ItemMenu.dart index 5c85594..d981ea0 100644 --- a/covas_mobile/lib/pages/ItemMenu.dart +++ b/covas_mobile/lib/pages/ItemMenu.dart @@ -65,6 +65,7 @@ class _ItemMenuState extends State with ShowErrorDialog { String listUser = ""; String eventName = ""; String eventStartDate = ""; + String organizers = ""; Events? events; @override @@ -79,7 +80,7 @@ class _ItemMenuState extends State with ShowErrorDialog { var accessToken = prefs.getString("access_token") ?? ""; String formerName = ""; String formerDate = ""; - print("${accessToken}"); + String formerOrga = ""; if (accessToken.isNotEmpty) { var urlGet = Uri.parse("${globals.api}/events/${widget.title}"); @@ -94,7 +95,18 @@ class _ItemMenuState extends State with ShowErrorDialog { final startDate = DateTime.parse(events["start_date"]); final date = DateFormat.yMd().format(startDate); final time = DateFormat.Hm().format(startDate); - formerDate = "${date} - ${time}"; + + final endDate = DateTime.parse(events["end_date"]); + final dateE = DateFormat.yMd().format(endDate); + final timeE = DateFormat.Hm().format(endDate); + formerDate = "${date} ${time} à ${dateE} ${timeE}"; + if (events["organizers"].length > 1) { + for (var orga in events["organizers"]) { + formerOrga = "${formerOrga}, ${orga}"; + } + } else { + formerOrga = "${events['organizers'][0]}"; + } } else { var text = ""; switch (responseGet.statusCode) { @@ -148,6 +160,7 @@ class _ItemMenuState extends State with ShowErrorDialog { // called again, and so nothing would appear to happen. eventName = formerName; eventStartDate = formerDate; + organizers = formerOrga; }); } @@ -188,7 +201,8 @@ class _ItemMenuState extends State with ShowErrorDialog { ), Row(children: [ Icon(Icons.group), - Text("Organisateurs : ", style: TextStyle(fontSize: 15.0)) + Text("Organisateurs : ${organizers}", + style: TextStyle(fontSize: 15.0)) ]), Row(children: [ Icon(Icons.description),