From cd17fd7f78e531554e95b1a5f86e00bb109b5d2c Mon Sep 17 00:00:00 2001 From: ArenMg Date: Wed, 5 May 2021 12:40:40 +0300 Subject: [PATCH] delete agenda --- src/main/webapp/assets/js/views/agenda.vue | 34 +++++++++++++++++---- src/main/webapp/assets/js/views/agendas.vue | 20 ++---------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/main/webapp/assets/js/views/agenda.vue b/src/main/webapp/assets/js/views/agenda.vue index fbd0f0e..e25fe74 100644 --- a/src/main/webapp/assets/js/views/agenda.vue +++ b/src/main/webapp/assets/js/views/agenda.vue @@ -35,7 +35,7 @@ v-if="!isEditMode" @click=" () => { - deleteAgenda(); + deleteCurrentAgenda(); } " > @@ -93,7 +93,14 @@
-
@@ -226,12 +233,27 @@ module.exports = { body: "Modification de l'agenda", }); }, - deleteAgenda: async function () { + deleteCurrentAgenda: function () { try { - let _= await axios.delete(`${baseUrl}/ws/agenda/calendars/${this.$route.query.id}`); - location.href = baseUrl; + swal({ + title: "Êtes-vous sûr?", + text: + "L'agenda sera supprimé", + icon: "warning", + buttons: ["Annuler", true], + dangerMode: true, + }).then( async (willDelete) => { + if (willDelete) { + let _ = await axios.delete(`${baseUrl}/ws/agenda/calendars/${this.$route.query.id}`); + swal("Succès!", "L'agenda a été supprimé", "success").then((value) => { + location.href = baseUrl; + }); + } + }); + } catch (error) { - console.log(error) + swal("Erreur!", `${error}`, "error"); + console.log(error); } }, }, diff --git a/src/main/webapp/assets/js/views/agendas.vue b/src/main/webapp/assets/js/views/agendas.vue index 06f1e6b..44cd8c6 100644 --- a/src/main/webapp/assets/js/views/agendas.vue +++ b/src/main/webapp/assets/js/views/agendas.vue @@ -47,19 +47,6 @@ -
-

Programme ajouté avec succès

- -

Une érreur est survenue (veuillez remplir tous les champs @@ -191,11 +178,10 @@ module.exports = { this.url = ""; this.selectedDate = new Date(); - this.isNotInserted = false; - this.isInserted = true; + swal("Succès!", "L'agenda a été créé", "success"); + } catch (error) { - this.isNotInserted = true; - this.isInserted = false; + swal("Erreur!", `${error}`, "error"); console.error(error); } },