ca marche
This commit is contained in:
parent
68b2fb3464
commit
40adbe15fd
3 changed files with 36 additions and 6 deletions
Binary file not shown.
Before Width: | Height: | Size: 207 KiB After Width: | Height: | Size: 252 KiB |
|
@ -145,7 +145,7 @@
|
|||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="textarea" class="form-control" placeholder="Notes" id="demande-notes">
|
||||
<textarea class="form-control" placeholder="Notes" id="demande-notes" ></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary" id="demande-button">Envoyer</button>
|
||||
|
|
|
@ -526,7 +526,7 @@ $('#demande-button').click(function () {
|
|||
amount: $('#demande-amount').val(),
|
||||
where: $('#demande-where').val(),
|
||||
supplement: $('#demande-supp').val(),
|
||||
note: $('#demande-note').val(),
|
||||
note: $('#demande-notes').val(),
|
||||
}),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
|
@ -569,20 +569,50 @@ function updateDemandes() {
|
|||
let pd = data.prankData;
|
||||
for(const pd_uid in pd) {
|
||||
$('#demande-list').append(`
|
||||
<span id="${pd[pd_uid].prankUid}" class="prank">
|
||||
<span id="${pd_uid}" class="prank">
|
||||
<h2 class="prank-title">Demande de crêpe</h2>
|
||||
<div class="prank-amount">Quantité: ${pd[pd_uid].amount}</div>
|
||||
<div class="prank-supplement">Garniture: ${pd[pd_uid].supplement}</div>
|
||||
<div class="prank-where">Livraison: ${pd[pd_uid].where}</div>
|
||||
<div class="prank-note">Notes: ${pd[pd_uid].note}</div>
|
||||
<div class="prank-status">Statue: ${pd[pd_uid].state}</div>
|
||||
</span>
|
||||
<div class="prank-status">Statue: ${pd[pd_uid].state}</div>
|
||||
${ (pd[pd_uid].state != "Accepted" && pd[pd_uid].state != "Refused" ) ?
|
||||
`<span class="activity-btn">
|
||||
<div class="prank-btn-delete">Supprimer</div>
|
||||
</span>`
|
||||
: ''
|
||||
}
|
||||
</span>
|
||||
`)
|
||||
|
||||
$('#' + pd_uid + " .prank-btn-delete").click(() => {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: base_url + 'delPrank',
|
||||
data: JSON.stringify({
|
||||
uid: localStorage.getItem('user'),
|
||||
token: localStorage.getItem('token'),
|
||||
prankUid: pd_uid
|
||||
|
||||
}),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
updateDemandes();
|
||||
}
|
||||
else {
|
||||
alter(data.why);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
console.alert(data.why);
|
||||
console.error(data.why);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue