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
|
<?php
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', 'wpsgRevocation'); ?></a></li>
<li role="presentation" :class="{ 'active': tab === 2 }"><a href="#tab2" @click.prevent.stop="tab = 2"><?php echo __('Gründe für Retouren', 'wpsgRevocation'); ?></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.', 'wpsgRevocation'), 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.', 'wpsgRevocation'), 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.', 'wpsgRevocation'), 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.', 'wpsgRevocation'), 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', 'wpsgRevocation'), 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.', 'wpsgRevocation')]); ?>
</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>.', 'wpsgRevocation'),
WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf'
); ?><br />
<?php echo __('Das Modul setzt eindeutige Artikelnummern voraus.', 'wpsgRevocation'); ?>
</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', 'wpsgRevocation'); ?></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', 'wpsgRevocation'); ?></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', 'wpsgRevocation'); ?></p>
<a href="#" @click.prevent.stop="addReason" class="addReason"><span class="wpsg-glyphicon glyphicon glyphicon-plus"></span><?php echo __('Neuen Grund anlegen', 'wpsgRevocation'); ?></a>
</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?', 'wpsgRevocation'); ?>')) {
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>
|