Subversion Repositories wpShopGermany4

Rev

Rev 7812 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6830 daniel 1
<?php
2
 
3
    /**
4
     * Template für die Anzeige des Abo Statuses in der Hauptbestellung
5
     */
6
 
7804 daniel 7
    $view = $this->view['wpsg_mod_abo'];
6830 daniel 8
 
9
?>
7804 daniel 10
 
7807 daniel 11
<?php foreach ($this->view['arOrderedAboProducts'] as $oOrderProduct) {
6830 daniel 12
 
7809 daniel 13
	try {
14
 
7812 daniel 15
		$oAbo = wpsg_abo::getFromOrderAndOrderProduct($view['oOrder']->getId(), $oOrderProduct->getId());
7809 daniel 16
 
17
		?>
7807 daniel 18
 
7811 daniel 19
		<?php echo wpsg_drawForm_AdminboxStart(
20
			'<a href="'.wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id='.$oOrderProduct->getProductId(), 'wpsg-product-edit-'.$oOrderProduct->getProductId()).'">'.
21
			$oOrderProduct->getProduct()->getProductName().
22
			'</a>'
23
		); ?>
7804 daniel 24
 
7812 daniel 25
			<?php $tExpire = strtotime($this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', Array($_REQUEST['edit_id'], $oOrderProduct->getId()))); ?>
26
			<?php echo wpsg_drawForm_Text(__('Laufzeit', 'wpsg'), wpsg_formatTimestamp($tExpire), 'wpsg_mod_abo_duration_'.$oOrderProduct->getProductIndex(), Array('class_content_wrap' => 'wpsg_abo_state wpsg_abo_state_class_'.$oAbo->getState())); ?>
7809 daniel 27
 
28
			<script>
29
 
30
				moment.locale('de');
31
 
7812 daniel 32
				jQuery('#wpsg_mod_abo_duration_<?php echo $oOrderProduct->getProductIndex(); ?>').editable({
7809 daniel 33
					type: 'combodate',
34
					display: function(value) {
35
 
36
						jQuery(this).html(value.format('DD.MM.YYYY HH:mm:ss'));
37
 
38
					},
39
					success: function(response, newValue) {
40
 
41
						jQuery.ajax({
42
							url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_abo&subaction=admin_inlineEdit&noheader=1',
43
							data: {
44
								field: 'duration',
7812 daniel 45
								order_product_id: '<?php echo $oOrderProduct->getId(); ?>',
7809 daniel 46
								order_id: '<?php echo $view['oOrder']->getId() ?>',
47
								date: newValue.format()
48
							},
49
							success: function(response) {
7812 daniel 50
 
51
                                jQuery('#wpsg_mod_abo_duration_<?php echo $oOrderProduct->getProductIndex(); ?>').parent().parent().attr("class", "col-sm-6 wpsg_abo_state_class_" + response.state)
7809 daniel 52
 
53
							}
54
						})
55
 
56
					},
57
					format: 'DD.MM.YYYY HH:mm:ss',
58
					viewformat: 'DD.MM.YYYY HH:mm:ss',
59
					template: 'D MMM YYYY  HH:mm:ss',
60
					combodate: {
61
						minYear: 2000,
62
						maxYear: <?php echo (intval(date('Y')) + 1); ?>,
63
						minuteStep: 1
64
					}
65
				});
66
 
67
			</script>
68
 
69
			<?php echo wpsg_drawForm_Text(wpsg_translate(__('Preis (#1# Tage):', 'wpsg'), $oOrderProduct->getProduct()->wpsg_mod_abo_durration), wpsg_ff($oOrderProduct->getProduct()->wpsg_mod_abo_price, $this->get_option('wpsg_currency'))); ?>
70
			<?php
71
 
7812 daniel 72
				$strURL = $this->callMod('wpsg_mod_abo', 'getRebuyLink', [$view['oOrder']->getId(), $oOrderProduct->getId()]);
7809 daniel 73
				$strURL = '<a href="'.$strURL.'">'.$strURL.'</a>';
74
 
75
				echo wpsg_drawForm_Text(__('URL für den Kauf einer Verlängerung', 'wpsg'), $strURL);
76
 
77
			?>
78
 
79
			<?php echo wpsg_drawForm_TextStart(); ?>
7804 daniel 80
 
7812 daniel 81
				<?php $abo_product_status = $this->callMod('wpsg_mod_abo', 'getAboProductStatus', Array($_REQUEST['edit_id'], $oOrderProduct->getId())); ?>
7809 daniel 82
 
83
				<?php if ($abo_product_status['status'] === wpsg_mod_abo::STATUS_ACTIVE) { ?>
7804 daniel 84
 
7809 daniel 85
					<?php echo __('Aktiv', 'wpsg'); ?>
86
 
7822 daniel 87
					&nbsp;[&nbsp;<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_abo&edit_id=<?php echo $_REQUEST['edit_id'] ?>&order_product_id=<?php echo $oOrderProduct->getID(); ?>&do=stop&noheader=1"><?php echo __('Deaktivieren'); ?></a>&nbsp;]
7809 daniel 88
 
89
				<?php } else if ($abo_product_status['status'] === wpsg_mod_abo::STATUS_STOPPED) { ?>
90
 
91
					<?php echo __('Inaktiv', 'wpsg'); ?>
7807 daniel 92
 
7822 daniel 93
					&nbsp;[&nbsp;<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_abo&edit_id=<?php echo $_REQUEST['edit_id'] ?>&order_product_id=<?php echo $oOrderProduct->getID(); ?>&do=run&noheader=1"><?php echo __('Aktivieren'); ?></a>&nbsp;]
7807 daniel 94
 
7809 daniel 95
				<?php } ?>
96
 
97
			<?php echo wpsg_drawForm_TextEnd(__('Verlängerung')); ?>
98
 
99
		<?php echo wpsg_drawForm_AdminboxEnd(); ?>
100
 
101
	<?php } catch (\Exception $e) { ?>
6830 daniel 102
 
7809 daniel 103
        <?php echo wpsg_drawForm_AdminboxStart($oOrderProduct->getProduct()->getProductName()); ?>
104
 
105
			<p><?php echo __('Abo wurde gelöscht.', 'wpsg'); ?></p>
106
 
107
		<?php echo wpsg_drawForm_AdminboxEnd(); ?>
108
 
109
	<?php } ?>
6830 daniel 110
 
111
<?php } ?>