7094 |
florian |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Template für die alternative Ansicht einer Bestellung im Backend
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
?>
|
|
|
8 |
|
|
|
9 |
<style>.orderdetail-alternative-left:active, .orderdetail-alternative-right:active { cursor: move; }</style>
|
|
|
10 |
|
|
|
11 |
<div class="wpsg_order_view wpsg_order_view_alternativedesign" id="wpsg-bs">
|
|
|
12 |
|
|
|
13 |
<nav class="navbar navbar-default">
|
|
|
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-example-navbar-collapse-1">
|
|
|
19 |
<ul class="nav navbar-nav">
|
|
|
20 |
<li role="presentation" class="<?php echo ((!isset($_REQUEST['action']))?'active':''); ?>"><a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order"><?php echo __("Bestellübersicht", "wpsg"); ?></a></li>
|
|
|
21 |
<li role="presentation" class="wpsg_showhide_filter active"><a onclick="return false;"><?php echo __("Bestellansicht (Detail)", "wpsg"); ?></a></li>
|
|
|
22 |
<li role="presentation" class="wpsg_top_extend" id="wpsg_be_orderdata">
|
|
|
23 |
|
|
|
24 |
<?php echo $this->view['oOrder']->getInvoiceFirstName().' '.$this->view['oOrder']->getInvoiceName().' / '.wpsg_ff($this->view['oOrder']->getAmount($this->getBackendTaxview()), $this->get_option('wpsg_currency')); ?>
|
|
|
25 |
|
|
|
26 |
<?php if (trim($this->view['oOrder']->admincomment) != "") { ?>
|
|
|
27 |
<a title="<?php echo __("Kommentar (Admin): ", "wpsg").htmlspecialchars($this->view['oOrder']->admincomment); ?>" onclick="return false;" class="glyphicon glyphicon-question-sign commenticon admincomment" href="#"></a>
|
|
|
28 |
<?php } ?>
|
|
|
29 |
|
|
|
30 |
<?php if (trim($this->view['oOrder']->comment) != "") { ?>
|
|
|
31 |
<a title="<?php echo __("Kommentar (Kunde): ", "wpsg").htmlspecialchars($this->view['oOrder']->comment); ?>" onclick="return false;" class="glyphicon glyphicon-question-sign commenticon customercomment" href="#"></a>
|
|
|
32 |
<?php } ?>
|
|
|
33 |
|
|
|
34 |
</li>
|
|
|
35 |
</ul>
|
|
|
36 |
<ul class="nav navbar-nav navbar-right">
|
|
|
37 |
<li>
|
|
|
38 |
<a style="padding-top:11px;padding-bottom:11px;">
|
|
|
39 |
<button role="button" class="button btn-reset-itemorder">Anordnung der Kacheln zurücksetzen</button>
|
|
|
40 |
</a>
|
|
|
41 |
</li>
|
|
|
42 |
</ul>
|
|
|
43 |
</div>
|
|
|
44 |
</div>
|
|
|
45 |
</nav>
|
|
|
46 |
|
|
|
47 |
<div class="wpsg_msg_wrap"><hr class="wp-header-end wpsg-wp-header-end"/></div>
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
<div class="orderdetail-alternative">
|
|
|
51 |
<div class="col-md-8 orderdetail-alternative-left connectedSortable">
|
|
|
52 |
<div id="item-general" class="orderdetail-item orderdetail-item-left orderdetail-item-_general">
|
|
|
53 |
<div id="item-general" class="orderdetail-item-inner">
|
|
|
54 |
|
|
|
55 |
<?php echo $this->view['arSubAction']['general']['content']; ?>
|
|
|
56 |
|
|
|
57 |
</div>
|
|
|
58 |
</div>
|
|
|
59 |
<div id="item-orderdata" class="orderdetail-item orderdetail-item-left orderdetail-item-_orderdata">
|
|
|
60 |
<div id="item-orderdata" class="orderdetail-item-inner">
|
|
|
61 |
|
|
|
62 |
<?php echo $this->view['arSubAction']['orderdata']['content']; ?>
|
|
|
63 |
|
|
|
64 |
</div>
|
|
|
65 |
</div>
|
|
|
66 |
<div id="item-ordervariables" class="orderdetail-item orderdetail-item-left orderdetail-item-_ordervariables">
|
|
|
67 |
<div id="item-ordervariables" class="orderdetail-item-inner">
|
|
|
68 |
|
|
|
69 |
<?php echo $this->view['arSubAction']['950']['content']; ?>
|
|
|
70 |
|
|
|
71 |
</div>
|
|
|
72 |
</div>
|
|
|
73 |
<div id="item-customercontact" class="orderdetail-item orderdetail-item-left orderdetail-item-_customercontact">
|
|
|
74 |
<div id="item-customercontact" class="orderdetail-item-inner">
|
|
|
75 |
|
|
|
76 |
<?php echo $this->view['arSubAction']['1000']['content']; ?>
|
|
|
77 |
|
|
|
78 |
</div>
|
|
|
79 |
</div>
|
|
|
80 |
<div id="item-bills" class="orderdetail-item orderdetail-item-left orderdetail-_item-bills">
|
|
|
81 |
<div id="item-bills" class="orderdetail-item-inner">
|
|
|
82 |
|
|
|
83 |
<?php echo $this->view['arSubAction']['1400']['content']; ?>
|
|
|
84 |
|
|
|
85 |
</div>
|
|
|
86 |
</div>
|
|
|
87 |
<div id="item-deliverynotes" class="orderdetail-item orderdetail-item-left orderdetail-item-_deliverynotes">
|
|
|
88 |
<div id="item-deliverynotes" class="orderdetail-item-inner">
|
|
|
89 |
|
|
|
90 |
<?php echo $this->view['arSubAction']['2000']['content']; ?>
|
|
|
91 |
|
|
|
92 |
</div>
|
|
|
93 |
</div>
|
|
|
94 |
</div> <!-- .orderdetail-alternative-left -->
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
<div class="col-md-4 orderdetail-alternative-right connectedSortable">
|
|
|
99 |
<div id="item-customerdata" class="orderdetail-item orderdetail-item-right orderdetail-item-_customerdata">
|
|
|
100 |
<div id="item-customerdata" class="orderdetail-item-inner">
|
|
|
101 |
|
|
|
102 |
<?php echo $this->view['arSubAction']['customerdata']['content']; ?>
|
|
|
103 |
|
|
|
104 |
</div>
|
|
|
105 |
</div>
|
|
|
106 |
<div id="item-shippay" class="orderdetail-item orderdetail-item-right orderdetail-item-_shippay">
|
|
|
107 |
<div id="item-shippay" class="orderdetail-item-inner">
|
|
|
108 |
|
|
|
109 |
<?php echo $this->view['arSubAction']['shippay']['content']; ?>
|
|
|
110 |
|
|
|
111 |
</div>
|
|
|
112 |
</div>
|
|
|
113 |
<div id="item-confirmation" class="orderdetail-item orderdetail-item-right orderdetail-item-_confirmation">
|
|
|
114 |
<div id="item-confirmation" class="orderdetail-item-inner">
|
|
|
115 |
|
|
|
116 |
<?php echo $this->view['arSubAction']['70']['content']; ?>
|
|
|
117 |
|
|
|
118 |
</div>
|
|
|
119 |
</div>
|
|
|
120 |
<div id="item-trustedshops" class="orderdetail-item orderdetail-item-right orderdetail-item-_trustedshops">
|
|
|
121 |
<div id="item-trustedshops" class="orderdetail-item-inner">
|
|
|
122 |
|
|
|
123 |
<?php echo $this->view['arSubAction']['5000']['content']; ?>
|
|
|
124 |
|
|
|
125 |
</div>
|
|
|
126 |
</div>
|
|
|
127 |
<div id="item-orderlog" class="orderdetail-item orderdetail-item-right orderdetail-item-_orderlog">
|
|
|
128 |
<div id="item-orderlog" class="orderdetail-item-inner">
|
|
|
129 |
|
|
|
130 |
<?php echo $this->view['arSubAction']['orderlog']['content']; ?>
|
|
|
131 |
|
|
|
132 |
</div>
|
|
|
133 |
</div>
|
|
|
134 |
<div id="item-dev" class="orderdetail-item orderdetail-item-right orderdetail-item-_dev">
|
|
|
135 |
<div id="item-dev" class="orderdetail-item-inner">
|
|
|
136 |
|
|
|
137 |
<?php echo $this->view['arSubAction']['dev']['content']; ?>
|
|
|
138 |
|
|
|
139 |
</div>
|
|
|
140 |
</div>
|
|
|
141 |
</div> <!-- .orderdetail-alternative-right -->
|
|
|
142 |
</div>
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
</div>
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
<script type="text/javascript">/* <![CDATA[ */
|
|
|
150 |
|
|
|
151 |
/**
|
|
|
152 |
* Ersetzt jedes Vorkommen eines Charaktersets in einem String
|
|
|
153 |
*/
|
|
|
154 |
String.prototype.replaceAll = function(search, replacement)
|
|
|
155 |
{
|
|
|
156 |
|
|
|
157 |
let target = this;
|
|
|
158 |
return target.split(search).join(replacement);
|
|
|
159 |
|
|
|
160 |
}; // String.prototype.replaceAll()
|
|
|
161 |
|
|
|
162 |
/**
|
|
|
163 |
* Sendet eine eMail
|
|
|
164 |
*/
|
|
|
165 |
function wpsg_sendMail(oid)
|
|
|
166 |
{
|
|
|
167 |
jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
|
|
|
168 |
|
|
|
169 |
jQuery.ajax( {
|
|
|
170 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&subaction=sendMail&do=send&edit_id=' + oid + '&noheader=1',
|
|
|
171 |
success: function(data) {
|
|
|
172 |
jQuery('#wpsg_produkte_table').replaceWith(data);
|
|
|
173 |
location.href = location.href;
|
|
|
174 |
}
|
|
|
175 |
} );
|
|
|
176 |
|
|
|
177 |
return false;
|
|
|
178 |
|
|
|
179 |
} // function wpsg_sendMail()
|
|
|
180 |
|
|
|
181 |
/**
|
|
|
182 |
* Fügt einen neuen Rabatt hinzu (nur wenn keiner da ist)
|
|
|
183 |
*/
|
|
|
184 |
function wpsg_addDiscount(oid)
|
|
|
185 |
{
|
|
|
186 |
jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
|
|
|
187 |
|
|
|
188 |
jQuery.ajax( {
|
|
|
189 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=discountData&do=add&edit_id=' + oid + '&noheader=1',
|
|
|
190 |
success: function(data) {
|
|
|
191 |
jQuery('#wpsg_produkte_table').replaceWith(data);
|
|
|
192 |
jQuery('#LinkRabattNeu').hide();
|
|
|
193 |
}
|
|
|
194 |
} );
|
|
|
195 |
|
|
|
196 |
return false;
|
|
|
197 |
|
|
|
198 |
} // function wpsg_addDiscount()
|
|
|
199 |
|
|
|
200 |
|
|
|
201 |
/**
|
|
|
202 |
* Fügt einen neuen Gutschein hinzu (nur wenn keiner da ist)
|
|
|
203 |
*/
|
|
|
204 |
function wpsg_addVoucher(oid)
|
|
|
205 |
{
|
|
|
206 |
jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
|
|
|
207 |
|
|
|
208 |
jQuery.ajax( {
|
|
|
209 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=voucherData&do=add&edit_id=' + oid + '&noheader=1',
|
|
|
210 |
success: function(data) {
|
|
|
211 |
jQuery('#wpsg_produkte_table').replaceWith(data);
|
|
|
212 |
jQuery('#LinkGutscheinNeu').hide();
|
|
|
213 |
//jQuery('#wpsg_kv_list').html(data);
|
|
|
214 |
//location.href = location.href;
|
|
|
215 |
//jQuery('#wpsg_kv_list').html('');
|
|
|
216 |
}
|
|
|
217 |
} );
|
|
|
218 |
|
|
|
219 |
return false;
|
|
|
220 |
|
|
|
221 |
} // function wpsg_addVoucher()
|
|
|
222 |
|
|
|
223 |
/*
|
|
|
224 |
* Wendet die gespeicherte Reihenfolge auf die verschiebbaren Elemente an
|
|
|
225 |
*/
|
|
|
226 |
function applySavedItemOrder()
|
|
|
227 |
{
|
|
|
228 |
|
|
|
229 |
let leftElements = jQuery(".orderdetail-item-left");
|
|
|
230 |
let rightElements = jQuery(".orderdetail-item-right");
|
|
|
231 |
|
|
|
232 |
let leftOrder = '<?php echo json_encode($this->get_option('wpsg_backendui_orderdetail_itemorder_left')); ?>' || false;
|
|
|
233 |
let rightOrder = '<?php echo json_encode($this->get_option('wpsg_backendui_orderdetail_itemorder_right')); ?>' || false;
|
|
|
234 |
|
|
|
235 |
if(leftOrder === "false" || leftOrder.includes('"",')) leftOrder = false;
|
|
|
236 |
if(rightOrder === "false" || rightOrder.includes('"",')) rightOrder = false;
|
|
|
237 |
|
|
|
238 |
if(leftOrder)
|
|
|
239 |
{
|
|
|
240 |
|
|
|
241 |
let elementIDs = [];
|
|
|
242 |
leftElements.each(function(key, item) {
|
|
|
243 |
elementIDs.push(item.id);
|
|
|
244 |
});
|
|
|
245 |
|
|
|
246 |
let cleanLeftOrder = leftOrder.replace("[", "").replace("]", "").replaceAll('"', "").split(",");
|
|
|
247 |
writeOrderItems(cleanLeftOrder, "left");
|
|
|
248 |
|
|
|
249 |
}
|
|
|
250 |
|
|
|
251 |
if(rightOrder)
|
|
|
252 |
{
|
|
|
253 |
|
|
|
254 |
let elementIDs = [];
|
|
|
255 |
rightElements.each(function(key, item) {
|
|
|
256 |
elementIDs.push(item.id);
|
|
|
257 |
});
|
|
|
258 |
|
|
|
259 |
let cleanRightOrder = rightOrder.replace("[", "").replace("]", "").replaceAll('"', "").split(",");
|
|
|
260 |
writeOrderItems(cleanRightOrder, "right");
|
|
|
261 |
|
|
|
262 |
}
|
|
|
263 |
|
|
|
264 |
} // function applySavedItemOrder()
|
|
|
265 |
|
|
|
266 |
/*
|
|
|
267 |
* Schreibt Elemente der angegebenen IDs ins DOM
|
|
|
268 |
*/
|
|
|
269 |
function writeOrderItems(orderIDs, orderPos)
|
|
|
270 |
{
|
|
|
271 |
|
|
|
272 |
let writeElement = "";
|
|
|
273 |
|
|
|
274 |
let elements = [];
|
|
|
275 |
orderIDs.forEach(function(id) {
|
|
|
276 |
elements.push(jQuery(`#${id}`)[0]);
|
|
|
277 |
});
|
|
|
278 |
|
|
|
279 |
switch(orderPos) {
|
|
|
280 |
|
|
|
281 |
case 'left':
|
|
|
282 |
writeElement = jQuery(".orderdetail-alternative-left");
|
|
|
283 |
break;
|
|
|
284 |
|
|
|
285 |
case 'right':
|
|
|
286 |
writeElement = jQuery(".orderdetail-alternative-right");
|
|
|
287 |
break;
|
|
|
288 |
|
|
|
289 |
}
|
|
|
290 |
|
|
|
291 |
if(writeElement.length > 0 || writeElement !== "")
|
|
|
292 |
{
|
|
|
293 |
|
|
|
294 |
writeElement[0].innerHTML = "";
|
|
|
295 |
elements.forEach(function (element) {
|
|
|
296 |
try{
|
|
|
297 |
writeElement[0].innerHTML += element.innerHTML;
|
|
|
298 |
}
|
|
|
299 |
catch(err){
|
|
|
300 |
return false;
|
|
|
301 |
}
|
|
|
302 |
});
|
|
|
303 |
|
|
|
304 |
}
|
|
|
305 |
|
|
|
306 |
} // function writeOrderItems()
|
|
|
307 |
|
|
|
308 |
/*
|
|
|
309 |
* Weist den zuvor eingeklappten Elementen eine Klase zu und klappt sie schließlich auch ein
|
|
|
310 |
*/
|
|
|
311 |
function applyFoldedStatus()
|
|
|
312 |
{
|
|
|
313 |
|
|
|
314 |
let foldedPanels = '<?php echo json_encode($this->get_option('wpsg_backendui_orderdetail_foldedpanels')); ?>' || false;
|
|
|
315 |
if(foldedPanels === "false" || foldedPanels.includes('"",')) foldedPanels = false;
|
|
|
316 |
|
|
|
317 |
if(foldedPanels)
|
|
|
318 |
{
|
|
|
319 |
|
|
|
320 |
let foldedPanelsArr = foldedPanels.replace("[", "").replace("]", "").replaceAll('"', "").split(",");
|
|
|
321 |
|
|
|
322 |
for(var i = 0; i < foldedPanelsArr.length; i++) {
|
|
|
323 |
let mainParent = jQuery(`#${foldedPanelsArr[i].split("_")[0]}`);
|
|
|
324 |
mainParent.find(".panel-body").slideUp('fast');
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
}
|
|
|
328 |
|
|
|
329 |
} // fucntion applyFoldedStatus()
|
|
|
330 |
|
|
|
331 |
/*
|
|
|
332 |
* Speichert die angegebene Reihenfolge der verschiebbaren Elemente
|
|
|
333 |
*/
|
|
|
334 |
function saveItemOrder(order, orderPosition)
|
|
|
335 |
{
|
|
|
336 |
|
|
|
337 |
jQuery.ajax( {
|
|
|
338 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=itemOrderData&do=save&noheader=1',
|
|
|
339 |
data: {
|
|
|
340 |
'order': order,
|
|
|
341 |
'orderPosition': orderPosition
|
|
|
342 |
}
|
|
|
343 |
} );
|
|
|
344 |
|
|
|
345 |
} // function saveItemOrder(order, orderPosition)
|
|
|
346 |
|
|
|
347 |
/*
|
|
|
348 |
* Speichert die angegebene Reihenfolge der verschiebbaren Elemente
|
|
|
349 |
*/
|
|
|
350 |
function saveFoldedItems(items)
|
|
|
351 |
{
|
|
|
352 |
|
|
|
353 |
jQuery.ajax( {
|
|
|
354 |
url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=foldedItemsData&do=save&noheader=1',
|
|
|
355 |
data: {
|
|
|
356 |
'folded_items': items
|
|
|
357 |
}
|
|
|
358 |
} );
|
|
|
359 |
|
|
|
360 |
} // function saveItemOrder(order, orderPosition)
|
|
|
361 |
|
|
|
362 |
// Weist dem gegebenen JS Element eine einzigartige Klasse zu
|
|
|
363 |
// und gibt das jeweilige Element als jQuery Object zurück
|
|
|
364 |
let counter = 0;
|
|
|
365 |
function jsElTojQueryObj(jsEl, specificClass) {
|
|
|
366 |
|
|
|
367 |
let id = jsEl.id ? `#${jsEl.id}` : "";
|
|
|
368 |
let classes = "";
|
|
|
369 |
|
|
|
370 |
if(typeof jsEl !== "object" || jsEl.length <= 1 && jsEl[0] === "#document")
|
|
|
371 |
return;
|
|
|
372 |
|
|
|
373 |
jsEl.classList.add(`${specificClass}-${counter++}`);
|
|
|
374 |
|
|
|
375 |
if(jsEl.classList && jsEl.classList.length > 0) {
|
|
|
376 |
|
|
|
377 |
jsEl.classList.forEach(function(className) {
|
|
|
378 |
if(!classes.includes(`.${className}`)) classes += `.${className}`;
|
|
|
379 |
});
|
|
|
380 |
|
|
|
381 |
}
|
|
|
382 |
|
|
|
383 |
return $(`${jsEl.tagName.toLowerCase()}${id}${classes}`);
|
|
|
384 |
|
|
|
385 |
} // function jsElTojQueryObj(jsEl, specificClass)
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
jQuery(document).ready(function() {
|
|
|
389 |
|
|
|
390 |
applySavedItemOrder();
|
|
|
391 |
applyFoldedStatus();
|
|
|
392 |
wpsg_view_orderdata_hide();
|
|
|
393 |
|
|
|
394 |
jQuery('#wpsg_order_view_tabs a.list-group-item').bind('click', function() {
|
|
|
395 |
|
|
|
396 |
jQuery('#wpsg_order_view_tabs a').removeClass('active');
|
|
|
397 |
jQuery('.wpsg_order_view_tab_content').hide();
|
|
|
398 |
|
|
|
399 |
tab = jQuery(this).attr('wpsg-data-target');
|
|
|
400 |
if (tab == 'orderdata') {
|
|
|
401 |
wpsg_view_orderdata_show();
|
|
|
402 |
} else {
|
|
|
403 |
wpsg_view_orderdata_hide();
|
|
|
404 |
}
|
|
|
405 |
jQuery(this).addClass('active');
|
|
|
406 |
jQuery('#tab' + jQuery(this).attr('wpsg-data-target')).show();
|
|
|
407 |
|
|
|
408 |
jQuery.cookie('wpsg_order_view_tab', jQuery(this).attr('wpsg-data-target'));
|
|
|
409 |
jQuery(this).blur();
|
|
|
410 |
|
|
|
411 |
} );
|
|
|
412 |
|
|
|
413 |
|
|
|
414 |
co = jQuery.cookie('wpsg_order_view_tab');
|
|
|
415 |
if (co === undefined) {
|
|
|
416 |
jQuery("[wpsg-data-target='general']").trigger("click");
|
|
|
417 |
} else {
|
|
|
418 |
jQuery("[wpsg-data-target='" + co + "']").trigger("click");
|
|
|
419 |
}
|
|
|
420 |
|
|
|
421 |
// Anordnung der Kacheln zurücksetzen
|
|
|
422 |
jQuery(".btn-reset-itemorder").click(function() {
|
|
|
423 |
const leftorder = ["item-general", "item-orderdata", "item-ordervariables", "item-customercontact", "item-bills", "item-deliverynotes"];
|
|
|
424 |
const rightorder = ["item-customerdata", "item-shippay", "item-confirmation", "item-trustedshops", "item-orderlog", "item-dev"];
|
|
|
425 |
|
|
|
426 |
saveItemOrder(leftorder, "left");
|
|
|
427 |
saveItemOrder(rightorder, "right");
|
|
|
428 |
|
|
|
429 |
setTimeout(function(){
|
|
|
430 |
applySavedItemOrder();
|
|
|
431 |
}, 1000);
|
|
|
432 |
});
|
|
|
433 |
|
|
|
434 |
// Drag & Drop
|
|
|
435 |
jQuery(".orderdetail-alternative-left, .orderdetail-alternative-right").sortable({
|
|
|
436 |
connectWith: ".connectedSortable"
|
|
|
437 |
}).disableSelection();
|
|
|
438 |
|
|
|
439 |
jQuery(".orderdetail-alternative-left").on('sortupdate', function()
|
|
|
440 |
{
|
|
|
441 |
var action = jQuery(".orderdetail-alternative-left").sortable("toArray");
|
|
|
442 |
saveItemOrder(action, "left");
|
|
|
443 |
});
|
|
|
444 |
jQuery(".orderdetail-alternative-right").on('sortupdate', function()
|
|
|
445 |
{
|
|
|
446 |
var action = jQuery(".orderdetail-alternative-right").sortable("toArray");
|
|
|
447 |
saveItemOrder(action, "right");
|
|
|
448 |
});
|
|
|
449 |
|
|
|
450 |
let foldedElements = '<?php echo json_encode($this->get_option('wpsg_backendui_orderdetail_foldedpanels')); ?>' || [];
|
|
|
451 |
if(foldedElements === "false" || foldedElements.includes('"",')) foldedElements = [];
|
|
|
452 |
if(foldedElements && foldedElements.length > 0) foldedElements = foldedElements.replace("[", "").replace("]", "").replaceAll('"', "").split(",");
|
|
|
453 |
|
|
|
454 |
// Panels einklappen
|
|
|
455 |
jQuery(".panel-heading").click(function(){
|
|
|
456 |
|
|
|
457 |
let jQueryPanelBody = jsElTojQueryObj(this.parentElement.lastElementChild, "orderdetail-panel-body");
|
|
|
458 |
let item_payload = jQueryPanelBody.parents().eq(1)[0].id + "_" + jQueryPanelBody[0].classList[0];
|
|
|
459 |
|
|
|
460 |
if(jQueryPanelBody.is(":hidden"))
|
|
|
461 |
{
|
|
|
462 |
|
|
|
463 |
let targetIndex = 0;
|
|
|
464 |
|
|
|
465 |
for(var i = 0; i < foldedElements.length; i++) {
|
|
|
466 |
if(foldedElements[i].includes(item_payload))
|
|
|
467 |
targetIndex = i;
|
|
|
468 |
}
|
|
|
469 |
|
|
|
470 |
foldedElements.splice(targetIndex, 1);
|
|
|
471 |
jQueryPanelBody.slideToggle('fast');
|
|
|
472 |
|
|
|
473 |
}
|
|
|
474 |
else
|
|
|
475 |
{
|
|
|
476 |
|
|
|
477 |
foldedElements.push(item_payload);
|
|
|
478 |
jQueryPanelBody.slideToggle('fast');
|
|
|
479 |
|
|
|
480 |
}
|
|
|
481 |
|
|
|
482 |
saveFoldedItems(foldedElements);
|
|
|
483 |
|
|
|
484 |
});
|
|
|
485 |
|
|
|
486 |
|
|
|
487 |
} );
|
|
|
488 |
|
|
|
489 |
/* ]]> */</script>
|