Subversion Repositories wpShopGermany4

Rev

Rev 5532 | Rev 5748 | 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 Länderverwaltung
5
	 */
6
 
7
?>
8
<div class="wpsg_admin_submenu">
9
 
5455 thomas 10
	<div class="list-group">
11
		<span class="list-group-head list-group-item"><?php echo __('Konfiguration'); ?></span>
12
		<?php foreach ($this->view['arSubAction'] as $k => $v) { ?>
13
		<a class="list-group-item <?php echo (($k == $this->view['subAction'])?'active':''); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&amp;subaction=<?php echo $k; ?>"><?php echo $v['Menutext']; ?></a>
1067 daniel 14
		<?php } ?>
5455 thomas 15
	</div>
1067 daniel 16
 
17
</div>
18
 
5562 daniel 19
<div class="modal fade" id="Modal_wpsg_country_edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
20
	<div class="modal-dialog" role="document">
21
		<div class="modal-content">
22
			<div class="modal-header">
23
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
24
				<h4 class="modal-title" id="myModalLabel"><?php echo __('Land anlegen/bearbeiten', 'wpsg'); ?></h4>
25
			</div>
26
			<div class="modal-body">
27
 
28
			</div>
29
			<div class="modal-footer">
30
				<button type="button" class="btn btn-default" onclick="return wpsg_country_save();" data-dismiss="modal"><?php echo __('Speichern und schließen', 'wpsg'); ?></button>
31
			</div>
32
		</div>
33
	</div>
34
</div>
35
 
1067 daniel 36
<div class="wpsg_admin_content">
4057 daniel 37
 
5562 daniel 38
	<form name="form1" method="post" enctype="multipart/form-data" action="<?php echo wpsg_hspc(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=laender&noheader=1'); ?>">
39
 
40
		<?php echo wpsg_drawForm_AdminboxStart(__('Länderverwaltung', 'wpsg')); ?>
41
 
42
		<div id="wpsg_country_list">
43
 
44
			<?php if (wpsg_isSizedArray($this->view['data'])) { ?>
45
			<table class="table wpsg_table_country">
46
 
47
				<tr>
48
					<th class="col_check"><input type="checkbox" onclick="return wpsg_country_check_all();" style="margin-top:-2px;" /></th>
49
					<th class="col_name"><?php echo __('Ländername', 'wpsg'); ?></th>
50
					<th class="col_vz"><?php echo __('Versandzone', 'wpsg'); ?></th>
51
					<th class="col_mwstsetting"><?php echo __('MwSt.', 'wpsg'); ?></th>
52
					<th class="col_mwst"><?php echo __('MwSt. A', 'wpsg'); ?></th>
53
					<th class="col_mwst"><?php echo __('MwSt. B', 'wpsg'); ?></th>
54
					<th class="col_mwst"><?php echo __('MwSt. C', 'wpsg'); ?></th>
55
					<th class="col_mwst"><?php echo __('MwSt. D', 'wpsg'); ?></th>
56
					<th class="col_action"></th>
57
				</tr>
58
 
59
				<?php foreach ($this->view['data'] as $l) { ?>
60
				<tr id="<?php echo $l['id']; ?>">
61
					<td class="col_check"><input type="checkbox" value="1" name="arDelete[<?php echo $l['id']; ?>]" /></td>
62
					<td class="col_name"><?php echo wpsg_hspc($l['name'].((wpsg_isSizedString($l['kuerzel']))?' ('.$l['kuerzel'].')':'')); ?></td>
63
					<td class="col_vz">
64
						<?php if (wpsg_isSizedInt($l['vz']) && wpsg_isSizedString($this->view['vz'][$l['vz']])) { ?>
65
						<?php echo wpsg_hspc($this->view['vz'][$l['vz']]); ?>
66
						<?php } ?>
67
					</td>
68
					<td class="col_mwstsetting">
69
						<?php if ($l['mwst'] == '2') { ?>
70
						<?php echo __('keine MwSt. bei USt.IdNr.', 'wpsg'); ?>
71
						<?php } else if ($l['mwst'] == '1') { ?>
72
						<?php echo __('keine MwSt.', 'wpsg'); ?>
73
						<?php } else { ?>
74
						<?php echo __('mit MwSt.', 'wpsg'); ?>
75
						<?php } ?>
76
					</td>
77
					<td class="col_mwst"><?php if (wpsg_tf($l['mwst_a']) != NULL) { ?>
78
						<?php echo wpsg_ff(wpsg_tf($l['mwst_a']), '%'); ?>
79
					<?php } ?></td>
80
					<td class="col_mwst"><?php if (wpsg_tf($l['mwst_b']) != NULL) { ?>
81
						<?php echo wpsg_ff(wpsg_tf($l['mwst_b']), '%'); ?>
82
					<?php } ?></td>
83
					<td class="col_mwst"><?php if (wpsg_tf($l['mwst_c']) != NULL) { ?>
84
						<?php echo wpsg_ff(wpsg_tf($l['mwst_c']), '%'); ?>
85
					<?php } ?></td>
86
					<td class="col_mwst"><?php if (wpsg_tf($l['mwst_d']) != NULL) { ?>
87
						<?php echo wpsg_ff(wpsg_tf($l['mwst_d']), '%'); ?>
88
					<?php } ?></td>
89
					<td class="col_action">
90
 
91
						<a href="#" onclick="return wpsg_country_edit('<?php echo $l['id']; ?>');" class="glyphicon glyphicon-pencil"></a>
92
						<a href="#" class="glyphicon glyphicon-trash"></a>
93
 
94
					</td>
95
				</tr>
5532 daniel 96
				<?php } ?>
5562 daniel 97
 
98
				<tr>
99
 
100
					<td class="col_check"><span class="glyphicon glyphicon-trash"></span></td>
101
					<td colspan="8">
102
 
103
						<input type="submit" name="submit" onclick="return confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>');" class="button btn-xs" value="<?php echo __('Markierte Länder löschen', 'wpsg'); ?>" />
104
 
105
					</td>
106
 
107
				</tr>
108
 
109
			</table>
110
			<?php } else { ?>
111
			<p><?php echo __('Noch keine Länder angelegt.', 'wpsg'); ?></p>
112
			<?php } ?>
113
 
114
		</div>
115
 
116
		<br />
117
 
118
	</form>
119
 
120
	<a href="#" onclick="return wpsg_country_add();"><span class="wpsg-glyphicon glyphicon glyphicon-plus"></span><?php echo __('Neues Land anlegen.', 'wpsg'); ?></a><br /><br />
5532 daniel 121
	<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=vz"><span class="wpsg-glyphicon glyphicon glyphicon-wrench"></span><?php echo __('Zur Versandzonenverwaltung', 'wpsg'); ?></a>
122
 
123
	<?php echo wpsg_drawForm_AdminboxEnd(); ?>
124
 
5562 daniel 125
	<script type="text/javascript">/* <![CDATA[ */
126
 
127
	    function wpsg_country_check_all() { jQuery('td.col_check input').each(function() { jQuery(this).prop('checked', !jQuery(this).prop('checked')); } ); }
128
 
129
		function wpsg_country_add()
130
		{
131
 
132
			jQuery('#Modal_wpsg_country_edit .modal-body').html('<img src="<?php echo $this->getRessourceURL('gfx/ajax-loader.gif'); ?>" alt="" />');
133
			jQuery('#Modal_wpsg_country_edit').modal('show');
134
 
135
			jQuery.ajax( {
136
				url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=add&noheader=1',
137
				success: function(data) { jQuery('#Modal_wpsg_country_edit .modal-body').html(data); }
138
			} );
139
 
140
			return false;
141
 
142
		} // function wpsg_country_add()
143
 
144
		function wpsg_country_save()
145
		{
146
 
147
			jQuery('#wpsg_country_list').html('<img src="<?php echo $this->getRessourceURL('gfx/ajax-loader.gif'); ?>" alt="" />');
148
 
149
			jQuery.ajax( {
150
				url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=save&noheader=1',
151
				data: {
152
					form_data: jQuery('#wpsg_land_edit_form_edit').serialize()
153
				},
154
				success: function(data) {
155
 
156
					jQuery('#wpsg_country_list').html(data);
157
 
158
				}
159
			} );
160
 
161
		} // function wpsg_country_save()
162
 
163
		function wpsg_country_edit(land_id)
164
		{
165
 
166
			jQuery('#Modal_wpsg_country_edit .modal-body').html('<img src="<?php echo $this->getRessourceURL('gfx/ajax-loader.gif'); ?>" alt="" />');
167
			jQuery('#Modal_wpsg_country_edit').modal('show');
168
 
169
			jQuery.ajax( {
170
				url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=edit&noheader=1&land_id' + land_id,
171
				success: function(data) { jQuery('#Modal_wpsg_country_edit .modal-body').html(data); }
172
			} );
173
 
174
			return false;
175
 
176
		} // function wpsg_country_edit(edit_id)
177
 
178
	/* ]]> */</script>
179
 
180
 
181
 
182
 
183
 
4057 daniel 184
	<div class="wpsg_admin_box">
185
 
4079 daniel 186
		<h3>
187
			<?php echo __('Neues Land hinzufügen', 'wpsg'); ?>
188
			<a target="_blank" href="http://wpshopgermany.maennchen1.de/?p=839037" class="wpsg_form_help_notip"></a>
189
		</h3>
4057 daniel 190
 
191
		<?php echo $this->render(WPSG_PATH_VIEW.'/admin/laender_edit.phtml'); ?>
192
 
193
		<h3><?php echo __('Bestehende Länder', 'wpsg'); ?></h3>
1067 daniel 194
 
4057 daniel 195
		<?php if (wpsg_isSizedArray($this->view['data'])) { ?>
196
		<table class="wpsg_admin_laender_list wpsg_admin_table" cellpadding="0" cellspacing="0">
197
			<tr>
4083 daniel 198
				<th class="col_name"><?php echo __('Ländername', 'wpsg'); ?></th>
4057 daniel 199
				<th class="col_vz"><?php echo __('Versandzone', 'wpsg'); ?></th>
200
				<th class="col_mwstsetting"><?php echo __('MwSt.', 'wpsg'); ?></th>
201
				<th class="col_mwst"><?php echo __('MwSt. A', 'wpsg'); ?></th>
202
				<th class="col_mwst"><?php echo __('MwSt. B', 'wpsg'); ?></th>
203
				<th class="col_mwst"><?php echo __('MwSt. C', 'wpsg'); ?></th>
4083 daniel 204
				<th class="col_mwst"><?php echo __('MwSt. D', 'wpsg'); ?></th>
4057 daniel 205
				<th class="col_action"></th>
206
			</tr>
207
			<?php $i = 0; foreach ($this->view['data'] as $l) { $i ++; ?>
208
			<tr id="wpsg_laenderrow_<?php echo $l['id']; ?>" class="<?php echo (($i % 2 == 0)?'odd':'even'); ?>">
209
				<td class="col_name data_name"><?php echo wpsg_hspc($l['name'].((wpsg_isSizedString($l['kuerzel']))?' ('.$l['kuerzel'].')':'')); ?></td>
210
				<td class="col_vz data_vz">
211
					<?php if (wpsg_isSizedInt($l['vz']) && wpsg_isSizedString($this->view['vz'][$l['vz']])) { ?>
212
					<?php echo wpsg_hspc($this->view['vz'][$l['vz']]); ?>
213
					<?php } ?>
214
				</td>
215
				<td class="col_mwstsetting data_mwst">
216
					<?php if ($l['mwst'] == '2') { ?>
217
					<?php echo __('keine MwSt. bei USt.IdNr.', 'wpsg'); ?>
218
					<?php } else if ($l['mwst'] == '1') { ?>
219
					<?php echo __('keine MwSt.', 'wpsg'); ?>
220
					<?php } else { ?>
221
					<?php echo __('mit MwSt.', 'wpsg'); ?>
222
					<?php } ?>
223
				</td>
224
				<td class="col_mwst data_mwst_a">
225
					<?php if (wpsg_tf($l['mwst_a']) != NULL) { ?>
226
						<?php echo wpsg_ff(wpsg_tf($l['mwst_a']), '%'); ?>
227
					<?php } ?>
228
				</td>
229
				<td class="col_mwst data_mwst_b">
230
					<?php if (wpsg_tf($l['mwst_b']) != NULL) { ?>
231
						<?php echo wpsg_ff(wpsg_tf($l['mwst_b']), '%'); ?>
232
					<?php } ?>
233
				</td>
234
				<td class="col_mwst data_mwst_c">
235
					<?php if (wpsg_tf($l['mwst_c']) != NULL) { ?>
236
						<?php echo wpsg_ff(wpsg_tf($l['mwst_c']), '%'); ?>
237
					<?php } ?>
238
				</td>
239
				<td class="col_mwst data_mwst_d">
240
					<?php if (wpsg_tf($l['mwst_d']) != NULL) { ?>
241
						<?php echo wpsg_ff(wpsg_tf($l['mwst_d']), '%'); ?>
242
					<?php } ?>
243
				</td>
244
				<td class="col_action">
1067 daniel 245
 
4057 daniel 246
					<a class="wpsg_icon wpsg_icon_edit" href="#" onclick="return wpsg_laender_edit(<?php echo $l['id']; ?>);"></a>
247
					<a class="wpsg_icon wpsg_icon_remove" href="#" onclick="return wpsg_laender_remove(<?php echo $l['id']; ?>);"></a>
248
 
249
				</td>
250
			</tr>
251
			<?php } ?>
252
		</table>
253
		<?php } else { ?>
254
		<p><?php echo __('Noch keine Länder angelegt.', 'wpsg'); ?>
255
		<?php } ?>
1067 daniel 256
 
4094 daniel 257
		<br /><br />
1067 daniel 258
 
4057 daniel 259
		<input type="button" onclick="return wpsg_laender_import();" value="<?php echo __('Standardländer importieren', 'wpsg'); ?>" class="button" />
4094 daniel 260
		<input type="button" onclick="return wpsg_eu_laender_import();" value="<?php echo __('Standard EU-Länder importieren', 'wpsg'); ?>" class="button" />
1067 daniel 261
 
4057 daniel 262
		<script type="text/javascript">/* <![CDATA[ */
263
 
264
			var land_load = false;
265
 
266
			function wpsg_laender_import()
267
			{
268
 
269
				if (!confirm('<?php echo __('Sind sie sich sicher ?', 'wpsg'); ?>')) return false;
270
 
271
				location.href = "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=import&noheader=1";
272
 
273
				return false;
274
 
275
			}
276
 
4094 daniel 277
			function wpsg_eu_laender_import()
278
			{
279
 
280
				if (!confirm('<?php echo __('Sind sie sich sicher ?', 'wpsg'); ?>')) return false;
281
 
282
				location.href = "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=eu_import&noheader=1";
283
 
284
				return false;
285
 
286
			}
287
 
4057 daniel 288
			function wpsg_laender_save()
289
			{
290
 
291
				jQuery.ajax( {
292
					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=saveEdit&noheader=1',
293
					data: {
294
						form_data: jQuery('#wpsg_land_edit_form_edit').serialize()
295
					},
296
					success: function(data) {
297
 
298
						if (typeof data === 'object')
299
						{
300
 
301
							land_load = true;
302
 
303
							for (var i in data)
304
							{
305
 
306
								jQuery('#wpsg_laenderrow_' + data['id']).find('.data_' + i).html(data[i]);
307
 
308
							}
309
 
310
							jQuery('#wpsg_laenderrow_edit > td > div').slideUp(100, function() {
311
 
312
								jQuery('#wpsg_laenderrow_edit').remove();
313
								land_load = false;
314
 
315
							} );
316
 
317
						}
318
						else alert(data);
319
 
320
					}
321
				} );
322
 
323
				return false;
324
 
325
			}
326
 
327
			function wpsg_laender_edit(land_id)
328
			{
329
 
330
				if (land_load == true) return; land_load = true;
331
 
332
				var edit_timeout = 0;
333
 
334
				if (jQuery('#wpsg_laenderrow_edit > td > div').is(':visible'))
335
				{
336
 
337
					edit_timeout = 150;
338
 
339
					jQuery('#wpsg_laenderrow_edit > td > div').slideUp(100, function() {
340
 
341
						jQuery('#wpsg_laenderrow_edit').remove();
342
 
343
					} );
344
 
345
				}
346
 
347
				window.setTimeout(function() {
348
 
4059 daniel 349
					jQuery('#wpsg_laenderrow_' + land_id).after('<tr id="wpsg_laenderrow_edit"><td colspan="8"><img src="<?php echo $this->getRessourceURL('gfx/ajax-loader.gif'); ?>" alt="" /><div style="display:none;"></div></td></tr>');
4057 daniel 350
 
351
					jQuery.ajax( {
352
						url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=edit&noheader=1',
353
						data: {
354
							land_id: land_id
355
						},
356
						success: function(data) {
357
 
358
							jQuery('#wpsg_laenderrow_edit > td > div').html(data);
359
							jQuery('#wpsg_laenderrow_edit > td > img').hide();
360
							jQuery('#wpsg_laenderrow_edit > td > div').slideDown(300, function() { land_load = false; } );
361
 
362
						}
363
					} );
364
 
365
				}, edit_timeout);
366
 
367
				return false;
368
 
369
			}
370
 
371
			function wpsg_laender_remove(land_id)
372
			{
373
 
374
				if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return false;
375
 
376
				jQuery.ajax( {
377
					url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=laender&do=remove&noheader=1',
378
					data: {
379
						land_id: land_id
380
					},
381
					success: function(data) {
382
 
383
						if (data === "1") jQuery('#wpsg_laenderrow_' + land_id).remove();
384
						else alert(data);
385
 
386
					}
387
				} );
388
 
389
				return false;
390
 
4079 daniel 391
			}
4057 daniel 392
 
393
		/* ]]> */</script>
394
 
395
	</div>
396
 
1067 daniel 397
</div>