1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
<?php
/** @version 4.6.1 */
declare(strict_types=1);
/**
* @author: Daniel Schmitzer
* @date: 14.04.26
* @time: 06:32
*/
$arReason = \wpsgRevocation\Revocation::getReasons();
?>
<div id="wpsg_mod_revocation_reason_wrap">
<div id="wpsg_mod_revocation_reason_app">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" :class="{ 'active': tab === 1 }"><a href="#tab1" @click.prevent.stop="tab = 1"><?php echo __('Einstellungen', 'wpsg'); ?></a></li>
<li role="presentation" :class="{ 'active': tab === 2 }"><a href="#tab2" @click.prevent.stop="tab = 2"><?php echo __('Gründe für Retouren', 'wpsg'); ?></a></li>
<li role="presentation" :class="{ 'active': tab === 3 }"><a href="#tab3" @click.prevent.stop="tab = 3"><?php echo __('Nicht zugeordnete Widerrufe', 'wpsg'); ?></a></li>
</ul>
<input type="hidden" name="wpsg_mod_revocation_reason" v-model="jsonString" />
<div class="tab-content">
<div v-show="tab === 1" class="tab-pane active">
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_revocation_view_order', __('An Produkten im Kundenfrontend an den Bestellungen anzeigen.', 'wpsg'), wpsg_ShopController::getShop()->get_option('wpsg_mod_revocation_view_order'), ['fullWidth' => true]); ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_revocation_view_flyout', __('Auf allen Seiten ein Widerrufs-Flyout anzeigen.', 'wpsg'), wpsg_ShopController::getShop()->get_option('wpsg_mod_revocation_view_flyout'), ['fullWidth' => true]); ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_revocation_view_product', __('Im Produkt neben "In den Warenkorb" anzeigen.', 'wpsg'), wpsg_ShopController::getShop()->get_option('wpsg_mod_revocation_view_product'), ['fullWidth' => true]); ?>
<?php echo wpsg_drawForm_Checkbox('wpsg_mod_revocation_view_customer_mail', __('Widerruflink in Bestellbestätigungsmail an Kunden.', 'wpsg'), wpsg_ShopController::getShop()->get_option('wpsg_mod_revocation_view_customer_mail'), ['fullWidth' => true]); ?>
<hr />
<div v-pre>
<?php echo wpsg_drawForm_Select('wpsg_page_widerrufsformular', __('Seite für das Widerrufsformular', 'wpsg'), wpsg_ShopController::getShop()->view['pages'], wpsg_ShopController::getShop()->get_option('wpsg_page_widerrufsformular'), ['hint' => __('Wählen Sie „Neu anlegen und zuordnen", damit beim Speichern automatisch eine eigene Seite erstellt wird – oder ordnen Sie eine bestehende Seite zu. Das Formular wird automatisch in diese Seite eingebunden.', 'wpsg')]); ?>
</div>
<p class="wpsg_note">
<?php echo wpsg_translate(
__('Einstellungen zu den E-Mails finden Sie in der <a href="#1#">E-Mail Konfiguration</a>.', 'wpsg'),
WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf'
); ?><br />
<?php echo __('Das Modul setzt eindeutige Artikelnummern voraus.', 'wpsg'); ?>
</p>
</div>
<div v-show="tab === 2" class="tab-pane active">
<div class="reason_wrap" v-if="arReason.length > 0">
<template v-for="r of arReason">
<div class="wpsg_form_field">
<label class="label"><?php echo __('ID', 'wpsg'); ?></label>
<div class="value">
{{r.id}}
<a data-id="1" class="removeReason" @click.prevent.stop="removeReason(r)" href="#"><span class="wpsg-glyphicon glyphicon glyphicon-trash"></span></a>
</div>
</div>
<div class="wpsg_form_field">
<label class="label"><?php echo __('Text', 'wpsg'); ?></label>
<div class="value">
<input type="text" v-model="r.text" />
</div>
</div>
<hr />
</template>
</div>
<p v-else><?php echo __('Keine Gründe definiert', 'wpsg'); ?></p>
<a href="#" @click.prevent.stop="addReason" class="addReason"><span class="wpsg-glyphicon glyphicon glyphicon-plus"></span><?php echo __('Neuen Grund anlegen', 'wpsg'); ?></a>
</div>
<div v-show="tab === 3" class="tab-pane active">
<?php /* S20: Widerrufe ohne passende Bestellung; v-pre, damit eingetragene Texte keine Vue-Vorlage sind. Löschen über das Modulformular (POST, Nonce, wpsg_conf) */ $arUnassigned = \wpsgRevocation\Revocation::unassignedEntries(); ?>
<div v-pre class="wpsg_mod_revocation_unassigned">
<p><?php echo esc_html(wpsg_translate(__('Widerrufe, zu denen keine Bestellung oder Position gefunden wurde. Gespeichert werden höchstens die letzten #1#.', 'wpsg'), \wpsgRevocation\Revocation::UNASSIGNED_MAX)); ?></p>
<?php if (sizeof($arUnassigned) === 0) { ?>
<p><?php echo esc_html__('Keine Einträge.', 'wpsg'); ?></p>
<?php } else { ?>
<?php /* Der Admin-Controller speichert nur mit „submit“; auch die Löschknöpfe gehen diesen Weg (Nonce, wpsg_conf) */ ?>
<input type="hidden" name="submit" value="1" />
<table class="table">
<thead><tr>
<th scope="col"><?php echo esc_html__('Datum', 'wpsg'); ?></th>
<th scope="col"><?php echo esc_html__('Name', 'wpsg'); ?></th>
<th scope="col"><?php echo esc_html__('E-Mail', 'wpsg'); ?></th>
<th scope="col"><?php echo esc_html__('Bestellnummer', 'wpsg'); ?></th>
<th scope="col"><?php echo esc_html__('Artikelnummer', 'wpsg'); ?></th>
<th scope="col"><?php echo esc_html__('Menge', 'wpsg'); ?></th>
<th scope="col"><?php echo esc_html__('Vermerk', 'wpsg'); ?></th>
<th scope="col"><span class="screen-reader-text"><?php echo esc_html__('Löschen', 'wpsg'); ?></span></th>
</tr></thead>
<tbody>
<?php foreach (array_reverse($arUnassigned) as $entry) { ?>
<tr>
<td><?php echo esc_html(\mysql2date('d.m.Y H:i', (string)($entry['time']??''))); ?></td>
<td><?php echo esc_html((string)($entry['name']??'')); ?></td>
<td><?php echo esc_html((string)($entry['contact']??'')); ?></td>
<td><?php echo esc_html((string)($entry['order_nr']??'')); ?></td>
<td><?php echo esc_html((string)($entry['product_nr']??'')); ?></td>
<td><?php echo intval($entry['amount']??0); ?></td>
<td><?php echo esc_html(implode(', ', \wpsgRevocation\Revocation::noteTexts((array)($entry['notes']??[])))); ?></td>
<td><button type="submit" class="button" name="wpsg_mod_revocation_unassigned_delete" value="<?php echo esc_attr($entry['id']); ?>"><?php echo esc_html__('Löschen', 'wpsg'); ?></button></td>
</tr>
<?php } ?>
</tbody>
</table>
<button type="submit" class="button" name="wpsg_mod_revocation_unassigned_delete" value="all" onclick="return confirm(<?php echo esc_attr(wp_json_encode(__('Alle nicht zugeordneten Widerrufe löschen?', 'wpsg'))); ?>);"><?php echo esc_html__('Alle löschen', 'wpsg'); ?></button>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<style>
#wpsg_mod_revocation_reason_wrap {
.wpsg_note { margin-top:1rem; font-style:italic; }
.addReason { margin-top:1rem; display:block; }
.removeReason { position:absolute; right:0; top:7px; font-size:1.4rem; }
.wpsg_form_field { display:grid; grid-template-columns:100px 1fr; column-gap:2rem; row-gap:1rem; width:100%; align-items:center; position:relative; min-height:30px;
& > .label { font-weight:bold; display:block; padding:0; margin:0; color:black; font-size:100%; text-align:left; }
& > .value {
input { width:100%; }
}
}
}
</style>
<script type="module">
import { createApp, computed, ref } from '<?php echo wpsg_ShopController::getShop()->getRessourceURL('js/vue.esm-browser.prod.3.5.32.js'); ?>';
createApp({
setup() {
const tab = ref(1);
const arReason = ref(<?php echo json_encode($arReason); ?>);
const addReason = () => {
const id = Date.now().toString(36) + Math.random().toString(36).slice(2);
arReason.value.push({ text: '', id: id });
};
const removeReason = r => {
if (confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) {
arReason.value = arReason.value.filter(v => v !== r);
}
}
const jsonString = computed(() => JSON.stringify(arReason.value));
return {
addReason, removeReason,
arReason, jsonString, tab
};
}
}).mount('#wpsg_mod_revocation_reason_app');
</script>
|