<?php

	/**
	 * Template für die Verwaltung der Kundendaten
	 */

?>
<div class="wpsg_admin_submenu">
	
	<div class="head">
		<div class="title"><?php echo __("Einstellungen", "wpsg"); ?></div>			
		<div style="clear:both;"></div>
	</div>

	<ul>		
		<?php foreach ($this->view['arSubAction'] as $k => $v) { ?>		
		<li class="<?php echo (($k == $this->view['subAction'])?'current':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&amp;subaction=<?php echo $k; ?>"><?php echo $v['Menutext']; ?></a></li>
		<?php } ?>
	</ul>
			
</div>

<div class="wpsg_admin_content">
	<div class="wpsg_admin_box" id="wpsg_tab">		
			
		<form name="form1" method="post" enctype="multipart/form-data" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&amp;subaction=<?php echo $_REQUEST['subaction']; ?>">
		  		
			<div class="head">
				<div class="title">
					<div class="tab" id="tab1"><?php echo __('Pfllichtfelder', 'wpsg'); ?></div>
					<div class="tab" id="tab2"><?php echo __('Weitere Kundendaten', 'wpsg'); ?></div>
					<div class="tabcontent tablink">
						<a href="" title="<?php echo __('Neues Kundenfeld hinzufügen', 'wpsg'); ?>" class="wpsg_icon wpsg_icon_right wpsg_icon_add" onclick="return wpsg_addCustomField();"></a>
					</div>
					<div class="wpsg_clear"></div>
				</div>
			</div>
			<div class="content" id="wpsg_mwst_list">
				
				<div id="tabcontent1" class="tabcontent">
					<?php echo $this->render(WPSG_PATH_VIEW.'/admin/kundendaten_tab1.phtml'); ?>
				</div>
				<div id="tabcontent2" class="tabcontent">
					
					<?php echo $this->render(WPSG_PATH_VIEW.'/admin/kundendaten_tab2.phtml'); ?>
					
				</div>
				
			</div>
			
			<p class="submit"><input type="submit" value="<?php echo __('Einstellungen speichern', 'wpsg'); ?>" class="button-primary" id="submit" name="submit" /></p>
			
		</form>
				
		<script type="text/javascript">

			/**
			 * Wird beim hinzufügen eines benutzerdefinierten Kundenfeldes aufgerufen
			 */
			function wpsg_addCustomField()
			{

				jQuery('#tabcontent2').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-Admin&subaction=kundendaten&do=add&noheader=1',
					success: function(data) {
						jQuery('#tabcontent2').html(data);
					}
				} );

				return false;
				
			} // function wpsg_addCustomField()
		
			jQuery(document).ready(function() {
				jQuery('#wpsg_tab').wpsg_tab( { 
					'cookiename': 'wpsg_kundendaten_tab',
					'tab2': function() {
						jQuery('.tablink').show();
					}
				} );
			} );
		
		</script>
				
	</div>
</div>