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();
|
|
|
18 |
|
|
|
19 |
$strVal = ((isset($arCalculation['voucher'][0]['set']))?$arCalculation['voucher'][0]['set']:0);
|
|
|
20 |
|
|
|
21 |
if (strpos($strVal, '%') !== false) $strVal = wpsg_ff(wpsg_tf($strVal), '%');
|
|
|
22 |
else $strVal = wpsg_ff(wpsg_tf($strVal), $this->get_option('wpsg_currency'));
|
|
|
23 |
|
|
|
24 |
?>
|
|
|
25 |
|
|
|
26 |
<form id="wpsg_be_voucher_form">
|
|
|
27 |
|
|
|
28 |
<div class="autocomplete_wrap">
|
|
|
29 |
<?php echo wpsg_drawForm_Input('be_voucher_search', __('Gutscheinsuche', 'wpsg'), ''); ?>
|
|
|
30 |
</div>
|
|
|
31 |
|
|
|
32 |
<br />
|
|
|
33 |
|
|
|
34 |
<?php echo wpsg_drawForm_Input('be_voucher_code', __('Code (Optional)', 'wpsg'), @$arCalculation['voucher'][0]['code']); ?>
|
|
|
35 |
<?php echo wpsg_drawForm_Input('be_voucher_id', __('Guschein ID (Optional)', 'wpsg'), @$arCalculation['voucher'][0]['id']); ?>
|
|
|
36 |
<?php echo wpsg_drawForm_Input('be_voucher_amount', wpsg_translate(__('Gutscheinwert in #1# (#2#) oder % ', 'wpsg'), $this->get_option('wpsg_currency'), $strBN), $strVal); ?>
|
|
|
37 |
|
|
|
38 |
</form>
|
|
|
39 |
|
|
|
40 |
<script>
|
|
|
41 |
|
|
|
42 |
jQuery('#wpsg_be_voucher_form').on('submit', function() { return false; } );
|
|
|
43 |
jQuery('#be_voucher_search').focus();
|
|
|
44 |
|
|
|
45 |
jQuery(document).ready(function() {
|
|
|
46 |
|
|
|
47 |
jQuery('#be_voucher_search').autocomplete( {
|
|
|
48 |
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']; ?>',
|
|
|
49 |
minLength: 2,
|
|
|
50 |
appendTo: ".autocomplete_wrap",
|
|
|
51 |
select: function(event, ui) {
|
|
|
52 |
|
|
|
53 |
jQuery('#be_voucher_code').val(ui.item.code);
|
|
|
54 |
jQuery('#be_voucher_id').val(ui.item.id);
|
|
|
55 |
jQuery('#be_voucher_amount').val(ui.item.gs_value);
|
|
|
56 |
|
|
|
57 |
jQuery('#be_voucher_search').val('');
|
|
|
58 |
|
|
|
59 |
return false;
|
|
|
60 |
|
|
|
61 |
}
|
|
|
62 |
} );
|
|
|
63 |
|
|
|
64 |
} );
|
|
|
65 |
|
|
|
66 |
</script>
|