Subversion Repositories wpShopGermany4

Rev

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

<?php

    /**
     * User: Daschmi (daschmi@dsachmi.de)
     * Date: 06.08.2016
     * Time: 13:45
     */
         
?>
<div id="wpsg_produkte_table">
<?php echo wpsg_drawForm_AdminboxStart(__('Bestelldaten', 'wpsg')); ?>
    <div id="wpsg_product_table_wrap">
        <?php $this->render(WPSG_PATH_VIEW.'order/product_table.phtml'); ?>
    </div>

<script type="text/javascript">/* <![CDATA[ */

<?php if ($this->hasMod('wpsg_mod_gutschein')) { ?>
        <?php if ((array_key_exists('gs', $this->view['basket'])) && ($this->view['basket']['gs']['value'] > 0)) { ?>

        jQuery('#gsname_<?php echo $gs_id; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=voucherData&do=editname&noheader=1', {
                submitdata: {
                field: 'code',
                gs_id: '<?php echo $gs_id; ?>',
                edit_id: '<?php echo $o_id; ?>'
                },
                submit  : '<?php echo __('Speichern', 'wpsg'); ?>',
                placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
                indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
        tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
        callback: function(data, config) {
                jQuery('#wpsg_produkte_table').replaceWith(data);
        }
        });

        jQuery('#gsvalue_<?php echo $gs_id; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=voucherData&do=editvalue&noheader=1', {
                submitdata: {
                field: 'value',
                gs_id: '<?php echo $gs_id; ?>',
                edit_id: '<?php echo $o_id; ?>',
                noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>',
                mwst: '<?php reset($this->view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>',
                price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>'
                },
                submit  : '<?php echo __('Speichern', 'wpsg'); ?>',
                placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
                indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
        tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
        callback: function(data, config) {
                jQuery('#wpsg_produkte_table').replaceWith(data);
                wpsg_be_act_orderdata();
        }
        });

        <?php } ?>
<?php } ?>

<?php if ($this->hasMod('wpsg_mod_discount')) { ?>
        <?php if (isset($this->view['basket']['sum']['preis_rabatt']) && $this->view['basket']['sum']['preis_rabatt'] > 0) { ?>

        jQuery('#discountvalue_<?php echo $o_id; ?>').wpsg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=discountData&do=editvalue&noheader=1', {
                submitdata: {
                field: 'value',
                edit_id: '<?php echo $o_id; ?>',
                noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>',
                mwst: '<?php reset($this->view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>',
                price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>'
                },
                submit  : '<?php echo __('Speichern', 'wpsg'); ?>',
                placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
                indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
        tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
        callback: function(data, config) {
                jQuery('#wpsg_produkte_table').replaceWith(data);
                wpsg_be_act_orderdata();
        }
        });

        <?php } ?>
<?php } ?>

        /**
         * Wird aufgerufen wenn ein Gutschein gelöscht werden soll
         */
        function wpsg_removeVoucher(gs_id, o_id)
        {

                if (!confirm('<?php echo __('Sind Sie sich sicher, dass sie diesen Gutschein löschen möchten?', 'wpsg'); ?>')) return false;

                jQuery('#wpsg_produkte_table').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&subaction=voucherData&do=remove&gs_id=' + gs_id + '&edit_id=' + o_id +'&noheader=1',
                        success: function(data) {
                                jQuery('#wpsg_produkte_table').replaceWith(data);
                                jQuery('#LinkGutscheinNeu').show();
                        wpsg_be_act_orderdata();
                        }
                } );

                return false;
        }

        /**
         * Wird aufgerufen wenn ein Rabatt gelöscht werden soll
         */
        function wpsg_removeDiscount(o_id)
        {

                if (!confirm('<?php echo __('Sind Sie sich sicher, dass sie diesen Rabatt löschen möchten?', 'wpsg'); ?>')) return false;

                jQuery('#wpsg_produkte_table').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&subaction=discountData&do=remove&edit_id=' + o_id +'&noheader=1',
                        success: function(data) {
                                jQuery('#wpsg_produkte_table').replaceWith(data);
                                jQuery('#LinkRabattNeu').show();
                        wpsg_be_act_orderdata();
                        }
                } );

                return false;
        }

        function wpsg_be_act_orderdata() {

                var o_id = 0;
                //alert('wpsg_be_act_orderdata');
                jQuery.ajax( {
                        url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=orderData&do=actual&edit_id=' + o_id +'&noheader=1',
                        success: function(data) {
                                data = JSON.parse(data);
                                jQuery('#wpsg_be_orderamount').html(data.preis);
                                odata = data.vname + ' ' + data.name + ' / ' + data.preis;
                                jQuery('#wpsg_be_orderdata').html(odata);
                                
                        }
                } );


                return false;
                
        }
        
    jQuery(document).ready(function() {
                 

                //wpsg_view_orderdata_show();

    } );

    function wpsg_view_orderdata_show() {
                
        jQuery('#LinkGutscheinNeu').show();
        jQuery('#LinkRabattNeu').show();
        jQuery('#LinkProduktNeu').show();
        jQuery('#LinkSendMail').show();

                //if (gs_id > 0) { jQuery('#LinkGutscheinNeu').hide(); }
                //if (prval != 0) { jQuery('#LinkRabattNeu').hide(); }
    }

    function wpsg_view_orderdata_hide() {
        jQuery('#LinkGutscheinNeu').hide();
        jQuery('#LinkRabattNeu').hide();
        jQuery('#LinkProduktNeu').hide();
        jQuery('#LinkSendMail').hide();
    }

    var Modul2 = {
            eigenschaft : "wert",
            methode : function () {
                alert("Modul-Eigenschaft (über window.Modul): " + Modul2.eigenschaft);
                // Alternativ:
                alert("Modul-Eigenschaft (über this): " + this.eigenschaft);
            }
    };
    //Modul2.methode();


    var WPSG_BE_Pay_Ship = {
                 
        changeShippingPayment: function (id, oid) {

            jQuery('#wpsg_shipping_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
            jQuery('#wpsg_shipping_dialog').modal( { } ).modal('show');
                            
            jQuery.ajax( {
                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editPayShipping&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
                success: function(data) {

                    jQuery('#wpsg_shipping_dialog .modal-body').html(data);

                }
            } );

            return false;
             
        }, // function changeShipping(id, oid)

        /**
         * Ändern der Versanddaten im Backend
         */
        updateShippingPayment: function() {
            
            var data = {
                submit: '1',
                shipping_key: jQuery('#edit_shipping_type').val(),
                shipping_price: jQuery('#edit_shipping_price').val(),
                payment_key: jQuery('#edit_payment_type').val(),
                payment_price: jQuery('#edit_payment_price').val()
            };
            
            jQuery('#wpsg_shipping_dialog').modal('hide');
            
            jQuery('#wpsg_product_table_wrap').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=updateOrder&subaction=editPayShipping&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
                data: data,
                success: function(data) {
                    
                    jQuery('#wpsg_product_table_wrap').html(data.product_table);
                    
                }
            } );
            
            return false; 

        } // function dialogShippingOK()
  
    };  // WPSG_BE_Pay_Ship

    var WPSG_BE_Product = {

        addProduct: function() {
    
            jQuery('#wpsg_product_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
            jQuery('#wpsg_product_dialog').modal( { } ).modal('show');
            jQuery('#wpsg_product_dialog .btn-primary').prop('disabled', true);
            
            jQuery.ajax( {
                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
                success: function(data) {
    
                    jQuery('#wpsg_product_dialog .modal-body').html(data);
    
                }
            } );
    
            return false;
            
        },
        
        remvoeProduct: function(order_product_id) {

            jQuery('#wpsg_product_table_wrap').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=removeProduct&noheader=1&edit_id=<?php echo $_REQUEST['edit_id']; ?>',
                data: { 
                    order_product_id: order_product_id
                },
                success: function(data) {

                    jQuery('#wpsg_product_table_wrap').html(data.product_table);

                }
            } );
            
            return false;
            
        },
        
        editProduct: function(order_product_id) {

            jQuery('#wpsg_product_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
            jQuery('#wpsg_product_dialog').modal( { } ).modal('show');
            jQuery('#wpsg_product_dialog .btn-primary').prop('disabled', true);

            jQuery.ajax( {
                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
                data: {
                    order_product_id: order_product_id  
                },
                success: function(data) {

                    jQuery('#wpsg_product_dialog .modal-body').html(data);

                }
            } );

            return false;
            
        },

        saveProduct: function() {
 
            jQuery('#wpsg_product_dialog').modal('hide');
            jQuery('#wpsg_product_table_wrap').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=submit&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
                data: jQuery('#wpsg_product_add_form').serialize(),
                success: function(data) {

                    jQuery('#wpsg_product_table_wrap').html(data.product_table);

                }
            } );

            return false;

        }
        
    }
    
    var WPSG_BE_Discount = {
        
        editDiscount: function() {

            jQuery('#wpsg_discount_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
            jQuery('#wpsg_discount_dialog').modal( { } ).modal('show'); 

            jQuery.ajax( {
                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editDiscount&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',                 
                success: function(data) {

                    jQuery('#wpsg_discount_dialog .modal-body').html(data);

                }
            } );

            return false;
            
        },
        
        saveDiscount: function() {

            jQuery('#wpsg_discount_dialog').modal('hide');
            jQuery('#wpsg_product_table_wrap').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=editDiscount&do=submit&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
                data: jQuery('#wpsg_be_discount_form').serialize(),
                success: function(data) {

                    jQuery('#wpsg_product_table_wrap').html(data.product_table);

                }
            } );

            return false;
            
        }
        
    }
    
        /* ]]> */</script>

</div>

<!-- Modaldialog für Rabatt -->
<div class="modal fade" id="wpsg_discount_dialog" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"><?php echo __('Rabatt hinzufügen/bearbeiten', 'wpsg'); ?></h4>
            </div>
            <div class="modal-body"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Abbrechen</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Discount.saveDiscount();">OK</button>
            </div>
        </div>
    </div>
</div>

<!-- Modaldialog für Produkte -->
<div class="modal fade" id="wpsg_product_dialog" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"><?php echo __('Produkt hinzufügen/bearbeiten', 'wpsg'); ?></h4>
      </div>
      <div class="modal-body"></div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Abbrechen</button>
        <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Product.saveProduct();">OK</button>
      </div>
    </div>
  </div>
</div>

<!-- Modaldialog für Versandart / Zahlungsart -->
<div class="modal fade" id="wpsg_shipping_dialog" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel"><?php echo __('Versandart', 'wpsg'); ?></h4>
      </div>
      <div class="modal-body"></div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Abbrechen</button>
        <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Pay_Ship.updateShippingPayment();">OK</button>
      </div>
    </div>
  </div>
</div>