This commit is contained in:
asyncnomi 2023-01-03 23:32:56 +01:00
parent 0143bb0050
commit fcd2eb8eae

View file

@ -112,12 +112,11 @@ function get_admin(type) {
prankData.push(data.prankData[prankUid]);
}
prankData.sort((a, b) => new Date(a.date) - new Date(b.date));
console.log(prankData);
for (entry in prankData) {
switch (prankData[entry].type) {
case "crêpe":
if (prankData[entry].state == "pending"
|| prankData[entry].state == "accepted") {
if (prankData[entry].state == "Pending"
|| prankData[entry].state == "Accepted") {
$("#admin-content").append(`
<span id="${prankData[entry].prankUid}" class="prank">
<div class="prank-title">Demande de crêpe par ${prankData[entry].creator}</div>
@ -130,9 +129,9 @@ function get_admin(type) {
<div class="prank-date">UID: ${prankData[entry].date}</div>
</span>
<span class="prank-btn">
<div class="prank-btn-accept" style="display: ${(prankData[entry].state == "accepted" && prankData[entry].manageBy == localStorage.getItem("user")) ? "none" : "flex"};">${(prankData[entry].state == "pending") ? "Accepter" : "Récupérer (accepté par: "+prankData[entry].manageBy+")"}</div>
<div class="prank-btn-accept" style="display: ${(prankData[entry].state == "Accepted" && prankData[entry].manageBy == localStorage.getItem("user")) ? "none" : "flex"};">${(prankData[entry].state == "Pending") ? "Accepter" : "Récupérer (accepté par: "+prankData[entry].manageBy+")"}</div>
<div class="prank-btn-refused">Refuser</div>
<div class="prank-btn-done" style="display: ${(prankData[entry].state == "accepted" && prankData[entry].manageBy == localStorage.getItem("user")) ? "flex" : "none"};">Done</div>
<div class="prank-btn-done" style="display: ${(prankData[entry].state == "Accepted" && prankData[entry].manageBy == localStorage.getItem("user")) ? "flex" : "none"};">Done</div>
</span>
</span>
`)
@ -159,7 +158,7 @@ function get_admin(type) {
}
treasureData.sort((a, b) => new Date(a.date) - new Date(b.date));
for (entry in treasureData) {
if (treasureData[entry].state == "pending") {
if (treasureData[entry].state == "Pending") {
$("#admin-content").append(`
<span id="${treasureData[entry].treasureUid}" class="treasure">
<div class="treasure-title">Demande de vérification par ${treasureData[entry].creator}</div>