Subversion Repositories wpShopGermany4

Rev

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

Rev Author Line No. Line
7179 daniel 1
<?php
2
 
3
	/**
4
	 * User: Daschmi (daschmi@daschmi.de)
5
	 * Date: 05.10.2018
6
	 * Time: 08:24
7
	 */
8
 
9
	namespace wpsg;
10
 
11
	/** @var wpsg_calculation $oCalculation */
12
	$oCalculation = $this->view['oCalculation'];
13
 
14
	if ($this->getBackendTaxView() === WPSG_NETTO) $strBN = 'NETTO';
15
	else $strBN = 'BRUTTO';
16
 
17
	$arCalculation = $oCalculation->getCalculationArray();
7486 daniel 18
	$voucher = [
19
		'code' => '',
20
		'id' => 0,
21
		'set' => 0,
22
		'type' => 'voucher'
23
	];
7179 daniel 24
 
7486 daniel 25
	// Voucher suchen
26
	foreach (array_merge($arCalculation['voucher'], $arCalculation['coupon']) as $v) {
27
 
28
		if ($v['order_voucher_id'] == $_REQUEST['order_voucher_id']) {
29
 
30
			$voucher = $v;
31
 
32
		}
33
 
34
	}
35
 
36
	$strVal = ((isset($voucher['set']))?$voucher['set']:0);
7179 daniel 37
 
38
	if (strpos($strVal, '%') !== false) $strVal = wpsg_ff(wpsg_tf($strVal), '%');
39
	else $strVal = wpsg_ff(wpsg_tf($strVal), $this->get_option('wpsg_currency'));
7486 daniel 40
 
7179 daniel 41
?>
42
 
43
<form id="wpsg_be_voucher_form">
44
 
7486 daniel 45
	<input type="hidden" name="order_voucher_id" value="<?php echo wpsg_getInt($_REQUEST['order_voucher_id']); ?>" />
46
 
7179 daniel 47
	<div class="autocomplete_wrap">
48
		<?php echo wpsg_drawForm_Input('be_voucher_search', __('Gutscheinsuche', 'wpsg'), ''); ?>
49
	</div>
50
 
51
	<br />
52
 
7486 daniel 53
	<?php echo wpsg_drawForm_Input('be_voucher_code', __('Code (Optional)', 'wpsg'), @$voucher['code']); ?>
54
	<?php echo wpsg_drawForm_Input('be_voucher_id', __('Guschein ID', 'wpsg'), @$voucher['id']); ?>
7179 daniel 55
	<?php echo wpsg_drawForm_Input('be_voucher_amount', wpsg_translate(__('Gutscheinwert in #1# (#2#) oder % ', 'wpsg'), $this->get_option('wpsg_currency'), $strBN), $strVal); ?>
7486 daniel 56
	<?php echo wpsg_drawForm_Checkbox('be_voucher_coupon', __('Wertgutschein'), (($voucher['type'] === 'coupon')?'1':'0')); ?>
7179 daniel 57
 
58
</form>
59
 
60
<script>
61
 
62
	jQuery('#wpsg_be_voucher_form').on('submit', function() { return false; } );
63
	jQuery('#be_voucher_search').focus();
64
 
65
	jQuery(document).ready(function() {
66
 
67
		jQuery('#be_voucher_search').autocomplete( {
68
			source: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editVoucher&do=search&noheader=1&edit_id=<?php echo $_REQUEST['edit_id']; ?>',
69
			minLength: 2,
70
			appendTo: ".autocomplete_wrap",
71
			select: function(event, ui) {
72
 
73
				jQuery('#be_voucher_code').val(ui.item.code);
74
				jQuery('#be_voucher_id').val(ui.item.id);
75
				jQuery('#be_voucher_amount').val(ui.item.gs_value);
76
 
77
				jQuery('#be_voucher_search').val('');
78
 
79
				return false;
80
 
81
			}
82
		} );
83
 
84
	} );
85
 
86
</script>