summaryrefslogtreecommitdiff
path: root/views/mods/mod_coverletter/order_view.phtml
blob: 5bfe58553d92c9052559224680c1c08975d28dbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
	
	/**
	 * Template für die Integration des Anschreiben Moduls in die Bestellverwaltung
	 */

?>
	
<?php echo wpsg_drawForm_AdminboxStart(__('Anschreiben', 'wpsg'));?>

	<?php if (sizeof($this->view['mod_coverletter']['arCoverLetter']) == 0 ) { ?>
	   
		<p><?php echo __('Bisher kein Anschreiben für diese Bestellung geschrieben.', 'wpsg'); ?></p>
	   
	<?php } else { ?>

		<?php foreach ($this->view['mod_coverletter']['arCoverLetter'] as $a) { ?>
	
			<div class="wpsg_flex wpsg_flex_justify_content_space_between">
				<span>
					<?php echo wpsg_translate(__('#2#: Anschreiben ##1#', 'wpsg'), $a['id'], wpsg_formatTimestamp(strtotime($a['cdate']))); ?>: <?php echo ((strlen($a['text']) > 50)?substr($a['text'],0,50).' ...':$a['text']); ?>
				</span>
				<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_coverletter&noheader=1&action=ajax&order_id=<?php echo $a['order_id']; ?>&cl_id=<?php echo $a['id']; ?>&wpsg_mod_coverletter_get" target="_new">
					<?php echo __('Ansehen', 'wpsg'); ?>
				</a>
			</div>
		
		<?php } ?>
		
	<?php } ?>
		
	<br />
	
	<div class="wpsg_clear"></div>
	
	<hr />
	
	<div class="inside">						
		<div>
			
			<form target="_blank" method="post" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&mod=wpsg_mod_coverletter&edit_id=<?php echo $this->view['data']['id']; ?>&action=ajax&noheader=1" id="wpsg_mod_coverletter_form">	

				<?php $arShopLocations = $this->getShopLocations(); ?>
				<?php $arShopLocationLabels = []; foreach ($arShopLocations as $l_id => $l) $arShopLocationLabels[$l_id] = $l['label']; ?>
				
				<?php if (sizeof($arShopLocations) > 1) { ?>
					
					<?php echo wpsg_drawForm_Select('target', __('Shop Adresse', 'wpsg'), $arShopLocationLabels, '1'); ?>
					
				<?php } else { ?>
					
					<input type="hidden" name="target" value="1" />
					
				<?php } ?>

				<?php echo wpsg_drawForm_Textarea('text', __('Text', 'wpsg'),$this->replaceUniversalPlatzhalter($this->get_option('wpsg_mod_coverletter_text'), $this->view['data']['id']), ['noLabel' => true, 'fullLabel' => __('Text für das Anschreiben', 'wpsg'), 'style' => 'height:200px']); ?>
				
				<br />
				
				<input type="submit" name="wpsg_mod_coverletter_write" value="<?php echo __("Speichern & Drucken", "wpsg"); ?>" style="float:left;" class="button button-primary" />
				<input type="submit" name="wpsg_mod_coverletter_preview" onclick="wpsg_form_refresh = false;" value="<?php echo __('Vorschau', 'wpsg'); ?>" style="float:left; margin-left:15px;" class="button" />
				
				<div class="wpsg_clear"></div>
				
			</form>
			
		</div>
	</div>

<?php echo wpsg_drawForm_AdminboxEnd(); ?>

<script>
	
	var wpsg_form_refresh = true;
	
	jQuery('#wpsg_mod_coverletter_form').on('submit', function() {
		
		if (wpsg_form_refresh) {
		
			setTimeout(function() {
			
				location.reload();
				
			}, 1000);
			
		}

		wpsg_form_refresh = true;
				
	} );
	
</script>