Subversion Repositories wpShopGermany4

Rev

Rev 7812 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

        /**
         * Template für die Übersicht der Abonnements
        */
        
?>

<div class="wpsg_order" id="wpsg-bs">

        <nav class="navbar navbar-default">
                <div class="container-fluid">
                        <div class="navbar-header">
                
                                <a class="navbar-brand" href="#"><?php echo __('wpShopGermany', 'wpsg'); ?></a>
                <a class="glyphicon glyphicon-menu-hamburger wpsg-bs-toggle-nav visible-xs-block" data-toggle="collapse" data-target="#wpsg-bs-headermenu" href="#"></a>
                
                        </div>
                        <div class="collapse navbar-collapse" id="wpsg-bs-headermenu">
                                <ul class="nav navbar-nav">
                                        <li role="presentation" class="<?php echo ((!isset($_REQUEST['action']))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order" onclick="return false;"><?php echo __("Aboübersicht", "wpsg"); ?></a></li>
                                        <li role="presentation" class="wpsg_showhide_filter wpsg-order-tab-a <?php echo (($this->view['hasFilter'] === true)?'active':''); ?>" id="wpsg-order-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>                  
                                </ul>
                        </div>
                </div>

                <div class="wpsg-filter wpsg-order-tab wpsg-order-tab-0 container-fluid form-horizontal" style="display:<?php echo (($this->view['hasFilter'] === true)?'block':'none'); ?>;">
                        <div class="row">
                                <div class="col-lg-4">
                                        <form method="post" id="filter_form" >
                                                
                                                <?php echo wpsg_formNounce('Abo', 'index', ['search' => '1']); ?>
                                                
                                                <input id="wpsg_seite" type="hidden" name="seite" value="<?php echo @$this->view['arFilter']['page']; ?>" class="current-page" />
                                                <input id="wpsg_order" type="hidden" name="filter[order]" value="<?php echo @$this->view['arFilter']['order']; ?>" />
                                                <input id="wpsg_ascdesc" type="hidden" name="filter[ascdesc]" value="<?php echo @$this->view['arFilter']['ascdesc']; ?>" />

                                                <?php echo wpsg_drawForm_Input('filter[s]', __('Suchfeld', 'wpsg'), wpsg_getStr($this->view['arFilter']['s'])); ?>
                        <?php echo wpsg_drawForm_Input('filter[k_id]', __('Kunde (ID)', 'wpsg'), wpsg_getStr($this->view['arFilter']['k_id'])); ?>
                                                
                                                <?php
                                                        
                                                        $arStateSelect = [];
                                                        foreach ($this->view['arState'] as $state_key => $state_data) $arStateSelect[$state_key] = $state_data['label'];
                                                        
                                                        echo wpsg_drawForm_Select('filter[status]', __('Abostatus', 'wpsg'), wpsg_array_merge(array('-1' => __('Alle', 'wpsg')), $arStateSelect), @$this->view['arFilter']['state']); ?>

                        <?php echo wpsg_drawForm_TextStart(); ?>
                        <div class="row">
                            <div class="col-lg-6">
                                <select name="filter[cdate_m]" class="form-control input-sm">
                                    <option value="-1"><?php echo __("Alle", "wpsg"); ?></option>
                                    <?php for ($i = 1; $i <= 12; $i ++) { ?>
                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['cdate_m']) == $i)?'selected="selected"':''); ?> value="<?php echo str_pad($i, 2, '0', STR_PAD_LEFT); ?>"><?php echo strftime("%B", mktime(0, 0, 0, $i, 1, 2000)); ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="col-lg-6">
                                <select name="filter[cdate_y]" class="form-control input-sm">
                                    <option value="-1"><?php echo __("Alle", "wpsg"); ?></option>
                                    <?php foreach ($this->view['cdate_years'] as $y) { ?>
                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['cdate_y']) == $y)?'selected="selected"':''); ?> value="<?php echo $y; ?>"><?php echo $y; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <?php echo wpsg_drawForm_TextEnd(__('Abo abgeschlossen am (Monat/Jahr)', 'wpsg'), array('noP' => true)); ?>       
                        
                        <?php echo wpsg_drawForm_TextStart(); ?>
                        <div class="row">
                            <div class="col-lg-6">
                                <select name="filter[enddate_m]" class="form-control input-sm">
                                    <option value="-1"><?php echo __("Alle", "wpsg"); ?></option>
                                    <?php for ($i = 1; $i <= 12; $i ++) { ?>
                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['enddate_m']) == $i)?'selected="selected"':''); ?> value="<?php echo str_pad($i, 2, '0', STR_PAD_LEFT); ?>"><?php echo strftime("%B", mktime(0, 0, 0, $i, 1, 2000)); ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="col-lg-6">
                                <select name="filter[enddate_y]" class="form-control input-sm">
                                    <option value="-1"><?php echo __("Alle", "wpsg"); ?></option>
                                    <?php foreach ($this->view['enddate_years'] as $y) { ?>
                                    <option <?php echo ((wpsg_getStr($this->view['arFilter']['enddate_y']) == $y)?'selected="selected"':''); ?> value="<?php echo $y; ?>"><?php echo $y; ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <?php echo wpsg_drawForm_TextEnd(__('Abo gekündigt am (Monat/Jahr)', 'wpsg'), array('noP' => true)); ?>                      

                                        <br />
                        
                        <?php echo wpsg_drawForm_SubmitButton(__('Abonnement suchen')); ?>

                                        </form>
                                </div>
                        </div>
                </div>
    
    </nav>
    
    <div class="wpsg_msg_wrap"><hr class="wp-header-end wpsg-wp-header-end"/></div>

        <div class="pagination_wrap wpsg_status_link_wrap">

                <ul class="pagination">
                        <?php foreach ($this->view['arState'] as $status_key => $status_info) { ?>
                        <li class="<?php echo ((wpsg_getStr($this->view['arFilter']['state']) == $status_key)?'active':''); ?>"><a href="#" onclick="return wpsg_setFilterStatus('<?php echo $status_key; ?>');"><?php echo wpsg_translate(__('#1# <span>(#2#)<span>', 'wpsg'), $status_info['label'], $status_info['count']); ?></a></li>
                        <?php } ?>
                </ul>

        </div>

        <?php $this->render(WPSG_PATH_VIEW.'/admin/pager.phtml'); ?>

        <div class="wpsg_clear"></div>

        <div class="content">
                <form method="post" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&noheader=1" enctype="multipart/form-data">

                <?php if (is_array($this->view['arData']) && sizeof($this->view['arData']) > 0) { ?>

            <table class="table table-bordered table-hover table-striped wpsg-table-order">
                <thead>
                    <tr>
                        <th class="col_checkbox"><input type="checkbox" onclick="return wpsg_order_checkAll();" /></th>
                        <th class="col_nr wpsg_order" data-order="cdate"><?php echo __('Nr', 'wpsg'); ?></th>
                        <th class="col_customer wpsg_order" data-order="customer"><?php echo __('Kunde', 'wpsg'); ?></th>
                        <th class="col_payment wpsg_order" data-order="payment"><?php echo __('Bezahlmethode', 'wpsg'); ?></th>
                        <th class="col_shipping wpsg_order" data-order="shipping"><?php echo __('Versandart', 'wpsg'); ?></th>
                        <th class="col_products wpsg_order" data-order="products"><?php echo __('Abonnement', 'wpsg'); ?></th>                       
                        <th class="col_sum wpsg_order" data-order="amount"><?php echo __('Bestellwert', 'wpsg'); ?></th>
                        <th class="col_time wpsg_order" data-order="expiration"><?php echo __('Laufzeit', 'wpsg'); ?></th>
                                                <th class="col_state"><?php echo __('Status', 'wpsg'); ?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($this->view['arData'] as $oAbo) { 
                        
                        $oOrder = $oAbo->getOrder(); 
                        $oOrderProduct = $oAbo->getOrderProduct();      
                        
                                        ?>
                    <tr>
                        <td class="col_checkbox">

                            <input class="col_set_checkbox" name="wpsg_multido[<?php echo $oAbo->id; ?>]" type="checkbox" />

                        </td>
                        <td class="col_nr">

                            <?php echo $oAbo->getNr(); ?> <span class="wpsg_grey"><?php echo wpsg_formatTimestamp(strtotime($oAbo->__get('cdate')), false); ?></span><br />

                            <div class="actions">
                                                                
                                <span class="view"><a title="<?php echo __("Dieses Abonnement ansehen", "wpsg"); ?>" href="<?php 
                                                                        
                                                                        echo wpsg_admin_url('Order', 'view', ['edit_id' => $oOrder->id]);
                                                                        
                                                                ?>"><?php echo __("Ansehen", "wpsg"); ?></a></span>
                                |
                                <span class="delete"><a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie dieses Abonnement löschen möchten?', 'wpsg'); ?>');" title="<?php echo __('Dieses Abonnement löschen', 'wpsg'); ?>" href="<?php 
                                                                        
                                                                        echo wpsg_admin_url('Abo', 'delete', ['abo_id' => $oAbo->id], ['noheader' => '1']);     
                                                                                                                                                        
                                                                ?>"><?php echo __('Löschen', 'wpsg'); ?></a></span>
                                                        
                            </div>
                                                        
                            <?php if (trim($oAbo->getOrder()->admincomment) != "") { ?>
                            <a title="<?php echo __("Kommentar (Admin): ", "wpsg").htmlspecialchars($oAbo->getOrder()->admincomment); ?>" onclick="return false;" class="glyphicon glyphicon-question-sign admincomment" href="#"></a>
                            <?php } ?>

                            <?php if (trim($oAbo->getOrder()->comment) != "") { ?>
                            <a title="<?php echo __("Kommentar (Kunde): ", "wpsg").htmlspecialchars($oAbo->getOrder()->comment); ?>" onclick="return false;" class="glyphicon glyphicon-question-sign customercomment" href="#"></a>
                            <?php } ?> 

                        </td>
                        <td class="col_customer">
                            <?php $firma = $oAbo->getOrder()->getInvoiceCompany(); if (wpsg_isSizedString($firma)) { ?>
                            <?php echo $firma; ?><br />
                            <?php } ?>
                            <?php echo $oAbo->getOrder()->getInvoiceTitle(); ?> <?php echo $oOrder->getInvoiceFirstname(); ?> <?php echo $oAbo->getOrder()->getInvoiceName(); ?>
                            <br />
                            <span class="wpsg_grey"><?php echo $oAbo->getOrder()->getInvoiceStreet(); ?><br />
                            <?php echo ltrim($oAbo->getOrder()->getInvoiceZip().' '.$oAbo->getOrder()->getInvoiceCity()); ?> <?php echo $oAbo->getOrder()->getInvoiceCountryKuerzel(); ?>
                            </span>
                        </td>
                        <td class="col_payment">

                            <?php /* Bei Crefopay wird die Darstellung der Zahlungsart über das Modul geregelt */ ?>
                            <?php if ($oOrder->getPaymentID() == 4000 && $this->hasMod('wpsg_mod_crefopay')) { ?>
                                <?php echo wpsg_hspc($this->callMod('wpsg_mod_crefopay', 'getOrderPaymentName', array($oOrder->id))); ?>
                            <?php } else { ?>
                                <?php echo $oOrder->getPaymentLabel(); ?>
                            <?php } ?>

                            <?php if ($oOrder->getPaymentAmount() > 0) { ?>
                            &nbsp;-&nbsp;<?php echo wpsg_ff($oOrder->getPaymentAmount(), $this->get_option('wpsg_currency')); ?>
                            <?php } ?>

                        </td>
                        <td class="col_shipping">

                            <?php echo $oOrder->getShippingLabel(); ?>

                            <?php if ($oOrder->getShippingAmount() > 0) { ?>
                            &nbsp;-&nbsp;<?php echo wpsg_ff($oOrder->getShippingAmount(), $this->get_option('wpsg_currency')); ?>
                            <?php } ?>

                            <?php if ($oOrder->hasShippingAdress()) { ?>
                                <br />
                                <?php echo $oOrder->getShippingTitle(); ?> <?php echo $oOrder->getShippingFirstName(); ?> <?php echo $oOrder->getShippingName(); ?><br />
                                <span class="wpsg_grey">
                                    <?php echo $oOrder->getShippingStreet(); ?>
                                    <?php echo $oOrder->getShippingZip(); ?> <?php echo $oOrder->getShippingCity(); ?> <?php echo $oOrder->getShippingCountryKuerzel(); ?><br />
                            </span>
                            <?php } ?>

                        </td>
                        <td class="col_products">

                                                        <?php if ($oOrderProduct === false) { ?>

                                <?php echo __('Produkt nicht gefunden.', 'wpsg'); ?>
                                                                
                                                        <?php } else { ?>
                                                                
                                                                <?php echo wpsg_translate(__('#1# x <a href="#2#">#3#</a> für je #4#', 'wpsg'),
                                                                        $oOrderProduct->getCount(),
                                                                        wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id='.$oOrderProduct->getProductId(), 'wpsg-product-edit-'.$oOrderProduct->getProductId()),
                                                                        $oOrderProduct->getProductName(),
                                                                        wpsg_ff($oOrderProduct->getOneAmount(), $this->get_option('wpsg_currency'))
                                                                ); ?>
                                                        
                                                        <?php } ?>
                            
                        </td>
                        <td class="col_sum">
                            <?php echo wpsg_ff($oOrder->getAmount(), $this->get_option('wpsg_currency')); ?>
                        </td>
                        
                        <?php /* Laufzeitspalte */ ?>
                        <td class="col_time">

                            <?php if ($oOrderProduct === false) { ?>

                                <?php echo __('Produkt nicht gefunden.', 'wpsg'); ?>
                                                                
                                                        <?php } else { ?>
                                                        
                                                                <?php if (in_array(strval($this->callMod('wpsg_mod_abo', 'isAboOrder', array($oOrder->id))), array(1))) { ?>
        
                                                                        <?php $abo_expiration = strtotime($this->callMod('wpsg_mod_abo', 'getOrderAboExpiration', array($oOrder->id, $oOrderProduct->getId()))); ?>
        
                                                                        <?php if ($abo_expiration > time()) { ?>
                                                                        
                                                                                <span class="wpsg_mod_abo_future_expire"><?php echo wpsg_formatTimestamp($abo_expiration); ?></span>
                                                                  
                                                                        <?php } else { ?>
                                                                  
                                                                                <span class="wpsg_mod_abo_expired"><?php echo wpsg_formatTimestamp($abo_expiration); ?></span>
                                                                        
                                                                        <?php } ?>
        
                                                                        <br />
                                                                                        
                                                                <?php } ?>
                                                        
                                                        <?php } ?>
                            
                       </td>
                                                
                                                <td class="col_state">
                                                        
                                                        <?php $state = $oAbo->getState(); ?>
                                                        
                                                        <?php if ($state === wpsg_abo::STATE_INEXTENSION) { ?><span style="color:orange;"><?php echo $oAbo->getStateLabel(); ?></span> 
                                                        <?php } else if ($state === wpsg_abo::STATE_RUNNING) { ?><span style="color:green;"><?php echo $oAbo->getStateLabel(); ?></span>
                                                        <?php } else if ($state === wpsg_abo::STATE_EXTEND) { ?><span style="color:red;"><?php echo $oAbo->getStateLabel(); ?></span><?php } ?>
                                                                                                                        
                                                </td>
                       
                    </tr>
                    
                    <?php } ?>
                    
                </tbody>
                
            </table>

            <div class="alignleft actions">
                <select name="wpsg_action" id="wpsg_action">
                    <option value="-1"><?php echo __('Aktion wählen', 'wpsg'); ?></option>
                    <option value="multiDelete"><?php echo __('Abonnement(s) löschen', 'wpsg'); ?></option>             
                </select>

                <input onclick="if (jQuery('#wpsg_action').val() == 'multiDelete') { if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return false; }" type="submit" value="<?php echo __('Ausführen', 'wpsg'); ?>" class="button-secondary action" id="doaction" name="wpsg_order_doaction" />

            </div>

            <div style="margin-right:-15px;">
                <?php $this->render(WPSG_PATH_VIEW.'/admin/pager.phtml'); ?>
            </div>

            <div class="wpsg_clear"></div>

                <?php } else { ?>

            <?php echo wpsg_drawForm_AdminboxStart(); ?>
                <?php echo __('Keine Abonnements in der Datenbank.', 'wpsg'); ?>
            <?php echo wpsg_drawForm_AdminboxEnd(); ?>

                <?php } ?>
                <input id="noheader1" type="hidden" name="noheader1" value="1" />
                </form>
        </div>

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

    <?php if (wpsg_isSizedString($this->view['arFilter']['order']) && wpsg_isSizedString($this->view['arFilter']['ascdesc'])) { ?>
    jQuery('th[data-order="<?php echo @$this->view['arFilter']['order']; ?>"]').addClass('wpsg_order_<?php echo strtolower(@$this->view['arFilter']['ascdesc']); ?>');
    <?php } ?>

    function wpsg_order_checkAll()
    {

        jQuery('.col_set_checkbox').each(function() { jQuery(this).prop('checked', !jQuery(this).prop('checked')); } );

    }

        function wpsg_setFilterStatus(state)
        {

                jQuery('#filterstatus').val(state);

                jQuery('#seite').val(1);
                jQuery('#filter_form').submit();

                return false;

        }

        function goPage(page)
        {

                //if (page <= 0 || page == <?php echo $this->view['arFilter']['page']; ?> || page > <?php echo wpsg_getStr($this->view['pages'], '0'); ?>) return;

                jQuery('#wpsg_seite').val(page);
                jQuery('#filter_form').submit();

                return false;

        } // function goPage(page)

    jQuery(document).ready(function() {

        jQuery('.wpsg-order-tab-mods').bind('click', function() {

            if (jQuery(this).hasClass('active'))
            {

                jQuery(this).removeClass('active');
                jQuery('.' + jQuery(this).attr("id")).slideUp(250);

            }
            else
            {

                jQuery(this).addClass('active');
                jQuery('.' + jQuery(this).attr("id")).slideDown(250);

            }

            return false;

        } );

    } );

/* <![CDATA[ */</script>