Subversion Repositories wpShopGermany4

Rev

Rev 8163 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1067 daniel 1
<?php
2
 
3
	/**
4
	 * Template für die Bearbeitung eines Kunden im Backend
5
	 */
8456 daniel 6
 
7
	$oCustomer = wpsg_customer::getInstance(intval($_REQUEST['edit_id']??0));
8
 
1067 daniel 9
?>
5752 daniel 10
<div class="wpsg_customer" id="wpsg-bs">
1405 daniel 11
 
5752 daniel 12
	<nav class="navbar navbar-default">
1405 daniel 13
 
5752 daniel 14
		<div class="container-fluid">
15
			<div class="navbar-header">
16
				<a class="navbar-brand" href="#"><?php echo __('wpShopGermany', 'wpsg'); ?></a>
17
			</div>
18
			<div class="collapse navbar-collapse" id="bs-customer-navbar-collapse-1">
19
				<ul class="nav navbar-nav">
20
					<li role="presentation" class="wpsg-customer-tab-a active"><a href="#" onclick="return false;"><?php echo __("Kundenverwaltung", "wpsg"); ?></a></li>
5753 daniel 21
					<li role="presentation" class="active"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=add"><span class="glyphicon glyphicon-plus"></span><?php echo __("Kunde anlegen/bearbeiten", "wpsg"); ?></a></li>
5752 daniel 22
				</ul>
23
				<ul class="nav navbar-nav navbar-right">
24
					<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'import'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=import&noheader=1"><span class="glyphicon glyphicon-import"></span><?php echo __("Import", "wpsg"); ?></a></li>
25
					<?php if (wpsg_isSizedArray($this->view['data'])) { ?>
26
						<li role="presentation" class="<?php echo ((wpsg_isSizedString($_REQUEST['action'], 'export'))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=export&noheader=1"><span class="glyphicon glyphicon-export"></span><?php echo __("Export", "wpsg"); ?></a></li>
27
					<?php } ?>
28
				</ul>
29
			</div>
30
		</div>
1405 daniel 31
 
5752 daniel 32
	</nav>
7529 daniel 33
 
34
	<div class="wpsg_msg_wrap"><hr class="wp-header-end wpsg-wp-header-end"/></div>
5752 daniel 35
	<div class="wpsg_clear"></div>
1405 daniel 36
 
5752 daniel 37
	<div class="content form-horizontal">
1405 daniel 38
 
5752 daniel 39
		<form method="POST" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Customer&action=save&noheader=1" enctype="multipart/form-data">
1405 daniel 40
 
7562 daniel 41
			<?php echo wpsg_formNounce('Customer', 'save'); ?>
42
 
5752 daniel 43
			<div class="row">
44
				<div class="col-md-8 col-lg-8">
1405 daniel 45
 
5752 daniel 46
					<?php echo wpsg_drawForm_AdminboxStart(__('Allgemein', 'wpsg')); ?>
5753 daniel 47
                        <?php echo wpsg_drawForm_Input('knr', __('Kundennummer', 'wpsg'), @$this->view['data']['knr']); ?>
1405 daniel 48
 
5752 daniel 49
                        <?php if ($this->hasMod('wpsg_mod_customergroup')) { ?>
5753 daniel 50
                            <?php echo wpsg_drawForm_Select('group_id', __('Kundengruppe', 'wpsg'), @$this->view['arCustomergroup'], @$this->view['data']['group_id']); ?>
5752 daniel 51
                        <?php } ?>
7087 thomas 52
						<?php if ($this->view['pflicht']['anrede'] != '2') { ?>
53
                        	<?php echo wpsg_drawForm_Select('title', __('Anrede', 'wpsg'), $this->view['arTitles'], @$this->view['data']['title'], array('noIndex' => true)); ?>
54
                        <?php } ?>
55
                        <?php if ($this->view['pflicht']['name'] != '2') { ?>
56
                        	<?php echo wpsg_drawForm_Input('name', __('Name', 'wpsg'), @$this->view['data']['name']); ?>
57
                        <?php } ?>
58
                        <?php if ($this->view['pflicht']['vname'] != '2') { ?>
59
	                        <?php echo wpsg_drawForm_Input('vname', __('Vorname', 'wpsg'), @$this->view['data']['vname']); ?>
60
						<?php } ?>
61
						<?php if ($this->view['pflicht']['geb'] != '2') { ?>
8456 daniel 62
	                    	<?php echo wpsg_drawForm_Input('geb', __('Geburtsdatum', 'wpsg'), wpsg_formatTimestamp(strtotime($this->view['data']['geb']??''), true), array('autocomplete' => false, 'datepicker' => true, 'hint' => __('Format: TT.MM.JJJJ', 'wpsg'))); ?>
7087 thomas 63
                       	<?php } ?>
64
                        <?php if ($this->view['pflicht']['email'] != '2') { ?>
65
                        	<?php echo wpsg_drawForm_Input('email', __('E-Mail', 'wpsg'), @$this->view['data']['email']); ?>
66
                        <?php } ?>
8456 daniel 67
 
68
						<?php if ($oCustomer->getEMailEInvoice() !== null) { ?>
69
							<?php echo wpsg_drawForm_Input('email_einvoice', __('E-Mail für eRechnung', 'wpsg'), $oCustomer->getEMailEInvoice()); ?>
70
						<?php } ?>
71
 
7087 thomas 72
                        <?php if ($this->view['pflicht']['firma'] != '2') { ?>
73
                        	<?php echo wpsg_drawForm_Input('firma', __('Firma', 'wpsg'), @$this->view['data']['firma']); ?>
74
                        <?php } ?>
75
                        <?php if ($this->view['pflicht']['tel'] != '2') { ?>
76
                        	<?php echo wpsg_drawForm_Input('tel', __('Telefon', 'wpsg'), @$this->view['data']['tel']); ?>
77
    					<?php } ?>
78
                        <?php if ($this->view['pflicht']['fax'] != '2') { ?>
79
	                        <?php echo wpsg_drawForm_Input('fax', __('Fax', 'wpsg'), @$this->view['data']['fax']); ?>
80
	                   	<?php }?>
81
	                    <?php if ($this->view['pflicht']['strasse'] != '2') { ?>
7247 daniel 82
 
7087 thomas 83
                        	<?php echo wpsg_drawForm_Input('strasse', __('Straße', 'wpsg'), @$this->view['data']['strasse']); ?>
7247 daniel 84
 
7948 daniel 85
							<?php if (($this->view['pflicht']['wpsg_showNr']??'') === '1') { ?>
7247 daniel 86
								<?php echo wpsg_drawForm_Input('nr', __('Hausnummer', 'wpsg'), @$this->view['data']['nr']); ?>
87
							<?php } ?>
88
 
7087 thomas 89
                        <?php } ?>
90
                        <?php if ($this->view['pflicht']['plz'] != '2') { ?>
91
                        	<?php echo wpsg_drawForm_Input('plz', __('PLZ', 'wpsg'), @$this->view['data']['plz']); ?>
92
                        <?php } ?>
93
                        <?php if ($this->view['pflicht']['ort'] != '2') { ?>
94
                        	<?php echo wpsg_drawForm_Input('ort', __('Ort', 'wpsg'), @$this->view['data']['ort']); ?>
95
                        <?php } ?>
96
                        <?php if ($this->view['pflicht']['land'] != '2') { ?>
97
                        	<?php echo wpsg_drawForm_Select('land', __('Land', 'wpsg'), @$this->view['arLand'], @$this->view['data']['land']); ?>
98
                        <?php } ?>
99
                        <?php if ($this->view['pflicht']['ustidnr'] != '2') { ?>
100
                        	<?php echo wpsg_drawForm_Input('ustidnr', __('UStIdNr.', 'wpsg'), @$this->view['data']['ustidnr']); ?>
101
                        <?php } ?>
7159 daniel 102
                        <?php echo wpsg_drawForm_Select('status', __('Status', 'wpsg'), ['1' => __('Aktiv', 'wpsg'), '0' => __('Inaktiv', 'wpsg'), '-1' => __('Anonymisiert')], @$this->view['data']['status'], array()); ?>
5752 daniel 103
                        <?php echo wpsg_drawForm_Checkbox('info-mail', __('Mail bei Statusänderung', 'wpsg'), '', array()); ?>
5753 daniel 104
                        <?php echo wpsg_drawForm_Textarea('comment', __('Kundenkommentar', 'wpsg'), @$this->view['data']['comment']); ?>
5752 daniel 105
					<?php echo wpsg_drawForm_AdminboxEnd(); ?>
1405 daniel 106
 
5752 daniel 107
                    <?php if (wpsg_isSizedArray($this->view['pflicht']['custom'])) { ?>
108
                    <?php echo wpsg_drawForm_AdminboxStart(__('Benutzerdefinierte Felder', 'wpsg')); ?>
109
                    <?php foreach ($this->view['pflicht']['custom'] as $c_id => $c) { ?>
110
                        <?php if ($c['typ'] == '0') { // Textfeld ?>
111
                            <?php echo wpsg_drawForm_Input('custom['.$c_id.']', __($c['name'], 'wpsg'), @$this->view['data']['custom'][$c_id]); ?>
112
                        <?php } else if ($c['typ'] == '1') { // Auswahl ?>
113
                            <?php echo wpsg_drawForm_Select('custom['.$c_id.']', __($c['name'], 'wpsg'), wpsg_array_merge(array('' => __('Keine Auswahl', 'wpsg')), explode('|', $c['auswahl'])), @$this->view['data']['custom'][$c_id], array('noIndex' => true)); ?>
114
                        <?php } else if ($c['typ'] == '2') { // Checkbox?>
115
                            <?php echo wpsg_drawForm_Checkbox('custom['.$c_id.']', __($c['name'], 'wpsg'), @$this->view['data']['custom'][$c_id]); ?>
116
                        <?php } ?>
117
                    <?php } ?>
118
                    <?php echo wpsg_drawForm_AdminboxEnd(); ?>
119
                    <?php } ?>
1405 daniel 120
 
5752 daniel 121
				</div>
122
				<div class="col-md-4 col-lg-4">
1405 daniel 123
 
5752 daniel 124
					<?php echo wpsg_drawForm_AdminboxStart(__('Passwortänderung', 'wpsg')); ?>
125
						<?php echo wpsg_drawForm_Input('password1', __('Passwort', 'wpsg'), '', array('type' => 'password')); ?>
126
						<?php echo wpsg_drawForm_Input('password2', __('Wiederholung', 'wpsg'), '', array('type' => 'password')); ?>
7562 daniel 127
                        <div id="wpsg_pwd_info" style="display:none;">
5752 daniel 128
                            <h4><?php echo __('Passwort sollte folgende Regeln befolgen:','wpsg') ?></h4>
129
                            <ul>
6671 thomas 130
                                <li id="wpsg_pwd_length" class="invalid"><?php echo __('Mindestens 8 Zeichen','wpsg')?></li>
5752 daniel 131
                                <li id="wpsg_pwd_letter" class="invalid"><?php echo __('Mindestens ein Kleinbuchstabe','wpsg') ?></li>
132
                                <li id="wpsg_pwd_capital" class="invalid"><?php echo __('Mindestens ein Großbuchstabe','wpsg') ?></li>
133
                                <li id="wpsg_pwd_number" class="invalid"><?php echo __('Mindestens eine Zahl','wpsg') ?></li>
134
                                <li id="wpsg_pwd_speziell" class="invalid"><?php echo __('Mindestens ein Sonderzeichen','wpsg') ?></li>
135
                            </ul>
136
                        </div>
137
					<?php echo wpsg_drawForm_AdminboxEnd(); ?>
7159 daniel 138
 
5752 daniel 139
					<?php if (wpsg_isSizedInt($this->view['data']['id'])) { ?>
140
					<?php echo wpsg_drawForm_AdminboxStart(__('Information', 'wpsg')) ?>
1405 daniel 141
 
5752 daniel 142
						<?php echo wpsg_drawForm_TextStart(); ?>
143
						<p>
144
							<?php echo $this->view['data']['countOrder']; ?>
145
							<?php if ($this->view['data']['countOrder'] > 0) { ?>
146
								[ <a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&filter%5Bk_id%5D=<?php echo $this->view['data']['id']; ?>"><?php echo __('Bestellungen anzeigen', 'wpsg'); ?></a> ]
147
							<?php } ?>
148
						</p>
149
						<?php echo wpsg_drawForm_TextEnd(__('Bestellungen', 'wpsg'), array('noP' => true)); ?>
1405 daniel 150
 
7159 daniel 151
                        <?php if ($this->view['data']['status'] !== '-1') { ?>
152
 
153
                            <?php echo wpsg_drawForm_TextStart(); ?>
154
                            <p>
155
                                <a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_kundenverwaltung&noheader=1&be_ajax=su&k_id=<?php echo $this->view['data']['id']; ?>"><?php echo __('Kundenlogin simulieren', 'wpsg'); ?></a>
156
                            </p>
157
                            <?php echo wpsg_drawForm_TextEnd(__('Kunden Login', 'wpsg'), array('noP' => true)); ?>
158
 
159
                        <?php } ?>
6714 daniel 160
 
7159 daniel 161
                        <?php if (wpsg_isSizedInt($this->view['data']['countOrder'])) { ?>
162
 
163
                            <?php echo wpsg_drawForm_TextStart(); ?>
164
						    <p><?php echo wpsg_formatTimestamp(strtotime($this->view['data']['lastorder'])); ?></p>
165
						    <?php echo wpsg_drawForm_TextEnd(__('Letzte Bestellung', 'wpsg'), array('noP' => true)); ?>
166
 
167
                        <?php } ?>
5752 daniel 168
 
7159 daniel 169
                        <?php if (strtotime($this->view['data']['anonymized']) > 0) { ?>
170
 
171
                            <?php echo wpsg_drawForm_TextStart(); ?>
172
                            <p><?php echo wpsg_formatTimestamp(strtotime($this->view['data']['anonymized'])); ?></p>
173
                            <?php echo wpsg_drawForm_TextEnd(__('Anonymisiert am', 'wpsg'), array('noP' => true)); ?>
174
 
175
                        <?php } ?>
176
 
177
                        <?php if (strtotime($this->view['data']['last_login']) > 0) { ?>
178
 
179
                            <?php echo wpsg_drawForm_TextStart(); ?>
180
                            <p><?php echo wpsg_formatTimestamp(strtotime($this->view['data']['last_login'])); ?></p>
181
                            <?php echo wpsg_drawForm_TextEnd(__('Letzte Anmeldung', 'wpsg'), array('noP' => true)); ?>
182
 
183
                        <?php } ?>
184
 
5752 daniel 185
						<?php if ($this->hasMod('wpsg_mod_statistics')) { ?>
186
						<?php echo wpsg_drawForm_TextStart(); ?>
187
						<p>
188
							<?php
189
 
190
							echo wpsg_translate(__('<a href="#1#" title="Storniert" class="wpsg_storno">#2#</a> / <a href="#3#" title="Offen" class="wpsg_open">#4#</a> / <a href="#5#" title="Bezahlt" class="wpsg_payed">#6#</a>', 'wpsg'),
191
								WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&filter[status]=500&filter[k_id]='.$this->view['data']['id'],
192
								wpsg_ff($this->view['amountStorno']),
193
								WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&filter[status]=0&filter[k_id]='.$this->view['data']['id'],
194
								wpsg_ff($this->view['amountAll'] - $this->view['amountStorno'] - $this->view['amountPayed']),
195
								WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&filter[status]=100,110&filter[k_id]='.$this->view['data']['id'],
196
								wpsg_ff($this->view['amountPayed'])
197
							);
198
 
199
							?>
200
						</p>
201
						<?php echo wpsg_DrawForm_TextEnd(wpsg_translate(__('Umsatz in #1#', 'wpsg'), $this->get_option('wpsg_currency')), array('noP' => true)); ?>
202
						<?php } ?>
203
 
204
					<?php echo wpsg_drawForm_AdminboxEnd(); ?>
205
					<?php } ?>
206
 
207
                    <?php $this->callMods('wpsg_mod_customer_sidebar', array(&$this->view['data'])); ?>
208
 
209
				</div>
210
			</div>
211
 
5753 daniel 212
            <?php if (@$_REQUEST['edit_id'] > 0) { ?>
5752 daniel 213
                <input type="hidden" name="edit_id" value="<?php echo $_REQUEST['edit_id']; ?>" />
214
            <?php } ?>
215
 
216
            <input type="submit" value="<?php echo __('Kunde speichern', 'wpsg'); ?>" class="button-primary" id="submit" name="submit" />
217
            <input type="submit" value="<?php echo __('Kunde speichern und zur Übersicht', 'wpsg'); ?>" class="button-primary" id="submit_index" name="submit_index" />
218
 
219
		</form>
220
 
221
	</div>
222
 
223
</div>
224
 
7562 daniel 225
<script>
5752 daniel 226
 
227
	jQuery(document).ready(function() {
1405 daniel 228
 
5752 daniel 229
		// Visualisierung der Passwortstärke
230
		jQuery('input[type=password]').keyup(function() {
1405 daniel 231
 
5752 daniel 232
			var password = jQuery(this).val();
5382 daniel 233
 
8163 daniel 234
			if (password.length < 8)
5752 daniel 235
			{
236
 
5382 daniel 237
				jQuery('#wpsg_pwd_length').removeClass('valid').addClass('invalid');
238
 
5752 daniel 239
			}
240
			else
241
			{
5382 daniel 242
 
243
				jQuery('#wpsg_pwd_length').removeClass('invalid').addClass('valid');
5752 daniel 244
 
5382 daniel 245
			}
246
 
5752 daniel 247
			if (password.match(/([a-z])/))
248
			{
249
 
5382 daniel 250
				jQuery('#wpsg_pwd_letter').removeClass('invalid').addClass('valid');
251
 
5752 daniel 252
			}
253
			else
254
			{
5382 daniel 255
 
256
				jQuery('#wpsg_pwd_letter').removeClass('valid').addClass('invalid');
5752 daniel 257
 
5382 daniel 258
			}
259
 
5752 daniel 260
			if (password.match(/([A-Z])/))
261
			{
262
 
5382 daniel 263
				jQuery('#wpsg_pwd_capital').removeClass('invalid').addClass('valid');
264
 
5752 daniel 265
			}
266
			else
267
			{
5382 daniel 268
 
269
				jQuery('#wpsg_pwd_capital').removeClass('valid').addClass('invalid');
5752 daniel 270
 
5382 daniel 271
			}
5752 daniel 272
 
273
			if (password.match(/([0-9])/))
274
			{
275
 
5382 daniel 276
				jQuery('#wpsg_pwd_number').removeClass('invalid').addClass('valid');
277
 
5752 daniel 278
			}
279
			else
280
			{
5382 daniel 281
 
282
				jQuery('#wpsg_pwd_number').removeClass('valid').addClass('invalid');
5752 daniel 283
 
5382 daniel 284
			}
285
 
5752 daniel 286
			if (password.match(/([~,!,%,@,&,#,°,^,$,?,_,*,§])/))
287
            {
288
 
5382 daniel 289
				jQuery('#wpsg_pwd_speziell').removeClass('invalid').addClass('valid');
290
 
5752 daniel 291
			}
292
            else
293
            {
5382 daniel 294
 
295
				jQuery('#wpsg_pwd_speziell').removeClass('valid').addClass('invalid');
5752 daniel 296
 
5382 daniel 297
			}
298
 
7562 daniel 299
		} ).on('focus', function() {
300
 
5752 daniel 301
			jQuery('#wpsg_pwd_info').show();
7562 daniel 302
 
303
		}).on('blur', function() {
5382 daniel 304
 
7562 daniel 305
			jQuery('#wpsg_pwd_info').hide();
306
 
307
		});
308
 
5752 daniel 309
	} );
310
 
7562 daniel 311
</script>