Subversion Repositories wpShopGermany4

Rev

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

Rev Author Line No. Line
1144 daniel 1
<?php
2
 
3
	/**
4
	 * Template für die Übersicht der Gutschein
5
	 */
6
 
7
?>
5753 daniel 8
<div class="wpsg_voucher" id="wpsg-bs">
5552 thomas 9
 
5753 daniel 10
    <nav class="navbar navbar-default">
1676 daniel 11
 
5552 thomas 12
		<div class="container-fluid">
13
			<div class="navbar-header">
14
				<a class="navbar-brand" href="#"><?php echo __('wpShopGermany', 'wpsg'); ?></a>
15
			</div>
5753 daniel 16
			<div class="collapse navbar-collapse" id="bs-customer-navbar-collapse-1">
5552 thomas 17
				<ul class="nav navbar-nav">
6680 hartmut 18
					<li role="presentation" class="wpsg-voucher-tab-a active"><a href="#" onclick="return false;"><?php echo __("Gutscheinverwaltung", "wpsg"); ?></a></li>
19
					<li role="presentation" class="wpsg-voucher-tab-a wpsg_showhide_filter <?php echo ((($this->view['hasFilter']) && (wpsg_getStr($this->view['arFilter']['s']) != ''))?'active':''); ?>" id="wpsg-voucher-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>
7486 daniel 20
                    <li role="presentation" class="wpsg-voucher-add" onclick="return false;"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=add"><span class="glyphicon glyphicon-plus"></span><?php echo __("Hinzufügen", "wpsg"); ?></a></li>
5552 thomas 21
				</ul>
22
				<ul class="nav navbar-nav navbar-right">
5753 daniel 23
                    <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-Voucher&action=import&noheader=1"><span class="glyphicon glyphicon-import"></span><?php echo __("Import", "wpsg"); ?></a></li>
24
					<?php if (wpsg_isSizedArray($this->view['arData'])) { ?>
25
					<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-Voucher&action=export&noheader=1"><span class="glyphicon glyphicon-export"></span><?php echo __("Export", "wpsg"); ?></a></li>
26
					<?php } ?>
27
				</ul>
5552 thomas 28
			</div>
29
		</div>
5753 daniel 30
 
6680 hartmut 31
        <div class="wpsg-filter wpsg-customer-tab wpsg-voucher-tab-0 container-fluid form-horizontal" style="display:<?php echo ((($this->view['hasFilter'] === true) && ($this->view['arFilter']['s'] != ''))?'block':'none'); ?>;">
5753 daniel 32
            <div class="row">
5552 thomas 33
				<div class="col-lg-4">
34
					<form method="post" id="filter_form">
5753 daniel 35
 
36
						<input id="wpsg_seite" type="hidden" name="filter[page]" value="<?php echo @$this->view['page']; ?>" class="current-page" />
37
                        <input id="wpsg_order" type="hidden" name="filter[order]" value="<?php echo @$this->view['arFilter']['order']; ?>" />
38
						<input id="wpsg_ascdesc" type="hidden" name="filter[ascdesc]" value="<?php echo @$this->view['arFilter']['ascdesc']; ?>" />
39
 
40
						<?php echo wpsg_drawForm_Input('filter[s]', __('Suchfeld', 'wpsg'), wpsg_getStr($this->view['arFilter']['s'])); ?>
41
 
42
						<?php echo wpsg_drawForm_SubmitButton(__('Gutscheine suchen')); ?><br />
6680 hartmut 43
						<input type="hidden" id="filterstatus" name="filter[status]" value="<?php echo @$this->view['arFilter']['status']; ?>" />
5753 daniel 44
 
45
					</form>
5552 thomas 46
				</div>
5753 daniel 47
			</div>
48
        </div>
49
 
50
    </nav>
51
 
6680 hartmut 52
    <div class="wpsg_msg_wrap"><hr class="wp-header-end wpsg-wp-header-end"/></div>
53
 
54
	<div class="pagination_wrap wpsg_status_link_wrap">
55
 
56
		<ul class="pagination">
57
			<?php foreach ($this->view['arStatus'] as $status_key => $status_info) { ?>
58
			<li class="<?php echo ((wpsg_getStr($this->view['arFilter']['status']) == $status_key)?'active':''); ?>"><a href="#" onclick="return wpsg_setFilterStatus('<?php echo $status_key; ?>');"><?php echo wpsg_translate(__('#1# <span>(#2#)<span>', 'wpsg'), $status_info['label'], $status_info['count']); ?></a></li>
59
			<?php } ?>
60
		</ul>
61
 
62
	</div>
6444 daniel 63
 
64
    <?php $this->render(WPSG_PATH_VIEW.'/admin/pager.phtml'); ?>
5753 daniel 65
 
66
	<div class="content">
1676 daniel 67
 
5753 daniel 68
        <?php if (is_array($this->view['arData']) && sizeof($this->view['arData']) > 0) { ?>
1924 daniel 69
 
5753 daniel 70
            <form method="POST" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Voucher&action=index&noheader=1">
71
                <table class="table wpsg-table-order table-bordered table-hover table-striped wpsg-table-customer">
72
                    <thead>
73
                        <tr>
74
                            <th class="col_checkbox"><input type="checkbox" onclick="jQuery('.col_set_checkbox').each(function() { jQuery(this).prop('checked', !jQuery(this).prop('checked')); } );" /></th>
75
                            <th class="wpsg_order col_code" data-order="code"><?php echo __("Code", 'wpsg'); ?></th>
76
                            <th class="wpsg_order col_start" data-order="start_date"><?php echo __("Start", 'wpsg'); ?></th>
77
                            <th class="wpsg_order col_end" data-order="end_date"><?php echo __("Ende", 'wpsg'); ?></th>
78
                            <th class="wpsg_order col_value" data-order="value"><?php echo __("Wert", 'wpsg'); ?></th>
79
                            <th class="wpsg_order col_status" data-order="status"><?php echo __("Status", 'wpsg'); ?></th>
80
                        </tr>
81
                    </thead>
82
                    <tbody>
7490 daniel 83
                        <?php /** @var wpsg_voucher $oVoucher */
84
							foreach ($this->view['arData'] as $oVoucher) { ?>
5753 daniel 85
                        <tr>
86
                            <td class="col_checkbox">
87
 
88
                                <input class="col_set_checkbox" value="<?php echo $oVoucher->id; ?>" name="wpsg_multido[]" type="checkbox" />
89
 
90
                            </td>
7025 daniel 91
                            <?php /* <td class="col_code"><?php echo $oVoucher->code; ?></td> */ ?>
92
                            <td class="col_code">
93
 
7486 daniel 94
								<span><?php echo $oVoucher->code; ?></span><br />
7025 daniel 95
 
7031 daniel 96
                                <?php if ($this->hasMod('wpsg_mod_voucherproduct') && $oVoucher->isAutoCreated()) { ?>
7025 daniel 97
                                &nbsp;[&nbsp;<a href="<?php echo WPSG_URL_WP . 'wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_voucherproduct&gs_id='.$oVoucher->id.'&order_id='.$oVoucher->autocreate_order.'&noheader=1&cmd=getVoucher'; ?>"><?php echo __('PDF', 'wpsg'); ?></a>&nbsp;]
98
                                <?php } ?>
7486 daniel 99
 
100
								<div class="actions">
101
									<span class="edit"><a title="<?php echo __("Diesen Gutschein bearbeiten", "wpsg"); ?>" href="#" class="wpsg_voucher_edit" onclick="return false;" data-voucher_id="<?php echo $oVoucher->getId(); ?>"><?php echo __("Bearbeiten", "wpsg"); ?></a></span>
102
									|
103
									<span class="delete"><a onclick="return confirm('<?php echo __('Sind Sie sich sicher, dass Sie diesen Gutschein löschen möchten?', 'wpsg'); ?>');" title="<?php echo __('Diese Gutschein löschen', 'wpsg'); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_gutschein&subaction=delete&noheader=1&voucher_id=<?php echo $oVoucher->getId(); ?>"><?php echo __('Löschen', 'wpsg'); ?></a></span>
8414 daniel 104
									|
105
									<span><a title="<?php echo __('Bestellungen anzeigen', 'wpsg'); ?>" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&filter[status]=-1&filter[voucher_id]=<?php echo $oVoucher->getId(); ?>"><?php echo __('Bestellungen suchen', 'wpsg'); ?></a></span>
7486 daniel 106
								</div>
7025 daniel 107
 
108
                            </td>
7486 daniel 109
                            <td class="col_start"><?php echo wpsg_formatTimestamp($oVoucher->start_date, true); ?></td>
110
                            <td class="col_end"><?php echo wpsg_formatTimestamp($oVoucher->end_date, true); ?></td>
111
                            <td class="col_value"><span><?php
5753 daniel 112
 
7490 daniel 113
                                if ($oVoucher->calc_typ == 'w') echo wpsg_ff($oVoucher->getFreeAmount(), $this->get_option('wpsg_currency'));
5753 daniel 114
                                else if ($oVoucher->calc_typ == 'p') echo wpsg_ff($oVoucher->value, '%');
7490 daniel 115
 
7511 daniel 116
                                if ($oVoucher->calc_typ == 'w' && $oVoucher->getUsedAmount() > 0 && !$oVoucher->isMultiUsable()) echo ' <span title="'.__('Original Betrag', 'wpsg').'">('.wpsg_ff($oVoucher->value, $this->get_option('wpsg_currency')).')</span>';
5753 daniel 117
 
7486 daniel 118
                            ?></span><?php
119
 
120
								if ($oVoucher->isCoupon()) {
121
 
122
									echo '<br />'.__('Wertgutschein', 'wpsg');
123
 
124
								}
125
 
126
							?></td>
5753 daniel 127
                            <td class="col_status">
128
 
129
                                <?php $comment = $oVoucher->comment; if (wpsg_isSizedString($comment)) { ?>
6005 hartmut 130
                                <a title="<?php echo __("Kommentar (Admin): ", "wpsg").htmlspecialchars($comment); ?>" onclick="return false;" class="glyphicon glyphicon-question-sign admincomment" href="#"></a>
5753 daniel 131
                                <?php } ?>
132
 
133
                                <?php echo $oVoucher->getStatusLabel(); ?>
134
 
135
                                <?php $used = $oVoucher->getUsed(); if (wpsg_isSizedInt($used)) { ?>
136
                                <?php echo wpsg_translate(__('#1# mal benutzt.', 'wpsg'), $used); ?>
137
                                <?php } ?>
138
 
139
                                <?php if ($oVoucher->multi === '1') { ?>
140
                                <span title="<?php echo __('Mehrfach benutzbar', 'wpsg'); ?>">&nbsp;[M]</span>
141
                                <?php } ?>
142
 
143
                            </td>
144
                        </tr>
7486 daniel 145
                        <?php } ?>
5753 daniel 146
                    </tbody>
147
                </table>
148
 
149
                 <div class="alignleft actions">
150
 
151
                    <input onclick="if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return false;" type="submit" value="<?php echo __('Markierte Gutscheine löschen', 'wpsg'); ?>" class="button-secondary action" id="doaction" name="submit-multidelete" />
152
 
153
                </div>
6680 hartmut 154
			</form>
155
 
7486 daniel 156
        	<?php $this->render(WPSG_PATH_VIEW.'/admin/pager.phtml'); ?>
5753 daniel 157
 
158
        <?php } else { ?>
7486 daniel 159
 
160
			<div class="table wpsg_clear">
161
 
162
				<?php echo wpsg_drawForm_AdminboxStart(); ?>
163
    			<?php echo __('Keine Gutscheine in der Datenbank.', 'wpsg'); ?>
164
            	<?php echo wpsg_drawForm_AdminboxEnd(); ?>
5753 daniel 165
 
7486 daniel 166
			</div>
5753 daniel 167
 
168
        <?php } ?>
169
 
170
    </div>
171
 
1599 daniel 172
</div>
173
 
7486 daniel 174
<!-- Modaldialog für Gutscheine -->
175
<div class="modal fade" id="wpsg_voucher_dialog" tabindex="-1" role="dialog">
176
	<div class="modal-dialog" role="document">
177
		<div class="modal-content">
178
			<div class="modal-header">
179
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
180
				<h4 class="modal-title" id="myModalLabel"><?php echo __('Gutschein hinzufügen/bearbeiten', 'wpsg'); ?></h4>
181
			</div>
182
			<div class="modal-body"></div>
183
			<div class="modal-footer">
184
				<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Abbrechen', 'wpsg'); ?></button>
185
				<button type="button" class="btn btn-primary wpsg-voucher-save" onclick="return false;"><?php echo __('OK', 'wpsg'); ?></button>
186
			</div>
187
		</div>
188
	</div>
189
</div>
190
 
1676 daniel 191
<script type="text/javascript">/* <![CDATA[ */
1599 daniel 192
 
5753 daniel 193
    <?php if (wpsg_isSizedString($this->view['arFilter']['order']) && wpsg_isSizedString($this->view['arFilter']['ascdesc'])) { ?>
194
    jQuery('th[data-order="<?php echo $this->view['arFilter']['order']; ?>"]').addClass('wpsg_order_<?php echo strtolower($this->view['arFilter']['ascdesc']); ?>');
195
    <?php } ?>
7486 daniel 196
 
197
	jQuery('.wpsg-voucher-add').on('click', function() {
5753 daniel 198
 
7486 daniel 199
		jQuery('#wpsg_voucher_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
200
		jQuery('#wpsg_voucher_dialog').modal( { } ).modal('show');
201
 
202
		jQuery.ajax({
203
			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_gutschein&subaction=addedit&noheader=1',
204
			success: function(data) {
205
 
206
				jQuery('#wpsg_voucher_dialog .modal-body').html(data);
207
 
208
			}
209
		});
210
 
211
		return false;
212
 
213
	}).attr("onclick", null);
214
 
215
	jQuery('.wpsg_voucher_edit').on('click', function() {
216
 
217
		jQuery('#wpsg_voucher_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
218
		jQuery('#wpsg_voucher_dialog').modal( { } ).modal('show');
219
 
220
		jQuery.ajax({
221
			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_gutschein&subaction=addedit&noheader=1&voucher_id=' + jQuery(this).data("voucher_id"),
222
			success: function(data) {
223
 
224
				jQuery('#wpsg_voucher_dialog .modal-body').html(data);
225
 
226
			}
227
		});
228
 
229
		return false;
230
 
231
	}).attr("onclick", null);
232
 
233
	jQuery('.wpsg-voucher-save').on('click', function() {
234
 
235
		//jQuery('#wpsg_voucher_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
236
		//jQuery('#wpsg_voucher_dialog').modal('hide');
237
 
238
		wpsg_loading('#wpsg_voucher_dialog .modal-body');
239
 
240
		jQuery.ajax({
241
			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_gutschein&subaction=save&noheader=1',
242
			data: {
243
				form_data: jQuery('#wpsg_voucher_form').serialize()
244
			},
245
			success: function(data) {
246
 
247
				wpsg_loading_done('#wpsg_voucher_dialog .modal-body');
248
 
249
				if (data !== "1") alert(data);
250
				else {
251
 
252
					location.reload();
253
 
254
				}
255
 
256
			}
257
		});
258
 
259
		return false;
260
 
261
	}).attr("onclick", null);
262
 
6680 hartmut 263
	function wpsg_setFilterStatus(state)
264
	{
265
 
266
		jQuery('#filterstatus').val(state);
267
 
268
		jQuery('#seite').val(1);
8040 karl 269
		jQuery('#filter_form').trigger('submit');
6680 hartmut 270
 
271
		return false;
272
 
273
	}
274
 
5753 daniel 275
	function goPage(page)
1599 daniel 276
	{
277
 
6152 thomas 278
		//if (page <= 0 || page == <?php echo $this->view['arFilter']['page']; ?> || page > <?php echo $this->view['pages']; ?>) return;
1599 daniel 279
 
5753 daniel 280
		jQuery('#wpsg_seite').val(page);
8040 karl 281
		jQuery('#filter_form').trigger('submit');
1599 daniel 282
 
5753 daniel 283
		return false;
284
 
285
	} // function goPage(page)
286
 
6680 hartmut 287
    jQuery(document).ready(function() {
5753 daniel 288
 
6680 hartmut 289
        jQuery('.wpsg-order-tab-mods').bind('click', function() {
290
 
291
            if (jQuery(this).hasClass('active'))
292
            {
293
 
294
                jQuery(this).removeClass('active');
295
                jQuery('.' + jQuery(this).attr("id")).slideUp(250);
296
 
297
            }
298
            else
299
            {
300
 
301
                jQuery(this).addClass('active');
302
                jQuery('.' + jQuery(this).attr("id")).slideDown(250);
303
 
304
            }
305
 
306
            return false;
307
 
308
        } );
309
 
310
    } );
311
 
1676 daniel 312
/* ]]> */</script>