From 9b4baec1311ee5a28e00e4fdd4c6c166d005d5ba Mon Sep 17 00:00:00 2001 From: hartmut Date: Thu, 1 Dec 2016 14:30:44 +0000 Subject: Bestellungen OK, Versand- und Zahlungsarten teilweise, wspg_editable geändert in wpsg_editable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://[internal]/wordpress/plugins/wpsg4@5934 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/order/view.phtml | 9 +- views/order/view_orderdata.phtml | 691 +++++++++++++++++++++++++++++++++------ 2 files changed, 595 insertions(+), 105 deletions(-) (limited to 'views/order') diff --git a/views/order/view.phtml b/views/order/view.phtml index 8df88e7..55e8386 100644 --- a/views/order/view.phtml +++ b/views/order/view.phtml @@ -37,11 +37,15 @@ +   + +
+
hasMod('wpsg_mod_gutschein')) { ?> view['basket'])) && ($this->view['basket']['gs']['value'] == 0))) { ?>   - +
@@ -49,7 +53,7 @@ hasMod('wpsg_mod_discount')) { ?> view['basket']['sum'])) && ($this->view['basket']['sum']['preis_rabatt'] == 0))) { ?>   - +
@@ -118,6 +122,7 @@ } // function wpsg_addVoucher() + jQuery(document).ready(function() { diff --git a/views/order/view_orderdata.phtml b/views/order/view_orderdata.phtml index c031b35..14968dc 100644 --- a/views/order/view_orderdata.phtml +++ b/views/order/view_orderdata.phtml @@ -25,6 +25,8 @@ getProductName($this->getProduktID($p['id']))); ?> + + get_option('wpsg_currency'); ?> view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?> @@ -99,7 +101,8 @@ getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').''); ?> getFrontendTaxview() == WPSG_NETTO) - if ($this->view['basket']['price_frontend'] == WPSG_NETTO) + //if ($this->view['basket']['price_frontend'] == WPSG_NETTO) + if ($this->get_option('wpsg_preisangaben') == WPSG_NETTO) { ?> getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').''); ?> @@ -115,9 +118,19 @@ + view['oOrder']; + $o_id = $_REQUEST['edit_id']; + $oOrder = wpsg_order::getInstance($o_id); + $sid = $oOrder->getShippingID(); + echo __(' ('.$this->arShipping[$sid]['name'].')', 'wpsg'); + ?> + - view['basket']['sum']['preis_shipping']); ?> get_option('wpsg_currency'); ?> + view['basket']['sum']['preis_shipping']); ?> + get_option('wpsg_currency'); ?> @@ -130,10 +143,13 @@ $pid = $oOrder->getPaymentID(); echo __(' ('.$this->arPayment[$pid]['name'].')', 'wpsg'); ?> - + + - - view['basket']['sum']['preis_payment']); ?> get_option('wpsg_currency'); ?> + + view['basket']['sum']['preis_payment']); ?> + get_option('wpsg_currency'); ?> @@ -157,14 +173,16 @@ view['basket']['sum']['preis_gesamt']); ?> get_option('wpsg_currency'); ?> - get_option('wpsg_kleinunternehmer') == '1' || $this->get_option('wpsg_preisangaben') != '1') { ?> + get_option('wpsg_kleinunternehmer') == '1' || $this->get_option('wpsg_preisangaben') != WPSG_NETTO) { ?> view['basket']['mwst'] as $mwst_id => $mwst) { ?> get_option('wpsg_kleinunternehmer') == '1') { ?> get_option('wpsg_kleinunternehmer_text'); ?> - view['basket']['price_frontend'] == WPSG_NETTO) { + view['basket']['price_frontend'] == WPSG_NETTO) { + if ($this->get_option('wpsg_preisangaben') == WPSG_NETTO) { echo wpsg_translate(__('zuzüglich MwSt. (#1#)', 'wpsg'), $mwst['name']); } else { echo wpsg_translate(__('darin enthaltene MwSt. (#1#)', 'wpsg'), $mwst['name']); ?> @@ -185,7 +203,7 @@ hasMod('wpsg_mod_gutschein')) { ?> view['basket'])) && ($this->view['basket']['gs']['value'] > 0)) { ?> - jQuery('#gsname_').wspg_editable('wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=editname&noheader=1', { + jQuery('#gsname_').wpsg_editable('wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=editname&noheader=1', { submitdata: { field: 'code', gs_id: '', @@ -200,7 +218,7 @@ } }); - jQuery('#gsvalue_').wspg_editable('wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=editvalue&noheader=1', { + jQuery('#gsvalue_').wpsg_editable('wp-admin/admin.php?page=wpsg-Admin&subaction=voucherData&do=editvalue&noheader=1', { submitdata: { field: 'value', gs_id: '', @@ -224,7 +242,7 @@ hasMod('wpsg_mod_discount')) { ?> view['basket']['sum']['preis_rabatt']) && $this->view['basket']['sum']['preis_rabatt'] > 0) { ?> - jQuery('#discountvalue_').wspg_editable('wp-admin/admin.php?page=wpsg-Admin&subaction=discountData&do=editvalue&noheader=1', { + jQuery('#discountvalue_').wpsg_editable('wp-admin/admin.php?page=wpsg-Admin&subaction=discountData&do=editvalue&noheader=1', { submitdata: { field: 'value', edit_id: '', @@ -307,131 +325,598 @@ //Modul2.methode(); - var WPSG_BE_Payment = { + var WPSG_BE_Pay_Ship = { + + paymentinfos: 0, + shippinginfos: 0, + pidold: 0, + sidold: 0, + preisold: 0.0, + oid: 0, + + changePayment: function (id, oid) { + var + i, + n; + //jQuery('#wpsg_payment_dialog .modal-body').html('<?php echo __('Bitte warten ...', 'wpsg'); ?>'); + + jQuery('#wpsg_payment_dialog').modal( { } ); + + this.paymentinfos = arPayment, JSON_FORCE_OBJECT); ?>; + this.oid = oid; + this.pidold = id; + + jQuery('#zahlungsartid').empty(); + jQuery.each(this.paymentinfos, function(i,n) { + console.log('element: ', n.name); + if (id == n.id) { + jQuery('#zahlungsartid').append(""); + } else { + jQuery('#zahlungsartid').append(""); + } + }); + jQuery('#zahlungsartid').val(id); + + //this.preis = this.paymentinfos[id].preis; + //this.preis = jQuery('#wpsg_cell_payment_value').val(); + this.preis = jQuery('#wpsg_cell_payment_value').html(); + this.preisold = this.preis; + if (this.preis == false) { this.preis = '0,00'; } + jQuery('#zahlungsartvalue').val(this.preis); + + return false; + + }, // function changePayment(id, oid) + + /** + * Löschen der Zahlungsdaten im Backend + */ + deletePayment: function(id, oid) { + var + pid, + url1; + + pid = jQuery('#zahlungsartid').val(); + pval = jQuery('#zahlungsartvalue').val(); + //alert('delete : ' + pid + ' / ' + pval); + + url1 = 'wp-admin/admin.php?page=wpsg-Admin&subaction=paymentData&do=delete&edit_id=' + this.oid + '&p_id=' + pid + '&noheader=1'; + jQuery.ajax( { + url: '' + url1, + success: function(data) { + //jQuery('#wpsg_payment_dialog').modal('hide'); + //jQuery('#wpsg_payment_dialog').hide(); + //jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide'); + jQuery('#wpsg_produkte_table').replaceWith(data); + } + } ); + + return false; + + }, // function deletePayment() + + /** + * Ändern der Zahlungsdaten im Backend + */ + dialogPaymentOK: function() { + var + pid, + pval, + url1; + + pid = jQuery('#zahlungsartid').val(); + pval = jQuery('#zahlungsartvalue').val(); + //alert('OK neu: ' + this.pidold + ' / ' + pid + ' / ' + pval); + if ((this.pidold == pid) && (this.preisold == pval)) { + jQuery('#wpsg_payment_dialog').modal('hide'); + //jQuery('#wpsg_payment_dialog').modal('close'); + return false; + } + //alert('OK neu: ' + pid + ' / ' + pval); + + url1 = 'wp-admin/admin.php?page=wpsg-Admin&subaction=paymentData&do=change&edit_id=' + this.oid + '&p_id=' + pid + '&p_value=' + pval + '&noheader=1'; + jQuery.ajax( { + url: '' + url1, + data: { + price_frontend: 'view['basket']['price_frontend']; ?>', + mwst: 'view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>', + noMwSt: 'view['basket']['noMwSt']; ?>' }, + success: function(data) { + //jQuery('#wpsg_payment_dialog').modal('hide'); + //jQuery('#wpsg_payment_dialog').hide(); + //jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide'); + jQuery('#wpsg_produkte_table').replaceWith(data); + } + } ); + + return false; + + }, // function dialogPaymentOK() + + /** + * Ändern der Zahlungsdaten im Backend + */ + dialogPaymentChange: function() { + var + pid, + pval; + pid = jQuery('#zahlungsartid').val(); + pval = this.paymentinfos[pid].preis; + jQuery('#zahlungsartvalue').val(pval); + + + }, // dialogPaymentChange() + + + changeShipping: function (id, oid) { + var + i, + n; + //jQuery('#wpsg_shipping_dialog .modal-body').html('<?php echo __('Bitte warten ...', 'wpsg'); ?>'); + + jQuery('#wpsg_shipping_dialog').modal( { } ); + + this.shippinginfos = arShipping, JSON_FORCE_OBJECT); ?>; + this.oid = oid; + this.sidold = id; + + jQuery('#versandartid').empty(); + jQuery.each(this.shippinginfos, function(i,n) { + console.log('element: ', n.name); + if (id == n.id) { + jQuery('#versandartid').append(""); + } else { + jQuery('#versandartid').append(""); + } + }); + jQuery('#versandartid').val(id); + + this.preis = jQuery('#wpsg_cell_shipping_value').html(); + this.preisold = this.preis; + if (this.preis == false) { this.preis = '0,00'; } + jQuery('#versandartvalue').val(this.preis); + + return false; + + }, // function changeShipping(id, oid) + + /** + * Löschen der Versanddaten im Backend + */ + deleteShipping: function(id, oid) { + var + sid, + url1; + + sid = jQuery('#versandartid').val(); + sval = jQuery('#versandartvalue').val(); + //alert('delete : ' + sid + ' / ' + sval); + + url1 = 'wp-admin/admin.php?page=wpsg-Admin&subaction=shippingData&do=delete&edit_id=' + this.oid + '&s_id=' + sid + '&noheader=1'; + jQuery.ajax( { + url: '' + url1, + success: function(data) { + //jQuery('#wpsg_payment_dialog').modal('hide'); + //jQuery('#wpsg_payment_dialog').hide(); + //jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide'); + jQuery('#wpsg_produkte_table').replaceWith(data); + } + } ); + + return false; + + }, // function deleteShipping() + + /** + * Ändern der Versanddaten im Backend + */ + dialogShippingOK: function() { + var + sid, + sval, + url1; + + sid = jQuery('#versandartid').val(); + sval = jQuery('#versandartvalue').val(); + //alert('OK neu: ' + this.sidold + ' / ' + sid + ' / ' + sval); + if ((this.sidold == sid) && (this.preisold == sval)) { + jQuery('#wpsg_shipping_dialog').modal('hide'); + //jQuery('#wpsg_shipping_dialog').modal('close'); + return false; + } + //alert('OK neu: ' + sid + ' / ' + sval); + + url1 = 'wp-admin/admin.php?page=wpsg-Admin&subaction=shippingData&do=change&edit_id=' + this.oid + '&s_id=' + sid + '&s_value=' + sval + '&noheader=1'; + jQuery.ajax( { + url: '' + url1, + data: { + price_frontend: 'view['basket']['price_frontend']; ?>', + mwst: 'view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>', + noMwSt: 'view['basket']['noMwSt']; ?>' }, + success: function(data) { + //jQuery('#wpsg_payment_dialog').modal('hide'); + //jQuery('#wpsg_payment_dialog').hide(); + //jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide'); + jQuery('#wpsg_produkte_table').replaceWith(data); + } + } ); + + return false; + + }, // function dialogShippingOK() + + /** + * Ändern der Versanddaten im Backend + */ + dialogShippingChange: function() { + var + sid, + sval; + sid = jQuery('#versandartid').val(); + sval = this.shippinginfos[pid].preis; + jQuery('#versandartvalue').val(sval); + + + }, // dialogShippingChange() + + changePayment2: function (id, oid) { - paymentinfos: 0, - pidold: 0, - oid: 0, + alert('TEST OK neu2'); - changePayment: function (id, oid) { + } // function changePayment2(id, oid) + + }; // WPSG_BE_Pay_Ship + //WPSG_BE_Pay_Ship.changePayment2(1, 2); + + + var WPSG_BE_Product = { - //alert('TEST OK neu'); + pidold: 0, + preisold: 0.0, + o_id: 0, + p_id: 0, + op_id: 0, + modus: 0, - //jQuery('#wpsg_payment_dialog .modal-body').html('<?php echo __('Bitte warten ...', 'wpsg'); ?>'); + productinfos : view['basket']['produkte'], JSON_FORCE_OBJECT); ?>, + mwstinfos : , + allproductinfos : db->fetchAssoc("SELECT * FROM `".wpsg_q(WPSG_TBL_PRODUCTS)."` WHERE `deleted` != '1'"), JSON_FORCE_OBJECT); ?>, + mwst1 : view['basket']['mwst'], JSON_FORCE_OBJECT); ?>, + noMwSt: 'view['basket']['noMwSt']; ?>', + mwst2: 'view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>', + + /** + * Wird aufgerufen wenn ein Produkt gelöscht werden soll + */ + removeProduct: function (op_id, o_id) + { + + if (!confirm('')) return false; + + jQuery('#wpsg_produkte_table').html('<?php echo __('Bitte warten ...', 'wpsg'); ?>'); + + jQuery.ajax( { + url: 'wp-admin/admin.php?page=wpsg-Admin&subaction=productData&do=remove&edit_id=' + o_id + '&op_id=' + op_id + '&noheader=1', + success: function (data) { + jQuery('#wpsg_produkte_table').replaceWith(data); + } + } ); + + return false; + }, // function removeProduct + + /** + * Wird aufgerufen wenn ein Produkt hinzugefügt werden soll + */ + addProduct: function (o_id, p_id) { + //jQuery('#wpsg_produkte_table').html('<?php echo __('Bitte warten ...', 'wpsg'); ?>'); + this.op_id = 0; + this.p_id = p_id; + this.o_id = o_id; + + //alert('TEST'); + jQuery('#wpsg_product_dialog').modal( { } ); + + this.modus = 1; // neues Produkt + jQuery('#wpsg_product_data').hide(); + + jQuery('#productid').empty(); + jQuery.each(this.allproductinfos, function (i,n) { + jQuery('#productid').append(""); + }); + jQuery('#productid').val(p_id); + + + return false; + }, // function addProduct + + /** + * Ändern der Produktdaten im Backend + */ + dialogProductOK: function () { + var + pid, + pval, + pme, + pmwst, + url1; + + pid = jQuery('#productid').val(); + pval = jQuery('#productvalue').val(); + pme = jQuery('#productmenge').val(); + pmwst = jQuery('#productmwst').val(); + //alert('OK neu: ' + this.pidold + ' / ' + pid + ' / ' + pval); + //if ((this.pidold == pid) && (this.preisold == pval)) { + if ((pid == null)) { + jQuery('#wpsg_product_dialog').modal('hide'); + return false; + } + //alert('OK neu: ' + pid + ' / ' + pval); - jQuery('#wpsg_payment_dialog').modal( { } ) + if (this.modus == 0) { + url1 = 'wp-admin/admin.php?page=wpsg-Admin&subaction=productData&do=change&edit_id=' + this.o_id + '&op_id=' + this.op_id + '&p_id=' + pid + '&noheader=1'; + jQuery.ajax( { + url: '' + url1, + data: { + p_val: pval, + p_me: pme, + pidold: this.pidold, + mwst: this.mwst1, + noMwSt: this.noMwSt, + p_mwst: pmwst}, + success: function(data) { + //jQuery('#wpsg_payment_dialog').modal('hide'); + //jQuery('#wpsg_payment_dialog').hide(); + //jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide'); + jQuery('#wpsg_produkte_table').replaceWith(data); + } + } ); + } else { + // Neues Produkt hinzufügen + jQuery.ajax( { + url: 'wp-admin/admin.php?page=wpsg-Admin&subaction=productData&do=add&edit_id=' + this.o_id + '&p_id=' + pid + '&noheader=1', + data: { + p_val: pval, + p_me: pme, + pidold: this.pidold, + mwst: this.mwst1, + noMwSt: this.noMwSt, + p_mwst: pmwst}, + success: function(data) { + jQuery('#wpsg_produkte_table').replaceWith(data); + //jQuery('#LinkRabattNeu').hide(); + } + } ); + } + return false; - /* - jQuery.ajax({ - url: 'admin.php?page=wpsg-Admin&subaction=kundendaten&noheader=1&show=code', - data: { 'kv_id': index }, - success: function(data) { jQuery('#wpsg_payment_dialog .modal-body').html(data); } - }); - */ - - this.paymentinfos = arPayment, JSON_FORCE_OBJECT); ?>; - this.oid = oid; - this.pidold = id; - - jQuery('#zahlungsartid').empty(); - jQuery.each(this.paymentinfos, function(i,n) { - console.log('element: ', n.name); - if (id == n.id) { - jQuery('#zahlungsartid').append(''); - } else { - jQuery('#zahlungsartid').append(''); - } - }); + }, // function dialogProduktOK() + + /** + * Bearbeiten der Produkt-Daten + */ + editProduct: function (op_id, p_id, o_id) + { + var + i, + id, + menge, + key, + mid, + n; + + this.modus = 0; // bearbeiten + this.op_id = op_id; + this.p_id = p_id; + this.o_id = o_id; + //jQuery('#wpsg_produkte_table').html('<?php echo __('Bitte warten ...', 'wpsg'); ?>'); - preis = this.paymentinfos[id].preis; - if (preis == false) { preis = '0,00'; } - jQuery('#zahlungsartvalue').val(preis); - - return false; + jQuery('#wpsg_product_dialog').modal( { } ); + jQuery('#wpsg_product_data').show(); + + this.pidold = p_id; + + jQuery('#productid').empty(); + jQuery.each(this.allproductinfos, function (i,n) { + console.log('element: ', n.name); + if (p_id == n.id) { + jQuery('#productid').append(""); + mid = n.mwst_key; + } else { + jQuery('#productid').append(""); + } + }); + jQuery('#productid').val(p_id); + + jQuery('#productmwst').empty(); + for (key in this.mwstinfos) { + if (p_id == key) { + jQuery('#productmwst').append(""); + } else { + jQuery('#productmwst').append(""); + } + } + jQuery('#productmwst').val(mid); - }, // function changePayment(id, oid) + id = this.findIndex(op_id); + this.preis = this.productinfos[id].preis; + + this.preisold = this.preis; + if (this.preis == false) { this.preis = '0,00'; } + jQuery('#productvalue').val(this.preis); + menge = this.productinfos[id].menge; + jQuery('#productmenge').val(menge); + + return false; + + }, // function editProduct() /** - * Ändern der Zahlungsdaten im Backend + * Ändern des Produktes im Backend */ - dialog_OK: function() { + dialogProductChange: function() { var pid, + id, + aid, pval; - - pid = jQuery('#zahlungsartid').val(); - pval = jQuery('#zahlungsartvalue').val(); - alert('OK neu: ' + this.pidold + ' / ' + pid + ' / ' + pval); - //TODO vergleichen oder nicht - if (this.pidold == pid) { - jQuery('#wpsg_payment_dialog').modal('hide'); - return false; - } - alert('OK neu: ' + pid + ' / ' + pval); - //TODO price_frontend - //TODO Frontend-Rabatt/Frontend-Gutschein bei Firmenkunde in Netto oder Brutto in der Datenbank? - - //TODO - //field: 'value', - //gs_id: '', - //edit_id: '', - //noMwSt: 'view['basket']['noMwSt']; ?>', - //mwst: 'view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>', - //price_frontend: 'view['basket']['price_frontend']; ?>' - //data: { name: "John", location: "Boston" } - - data1: { - //price_frontend: 'view['basket']['price_frontend']; ?>', - //noMwSt: 'view['basket']['noMwSt']; ?>' + pid = jQuery('#productid').val(); + aid = this.findAllIndex(pid); + if (aid !== false) { + pval = this.allproductinfos[aid].name; + id = this.findIndex(this.op_id); + pval = this.allproductinfos[aid].preis; + jQuery('#productvalue').val(pval); + jQuery('#productmenge').val(1); + pval = this.allproductinfos[aid].mwst_key; + jQuery('#productmwst').val(pval); } - - url1 = 'wp-admin/admin.php?page=wpsg-Admin&subaction=paymentData&do=change&edit_id=' + this.oid + '&p_id=' + pid + '&p_value=' + pval + '&noheader=1'; - jQuery.ajax( { - url: '' + url1, - dataType: 'json', - data: { - price_frontend: 'view['basket']['price_frontend']; ?>', - noMwSt: 'view['basket']['noMwSt']; ?>' }, - method: 'POST', - success: function(data) { - jQuery('#wpsg_produkte_table').replaceWith(data); + + }, // dialogProductChange() + + /** + * Suchen des Indexes in allproductinfos an Hand der id + */ + findAllIndex: function(id) { + var + pid, + pval; + for (key in this.allproductinfos) { + if (id == this.allproductinfos[key].id) { + return key; } - } ); - + } return false; - - }, // function dialog_OK() + }, // findAllIndex() + /** - * Ändern der Zahlungsdaten im Backend + * Suchen des Indexes in productinfos an Hand der order_product_id */ - dialog_change: function() { + findIndex: function(id) { var pid, pval; - pid = jQuery('#zahlungsartid').val(); - pval = this.paymentinfos[pid].preis; - jQuery('#zahlungsartvalue').val(pval); - - - }, // dialog_change() + for (key in this.productinfos) { + if (id == this.productinfos[key].order_product_id) { + return key; + } + } + return false; + }, // findIndex() - changePayment2: function (id, oid) { + changeProduct2: function (id, oid) { alert('TEST OK neu2'); - } // function wpsg_changePayment2(id, oid) + } // function changeProduct2(id, oid) - }; // WPSG_BE_Payment - //WPSG_BE_Payment.changePayment2(1, 2); - + }; // WPSG_BE_Product + //WPSG_BE_Product.changeProduct2(1, 2); /* ]]> */ - + + + + + + + + + -- cgit v1.2.3