mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-05-19 02:51:48 +02:00
71 lines
2.4 KiB
HTML
71 lines
2.4 KiB
HTML
|
|
|
|
{% extends 'base.html' %}
|
|
{% block title %}Warteliste{% endblock %}
|
|
{% block content %}
|
|
<a id="bfb" role="button" class="btn btn-primary btn-lg btn-block mb-2" href="/list">Eintragen</a>
|
|
<table class="table entries"
|
|
data-toggle="table"
|
|
data-url="/api/queue"
|
|
data-pagination="true"
|
|
data-classes="table"
|
|
data-show-refresh="false"
|
|
data-auto-refresh="true"
|
|
data-auto-refresh-interval="10">
|
|
<thead>
|
|
<tr>
|
|
<th data-field="Name">Name</th>
|
|
<th data-field="Title">Song</th>
|
|
<th data-field="Artist">Künstler</th>
|
|
<th scope="col" data-formatter="TableActionsFormatter"></th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
<a name="end"></a>
|
|
{% endblock %}
|
|
{% block extrajs %}
|
|
<script>
|
|
$.getJSON("/api/entries/accept", (data) => {
|
|
if (data["value"]==0) {
|
|
$("#bfb").addClass("disabled")
|
|
$("#bfb").prop("aria-disabled",true);
|
|
$("#bfb").prop("tabindex","-1");
|
|
$("#bfb").wrap("<span class='tooltip-span' tabindex='0' data-toggle='tooltip' data-placement='bottom'></span>");
|
|
$(".tooltip-span").prop("title", "Eintragungen sind leider momentan nicht möglich.")
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
}
|
|
})
|
|
|
|
function TableActionsFormatter(value,row,index) {
|
|
console.log("Value: " + value + ", Row: " + row + ", Index: " + index)
|
|
console.log(row)
|
|
if (getOwnedEntries().includes(row.entry_ID)) {
|
|
return "<button type='button' class='btn btn-danger' data-toggle='tooltip' data-placement='top' title='Eintrag zurückziehen' onclick=\"event.stopPropagation();$(this).tooltip('dispose');requestDeletionAsUser("+row["entry_ID"]+")\"><i class='fas fa-trash'></i></button>"
|
|
}
|
|
return ""
|
|
}
|
|
|
|
function requestDeletionAsUser(id) {
|
|
bootbox.confirm("Wirklich den Eintrag zurückziehen? Das könnte zu einer langen Wartezeit führen!", function (result) {
|
|
if (result) {
|
|
payload = {
|
|
"client_id": localStorage.getItem("clientId"),
|
|
"entry_id": id
|
|
}
|
|
$.ajax({
|
|
url: "/api/entries/delete/"+id,
|
|
type: "POST",
|
|
data: JSON.stringify(payload),
|
|
contentType: "application/json; charset=utf-8",
|
|
dataType: "json",
|
|
success: function(result) {
|
|
bootbox.alert("Eintrag zurückgezogen!")
|
|
location.reload()
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
</script>
|
|
{% endblock %} |