summaryrefslogtreecommitdiff
path: root/views/order/backendEdit
diff options
context:
space:
mode:
authorDaniel Schmitzer <noreply@maennchen1.de>2018-09-28 07:05:48 +0000
committerDaniel Schmitzer <noreply@maennchen1.de>2018-09-28 07:05:48 +0000
commitb6dd44ae23fe378b9d857ab38a9f1318d0d6274f (patch)
tree112bd1d5ed740f01bf9341d5c0ed7db995eb4049 /views/order/backendEdit
parent1b94e9e9c54019ee68f12accaac82a6971b555a6 (diff)
- Produktbearbeitung Backend
- Neue Calculation für das Backend git-svn-id: https://[internal]/wordpress/plugins/wpsg4@7173 0d5edaf7-2b12-4e95-93f4-047927463d4b
Diffstat (limited to 'views/order/backendEdit')
-rw-r--r--views/order/backendEdit/addDiscount.phtml33
-rw-r--r--views/order/backendEdit/addProduct.phtml79
-rw-r--r--views/order/backendEdit/addProduct_product_selected.phtml72
-rw-r--r--views/order/backendEdit/editPayShipping.phtml108
4 files changed, 292 insertions, 0 deletions
diff --git a/views/order/backendEdit/addDiscount.phtml b/views/order/backendEdit/addDiscount.phtml
new file mode 100644
index 0000000..68873e7
--- /dev/null
+++ b/views/order/backendEdit/addDiscount.phtml
@@ -0,0 +1,33 @@
+<?php
+
+ /**
+ * Template für das Bearbeiten eines Rabattes im Backend
+ */
+
+ namespace wpsg;
+
+ /** @var wpsg_calculation $oCalculation */
+ $oCalculation = $this->view['oCalculation'];
+
+ $arTax = $oCalculation->getTaxLabelArray();
+
+ if ($this->getBackendTaxView() === WPSG_NETTO) $strBN = 'NETTO';
+ else $strBN = 'BRUTTO';
+
+ $arCalculation = $oCalculation->getCalculationArray();
+
+?>
+
+<form id="wpsg_be_discount_form">
+
+ <?php echo wpsg_drawForm_Input('be_discount_amount', wpsg_translate(__('Rabattwert in #1# (#2#) oder % ', 'wpsg'), $this->get_option('wpsg_currency'), $strBN), @$arCalculation['discount'][0]['set']); ?>
+ <?php echo wpsg_drawForm_Select('be_discount_tax', __('Steuersatz', 'wpsg'), $arTax, @$arCalculation['discount'][0]['tax_key']); ?>
+
+</form>
+
+<script>
+
+ jQuery('#wpsg_be_discount_form').on('submit', function() { return false; } );
+ jQuery('#be_discount_amount').focus();
+
+</script>
diff --git a/views/order/backendEdit/addProduct.phtml b/views/order/backendEdit/addProduct.phtml
new file mode 100644
index 0000000..afd946b
--- /dev/null
+++ b/views/order/backendEdit/addProduct.phtml
@@ -0,0 +1,79 @@
+<?php
+
+ /**
+ * Template für das hinzufügen von Produkten zur Bestellung
+ */
+
+?>
+
+<style>
+
+ #product_search { width:100%; }
+
+</style>
+
+<form id="wpsg_product_add_form">
+
+ <div class="autocomplete_wrap">
+ <input type="text" id="product_search" name="product_serch" value="" placeholder="<?php echo __('Produktsuche', 'wpsg'); ?>" />
+ </div>
+
+ <hr />
+
+ <div id="wpsg_product_add_target">
+
+ </div>
+
+</form>
+
+<script>
+
+ function wpsg_loadProduct(product_id, order_product_id) {
+
+ jQuery('#wpsg_product_add_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+ jQuery.ajax( {
+ url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&do=product&noheader=1&edit_id=<?php $_REQUEST['edit_id']; ?>',
+ data: {
+ product_id: product_id,
+ order_product_id: order_product_id
+ },
+ success: function(data) {
+
+ jQuery('#wpsg_product_add_target').html(data);
+
+ }
+ } );
+
+ } // function wpsg_loadProduct(product_id, order_product_id)
+
+ jQuery(document).ready(function() {
+
+ jQuery('#wpsg_product_add_form').on('submit', function() { return false; } );
+
+ jQuery('#product_search').autocomplete( {
+ source: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&do=search&noheader=1&edit_id=<?php echo $_REQUEST['edit_id']; ?>',
+ minLength: 2,
+ appendTo: ".autocomplete_wrap",
+ select: function(event, ui) {
+
+ wpsg_loadProduct(ui.item.id, <?php echo ((wpsg_isSizedInt($_REQUEST['order_product_id']))?$_REQUEST['order_product_id']:0); ?>);
+
+ return false;
+
+ }
+ } );
+
+ <?php if (wpsg_isSizedInt($_REQUEST['order_product_id'])) { ?>
+
+ wpsg_loadProduct(0, <?php echo $_REQUEST['order_product_id']; ?>);
+
+ <?php } else { ?>
+
+ jQuery('#product_search').focus();
+
+ <?php } ?>
+
+ } );
+
+</script> \ No newline at end of file
diff --git a/views/order/backendEdit/addProduct_product_selected.phtml b/views/order/backendEdit/addProduct_product_selected.phtml
new file mode 100644
index 0000000..ba13724
--- /dev/null
+++ b/views/order/backendEdit/addProduct_product_selected.phtml
@@ -0,0 +1,72 @@
+<?php
+
+ /**
+ * Template für das hinzufügen eines Produktes wenn das Produkt ausgewählt wurde
+ */
+
+ /** @var wpsg_product $oProduct */
+ $oProduct = $this->view['oProduct'];
+
+ /** @var wpsg_order_product $oOrderProduct */
+ $oOrderProduct = $this->view['oOrderProduct'];
+
+?>
+
+<style>
+
+ .wpsg_product_add { position:relative; min-height:150px; }
+ .wpsg_product_add .image { position:absolute; left:0px; top:10px; }
+
+</style>
+
+<strong><?php echo $oProduct->getProductName(); ?></strong>
+
+<div class="wpsg_product_add">
+
+ <input type="hidden" name="product_id" value="<?php echo $oProduct->id; ?>" />
+
+ <?php if ($oOrderProduct !== false) { ?>
+ <input type="hidden" name="order_product_id" value="<?php echo $oOrderProduct->id; ?>" />
+ <?php } ?>
+
+ <?php
+
+ $attachment_id = $GLOBALS['wpsg_sc']->imagehandler->getAttachmentID($oProduct->id);
+
+ ?>
+
+ <?php if (wpsg_isSizedInt($attachment_id)) { ?>
+ <div class="image"><?php echo wp_get_attachment_image($attachment_id, [100, 100]); ?></div>
+ <?php } ?>
+
+ <?php echo wpsg_drawForm_Input('add_price', __('Produktpreis', 'wpsg').' '.(($this->getBackendTaxView() === WPSG_BRUTTO)?'(BRUTTO)':'(NETTO'), (($oOrderProduct !== false)?$oOrderProduct->getPrice($this->getBackendTaxView()):$oProduct->getPrice($this->getBackendTaxView()))); ?>
+ <?php echo wpsg_drawForm_Input('add_amount', __('Menge', 'wpsg'), (($oOrderProduct !== false)?$oOrderProduct->getCount():'1')); ?>
+
+ <?php if ($this->callMod('wpsg_mod_productvariants', 'isVariantsProduct', [$oProduct->id])) { $arVariants = $this->callMod('wpsg_mod_productvariants', 'getVariants', [$oProduct->id, true, true, true]); ?>
+
+ <?php if (wpsg_isSizedArray($arVariants)) { ?>
+
+ <br />
+
+ <?php foreach ($arVariants as $var_id => $var_data) {
+
+ $arVariSelect = [];
+ foreach ($var_data['arVariation'] as $vari_id => $vari_data) $arVariSelect[$vari_id] = $vari_data['name'];
+
+ ?>
+
+ <?php echo wpsg_drawForm_Select('wpsg_vp['.$var_id.']', $var_data['name'], $arVariSelect,''); ?>
+
+ <?php } ?>
+
+ <?php } ?>
+
+ <?php } ?>
+
+ <script>
+
+ jQuery('#wpsg_product_dialog .btn-primary').prop('disabled', false);
+
+ </script>
+
+</div> \ No newline at end of file
diff --git a/views/order/backendEdit/editPayShipping.phtml b/views/order/backendEdit/editPayShipping.phtml
new file mode 100644
index 0000000..a38ac1c
--- /dev/null
+++ b/views/order/backendEdit/editPayShipping.phtml
@@ -0,0 +1,108 @@
+<?php
+
+ /**
+ * Template für das Bearbeiten der Versand- und Zahlungsart im Backend
+ */
+
+ $arShippingSelect = [];
+ foreach ($this->arShipping as $shipping_id => $shipping_data) {
+
+ $arShippingSelect[$shipping_id] = $shipping_data['name'];
+
+ if (wpsg_isSizedDouble($shipping_data['price'])) {
+
+ $arShippingSelect[$shipping_id] .= ' ('.wpsg_ff($shipping_data['price'],$this->get_option('wpsg_currency')).')';
+
+ }
+
+ }
+
+ $arPaymentSelect = [];
+ foreach ($this->arPayment as $payment_id => $payment_data) {
+
+ $arPaymentSelect[$payment_id] = $payment_data['name'];
+
+ if (wpsg_isSizedDouble($payment_data['preis'])) {
+
+ $arPaymentSelect[$payment_id] .= ' ('.wpsg_ff($payment_data['preis'],$this->get_option('wpsg_currency')).')';
+
+ }
+
+ }
+
+ if ($this->getBackendTaxview() === WPSG_BRUTTO) {
+
+ $price_shipping = wpsg_ff($this->view['data']['price_shipping_brutto'], $this->get_option('wpsg_currency'));
+ $price_payment = wpsg_ff($this->view['data']['price_payment_brutto'], $this->get_option('wpsg_currency'));
+
+ $price_suffix = ' ('.__('Brutto', 'wpsg').')';
+
+ } else {
+
+ $price_shipping = wpsg_ff($this->view['data']['price_shipping_brutto'], $this->get_option('wpsg_currency'));
+ $price_payment = wpsg_ff($this->view['data']['price_payment_brutto'], $this->get_option('wpsg_currency'));
+
+ $price_suffix = ' ('.__('Netto', 'wpsg').')';
+
+ }
+
+?>
+
+<div id="editPayShipping">
+
+ <?php echo wpsg_drawForm_Select('edit_shipping_type', __('Versandart', 'wpsg'), $arShippingSelect,$this->view['data']['type_shipping']); ?>
+ <?php echo wpsg_drawForm_Input('edit_shipping_price', __('Kosten', 'wpsg').$price_suffix, $price_shipping); ?>
+
+ <br />
+
+ <?php echo wpsg_drawForm_Select('edit_payment_type', __('Zahlungsart', 'wpsg'), $arPaymentSelect,$this->view['data']['type_payment']); ?>
+ <?php echo wpsg_drawForm_Input('edit_payment_price', __('Kosten', 'wpsg').$price_suffix, $price_payment); ?>
+
+</div>
+
+<script>
+
+ var arShipping = <?php echo json_encode($this->arShipping); ?>;
+ var arPayment = <?php echo json_encode($this->arPayment); ?>;
+
+ jQuery('#edit_shipping_type').on('change', function() {
+
+ for (var i in arShipping) {
+
+ if (i == jQuery(this).val()) {
+
+ var price = parseFloat(jQuery('#edit_shipping_price').val().replace('EUR', '').replace(',', '.'));
+
+ if (isNaN(price) || price <= 0) {
+
+ jQuery('#edit_shipping_price').val(wpsg_number_format(arShipping[i].price, 2, ',') + ' <?php echo $this->get_option('wpsg_currency'); ?>');
+
+ }
+
+ }
+
+ }
+
+ } ).change();
+
+ jQuery('#edit_payment_type').on('change', function() {
+
+ for (var i in arPayment) {
+
+ if (i == jQuery(this).val()) {
+
+ var price = parseFloat(jQuery('#edit_payment_price').val().replace('EUR', '').replace(',', '.'));
+
+ if (isNaN(price) || price <= 0) {
+
+ jQuery('#edit_payment_price').val(wpsg_number_format(arPayment[i].preis, 2, ',') + ' <?php echo $this->get_option('wpsg_currency'); ?>');
+
+ }
+
+ }
+
+ }
+
+ } ).change();
+
+</script>