mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-05-20 03:21:47 +02:00
Add PDF export/printing for list of played songs
This commit is contained in:
parent
5f551ac092
commit
703382cb1a
@ -4,11 +4,13 @@
|
|||||||
{% block title %}Home{% endblock %}
|
{% block title %}Home{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Name</th>
|
<th scope="col">Name</th>
|
||||||
<th scope="col">Song</th>
|
<th scope="col">Song</th>
|
||||||
<th scope="col">Künstler</th>
|
<th scope="col">Künstler</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
{% for entry in list: %}
|
{% for entry in list: %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -17,12 +17,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Name</th>
|
<th scope="col">Name</th>
|
||||||
<th scope="col">Song</th>
|
<th scope="col">Song</th>
|
||||||
<th scope="col">Künstler</th>
|
<th scope="col">Künstler</th>
|
||||||
<th scope="col">Aktionen</th>
|
<th scope="col">Aktionen</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
{% for entry in list: %}
|
{% for entry in list: %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
@ -5,13 +5,18 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<button type="button" class="topbutton btn btn-danger" onclick="confirmDeleteAllEntries()"><i
|
<button type="button" class="topbutton btn btn-danger" onclick="confirmDeleteAllEntries()"><i
|
||||||
class="fas fa-trash mr-2"></i>Abspielliste löschen</button>
|
class="fas fa-trash mr-2"></i>Abspielliste löschen</button>
|
||||||
|
<button type="button" class="topbutton btn" onclick="printPDF()"><i class="fas fa-print mr-2"></i>Drucken</button>
|
||||||
|
<button type="button" class="topbutton btn" onclick="exportPDF()"><i class="fas fa-file-pdf mr-2"></i>Als PDF
|
||||||
|
herunterladen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table class="table">
|
<table class="table" id="table">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Song</th>
|
<th scope="col">Song</th>
|
||||||
<th scope="col">Wiedergaben</th>
|
<th scope="col">Wiedergaben</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
{% for entry in list: %}
|
{% for entry in list: %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -26,6 +31,8 @@
|
|||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block extrajs %}
|
{% block extrajs %}
|
||||||
|
<script src="https://unpkg.com/jspdf@latest/dist/jspdf.min.js"></script>
|
||||||
|
<script src="https://unpkg.com/jspdf-autotable@3.1.1/dist/jspdf.plugin.autotable.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function confirmDeleteAllEntries() {
|
function confirmDeleteAllEntries() {
|
||||||
bootbox.confirm({
|
bootbox.confirm({
|
||||||
@ -57,5 +64,24 @@
|
|||||||
});
|
});
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function exportPDF() {
|
||||||
|
var doc = new jsPDF();
|
||||||
|
doc.autoTable({
|
||||||
|
html: '#table',
|
||||||
|
theme: 'grid'
|
||||||
|
});
|
||||||
|
doc.save('Abspielliste.pdf');
|
||||||
|
}
|
||||||
|
|
||||||
|
function printPDF() {
|
||||||
|
var doc = new jsPDF();
|
||||||
|
doc.autoTable({
|
||||||
|
html: '#table',
|
||||||
|
theme: 'grid'
|
||||||
|
});
|
||||||
|
doc.autoPrint();
|
||||||
|
doc.output('dataurlnewwindow');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user