Subversion Repositories wpShopGermany4

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8427 daniel 1
<?php
2
 
3
	declare(strict_types=1);
4
 
5
	/**
6
	 * @author: Daniel Schmitzer (daniel@maennchen1.de)
7
	 * @date: 03.12.23
8
	 * @time: 15:14
9
	 */
10
 
11
	namespace wpsgTicket;
12
 
13
	/** @var \wpsg_order $oOrder */
14
    $oOrder = \wpsg_order::getInstance(intval($this->view['data']['id']));
15
 
16
	$data = [];
17
 
18
	foreach ($oOrder->getOrderProducts() as $oOrderProduct) {
19
 
20
		if (intval($oOrderProduct->getMeta('ticket_id', false, 0)) > 0) {
21
 
22
			for ($amount_index = 0; $amount_index < $oOrderProduct->getAmount(); $amount_index++) {
23
 
24
				$oTicketBooking = TicketBooking::getInstanceByBookingKey(TicketBooking::encodeBookingKey($oOrderProduct->getId(), $amount_index));
25
 
26
				$data[] = $oTicketBooking->toJSON();
27
 
28
			}
29
 
30
		}
31
 
32
	}
33
 
34
?>
35
 
36
<?php echo wpsg_drawForm_AdminboxStart(__('Ticketbuchungen', 'wpsg')); ?>
37
	<div id="order_view_app">
38
 
39
		<table>
40
			<thead>
41
				<tr>
42
					<th class="col_ticket"><?php echo __('Ticket', 'wpsg'); ?></th>
43
					<th class="col_product"><?php echo __('Ticket Produkt', 'wpsg'); ?></th>
44
					<th class="col_date"><?php echo __('Datum / Zeitraum', 'wpsg'); ?></th>
45
					<th class="col_state"><?php echo __('Status', 'wpsg'); ?></th>
46
				</tr>
47
			</thead>
48
			<tbody v-for="(row, i) in data">
49
				<tr>
50
					<td class="col_ticket">
51
						<a :href="row.urls.pdf" target="_blank">{{row.label}}</a>
52
					</td>
53
					<td class="col_product">
54
						<a :href="row.urls.product_edit">{{row.ticket_product_label}}</a>
55
					</td>
56
					<td class="col_date">{{row.ticket_data.label}}</td>
57
					<td class="col_state">
58
						<span :class="{'text-red': row.state_code === <?php echo TicketBooking::STATUS_UNAVAILABLE; ?>, 'text-green': row.state_code === <?php echo TicketBooking::STATUS_AVAILABLE; ?>}">{{row.state_label}}</span>
59
						<span v-if="row.is_send" :title="row.is_send_tooltip" class="ml-4 glyphicon glyphicon-send text-green"></span>
60
					</td>
61
				</tr>
62
				<template v-if="row.arProductVars.length > 0">
63
					<template v-for="(pv_data, pv_id) of row.arProductVars">
64
						<tr>
65
							<td colspan="2">
66
								{{pv_data['name']}}:
67
							</td>
68
							<td colspan="2">
69
								{{pv_data['value']}}
70
							</td>
71
						</tr>
72
					</template>
73
				</template>
74
			</tbody>
75
		</table>
76
 
77
		<br />
78
 
79
		<div class="flex items-center gap-2">
80
 
81
			<a href="<?php echo \add_query_arg([
82
				'action' => 'wpsg_ticket',
83
				'ticket_action' => 'export',
84
				'order_id' => $oOrder->getId()
85
			], \admin_url('admin-ajax.php')); ?>" target="_blank" class="button"><?php echo __('Terminübersicht exportieren', 'wpsg'); ?></a>
86
 
87
			<a href="<?php echo \add_query_arg([
88
				'action' => 'wpsg_ticket',
89
				'ticket_action' => 'resend',
90
				'order_id' => $oOrder->getId()
91
			], \admin_url('admin-ajax.php')); ?>" class="button"><?php echo __('Tickets per E-Mail an Kunden versenden', 'wpsg'); ?></a>
92
 
93
		</div>
94
 
95
	</div>
96
	<style>
97
 
98
		#order_view_app table { width:100%; }
99
		#order_view_app table tr td { padding:0.25rem 0.5rem 0.25rem 0; border-bottom:1px solid #DEDEDE; }
100
		#order_view_app table tr th { border-bottom:1px solid black; }
101
		#order_view_app .text-red { color:red; }
102
		#order_view_app .text-green { color:green; }
103
		#order_view_app .flex { display:flex; }
104
		#order_view_app .items-center { align-items:center; }
105
		#order_view_app .ml-4 { margin-left:1rem; }
106
		#order_view_app .gap-2 { gap:0.5rem; }
107
 
108
	</style>
109
<?php echo wpsg_drawForm_AdminboxEnd(); ?>
110
 
111
<script type="module">
112
 
113
	const wpsgSettings = {
114
		baseUrl: '<?php echo WPSG_URL; ?>'
115
	};
116
 
117
	import { order_view } from '<?php echo WPSG_URL; ?>mods/mod_ticket/assets/js/wpsg_order_view.js';
118
 
119
	order_view(wpsgSettings, <?php echo json_encode([
120
		'order_id' => $oOrder->getId(),
121
		'data' => $data,
122
		'ajax_url' => \admin_url('admin-ajax.php')
123
	]); ?>);
124
 
125
</script>