Rev 7811 | Rev 7822 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/**
* Template für die Anzeige des Abo Statuses in der Hauptbestellung
*/
$view = $this->view['wpsg_mod_abo'];
?>
<?php foreach ($this->view['arOrderedAboProducts'] as $oOrderProduct) {
try {
$oAbo = wpsg_abo::getFromOrderAndOrderProduct($view['oOrder']->getId(), $oOrderProduct->getId());
?>
<?php echo wpsg_drawForm_AdminboxStart(
'<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()).'">'.
$oOrderProduct->getProduct()->getProductName().
'</a>'
); ?>
<?php $tExpire = strtotime($this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', Array($_REQUEST['edit_id'], $oOrderProduct->getId()))); ?>
<?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())); ?>
<script>
moment.locale('de');
jQuery('#wpsg_mod_abo_duration_<?php echo $oOrderProduct->getProductIndex(); ?>').editable({
type: 'combodate',
display: function(value) {
jQuery(this).html(value.format('DD.MM.YYYY HH:mm:ss'));
},
success: function(response, newValue) {
jQuery.ajax({
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_abo&subaction=admin_inlineEdit&noheader=1',
data: {
field: 'duration',
order_product_id: '<?php echo $oOrderProduct->getId(); ?>',
order_id: '<?php echo $view['oOrder']->getId() ?>',
date: newValue.format()
},
success: function(response) {
jQuery('#wpsg_mod_abo_duration_<?php echo $oOrderProduct->getProductIndex(); ?>').parent().parent().attr("class", "col-sm-6 wpsg_abo_state_class_" + response.state)
}
})
},
format: 'DD.MM.YYYY HH:mm:ss',
viewformat: 'DD.MM.YYYY HH:mm:ss',
template: 'D MMM YYYY HH:mm:ss',
combodate: {
minYear: 2000,
maxYear: <?php echo (intval(date('Y')) + 1); ?>,
minuteStep: 1
}
});
</script>
<?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'))); ?>
<?php
$strURL = $this->callMod('wpsg_mod_abo', 'getRebuyLink', [$view['oOrder']->getId(), $oOrderProduct->getId()]);
$strURL = '<a href="'.$strURL.'">'.$strURL.'</a>';
echo wpsg_drawForm_Text(__('URL für den Kauf einer Verlängerung', 'wpsg'), $strURL);
?>
<?php echo wpsg_drawForm_TextStart(); ?>
<?php $abo_product_status = $this->callMod('wpsg_mod_abo', 'getAboProductStatus', Array($_REQUEST['edit_id'], $oOrderProduct->getId())); ?>
<?php if ($abo_product_status['status'] === wpsg_mod_abo::STATUS_ACTIVE) { ?>
<?php echo __('Aktiv', 'wpsg'); ?>
[ <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'] ?>&product_key=<?php echo $oOrderProduct->getProductKey(); ?>&do=stop&noheader=1"><?php echo __('Deaktivieren'); ?></a> ]
<?php } else if ($abo_product_status['status'] === wpsg_mod_abo::STATUS_STOPPED) { ?>
<?php echo __('Inaktiv', 'wpsg'); ?>
[ <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'] ?>&product_key=<?php echo $oOrderProduct->getProductKey(); ?>&do=run&noheader=1"><?php echo __('Aktivieren'); ?></a> ]
<?php } ?>
<?php echo wpsg_drawForm_TextEnd(__('Verlängerung')); ?>
<?php echo wpsg_drawForm_AdminboxEnd(); ?>
<?php } catch (\Exception $e) { ?>
<?php echo wpsg_drawForm_AdminboxStart($oOrderProduct->getProduct()->getProductName()); ?>
<p><?php echo __('Abo wurde gelöscht.', 'wpsg'); ?></p>
<?php echo wpsg_drawForm_AdminboxEnd(); ?>
<?php } ?>
<?php } ?>