diff --git a/static/css/main.css b/static/css/main.css index 36e97e5..ac9624f 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -269,7 +269,7 @@ button[type="submit"]:hover { } .treasure-submitted { - background-color: rgba(255, 196, 0, 0.395); + background-color: rgba(67, 67, 67, 0.296); } .treasure-accepted { diff --git a/static/index.html b/static/index.html index 3630c4a..dc8935a 100644 --- a/static/index.html +++ b/static/index.html @@ -199,6 +199,7 @@ ×

+
diff --git a/static/js/main.js b/static/js/main.js index 2c7be44..e39197d 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -601,7 +601,8 @@ function refreshListener() { $(".treasure-btn-submit").click((e) => { let uid = e.target.parentNode.parentNode.id; - $('#treasure-popup-uid').val(uid); + $('#treasure-popup-activity-uid').val(uid); + $('#treasure-popup-uid').val($('#' + uid + ' .treasure-uid').text()); $('#treasure-popup-title').text($('#' + uid + ' .treasure-title').text()); $('#treasure-popup-desc').text($('#' + uid + ' .treasure-user-desc').text()); @@ -616,17 +617,23 @@ $('.close').click((e) => { $('#treasure-popup-button').click((e) => { var fr = new FileReader(); + var indata = { + uid: localStorage.getItem('user'), + token: localStorage.getItem('token'), + activityUid: $('#treasure-popup-activity-uid').val(), + desc: $('#treasure-popup-desc').text(), + } + var tuid = $('#treasure-popup-uid').val(); + if(tuid != '') { + indata.treasureUid = tuid; + } + fr.addEventListener('load', () => { + indata.image = fr.result; $.ajax({ type: "POST", url: base_url + "sendTreasure", - data: JSON.stringify({ - uid: localStorage.getItem('user'), - token: localStorage.getItem('token'), - image: fr.result, - activityUid: $('#treasure-popup-uid').val(), - desc: $('#treasure-popup-desc').text(), - }), + data: JSON.stringify(indata), contentType: "application/json; charset=utf-8", dataType: "json", @@ -797,11 +804,18 @@ function updateDemandes() { let td = data.treasureData; for(const td_uid in td) { - $elem = $('#' + td[td_uid].activityUid); - $elem.addClass('treasure-submitted'); - $elem.find(".treasure-btn-submit").text('Editer la soumission'); - $(`
Image: Lien
`).insertAfter($elem.find('.treasure-desc')) - $(`
Votre description :${td[td_uid].desc}
`).insertAfter($elem.find('.treasure-desc')) + if(td[td_uid].state != "Refused") { + $elem = $('#' + td[td_uid].activityUid); + $elem.addClass('treasure-submitted'); + $elem.find(".treasure-btn-submit").text('Editer la soumission'); + + $(`
Image: Lien
`).insertAfter($elem.find('.treasure-desc')) + $(`
${td[td_uid].desc}
`).insertAfter($elem.find('.treasure-desc')) + $(`

Votre soumission :

`).insertAfter($elem.find('.treasure-desc')) + $(` +
${td_uid}
+
`).insertAfter($elem.find('.treasure-btn')); + } } refreshListener(); }