add future event only
This commit is contained in:
parent
eef7e44999
commit
76f1de27ec
@ -137,7 +137,6 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
}
|
||||
|
||||
Future<void> _updateEvent(BuildContext context) async {
|
||||
var url = Uri.parse("${globals.api}/token");
|
||||
var name = inputName.text;
|
||||
var place = inputGeo.text;
|
||||
var description = inputDesc.text;
|
||||
@ -146,12 +145,13 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
List<String>.from(_stringOrgaController.getTags as List);
|
||||
|
||||
var startDateFormat = formatDate(startDatepicker.text);
|
||||
DateTime startDateCompare = DateTime.parse(startDateFormat);
|
||||
DateTime dateNow = DateTime.now();
|
||||
var endDateFormat = formatDate(endDatepicker.text);
|
||||
var startDate =
|
||||
"${startDateFormat}T${startTimepicker.text.replaceAll('-', ':')}";
|
||||
var endDate = "${endDateFormat}T${endTimepicker.text.replaceAll('-', ':')}";
|
||||
print("start date : ${startDate}");
|
||||
print("end date : ${endDate}");
|
||||
if (startDateCompare.isAfter(dateNow)) {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
var accessToken = prefs.getString("access_token") ?? "";
|
||||
|
||||
@ -172,7 +172,8 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
|
||||
if (data['features'].isNotEmpty) {
|
||||
place = data['features'][0]['place_name'];
|
||||
final coordinates = data['features'][0]['geometry']['coordinates'];
|
||||
final coordinates =
|
||||
data['features'][0]['geometry']['coordinates'];
|
||||
final longitude = coordinates[0]; // Longitude
|
||||
final latitude = coordinates[1]; // Latitude
|
||||
|
||||
@ -282,6 +283,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
} else {
|
||||
showErrorDialog(context, "Champ vide");
|
||||
}
|
||||
} else {
|
||||
showErrorDialog(context, "Evenement non futur");
|
||||
}
|
||||
}
|
||||
|
||||
void start() async {
|
||||
|
Loading…
x
Reference in New Issue
Block a user