Subversion Repositories wpShopGermany4

Rev

Rev 6455 | Rev 7349 | Go to most recent revision | 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>
163
				<textarea id="kk_text" class="wpsg_kundenkontakt_textarea"></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
 
178
<?php echo wpsg_drawForm_AdminboxStart(__('SMS Versand', 'wpsg'));?>
179
 
180
	<div class="inside">
181
		<div style="padding:5px;">
182
 
183
			<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">
184
 
185
				<input type="hidden" name="_wpnonce" value="<?php echo \wp_create_nonce('wpsg_mod_kundenkontakt_sms_form_'.$this->view['data']['id']); ?>" />
186
 
187
				<p>Mit diesem Formular kann eine SMS an den Kunden versendet werden.</p>
188
 
189
				<br />
3438 daniel 190
 
7267 daniel 191
				<div id="numbercheck">
192
					<?php if ($this->view['valid'] === true) { ?>
193
 
194
						<div class="alert alert-success">
195
							<?php echo wpsg_translate(__('Die Telefonnummer #1# ist gültig.', 'wpsg'), $this->view['phone']); ?>
196
						</div>
197
 
198
					<?php } else { ?>
199
 
200
						<div class="alert alert-danger">
201
							<?php echo wpsg_translate(__('Die Telefonnummer #1# ist nicht gültig.', 'wpsg'), $this->view['phone']); ?>
202
						</div>
203
 
204
					<?php } ?>
205
				</div>
206
 
207
				<br />
208
 
209
				<?php echo wpsg_drawForm_Input('phone', __('Empfänger', 'wpsg'), $this->view['phone']); ?>
210
 
211
				<br />
212
 
213
				<textarea id="text" name="text" <?php echo (($this->view['valid'] === true)?'':'disabled="disabled"'); ?> style="width:100%; height:100px;"></textarea>
214
 
215
				<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;" />
216
 
217
				<script>
218
 
219
					jQuery('#phone').on('input', function() {
220
 
221
						jQuery('#numbercheck').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
222
 
223
						jQuery('#text').prop('disabled', true);
224
						jQuery('#sms_submit').prop('disabled', true);
225
 
226
						jQuery.ajax( {
227
							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',
228
							data: {
229
								'phone': jQuery('#phone').val()
230
							},
231
							success: function(data) {
232
 
233
								if (data.valid) {
234
 
235
									jQuery('#text').prop('disabled', false);
236
									jQuery('#sms_submit').prop('disabled', false);
237
 
238
								}
239
 
240
								jQuery('#numbercheck').html(data.text);
241
 
242
							}
243
						} );
244
 
245
					} );
246
 
247
				</script>
248
 
249
			</form>
250
 
1272 david 251
		</div>
252
	</div>
6453 thomas 253
 
6455 thomas 254
<?php echo wpsg_drawForm_AdminboxEnd(); ?>