summaryrefslogtreecommitdiff
path: root/views/mods/mod_kundenverwaltung/order.phtml
blob: ddf7fc94888c0f823fd905db521f5476f58c507e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php

	/**
	 * Template für die Übersichtsseite der Bestellungen im Frontend
	 * @version 4.6.1
	 */

	//wpsg_debug($this->view['arOrder']);

?>

<div class="wpsg_mod_kundenverwaltung_order wpsg">

	<?php echo $this->writeFrontendMessage(); ?>
	
	<?php if (wpsg_isSizedArray($this->view['arOrder'])) { ?>
		<?php foreach ($this->view['arOrder'] as $order) { $strSum = wpsg_ff($order['price_gesamt'], $this->get_option('wpsg_currency')); ?>

		<section class="wpsg_box wpsg-account-order wpsg_order_<?php echo intval($order['id']); ?>">

			<div class="wpsg-account-order__head">
				<h2 class="wpsg-account-order__title"><?php echo esc_html(date('d.m.Y', strtotime($order['cdate']))); ?> · <?php echo __('Bestellnummer', 'wpsg'); ?> <?php echo esc_html((string)($order['onr']??'')); ?></h2>
				<span class="wpsg-account-order__sum"><?php echo $strSum; ?></span>
			</div>

			<p class="wpsg-account-order__meta">
				<?php echo $this->arStatus[$order['status']]??''; ?>
				<?php if ($this->hasMod('wpsg_mod_rechnungen')) { foreach (\wpsg\wpsg_invoice::findByOrderId(intval($order['id'])) as $oInvoice) { ?>
				<?php if ($oInvoice->isInvoice()) { ?>
				· <a href="<?php echo $this->callMod('wpsg_mod_rechnungen', 'getFrontendLink', [$oInvoice->getId()]); ?>"><?php echo wpsg_translate(__('Rechnung #1#', 'wpsg'), $oInvoice->getNr()); ?></a>
				<?php } else if ($oInvoice->isStorno()) { ?>
				· <a href="<?php echo $this->callMod('wpsg_mod_rechnungen', 'getFrontendLink', [$oInvoice->getId()]); ?>"><?php echo wpsg_translate(__('Rechnungskorrektur #1#', 'wpsg'), $oInvoice->getNr()); ?></a>
				<?php } ?>
				<?php } } ?>
			</p>

			<details class="wpsg-account-order__items">
				<summary><?php echo __('Bestellte Produkte', 'wpsg'); ?> (<?php echo count((array)$order['arProdukte']); ?>)</summary>

				<table class="wpsg_mod_kundenverwaltung_producttable">
					<tr class="screen-reader-text">
						<th class="col_name"><?php echo __('Name', 'wpsg'); ?></th>
						<th class="col_price"><?php echo __('Preis', 'wpsg'); ?></th>
					</tr>
					<?php foreach ((array)$order['arProdukte'] as $p) { ?>
					<tr>
						<td class="col_name">
							<span><?php echo $p['menge']??0; ?> x </span>
							<?php if (($p['url']??'') !== '') { ?><a href="<?php echo $p['url']; ?>"><?php echo $p['account_name']??''; ?></a><?php } else { ?><?php echo $p['account_name']??''; ?><?php } ?>
							<span class="wpsg-account-order__detail"><?php echo __('Artikelnummer', 'wpsg'); ?>: <?php echo $p['anr']??''; ?></span>
							<?php if ($this->hasMod('wpsg_mod_productvariants') && wpsg_isSizedString($p['mod_vp_varkey'])) { $arVarInfo = $this->callMod('wpsg_mod_productvariants', 'getVariantenInfoArray', array($p['mod_vp_varkey'])); ?>
							<span class="wpsg-account-order__detail"><?php echo __('Variante', 'wpsg'); ?>: <?php echo $arVarInfo['key']; ?></span>
							<?php } ?>
							<?php if ($this->hasMod('wpsg_mod_downloadplus') && empty($p['missing']) && $this->callMod('wpsg_mod_downloadplus', 'isPDFProdukt', array($p['id'])) === true) { ?>
							<?php foreach ((array)$this->callMod('wpsg_mod_downloadplus', 'getIndivFiles', array($p['id'], $order['id'])) as $d) { ?>
							<span class="wpsg-account-order__detail"><?php echo wpsg_translate(__('Datei "#1#": ', 'wpsg'), ((strlen($d['file_out']) > 0)?$d['file_out']:$d['file'])); ?>
							<?php if ($d['status'] == '0') { ?>
							<?php echo __('Noch nicht geplant', 'wpsg'); ?>
							<?php } else if ($d['status'] == '1') { ?>
							<?php echo wpsg_translate(__('Geplant am #1#.', 'wpsg'), date('d.m.Y', strtotime($d['scheduled']))); ?>
							<?php } else if ($d['status'] == '2') { ?>
							<?php $strURL = site_url().'?wpsg_action=wpsg_mod_downloadplus_download&hash='.$d['hash'].'&indi='.$d['indiv_id']; ?>
							<?php echo wpsg_translate(__('<a href="#1#" target="blank">Download</a>', 'wpsg'), $strURL); ?>
							<?php } ?>
							</span>
							<?php } ?>
							<?php } ?>
							<?php if ($this->hasMod('wpsg_mod_productvars')) { $arPV = $this->callMod('wpsg_mod_productvars', 'getAllProductVarValues', array($order['id'], $p['product_index'])); ?>
							<?php /* Etwa für eine Referenznummer, die der Kunde hier nicht sehen soll; siehe doc/einhaengepunkte.md */ $arPV = (array)\apply_filters('wpsg_account_order_productvars', (wpsg_isSizedArray($arPV)?$arPV:[]), intval($order['id']), $p['product_index']??null); ?>
							<?php foreach ($arPV as $pv) { if (!is_array($pv)) continue; ?>
							<span class="wpsg-account-order__detail"><?php echo wpsg_hspc($pv['name']); ?>: <?php echo wpsg_hspc($pv['value']); ?></span>
							<?php } ?>
							<?php } ?>
						</td>
						<td class="col_price">
							<?php if ($this->getFrontendTaxview() == WPSG_NETTO) { ?>
							<?php echo wpsg_ff($p['preis_netto'], $this->get_option('wpsg_currency')); ?>
							<?php } else { ?>
							<?php echo wpsg_ff($p['preis'], $this->get_option('wpsg_currency')); ?>
							<?php } ?>
						</td>
					</tr>
					<?php if (empty($p['missing'])) \do_action('wpsg_mod_kundenverwaltung_order_after_products', $order, $p); ?>
					<?php } ?>
				</table>

			</details>

		</section>

		<?php } ?>
	<?php } else { ?>
	<p><?php echo __('Bisher keine Bestellungen durchgeführt.', 'wpsg'); ?></p>
	<?php } ?>
	
</div>