fin
This commit is contained in:
parent
625c4a8bb3
commit
609f0ec9d0
3 changed files with 29 additions and 14 deletions
|
@ -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 {
|
||||
|
|
|
@ -199,6 +199,7 @@
|
|||
<a class="close" href="#">×</a>
|
||||
<p id="treasure-popup-title"></p>
|
||||
<input type="hidden" id="treasure-popup-uid">
|
||||
<input type="hidden" id="treasure-popup-activity-uid">
|
||||
<div class="form-group">
|
||||
<input class="form-control" type="file" id="treasure-popup-image" >
|
||||
</div>
|
||||
|
|
|
@ -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');
|
||||
$(`<div class="treasure-image">Image: <a href="${base_url}images/${td[td_uid].image}.html" target="_blank"> Lien</a></div>`).insertAfter($elem.find('.treasure-desc'))
|
||||
$(`<div class="treasure-user-desc">Votre description :${td[td_uid].desc}</div>`).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');
|
||||
|
||||
$(`<div class="treasure-image">Image: <a href="${base_url}images/${td[td_uid].image}.html" target="_blank"> Lien</a></div>`).insertAfter($elem.find('.treasure-desc'))
|
||||
$(`<div class="treasure-user-desc">${td[td_uid].desc}</div>`).insertAfter($elem.find('.treasure-desc'))
|
||||
$(`<p>Votre soumission :</p>`).insertAfter($elem.find('.treasure-desc'))
|
||||
$(`<span class="treasure-footer">
|
||||
<div class="treasure-uid">${td_uid}</div>
|
||||
</span>`).insertAfter($elem.find('.treasure-btn'));
|
||||
}
|
||||
}
|
||||
refreshListener();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue