<?php

	/**
	 * Template für die Einstellungen des "Lieferschein" Moduls
	 */

?>
<br />
<div class="wpsg_admin_box" id="wpsg_tab">	
	<div class="head">
		<div class="title">
			<div class="tab" id="tab1"><?php echo __('Vordefinierte Textfelder', 'wpsg'); ?></div>
			<div class="tab" id="tab2"><?php echo __('Fußzeile', 'wpsg'); ?></div>			
			<div class="tab" id="tab3"><?php echo __('Sonstiges', 'wpsg'); ?></div>
			<div class="tabcontent tablink">
				<a href="" title="<?php echo __('Neues Feld für die Fußzeile hinzufügen', 'wpsg'); ?>" class="wpsg_icon wpsg_icon_right wpsg_icon_add" onclick="return wpsg_addFooter();"></a>
			</div>
			<div class="wpsg_clear"></div>
		</div>
	</div>
	<div class="content">
		<div id="tabcontent1" class="tabcontent">
			
			<?php echo wpsg_drawForm_Input('wpsg_mod_deliverynote_adressrow', __('Adresszeile', 'wpsg'), $this->get_option('wpsg_mod_deliverynote_adressrow')); ?>
			<div class="wpsg_hinweis"><?php echo __('Diese Zeile wird klein oberhalb der Kundenadresse platziert', 'wpsg'); ?></div>
			<br />
			
			<div class="wpsg_form_field">
				<div class="wpsg_form_left">
					<label><?php echo __('Briefpapier (PDF/JPG)', 'wpsg'); ?>:</label><br />
					<?php if ($this->view['wpsg_mod_deliverynote']['bp'] !== false) { ?>
					<label>
						<input type="checkbox" name="wpsg_mod_deliverynote_bp_del" value="1" />&nbsp;<?php echo __('Löschen', 'wpsg'); ?>
					</label>
					<?php } ?>
				</div>
				<div class="wpsg_form_right">
					<?php if ($this->view['wpsg_mod_deliverynote']['bp'] === false) { ?>
					<p><?php echo __('Es wurde bisher kein Briefpapier hochgeladen', 'wpsg'); ?></p>
					<?php } else { ?>
					<a href="<?php echo $this->view['wpsg_mod_deliverynote']['bp']; ?>" target="_blank"><?php echo __('Derzeitiges Briefpapier', 'wpsg'); ?></a>
					<?php } ?>					
					<a style="float:right; position:relative;" class="wpsg_form_help" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_deliverynote_bp" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_deliverynote_bp"></a>
					<input type="file" name="wpsg_mod_deliverynote_bp">
				</div>
				<div class="wpsg_clear"></div>
			</div>
			
			<div class="wpsg_form_field">
				<div class="wpsg_form_left">
					<label><?php echo __('Logo (JPG)', 'wpsg'); ?>:</label><br />
					<?php if ($this->view['wpsg_mod_deliverynote']['logo'] !== false) { ?>
					<label>
						<input type="checkbox" name="wpsg_mod_deliverynote_logo_del" value="1" />&nbsp;<?php echo __('Löschen', 'wpsg'); ?>
					</label>
					<?php } ?>
				</div>
				<div class="wpsg_form_right">
					<?php if ($this->view['wpsg_mod_deliverynote']['logo'] === false) { ?>
					<p><?php echo __('Es wurde bisher kein Logo hochgeladen', 'wpsg'); ?></p>
					<?php } else { ?>
					<a href="<?php echo $this->view['wpsg_mod_deliverynote']['logo']; ?>" target="_blank"><?php echo __('Derzeitiges Logo', 'wpsg'); ?></a>
					<?php } ?>
					<a style="float:right; position:relative;" class="wpsg_form_help" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_deliverynote_logo" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_deliverynote_logo"></a>
					<input type="file" name="wpsg_mod_deliverynote_logo">
				</div>
				<div class="wpsg_clear"></div>
			</div>
			
			<div class="wpsg_hinweis"><?php echo __('Das Briefpapier wird hinter die gesamte Seite gelegt, das Logo wird rechts oben auf jeder Seite platziert. (96 dpi)', 'wpsg'); ?></div>
			<br />
			
			<table class="wpsg_mod_deliverynote_fieldtable">
				<tr>
					<th class="col_bezeichnung"><?php echo __('Bezeichnung', 'wpsg'); ?></th>
					<th class="col_freitext"><?php echo __('Freitext', 'wpsg'); ?></th>
					<th class="col_x"><?php echo __('X', 'wpsg'); ?></th>
					<th class="col_y"><?php echo __('Y', 'wpsg'); ?></th>
					<th class="col_color"><?php echo __('Farbe', 'wpsg'); ?></th>
					<th class="col_groesse"><?php echo __('Größe', 'wpsg'); ?></th>
					<th class="col_action"></th>
				</tr>
				<?php foreach ($this->view['wpsg_mod_deliverynote']['fields'] as $f => $field_name) { ?>
				<tr>
					<td><?php echo wpsg_hspc($field_name); ?></td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $f; ?>][text]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['text']); ?>" />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $f; ?>][x]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['x']); ?>" />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $f; ?>][y]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['y']); ?>" />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $f; ?>][color]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['color']); ?>" />
					</td>
					<td>
						<select name="text[<?php echo $f; ?>][fontsize]" style="width:100%;">
							<option <?php echo (($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['fontsize'] == "8")?'selected="selected"':''); ?> value="8">8</option>				
							<option <?php echo (($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['fontsize'] == "9")?'selected="selected"':''); ?> value="9">9</option>
							<option <?php echo (($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['fontsize'] == "10")?'selected="selected"':''); ?> value="10">10</option>
							<option <?php echo (($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['fontsize'] == "11")?'selected="selected"':''); ?> value="11">11</option>
							<option <?php echo (($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['fontsize'] == "12")?'selected="selected"':''); ?> value="12">12</option>
							<option <?php echo (($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['fontsize'] == "13")?'selected="selected"':''); ?> value="13">13</option>
							<option <?php echo (($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['fontsize'] == "14")?'selected="selected"':''); ?> value="14">14</option>
						</select>
					</td>
					<td>			
						<label><input type="checkbox" value="1" name="text[<?php echo $f; ?>][aktiv]" <?php echo ((wpsg_isSizedInt($this->view['wpsg_mod_deliverynote']['arTexte'][$f]['aktiv']))?'checked="checked"':''); ?> />&nbsp;<?php echo __("Aktiv", "wpsg"); ?></label>
						<a style="float:right; position:relative;" class="wpsg_form_help" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_deliverynote_fieldconfig" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_deliverynote_fieldconfig"></a>
					</td>
				</tr>
				<?php } ?>
			</table>
						
			<br />
			
			<input style="float:right;" class="button" onclick="if (!confirm('<?php echo __('Sind Sie sich sicher? Ihre bisherigen Einstellungen gehen verloren!', 'wpsg'); ?>')) return false; else location.href = '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&amp;action=module&amp;modul=<?php echo $_REQUEST['modul']; ?>&amp;do=reset&amp;noheader=1';" type="button" value="<?php echo __('Standardeinstellungen laden', 'wpsg'); ?>" />
			
			<div class="wpsg_hinweis">
				<?php echo __('Die Angaben für X (Abstand von Links) und Y (Abstand von Oben) werden in mm eingetragen.', 'wpsg'); ?><br />
				<?php echo __('Die Farbe wird im Hexadezimalformat angegeben (#FFFFF für weiß, #000000 für schwarz).', 'wpsg'); ?> 
			</div>
			<br />
			
		</div>
		<div id="tabcontent2" class="tabcontent">
			
			<div id="foottext_list"><?php echo $this->view['foottext_list']; ?></div>
			<br />
			
			<div class="wpsg_hinweis">
				<?php echo __('Hier können Sie Texte vordefinieren, die sie unter den Lieferschein setzen können.', 'wpsg'); ?>
			</div>
			
		</div>		
		<div id="tabcontent3" class="tabcontent">
		
			<?php echo wpsg_drawForm_Input('wpsg_mod_deliverynote_nrformat', __('Format der Lieferscheinnummer', 'wpsg'), $this->get_option('wpsg_mod_deliverynote_nrformat'), array('help' => 'wpsg_mod_deliverynote_nrformat')); ?>
			<?php echo wpsg_drawForm_Input('wpsg_mod_deliverynote_nr', __('Start für Lieferscheinnummer', 'wpsg'), $this->get_option('wpsg_mod_deliverynote_nr'), array('help' => 'wpsg_mod_deliverynote_nr')); ?>
			<?php echo wpsg_drawForm_Input('wpsg_mod_deliverynote_url', __('URL Für URL Benachrichtigung', 'wpsg'), $this->get_option('wpsg_mod_deliverynote_url'), array('help' => 'wpsg_mod_deliverynote_url')); ?>
			<?php echo wpsg_drawForm_Checkbox('wpsg_mod_deliverynote_url_standard', __('URL Benachrichtigung standardmäßig aktiv', 'wpsg'), $this->get_option('wpsg_mod_deliverynote_url_standard'), array('help' => 'wpsg_mod_deliverynote_url_standard')); ?>
			<?php echo wpsg_drawForm_Checkbox('wpsg_mod_deliverynote_hideCountry', __('Land auf Lieferschein verbergen', 'wpsg'), $this->get_option('wpsg_mod_deliverynote_hideCountry'), array('help' => 'wpsg_mod_deliverynote_hideCountry')); ?>
			<?php echo wpsg_drawForm_Select('wpsg_mod_deliverynote_anr', __('Artikelnummer anzeigen', 'wpsg'), array(
				'0' => __('Nicht anzeigen', 'wpsg'),
				'1' => __('In Spalte "Nr." zeigen', 'wpsg'),
				'2' => __('Als extra Zeile anzeigen', 'wpsg')					
			), $this->get_option('wpsg_mod_deliverynote_anr'), array('help' => 'wpsg_mod_deliverynote_anr')); ?>
					
		</div>
	</div>
</div>

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

	/**
	 * Wird beim anlegen einer neuen Fußzeile aufgerufen
	 */ 
	function wpsg_addFooter()
	{
	
		jQuery('#foottext_list').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&action=module&modul=wpsg_mod_deliverynote&do=addFoottext&noheader=1',
			success: function(data) {
				jQuery('#foottext_list').html(data);
			}
		} );
	
		return false;
	
	} // function wpsg_addFooter()
	
	/**
	 * Wird beim entfernen einer Fußzeile aufgerufen
	 */
	function wpsg_removeFooter(foot_id)
	{
	
		if (!confirm('<?php echo __('Sind Sie sich sicher, dass Sie diese Fußzeile löschen möchten?', 'wpsg'); ?>')) return false;
		
		jQuery('#foottext_list').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&action=module&modul=wpsg_mod_deliverynote&do=removeFoottext&noheader=1',
			data: {
				foot_id: foot_id
			},
			success: function(data) {
				jQuery('#foottext_list').html(data);
			}
		} );
	
		return false;
		
	} // function wpsg_removeFooter()
			
	jQuery(document).ready(function() {
		jQuery('#wpsg_tab').wpsg_tab( { 
			'cookiename': 'wpsg_mod_deliverynote_tab',
			'tab2': function() {
				jQuery('.tablink').show();
			}
		} );
	} );

/* ]]> */</script>