summaryrefslogtreecommitdiff
path: root/views/order/backendEdit/addVoucher.phtml
blob: 7b9008664f831c439c6e2a958f1c213e16a9d81d (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
<?php
	
	/**
	 * User: Daschmi (daschmi@daschmi.de)
	 * Date: 05.10.2018
	 * Time: 08:24
	 */
	
	namespace wpsg;
	
	/** @var wpsg_calculation $oCalculation */
	$oCalculation = $this->view['oCalculation'];
	 
	if ($this->getBackendTaxView() === WPSG_NETTO) $strBN = 'NETTO';
	else $strBN = 'BRUTTO';
	
	$arCalculation = $oCalculation->getCalculationArray();
	
	$strVal = ((isset($arCalculation['voucher'][0]['set']))?$arCalculation['voucher'][0]['set']:0); 
	
	if (strpos($strVal, '%') !== false) $strVal = wpsg_ff(wpsg_tf($strVal), '%');
	else $strVal = wpsg_ff(wpsg_tf($strVal), $this->get_option('wpsg_currency'));
	
?>

<form id="wpsg_be_voucher_form">
	
	<div class="autocomplete_wrap">
		<?php echo wpsg_drawForm_Input('be_voucher_search', __('Gutscheinsuche', 'wpsg'), ''); ?>
	</div>
	
	<br />
				
	<?php echo wpsg_drawForm_Input('be_voucher_code', __('Code (Optional)', 'wpsg'), @$arCalculation['voucher'][0]['code']); ?>
	<?php echo wpsg_drawForm_Input('be_voucher_id', __('Guschein ID (Optional)', 'wpsg'), @$arCalculation['voucher'][0]['id']); ?>
	<?php echo wpsg_drawForm_Input('be_voucher_amount', wpsg_translate(__('Gutscheinwert in #1# (#2#) oder % ', 'wpsg'), $this->get_option('wpsg_currency'), $strBN), $strVal); ?>
		
</form>

<script>

	jQuery('#wpsg_be_voucher_form').on('submit', function() { return false; } );
	jQuery('#be_voucher_search').focus();
	
	jQuery(document).ready(function() {

		jQuery('#be_voucher_search').autocomplete( {
			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']; ?>',
			minLength: 2,
			appendTo: ".autocomplete_wrap",
			select: function(event, ui) {

				jQuery('#be_voucher_code').val(ui.item.code);
				jQuery('#be_voucher_id').val(ui.item.id);				
				jQuery('#be_voucher_amount').val(ui.item.gs_value);
				
				jQuery('#be_voucher_search').val('');
				
				return false;

			}
		} );
		
	} );

</script>