Subversion Repositories wpShopGermany4

Rev

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

<?php

        /**
         * Template für die Länderverwaltung
         */

?>
<div class="wpsg_admin_submenu">
        
        <div class="list-group">
                <span class="list-group-head list-group-item"><?php echo __('Konfiguration'); ?></span>         
                <?php foreach ($this->view['arSubAction'] as $k => $v) { ?>              
                <a class="list-group-item <?php echo (($k == $this->view['subAction'])?'active':''); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&amp;subaction=<?php echo $k; ?>"><?php echo $v['Menutext']; ?></a>          
                <?php } ?>
        </div> 
                        
</div>

<div class="wpsg_admin_content">

        <div class="wpsg_admin_box">    
                
                <h3>
                        <?php echo __('Neues Land hinzufügen', 'wpsg'); ?>
                        <a target="_blank" href="http://wpshopgermany.maennchen1.de/?p=839037" class="wpsg_form_help_notip"></a>        
                </h3>
                
                <?php echo $this->render(WPSG_PATH_VIEW.'/admin/laender_edit.phtml'); ?>
                
                <h3><?php echo __('Bestehende Länder', 'wpsg'); ?></h3>
        
                <?php if (wpsg_isSizedArray($this->view['data'])) { ?>
                <table class="wpsg_admin_laender_list wpsg_admin_table" cellpadding="0" cellspacing="0">
                        <tr>
                                <th class="col_name"><?php echo __('Ländername', 'wpsg'); ?></th>
                                <th class="col_vz"><?php echo __('Versandzone', 'wpsg'); ?></th>
                                <th class="col_mwstsetting"><?php echo __('MwSt.', 'wpsg'); ?></th>
                                <th class="col_mwst"><?php echo __('MwSt. A', 'wpsg'); ?></th>
                                <th class="col_mwst"><?php echo __('MwSt. B', 'wpsg'); ?></th>
                                <th class="col_mwst"><?php echo __('MwSt. C', 'wpsg'); ?></th>
                                <th class="col_mwst"><?php echo __('MwSt. D', 'wpsg'); ?></th>                          
                                <th class="col_action"></th>
                        </tr>
                        <?php $i = 0; foreach ($this->view['data'] as $l) { $i ++; ?>
                        <tr id="wpsg_laenderrow_<?php echo $l['id']; ?>" class="<?php echo (($i % 2 == 0)?'odd':'even'); ?>">
                                <td class="col_name data_name"><?php echo wpsg_hspc($l['name'].((wpsg_isSizedString($l['kuerzel']))?' ('.$l['kuerzel'].')':'')); ?></td>
                                <td class="col_vz data_vz">
                                        <?php if (wpsg_isSizedInt($l['vz']) && wpsg_isSizedString($this->view['vz'][$l['vz']])) { ?>
                                        <?php echo wpsg_hspc($this->view['vz'][$l['vz']]); ?>
                                        <?php } ?>
                                </td>
                                <td class="col_mwstsetting data_mwst">
                                        <?php if ($l['mwst'] == '2') { ?>
                                        <?php echo __('keine MwSt. bei USt.IdNr.', 'wpsg'); ?>
                                        <?php } else if ($l['mwst'] == '1') { ?>
                                        <?php echo __('keine MwSt.', 'wpsg'); ?>
                                        <?php } else { ?>
                                        <?php echo __('mit MwSt.', 'wpsg'); ?>
                                        <?php } ?>
                                </td>
                                <td class="col_mwst data_mwst_a">
                                        <?php if (wpsg_tf($l['mwst_a']) != NULL) { ?>
                                                <?php echo wpsg_ff(wpsg_tf($l['mwst_a']), '%'); ?>
                                        <?php } ?>                                      
                                </td>
                                <td class="col_mwst data_mwst_b">
                                        <?php if (wpsg_tf($l['mwst_b']) != NULL) { ?>
                                                <?php echo wpsg_ff(wpsg_tf($l['mwst_b']), '%'); ?>
                                        <?php } ?>                                      
                                </td>
                                <td class="col_mwst data_mwst_c">
                                        <?php if (wpsg_tf($l['mwst_c']) != NULL) { ?>
                                                <?php echo wpsg_ff(wpsg_tf($l['mwst_c']), '%'); ?>
                                        <?php } ?>                                      
                                </td>
                                <td class="col_mwst data_mwst_d">
                                        <?php if (wpsg_tf($l['mwst_d']) != NULL) { ?>
                                                <?php echo wpsg_ff(wpsg_tf($l['mwst_d']), '%'); ?>
                                        <?php } ?>                                      
                                </td>
                                <td class="col_action">
                                        
                                        <a class="wpsg_icon wpsg_icon_edit" href="#" onclick="return wpsg_laender_edit(<?php echo $l['id']; ?>);"></a> 
                                        <a class="wpsg_icon wpsg_icon_remove" href="#" onclick="return wpsg_laender_remove(<?php echo $l['id']; ?>);"></a>
                                        
                                </td>
                        </tr>
                        <?php } ?>
                </table>
                <?php } else { ?>
                <p><?php echo __('Noch keine Länder angelegt.', 'wpsg'); ?>
                <?php } ?>
                
                <br /><br />
                
                <input type="button" onclick="return wpsg_laender_import();" value="<?php echo __('Standardländer importieren', 'wpsg'); ?>" class="button" />
                <input type="button" onclick="return wpsg_eu_laender_import();" value="<?php echo __('Standard EU-Länder importieren', 'wpsg'); ?>" class="button" />
        
                <script type="text/javascript">/* <![CDATA[ */

                        var land_load = false;

                        function wpsg_laender_import()
                        {

                                if (!confirm('<?php echo __('Sind sie sich sicher ?', 'wpsg'); ?>')) return false;

                                location.href = "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=import&noheader=1";
                                
                                return false;
                                
                        }

                        function wpsg_eu_laender_import()
                        {

                                if (!confirm('<?php echo __('Sind sie sich sicher ?', 'wpsg'); ?>')) return false;

                                location.href = "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=eu_import&noheader=1";
                                
                                return false;
                                
                        }

                        function wpsg_laender_save()
                        {

                                jQuery.ajax( {
                                        url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=saveEdit&noheader=1',
                                        data: {
                                                form_data: jQuery('#wpsg_land_edit_form_edit').serialize()
                                        },
                                        success: function(data) {
 
                                                if (typeof data === 'object')
                                                {

                                                        land_load = true;
 
                                                        for (var i in data)
                                                        {
 
                                                                jQuery('#wpsg_laenderrow_' + data['id']).find('.data_' + i).html(data[i]);
                                                                
                                                        }
                                                        
                                                        jQuery('#wpsg_laenderrow_edit > td > div').slideUp(100, function() {

                                                                jQuery('#wpsg_laenderrow_edit').remove();
                                                                land_load = false;
                                                                
                                                        } );
                                                         
                                                }
                                                else alert(data);
                                                
                                        }
                                } );

                                return false;
                                
                        }
                
                        function wpsg_laender_edit(land_id)
                        {

                                if (land_load == true) return; land_load = true;

                                var edit_timeout = 0;
                                
                                if (jQuery('#wpsg_laenderrow_edit > td > div').is(':visible'))
                                {

                                        edit_timeout = 150;
                                        
                                        jQuery('#wpsg_laenderrow_edit > td > div').slideUp(100, function() {

                                                jQuery('#wpsg_laenderrow_edit').remove();
                                                
                                        } );
                                        
                                }

                                window.setTimeout(function() {
 
                                        jQuery('#wpsg_laenderrow_' + land_id).after('<tr id="wpsg_laenderrow_edit"><td colspan="8"><img src="<?php echo $this->getRessourceURL('gfx/ajax-loader.gif'); ?>" alt="" /><div style="display:none;"></div></td></tr>');
                                
                                        jQuery.ajax( {
                                                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=edit&noheader=1',
                                                data: {
                                                        land_id: land_id
                                                },
                                                success: function(data) {
                                                                                                        
                                                        jQuery('#wpsg_laenderrow_edit > td > div').html(data);
                                                        jQuery('#wpsg_laenderrow_edit > td > img').hide();
                                                        jQuery('#wpsg_laenderrow_edit > td > div').slideDown(300, function() { land_load = false; } );
                                                        
                                                }
                                        } );

                                }, edit_timeout);

                                return false;
                                
                        }

                        function wpsg_laender_remove(land_id)
                        {

                                if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return false;

                                jQuery.ajax( {
                                        url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=remove&noheader=1',
                                        data: {
                                                land_id: land_id
                                        },
                                        success: function(data) {
                                                                                                 
                                                if (data === "1") jQuery('#wpsg_laenderrow_' + land_id).remove();
                                                else alert(data);
                                                
                                        }
                                } );
                                
                                return false;

                        }
        
                /* ]]> */</script>
        
        </div>

</div>