diff --git a/static/js/main.js b/static/js/main.js index 7239bbf..c1a8661 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -614,7 +614,13 @@ function updateDemandes() { success: function (data) { if(data.success) { $('#demande-list').html(''); - let pd = data.prankData; + let pd = []; + for (pd_uid in data.prankData) { + if (data.prankData[pd_uid].creator == localStorage.getItem('user')) { + pd.push(data.prankData[pd_uid]); + } + } + pd.sort((a, b) => new Date(b.date) - new Date(a.date)); for(const pd_uid in pd) { $('#demande-list').append(` @@ -626,7 +632,7 @@ function updateDemandes() {
Statue: ${pd[pd_uid].state}
${ (pd[pd_uid].state != "Accepted" && pd[pd_uid].state != "Refused" ) ? ` -
Supprimer
+
Annuler
` : '' } @@ -651,7 +657,7 @@ function updateDemandes() { updateDemandes(); } else { - alter(data.why); + alert(data.why); } }