Files
bm/public_html/resources/views/admin/events/seatmapnew.blade.php
2025-09-24 13:26:28 +02:00

167 lines
4.5 KiB
PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sitzplan</title>
</head>
<body>
<button onclick="print()">Seite drucken</button>
<table border="1" id="myTable">
<tr>
<th>Rechnungsnummer</th>
<th>Kundenname</th>
<th>Betrag</th>
<th>Anzahl der Karten</th>
<th>Sitzplatz</th>
<th>E-Mail</th>
<th>Telefon</th>
</tr>
@foreach($data as $d)
<?php
$order = App\Order::find($d->id);
?>
<tr>
<td>
{{$order->id}}
</td>
<td>
<?php
$user = App\User::withTrashed()->find($order->user_id);
?>
{{$user["firstname"]}} {{$user["lastname"]}}
@if($user->trashed())
(gelöscht!)
@endif
</td>
<td>
€ {{number_format($order->getPrice()/100, 2)}}
</td>
<td>
<?php
$ssus=$order->singleseatusers()->get();
?>
{{sizeof($ssus)}}
</td>
<td>
<ul>
@foreach($ssus as $ssu)
<li>{{$ssu->calcSeatName()}}</li>
@endforeach
</ul>
</td>
<td>
{{$user->email}}
</td>
<td>
{{$user->phone}}
</td>
</tr>
@endforeach
<table>
<script>
function sortTable() {
var table, rows, switching, i, x, y, shouldSwitch;
table = document.getElementById("myTable");
switching = true;
/*Make a loop that will continue until
no switching has been done:*/
while (switching) {
//start by saying: no switching is done:
switching = false;
rows = table.rows;
/*Loop through all table rows (except the
first, which contains table headers):*/
for (i = 1; i < (rows.length - 1); i++) {
//start by saying there should be no switching:
shouldSwitch = false;
/*Get the two elements you want to compare,
one from current row and one from the next:*/
x = rows[i].getElementsByTagName("TD")[1];
y = rows[i + 1].getElementsByTagName("TD")[1];
console.log(x.innerHTML.toLowerCase().trim());
//check if the two rows should switch place:
if (x.innerHTML.toLowerCase().trim() > y.innerHTML.toLowerCase().trim()) {
//if so, mark as a switch and break the loop:
shouldSwitch = true;
break;
}
}
if (shouldSwitch) {
/*If a switch has been marked, make the switch
and mark that a switch has been done:*/
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
switching = true;
}
}
}
sortTable()
</script>
<script>
var PRINTER_NAME = "Gestetner";
var HTTP_GET_VARS;
// var PRINTER_NAME = "Deskjet";
var PRINTER_FALLBACK_NAME = "Adobe";
function print(){
jsPrintSetup.setPrinter(selectPrinter());
jsPrintSetup.setOption('orientation', jsPrintSetup.kPortraitOrientation);
jsPrintSetup.setOption('marginTop', 0);
jsPrintSetup.setOption('marginBottom', 0);
jsPrintSetup.setOption('marginLeft', 0);
jsPrintSetup.setOption('marginRight', 0);
jsPrintSetup.setOption('headerStrLeft', '');
jsPrintSetup.setOption('headerStrCenter', '');
jsPrintSetup.setOption('headerStrRight', '');
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption('footerStrCenter', '');
jsPrintSetup.setOption('footerStrRight', '');
jsPrintSetup.setOption('printBGColors', 1);
jsPrintSetup.clearSilentPrint();
jsPrintSetup.setOption('printSilent', 1);
jsPrintSetup.printWindow(window);
window.close();
}
function selectPrinter() {
var printers = jsPrintSetup.getPrintersList().split(',');
//console.log(printers);
for (var i = 0; i < printers.length; ++i) {
if (printers[i].toLowerCase().indexOf(PRINTER_NAME.toLowerCase()) != -1) {
return printers[i];
}
}
for (var i = 0; i < printers.length; ++i) {
if (printers[i].toLowerCase().indexOf(PRINTER_FALLBACK_NAME.toLowerCase()) != -1) {
return printers[i];
}
}
if (printers.length > 0) {
return printers[0];
}
return '';
}
</script>
</body>
</html>