PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.8
Booking for Appointments and Events Calendar – Amelia v2.4.8
2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / v3 / src / views / public / EventForm / Common / Congratulations / Congratulations.vue
ameliabooking / v3 / src / views / public / EventForm / Common / Congratulations Last commit date
Congratulations.vue 1 month ago
Congratulations.vue
204 lines
1 <template>
2 <div
3 v-if="ready && booked && !loading && !loadingUpcoming"
4 :style="cssVars"
5 class="am-elf__main-content am-elf__congrats"
6 :class="props.globalClass"
7 >
8 <Congratulations
9 :labels="amLabels"
10 :base-urls="baseUrls"
11 :booked="booked"
12 :coupon="coupon"
13 :customer="customer"
14 :in-dialog="props.inDialog"
15 >
16 <template #positionBottom>
17 <AddToCalendar
18 class="am-congrats__main-atc"
19 :booked="booked"
20 :labels="amLabels"
21 :ready="ready"
22 ></AddToCalendar>
23 </template>
24 </Congratulations>
25 </div>
26
27 <!-- Skeleton -->
28 <Skeleton v-else></Skeleton>
29 <!-- /Skeleton -->
30 </template>
31
32 <script setup>
33 // * Components
34 import Congratulations from '../../../Parts/Congratulations/Page/Congratulations.vue'
35
36 // * Parts
37 import AddToCalendar from '../../../Parts/Congratulations/Parts/AddToCalendar.vue'
38 import Skeleton from '../../../Parts/Congratulations/Skeleton/Skeleton.vue'
39
40 // * Import from Vue
41 import { computed, inject, watchEffect, onMounted, reactive, provide } from 'vue'
42
43 // * Import from Vuex
44 import { useStore } from 'vuex'
45
46 // * Composables
47 import { useColorTransparency } from '../../../../../assets/js/common/colorManipulation.js'
48
49 let props = defineProps({
50 globalClass: {
51 type: String,
52 default: '',
53 },
54 inDialog: {
55 type: Boolean,
56 default: false,
57 },
58 })
59
60 const store = useStore()
61
62 // * Root Settings
63 const amSettings = computed(() => store.getters['getSettings'])
64
65 // * URLs
66 const baseUrls = computed(() => store.getters['getBaseUrls'])
67
68 /**************
69 * Computed *
70 *************/
71
72 // * Ready state
73 let ready = computed(() => store.getters['getReady'])
74
75 // * Loading state
76 let loading = computed(() => store.getters['getLoading'])
77
78 let loadingUpcoming = computed(() =>
79 store.getters['getFormKey'] === 'ecf' ? store.getters['eventEntities/getUpcomingLoading'] : false,
80 )
81
82 let booked = computed(() => store.getters['eventBooking/getBooked'])
83
84 // * Coupon
85 let coupon = computed(() => store.getters['coupon/getCoupon'])
86
87 let customer = computed(() => {
88 return {
89 firstName: store.getters['customerInfo/getCustomerFirstName'],
90 lastName: store.getters['customerInfo/getCustomerLastName'],
91 email: store.getters['customerInfo/getCustomerEmail'],
92 phone: store.getters['customerInfo/getCustomerPhone'],
93 }
94 })
95
96 /**************
97 * Navigation *
98 *************/
99
100 const { footerButtonClicked } = inject('changingStepsFunctions', {
101 footerButtonClicked: {
102 value: false,
103 },
104 })
105
106 function finish() {
107 if (booked.value.redirectAfterBookingUrl) {
108 window.location.href = booked.value.redirectAfterBookingUrl
109 } else {
110 window.location.reload()
111 }
112 }
113
114 // * Watching when footer button was clicked
115 watchEffect(() => {
116 if (footerButtonClicked.value) {
117 finish()
118 }
119 })
120
121 onMounted(() => {
122 if (!store.getters['getRestoring']) {
123 store.commit('setLoading', false)
124 }
125 })
126
127 let stepsArray = inject('stepsArray')
128 let stepIndex = inject('stepIndex')
129
130 // * Form Key
131 let formKey = computed(() => store.getters['getFormKey'])
132
133 // * labels
134 const labels = inject('labels')
135
136 // * local language short code
137 const localLanguage = inject('localLanguage')
138
139 // * Computed labels
140 let amLabels = computed(() => {
141 let computedLabels = reactive({ ...labels })
142 let componentKey = stepsArray.value[stepIndex.value].key
143
144 if (
145 amSettings.value.customizedData &&
146 formKey.value in amSettings.value.customizedData &&
147 amSettings.value.customizedData[formKey.value][componentKey].translations
148 ) {
149 let customizedLabels = amSettings.value.customizedData[formKey.value][componentKey].translations
150 Object.keys(customizedLabels).forEach((labelKey) => {
151 if (customizedLabels[labelKey][localLanguage.value]) {
152 computedLabels[labelKey] = customizedLabels[labelKey][localLanguage.value]
153 } else if (customizedLabels[labelKey].default) {
154 computedLabels[labelKey] = customizedLabels[labelKey].default
155 }
156 })
157 }
158 return computedLabels
159 })
160
161 provide('amLabels', amLabels.value)
162
163 // * Colors
164 let amColors = inject('amColors')
165
166 const cssVars = computed(() => {
167 if (booked.value.type !== 'event') {
168 return {
169 '--am-c-atc-text-op40': useColorTransparency(amColors.value.colorMainText, 0.4),
170 '--am-c-atc-heading-text-op40': useColorTransparency(amColors.value.colorSbText, 0.4),
171 '--am-c-atc-text-op30': useColorTransparency(amColors.value.colorMainText, 0.3),
172 '--am-c-atc-text': amColors.value.colorMainText,
173 '--am-c-atc-heading-text': amColors.value.colorSbText,
174 '--am-c-atc-bgr-coverage':
175 booked.value.type === 'package' &&
176 !(amSettings.value.general.addToCalendar && booked.value && booked.value.data.length)
177 ? '50%'
178 : '80%',
179 }
180 } else {
181 return {
182 '--am-c-atc-text-op40': useColorTransparency(amColors.value.colorMainText, 0.4),
183 '--am-c-atc-heading-text-op40': useColorTransparency(
184 amColors.value.colorMainHeadingText,
185 0.4,
186 ),
187 '--am-c-atc-text-op30': useColorTransparency(amColors.value.colorMainText, 0.3),
188 '--am-c-atc-text': amColors.value.colorMainText,
189 '--am-c-atc-heading-text': amColors.value.colorMainHeadingText,
190 }
191 }
192 })
193 </script>
194
195 <script>
196 export default {
197 name: 'CongratulationsStep',
198 label: 'event_congrats',
199 key: 'congrats',
200 }
201 </script>
202
203 <style lang="scss"></style>
204