delete agenda

This commit is contained in:
ArenMg 2021-05-05 12:40:40 +03:00
parent 55f1f53a20
commit cd17fd7f78
2 changed files with 31 additions and 23 deletions

View file

@ -35,7 +35,7 @@
v-if="!isEditMode" v-if="!isEditMode"
@click=" @click="
() => { () => {
deleteAgenda(); deleteCurrentAgenda();
} }
" "
> >
@ -93,7 +93,14 @@
</div> </div>
<div class="space-top"></div> <div class="space-top"></div>
<div v-if="isEditMode" class="space-top"> <div v-if="isEditMode" class="space-top">
<button id="modifySondage" @click="()=>{modifyAgenda()}"> <button
id="modifySondage"
@click="
() => {
modifyAgenda();
}
"
>
Modifier l' agenda Modifier l' agenda
</button> </button>
</div> </div>
@ -226,12 +233,27 @@ module.exports = {
body: "Modification de l'agenda", body: "Modification de l'agenda",
}); });
}, },
deleteAgenda: async function () { deleteCurrentAgenda: function () {
try { try {
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}`); 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; location.href = baseUrl;
});
}
});
} catch (error) { } catch (error) {
console.log(error) swal("Erreur!", `${error}`, "error");
console.log(error);
} }
}, },
}, },

View file

@ -47,19 +47,6 @@
</button> </button>
</div> </div>
</div> </div>
<div v-if="isInserted" class="success-mess">
<p class="mess-text">Programme ajouté avec succès</p>
<button
class="exit-btn"
@click="
() => {
isInserted = false;
}
"
>
fermer
</button>
</div>
<div v-if="isNotInserted" class="error-mess"> <div v-if="isNotInserted" class="error-mess">
<p class="mess-text"> <p class="mess-text">
Une érreur est survenue (veuillez remplir tous les champs Une érreur est survenue (veuillez remplir tous les champs
@ -191,11 +178,10 @@ module.exports = {
this.url = ""; this.url = "";
this.selectedDate = new Date(); this.selectedDate = new Date();
this.isNotInserted = false; swal("Succès!", "L'agenda a été créé", "success");
this.isInserted = true;
} catch (error) { } catch (error) {
this.isNotInserted = true; swal("Erreur!", `${error}`, "error");
this.isInserted = false;
console.error(error); console.error(error);
} }
}, },