Subversion Repositories wpShopGermany4

Rev

Rev 7349 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1272 david 1
<script type="text/javascript">
2759 daniel 2
 
1272 david 3
	jQuery(document).ready(function() {
3755 daniel 4
 
3438 daniel 5
		kk_switchTemplate();
6
 
2759 daniel 7
	} );
1272 david 8
 
9
	/**
10
	 *
11
	 */
12
	function kk_switchTemplate()
13
	{
14
 
15
		var template_val = jQuery("#kk_template").val();
16
 
17
		if (template_val != "-1")
18
		{
19
 
20
			jQuery.ajax( {
21
				url: "<?php echo WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_kundenkontakt&edit_id='.$this->view['data']['id'].'&noheader=1&do=kk_switchTemplate' ?>",
3757 daniel 22
				dataType: 'json',
1272 david 23
				data: {
24
					template_file: template_val
25
				},
26
				success: function(data) {
27
 
3757 daniel 28
					jQuery("#kk_subject").val(data.subject);
1272 david 29
 
3757 daniel 30
					<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
31
					jQuery('#kk_html').html(data.content);
4885 daniel 32
					tinyMCE.get("kk_html").setContent(data.content);
3757 daniel 33
					<?php } else { ?>
34
					jQuery("#kk_text").text(data.content);
35
					<?php } ?>
36
 
1272 david 37
				}
38
			} );
39
 
40
		}
41
		else
42
		{
3438 daniel 43
 
3757 daniel 44
			jQuery("#kk_subject").val('');
45
			jQuery("#kk_template").val(-1);
46
 
47
			<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
48
			jQuery('#kk_html').html('');
4885 daniel 49
			//tinyMCE.get("kk_html").setContent('');
3757 daniel 50
			<?php } else { ?>
1272 david 51
			jQuery("#kk_text").text('');
3757 daniel 52
			<?php } ?>
3438 daniel 53
 
1272 david 54
		}
55
 
56
	}
57
 
58
	/**
59
	 *
60
	 */
61
	function kk_sendMail()
62
	{
3755 daniel 63
 
1272 david 64
		if (jQuery('#kk_subject').val() == '')
65
		{
66
 
67
			alert("<?php echo __('Bitte einen Betreff angeben!', 'wpsg'); ?>");
68
			return;
69
 
70
		}
71
 
72
		if (jQuery('#kk_text').val() == '')
73
		{
74
 
75
			alert("<?php echo __('Bitte einen Text angeben!', 'wpsg'); ?>");
76
			return;
77
 
78
		}
79
 
3755 daniel 80
		var text = "";
81
 
82
		<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
83
		text = tinyMCE.get('kk_html').getContent();
84
		<?php } else { ?>
85
		text = jQuery('#kk_text').val();
86
		<?php } ?>
87
 
1272 david 88
		jQuery.ajax( {
89
			url: "<?php echo WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_kundenkontakt&edit_id='.$this->view['data']['id'].'&noheader=1&do=kk_sendMail' ?>",
4421 daniel 90
			method: 'post',
1272 david 91
			data: {
3755 daniel 92
				text: text,
1272 david 93
				absendermail: jQuery('#kk_absendermail').val(),
94
				absendername: jQuery('#kk_absendername').val(),
95
				subject: jQuery('#kk_subject').val(),
96
				empfaenger: "<?php echo $this->view['data']['email']; ?>"
97
			},
98
			success: function(data) {
3755 daniel 99
 
1272 david 100
				if (data != '1')
101
				{
102
					alert("<?php echo __("Mail konnte nicht versendet werden es ist ein Fehler aufgetreten!", "wpsg"); ?>");
103
				}
104
				else
105
				{
3755 daniel 106
 
107
					<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
108
					tinyMCE.get('kk_html').setContent('');
109
					<?php } else { ?>
110
					jQuery('#kk_text').html('');
111
					<?php } ?>
1272 david 112
 
113
					jQuery('#kk_subject').val('');
114
					jQuery('#kk_absendermail').val('');
115
					jQuery('#kk_absendername').val('');
116
					jQuery('#kk_template').val(-1);
117
 
118
					alert("<?php echo __('Mail wurde erfolgreich an den Kunden gesendet.', 'wpsg'); ?>");
1275 david 119
 
120
					location.reload();
1272 david 121
 
122
				}
3755 daniel 123
 
1272 david 124
			}
1275 david 125
 
1272 david 126
		} );
127
 
128
	}
129
 
130
 
131
</script>
132
<?php //wpsg_debug($this->view) ?>
6455 thomas 133
<?php echo wpsg_drawForm_AdminboxStart(__('Kundenkontakt', 'wpsg'));?>
6453 thomas 134
 
1272 david 135
	<div class="inside">
2759 daniel 136
		<div style="padding:5px;">
1272 david 137
 
3755 daniel 138
			<form method="post" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_kundenkontakt&edit_id=<?php echo $this->view['data']['id']; ?>&noheader=1">
139
 
6204 thomas 140
				<label><?php echo __("Template", "wpsg"); ?>:</label>
141
				<select name="kk_template" class="wpsg_kundenkontakt_template" id="kk_template" onchange="kk_switchTemplate();">
1272 david 142
					<option value="-1"><?php echo __("Bitte auswählen", "wpsg"); ?></option>
143
					<?php foreach ($this->view['arTemplates'] as $k => $v) { ?>
6204 thomas 144
						<option value="<?php echo rawurlencode($v['filename']); ?>"><?php echo htmlspecialchars($v['name']); ?></option>
1272 david 145
					<?php } ?>
6204 thomas 146
				</select>
3755 daniel 147
				<div class="wpsg_clear"></div>
148
 
6204 thomas 149
				<label><?php echo __("Betreff", "wpsg"); ?>:</label>
150
				<input type="text" name="kk_subject" class="wpsg_kundenkontakt_betreff" id="kk_subject" />
3755 daniel 151
				<div class="wpsg_clear"></div>
152
 
153
				<?php if ($this->get_option('wpsg_htmlmail') === '1') { ?>
4886 daniel 154
 
3755 daniel 155
					<?php echo __('Text (HTML)', 'wpsg'); ?>:<br /><br />
4885 daniel 156
 
3755 daniel 157
					<?php wp_editor('', 'kk_html'); ?>
4885 daniel 158
 
4886 daniel 159
 
3755 daniel 160
				<div class="wpsg_clear"></div>
161
				<?php } else { ?>
6204 thomas 162
				<label><?php echo __("Text", "wpsg"); ?>:<br /></label>
7932 daniel 163
				<textarea id="kk_text" class="wpsg_kundenkontakt_textarea" style="font-family:monospace;"></textarea>
3755 daniel 164
				<div class="wpsg_clear"></div>
165
				<?php } ?>
166
 
1272 david 167
				<br />
3755 daniel 168
				<input type="button" class="button" onclick="kk_sendMail(); return false;" value="<?php echo __("Absenden", "wpsg"); ?>" style="float:right;" />
169
				<div class="wpsg_clear"></div>
170
 
1272 david 171
			</form>
7267 daniel 172
 
173
		</div>
174
	</div>
175
 
176
<?php echo wpsg_drawForm_AdminboxEnd(); ?>
177
 
7349 daniel 178
<?php if ($this->get_option('wpsg_mod_kundenkontakt_smsflatrate_active') === '1') { ?>
179
	<?php echo wpsg_drawForm_AdminboxStart(__('SMS Versand', 'wpsg'));?>
7267 daniel 180
 
7349 daniel 181
		<div class="inside">
182
			<div style="padding:5px;">
183
 
184
				<form id="sms_form" method="post" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_kundenkontakt&edit_id=<?php echo $this->view['data']['id']; ?>&do=sms_submit&noheader=1">
185
 
186
					<input type="hidden" name="_wpnonce" value="<?php echo \wp_create_nonce('wpsg_mod_kundenkontakt_sms_form_'.$this->view['data']['id']); ?>" />
187
 
188
					<p>Mit diesem Formular kann eine SMS an den Kunden versendet werden.</p>
189
 
190
					<br />
7267 daniel 191
 
7349 daniel 192
					<div id="numbercheck">
193
						<?php if ($this->view['valid'] === true) { ?>
7267 daniel 194
 
7349 daniel 195
							<div class="alert alert-success">
196
								<?php echo wpsg_translate(__('Die Telefonnummer #1# ist gültig.', 'wpsg'), $this->view['phone']); ?>
197
							</div>
198
 
199
						<?php } else { ?>
200
 
201
							<div class="alert alert-danger">
202
								<?php echo wpsg_translate(__('Die Telefonnummer #1# ist nicht gültig.', 'wpsg'), $this->view['phone']); ?>
203
							</div>
204
 
205
						<?php } ?>
206
					</div>
7267 daniel 207
 
7349 daniel 208
					<br />
7267 daniel 209
 
7349 daniel 210
					<?php echo wpsg_drawForm_Input('phone', __('Empfänger', 'wpsg'), $this->view['phone']); ?>
211
 
212
					<br />
213
 
214
					<textarea id="text" name="text" <?php echo (($this->view['valid'] === true)?'':'disabled="disabled"'); ?> style="width:100%; height:100px;"></textarea>
215
 
216
					<input type="submit" id="sms_submit" <?php echo (($this->view['valid'] === true)?'':'disabled="disabled"'); ?> value="<?php echo __('SMS Senden', 'wpsg'); ?>" class="button" style="float:right; margin-top:15px;" />
217
 
218
					<script>
219
 
220
						jQuery('#phone').on('input', function() {
7267 daniel 221
 
7349 daniel 222
							jQuery('#numbercheck').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
223
 
224
							jQuery('#text').prop('disabled', true);
225
							jQuery('#sms_submit').prop('disabled', true);
226
 
227
							jQuery.ajax( {
228
								url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_kundenkontakt&noheader=1&edit_id=<?php echo $_REQUEST['edit_id']; ?>&do=validateNumber',
229
								data: {
230
									'phone': jQuery('#phone').val()
231
								},
232
								success: function(data) {
7267 daniel 233
 
7349 daniel 234
									if (data.valid) {
235
 
236
										jQuery('#text').prop('disabled', false);
237
										jQuery('#sms_submit').prop('disabled', false);
238
 
239
									}
7267 daniel 240
 
7349 daniel 241
									jQuery('#numbercheck').html(data.text);
7267 daniel 242
 
243
								}
7349 daniel 244
							} );
245
 
7267 daniel 246
						} );
247
 
7349 daniel 248
					</script>
7267 daniel 249
 
7349 daniel 250
				</form>
251
 
252
			</div>
1272 david 253
		</div>
7349 daniel 254
 
255
	<?php echo wpsg_drawForm_AdminboxEnd(); ?>
256
<?php } ?>