Subversion Repositories wpShopGermany4

Rev

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

<?php

        /**
         * Template für die Einstellungen des Abo Moduls
         */
        
        $arPaymentSelect = [
                'origin' => __('Wie ursprüngliche Zahlungsart', 'wpsg')
        ];
        
        foreach ($this->arPayment as $p) { $arPaymentSelect[$p['id']] = $p['name']; }
        
?>
<?php echo wpsg_drawForm_Input('wpsg_mod_abo_url', __('Standard URL für Ablauf/Verlängerung', 'wpsg'), $this->get_option('wpsg_mod_abo_url'), array ('help' => 'wpsg_mod_abo_url')); ?>
<br />
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_abo_wpsgmodabofirstbuy', __('Mail bei erstem Kauf eines Abos', 'wpsg'), $this->get_option('wpsg_mod_abo_wpsgmodabofirstbuy'), array('hint' => wpsg_translate(__('Mail wird bei Bezahlung der Abo Bestellung zusätzlich versendet. (mail_firstbuy.phtml) -> <a href="#1#">Konfiguration</a>', 'wpsg'), WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf#wpsgmodabofirstbuy'), 'help' => 'wpsg_mod_abo_wpsgmodabofirstbuy')); ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_abo_wpsgmodabrebuy', __('Mail bei Kauf einer Verlängerung', 'wpsg'), $this->get_option('wpsg_mod_abo_wpsgmodabrebuy'), array('hint' => wpsg_translate(__('Mail wird bei Bezahlung einer Abo Verlängerung versendet. (mail_rebuy.phtml) -> <a href="#1#">Konfiguration</a>', 'wpsg'), WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf#wpsgmodabrebuy'), 'help' => 'wpsg_mod_abo_wpsgmodabrebuy')); ?>

<br />

<?php echo wpsg_drawForm_Input('wpsg_mod_abo_perpage', __('Abos pro Seite (Backend)', 'wpsg'), $this->get_option('wpsg_mod_abo_perpage'), array('help' => 'wpsg_mod_abo_perpage')); ?>

<br />
 
<?php echo wpsg_drawForm_Select('wpsg_mod_abo_expiremode', __('Bei Ablauf des Abos', 'wpsg'), Array(
    wpsg_mod_abo::EXPIRE_NONE => __('Nichts', 'wpsg'),
        wpsg_mod_abo::EXPIRE_MAIL => __('Mail versenden', 'wpsg'),
        wpsg_mod_abo::EXPIRE_AUTO => __('Automatisch verlängern', 'wpsg')
), $this->get_option('wpsg_mod_abo_expiremode'), array('help' => 'wpsg_mod_abo_expiremode')); ?>

<?php echo wpsg_drawForm_Select('wpsg_mod_abo_premode', __('X - Tage vor Ablauf des Abos', 'wpsg'), [
    wpsg_mod_abo::EXPIRE_NONE => __('Nichts', 'wpsg'),
    wpsg_mod_abo::EXPIRE_MAIL => __('Mail versenden', 'wpsg'),
    wpsg_mod_abo::EXPIRE_AUTO => __('Automatisch verlängern', 'wpsg')
], $this->get_option('wpsg_mod_abo_premode'), ['help' => 'wpsg_mod_abo_premode']); ?>

<div id="wpsg_mod_abo_premode_greater0" style="display:none;">

    <?php echo wpsg_drawForm_Input('wpsg_mod_abo_autoexpire_informationtime', __('Zeitspanne zum Versenden der Informationsmail in Tagen', 'wpsg'), $this->get_option('wpsg_mod_abo_autoexpire_informationtime'), [
        'help' => 'wpsg_mod_abo_autoexpire_informationtime'
    ]); ?>

</div>

<script>

    let wpsg_mod_abo_premodeSELECT = document.getElementById('wpsg_mod_abo_premode');
    let wpsg_mod_abo_premode_greater0DIV = document.getElementById('wpsg_mod_abo_premode_greater0');

    wpsg_mod_abo_premodeSELECT.addEventListener('change', () => {

        console.log(parseInt(wpsg_mod_abo_premodeSELECT.value));

        if (parseInt(wpsg_mod_abo_premodeSELECT.value) > 0 || (parseInt(wpsg_mod_abo_premodeSELECT.value) === -1 && <?php echo ((intval($this->get_option('wpsg_mod_abo_premode')) > 0)?'true':'false'); ?>)) {

            wpsg_mod_abo_premode_greater0DIV.style.display = 'block';

        } else {

            wpsg_mod_abo_premode_greater0DIV.style.display = 'none';

        }

    });

    wpsg_mod_abo_premodeSELECT.dispatchEvent(new Event('change'));

</script>

<br />

<div id="wpsg_mod_abo_expiremode_auto_layer" style="display:none;">
        
        <?php /* TODO: Mehrfachauswahl von Zahlungsarten */ ?>
        <?php echo wpsg_drawForm_Select('wpsg_mod_abo_autoexpire_payment', __('Zahlungsart für automatische Verlängerung', 'wpsg'), $arPaymentSelect, $this->get_option('wpsg_mod_abo_autoexpire_payment'), array('help' => 'wpsg_mod_abo_autoexpire_payment')); ?>

        <?php echo wpsg_drawForm_Select('wpsg_mod_abo_autoexpire_customermail', __('Mail an Kunden', 'wpsg'), [
        '0' => __('Nein', 'wpsg'),
        '1' => __('Ja', 'wpsg')
    ], $this->get_option('wpsg_mod_abo_autoexpire_customermail'), ['help' => 'wpsg_mod_abo_autoexpire_customermail']); ?>

    <?php echo wpsg_drawForm_Select('wpsg_mod_abo_autoexpire_adminmail', __('Mail an Administrator', 'wpsg'), [
        '0' => __('Nein', 'wpsg'),
        '1' => __('Ja', 'wpsg')
    ], $this->get_option('wpsg_mod_abo_autoexpire_adminmail'), ['help' => 'wpsg_mod_abo_autoexpire_adminmail']); ?>

        <br />

</div>

<script>

    let wpsg_mod_abo_expiremode_auto_layer = document.getElementById('wpsg_mod_abo_expiremode_auto_layer');
    let wpsg_mod_abo_expiremode = document.getElementById('wpsg_mod_abo_expiremode');
    let wpsg_mod_abo_premode = document.getElementById('wpsg_mod_abo_premode');

    function displayAutoRenewOptions() {

        if (wpsg_mod_abo_expiremode.value === '<?php echo wpsg_mod_abo::EXPIRE_AUTO; ?>' || wpsg_mod_abo_premode.value === '<?php echo wpsg_mod_abo::EXPIRE_AUTO; ?>') {

                wpsg_mod_abo_expiremode_auto_layer.style.display = 'block';

        } else {

                wpsg_mod_abo_expiremode_auto_layer.style.display = 'none';

        }

    }

    wpsg_mod_abo_expiremode.addEventListener('change', displayAutoRenewOptions);
    wpsg_mod_abo_premode.addEventListener('change', displayAutoRenewOptions);

    displayAutoRenewOptions();

</script>

<?php echo wpsg_drawForm_Select('wpsg_mod_abo_autoexpire_customer', __('Kunde kann im Frontend', 'wpsg'), Array(
    wpsg_mod_abo::CUSTOMER_AUTO_NOTHING => __('Nichts', 'wpsg'),
    wpsg_mod_abo::CUSTOMER_AUTO_DIRECT => __('Verlängerung direkt stoppen', 'wpsg'),
    wpsg_mod_abo::CUSTOMER_AUTO_MAIL => __('Verlängerung über Mail an Administrator stoppen', 'wpsg')
), $this->get_option('wpsg_mod_abo_autoexpire_customer'), array('help' => 'wpsg_mod_abo_autoexpire_customer')); ?>

<?php echo wpsg_drawForm_Input(false, __('CRON URL', 'wpsg'), site_url().'/?wpsg_cron=1', ['readonly' => true]); ?>
<?php echo wpsg_drawForm_Text(__('Letzter Cron Aufruf', 'wpsg'), wpsg_formatTimestamp($this->get_option('wpsg_mod_abo_cron_lastrun'), false, true)); ?>

<br /> 

<script>

    jQuery(document).ready(function() {
        
        jQuery('#wpsg_mod_abo_expiremode').on('change', function() {
                
                jQuery('.wpsg_mod_expiremode').hide();
                        jQuery('.wpsg_mod_expiremode_' + jQuery(this).val()).show();
                
                } ); 

        } );

</script>