CustomizeCatalog.vue
3 years ago
CustomizeCustomerPanel.vue
2 years ago
CustomizeEmployeePanel.vue
1 year ago
CustomizeEventCalendar.vue
1 year ago
CustomizeEventList.vue
1 year ago
CustomizeSearch.vue
4 years ago
CustomizeStepNew.vue
2 years ago
CustomizeStepOld.vue
4 years ago
CustomizeEventCalendar.vue
407 lines
| 1 | <template> |
| 2 | <template v-if="!amFonts.customFontSelected"> |
| 3 | <link rel="preconnect" href="https://fonts.googleapis.com"> |
| 4 | <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 5 | <link rel="stylesheet" type="text/css" :href="`${baseUrls.wpAmeliaPluginURL}v3/src/assets/scss/common/fonts/font.css`" media="all"> |
| 6 | </template> |
| 7 | <div |
| 8 | id="amelia-container" |
| 9 | ref="ameliaContainer" |
| 10 | class="am-ecf" |
| 11 | :class="{'am-ecf-dialog': stepsArray[stepIndex].key !== 'calendar'}" |
| 12 | :style="cssVars" |
| 13 | > |
| 14 | <!-- Events Calendar --> |
| 15 | <component |
| 16 | :is="stepsArray[stepIndex]" |
| 17 | v-if="stepsArray[stepIndex].key === 'calendar'" |
| 18 | ></component> |
| 19 | <!-- /Events Calendar --> |
| 20 | |
| 21 | <template v-if="stepsArray[stepIndex].key !== 'calendar'"> |
| 22 | <div v-if="stepIndex > 1" class="am-dialog-el-header"> |
| 23 | <EventListHeader |
| 24 | :ready="true" |
| 25 | :loading="false" |
| 26 | :customized-labels="globalStepLabels()" |
| 27 | /> |
| 28 | </div> |
| 29 | <component |
| 30 | :is="stepsArray[stepIndex]" |
| 31 | :in-dialog="true" |
| 32 | global-class="am-dialog-el__main-container" |
| 33 | ></component> |
| 34 | <EventListFooter |
| 35 | v-if="stepsArray[stepIndex].key !== 'calendar'" |
| 36 | :customized-labels="globalStepLabels()" |
| 37 | :primary-footer-button-type="isWaiting && stepsArray[stepIndex].name === 'EventInfo' ? waitingBtnType : primBtn" |
| 38 | :secondary-footer-button-type="secBtn" |
| 39 | :second-button-show="!licence.isLite ? secBtnVisible : false" |
| 40 | :is-waiting-list="isWaiting" |
| 41 | /> |
| 42 | </template> |
| 43 | </div> |
| 44 | </template> |
| 45 | |
| 46 | <script setup> |
| 47 | // * import from Vue |
| 48 | import { |
| 49 | computed, |
| 50 | ref, |
| 51 | inject, |
| 52 | provide, |
| 53 | markRaw, |
| 54 | onMounted, |
| 55 | watchEffect, |
| 56 | onBeforeMount |
| 57 | } from 'vue' |
| 58 | |
| 59 | // * import composable |
| 60 | import { usePopulateMultiDimensionalObject } from '../../../../assets/js/common/objectAndArrayManipulation.js' |
| 61 | import { defaultCustomizeSettings } from '../../../../assets/js/common/defaultCustomize' |
| 62 | import { useColorTransparency } from '../../../../assets/js/common/colorManipulation' |
| 63 | |
| 64 | // * Form Construction |
| 65 | import EventListHeader from "../../../common/EventListFormConstruction/Header/Header.vue"; |
| 66 | import EventListFooter from "../../../common/EventListFormConstruction/Footer/Footer.vue"; |
| 67 | |
| 68 | // * Step Components |
| 69 | import EventsCalendar from "../steps/Events/EventCalendar/EventsCalendar.vue"; |
| 70 | import EventInfo from "../steps/Events/common/EventInfo/EventInfo.vue"; |
| 71 | import EventTickets from "../steps/Events/common/EventTickets/EventTickets.vue"; |
| 72 | import EventCustomerInfo from "../steps/Events/common/EventCustomerInfo/EventCustomerInfo.vue"; |
| 73 | import EventPayment from "../steps/Events/common/EventPayment/EventPayment.vue"; |
| 74 | import EventCongratulations from "../steps/Events/common/Congratulations/EventCongratulations.vue"; |
| 75 | |
| 76 | // * Form Component Collection |
| 77 | const eventsCalendar = markRaw(EventsCalendar) |
| 78 | const eventInfo = markRaw(EventInfo) |
| 79 | const eventTickets = markRaw(EventTickets) |
| 80 | const eventCustomerInfo = markRaw(EventCustomerInfo) |
| 81 | const eventPayment = markRaw(EventPayment) |
| 82 | const eventCongratulations = markRaw(EventCongratulations) |
| 83 | |
| 84 | // * Root Settings |
| 85 | let amSettings = inject('settings') |
| 86 | |
| 87 | // * Plugin Licence |
| 88 | let licence = inject('licence') |
| 89 | |
| 90 | // * Root Urls |
| 91 | const baseUrls = inject('baseUrls') |
| 92 | |
| 93 | // * is waiting |
| 94 | let isWaiting = computed(() => { |
| 95 | return amSettings.appointments.waitingListEvents.enabled && !licence.isBasic && !licence.isStarter && !licence.isLite |
| 96 | }) |
| 97 | |
| 98 | let amTranslations = inject('translations') |
| 99 | let langKey = inject('langKey') |
| 100 | let stepName = inject('stepName') |
| 101 | let pageRenderKey = inject('pageRenderKey') |
| 102 | let amCustomize = inject('customize') |
| 103 | |
| 104 | let amFonts = computed(() => { |
| 105 | return amCustomize.value.fonts |
| 106 | }) |
| 107 | provide('amFonts', amFonts) |
| 108 | |
| 109 | let primBtn = computed(() => { |
| 110 | if ( |
| 111 | amCustomize.value[pageRenderKey.value][stepName.value] |
| 112 | && 'primBtn' in amCustomize.value[pageRenderKey.value][stepName.value].options |
| 113 | ) { |
| 114 | return amCustomize.value[pageRenderKey.value][stepName.value].options.primBtn.buttonType |
| 115 | } |
| 116 | return 'filled' |
| 117 | }) |
| 118 | |
| 119 | let secBtn = computed(() => { |
| 120 | if ( |
| 121 | amCustomize.value[pageRenderKey.value][stepName.value] |
| 122 | && 'secBtn' in amCustomize.value[pageRenderKey.value][stepName.value].options |
| 123 | ) { |
| 124 | return amCustomize.value[pageRenderKey.value][stepName.value].options.secBtn.buttonType |
| 125 | } |
| 126 | return 'plain' |
| 127 | }) |
| 128 | |
| 129 | let secBtnVisible = computed(() => { |
| 130 | if ( |
| 131 | amCustomize.value[pageRenderKey.value][stepName.value] |
| 132 | && 'secBtn' in amCustomize.value[pageRenderKey.value][stepName.value].options |
| 133 | ) { |
| 134 | return amCustomize.value[pageRenderKey.value][stepName.value].options.secBtn.visibility |
| 135 | } |
| 136 | return true |
| 137 | }) |
| 138 | |
| 139 | let waitingBtnType = computed(() => { |
| 140 | if ( |
| 141 | amCustomize.value[pageRenderKey.value][stepName.value] |
| 142 | && 'waitingBtn' in amCustomize.value[pageRenderKey.value][stepName.value].options |
| 143 | ) { |
| 144 | return amCustomize.value[pageRenderKey.value][stepName.value].options.waitingBtn.buttonType |
| 145 | } |
| 146 | return 'filled' |
| 147 | }) |
| 148 | |
| 149 | // * Step index |
| 150 | let stepIndex = inject('stepIndex') |
| 151 | provide('stepIndex', stepIndex) |
| 152 | |
| 153 | let stepsArray = ref([ |
| 154 | eventsCalendar, |
| 155 | eventInfo, |
| 156 | eventTickets, |
| 157 | eventCustomerInfo, |
| 158 | eventPayment, |
| 159 | eventCongratulations |
| 160 | ]) |
| 161 | provide('stepsArray', stepsArray) |
| 162 | |
| 163 | watchEffect(() => { |
| 164 | stepName.value = stepsArray.value[stepIndex.value].key |
| 165 | }) |
| 166 | |
| 167 | let { pageNameHandler } = inject('headerFunctionality', { |
| 168 | pageNameHandler: () => 'Step-by-Step Booking Form' |
| 169 | }) |
| 170 | |
| 171 | pageNameHandler('Event Calendar Booking Form') |
| 172 | |
| 173 | // * implementation of saved labels into amTranslation object |
| 174 | let stepKey = ref('') |
| 175 | |
| 176 | function savedLabelsImplementation (labelObj) { |
| 177 | Object.keys(labelObj).forEach((labelKey) => { |
| 178 | if (labelKey in amCustomize.value[pageRenderKey.value][stepKey.value].translations) { |
| 179 | labelObj[labelKey] = {...labelObj[labelKey], ...amCustomize.value[pageRenderKey.value][stepKey.value].translations[labelKey]} |
| 180 | } |
| 181 | }) |
| 182 | } |
| 183 | |
| 184 | // * Component reference |
| 185 | let ameliaContainer = ref(null) |
| 186 | |
| 187 | // * Plugin wrapper width |
| 188 | let containerWidth = ref(0) |
| 189 | provide('containerWidth', containerWidth) |
| 190 | |
| 191 | // * window resize listener |
| 192 | window.addEventListener('resize', resize); |
| 193 | |
| 194 | // * Resize function |
| 195 | function resize() { |
| 196 | if (ameliaContainer.value) { |
| 197 | containerWidth.value = ameliaContainer.value.offsetWidth |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | onMounted(() => { |
| 202 | containerWidth.value = ameliaContainer.value.offsetWidth |
| 203 | |
| 204 | if (amCustomize.value.fonts.customFontSelected) { |
| 205 | activateCustomFontStyles() |
| 206 | } |
| 207 | }) |
| 208 | |
| 209 | function activateCustomFontStyles () { |
| 210 | let head = document.head || document.getElementsByTagName('head')[0] |
| 211 | if (head.querySelector('#amCustomFont')) { |
| 212 | head.querySelector('#amCustomFont').remove() |
| 213 | } |
| 214 | |
| 215 | let css = `@font-face {font-family: '${amCustomize.value.fonts.fontFamily}'; src: url(${amCustomize.value.fonts.fontUrl});}` |
| 216 | let style = document.createElement('style') |
| 217 | head.appendChild(style) |
| 218 | style.setAttribute('type', 'text/css') |
| 219 | style.setAttribute('id', 'amCustomFont') |
| 220 | style.appendChild(document.createTextNode(css)) |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Lifecycle Hooks |
| 225 | */ |
| 226 | onBeforeMount(() => { |
| 227 | window.scrollTo({ |
| 228 | top: 0, |
| 229 | left: 0, |
| 230 | behavior: 'smooth' |
| 231 | }) |
| 232 | Object.keys(amCustomize.value[pageRenderKey.value]).forEach(step => { |
| 233 | if (step !== 'colors' && amCustomize.value[pageRenderKey.value][step].translations) { |
| 234 | stepKey.value = step |
| 235 | usePopulateMultiDimensionalObject('labels', amTranslations[pageRenderKey.value][step], savedLabelsImplementation) |
| 236 | } |
| 237 | }) |
| 238 | }) |
| 239 | |
| 240 | function globalStepLabels () { |
| 241 | let stepLabels = {} |
| 242 | let customizedLabels = amCustomize.value[pageRenderKey.value][stepName.value].translations |
| 243 | if (customizedLabels && Object.keys(customizedLabels)) { |
| 244 | Object.keys(amCustomize.value[pageRenderKey.value][stepName.value].translations).forEach(label => { |
| 245 | stepLabels[label] = amCustomize.value[pageRenderKey.value][stepName.value].translations[label][langKey.value] |
| 246 | }) |
| 247 | } else { |
| 248 | stepLabels = {} |
| 249 | } |
| 250 | |
| 251 | return stepLabels |
| 252 | } |
| 253 | |
| 254 | // * Colors |
| 255 | // * Customize colors |
| 256 | let amColors = computed(() => { |
| 257 | return amCustomize.value[pageRenderKey.value] ? amCustomize.value[pageRenderKey.value].colors : defaultCustomizeSettings[pageRenderKey.value].colors |
| 258 | }) |
| 259 | |
| 260 | provide('amColors', amColors); |
| 261 | let cssVars = computed(() => { |
| 262 | return { |
| 263 | '--am-c-primary': amColors.value.colorPrimary, |
| 264 | '--am-c-success': amColors.value.colorSuccess, |
| 265 | '--am-c-error': amColors.value.colorError, |
| 266 | '--am-c-warning': amColors.value.colorWarning, |
| 267 | '--am-c-main-bgr': amColors.value.colorMainBgr, |
| 268 | '--am-c-main-heading-text': amColors.value.colorMainHeadingText, |
| 269 | '--am-c-main-text': amColors.value.colorMainText, |
| 270 | '--am-c-sb-bgr': amColors.value.colorSbBgr, |
| 271 | '--am-c-sb-text': amColors.value.colorSbText, |
| 272 | '--am-c-inp-bgr': amColors.value.colorInpBgr, |
| 273 | '--am-c-inp-border': amColors.value.colorInpBorder, |
| 274 | '--am-c-inp-text': amColors.value.colorInpText, |
| 275 | '--am-c-inp-placeholder': amColors.value.colorInpPlaceHolder, |
| 276 | '--am-c-drop-bgr': amColors.value.colorDropBgr, |
| 277 | '--am-c-drop-text': amColors.value.colorDropText, |
| 278 | '--am-c-card-bgr': amColors.value.colorCardBgr, |
| 279 | '--am-c-card-text': amColors.value.colorCardText, |
| 280 | '--am-c-card-border': amColors.value.colorCardBorder, |
| 281 | '--am-c-btn-prim': amColors.value.colorBtnPrim, |
| 282 | '--am-c-btn-prim-text': amColors.value.colorBtnPrimText, |
| 283 | '--am-c-btn-sec': amColors.value.colorBtnSec, |
| 284 | '--am-c-btn-sec-text': amColors.value.colorBtnSecText, |
| 285 | '--am-c-skeleton-op20': useColorTransparency(amColors.value.colorMainText, 0.2), |
| 286 | '--am-c-skeleton-op60': useColorTransparency(amColors.value.colorMainText, 0.6), |
| 287 | '--am-font-family': amFonts.value.fontFamily, |
| 288 | |
| 289 | // -mw- max width |
| 290 | '--am-mw-main': '792px', |
| 291 | '--am-hd-main': stepIndex.value > 0 ? '592px' :'652px', |
| 292 | '--am-c-scroll-op30': useColorTransparency(amColors.value.colorPrimary, 0.3), |
| 293 | '--am-c-scroll-op10': useColorTransparency(amColors.value.colorPrimary, 0.1), |
| 294 | |
| 295 | '--am-rad-input': '6px', |
| 296 | |
| 297 | '--am-mb-dialog': '300px' |
| 298 | } |
| 299 | }) |
| 300 | </script> |
| 301 | |
| 302 | <script> |
| 303 | export default { |
| 304 | name: "EventsCalendarFormWrapper" |
| 305 | } |
| 306 | </script> |
| 307 | |
| 308 | <style lang="scss"> |
| 309 | @import '../../../../assets/scss/public/overides/overides'; |
| 310 | @import '../../../../assets/scss/common/reset/reset'; |
| 311 | @import '../../../../assets/scss/common/icon-fonts/style'; |
| 312 | @import '../../../../assets/scss/common/skeleton/skeleton.scss'; |
| 313 | @import '../../../../assets/scss/common/empty-state/_empty-state-mixin.scss'; |
| 314 | @import '../../../../assets/scss/common/transitions/_transitions-mixin.scss'; |
| 315 | |
| 316 | :root { |
| 317 | // Colors |
| 318 | // shortcuts |
| 319 | // -c- color |
| 320 | // -bgr- background |
| 321 | // -prim- primary |
| 322 | // -sec- secondary |
| 323 | // primitive colors |
| 324 | --am-c-primary: #{$blue-1000}; |
| 325 | --am-c-success: #{$green-1000}; |
| 326 | --am-c-error: #{$red-900}; |
| 327 | --am-c-warning: #{$yellow-1000}; |
| 328 | // main container colors - right part of the form |
| 329 | --am-c-main-bgr: #{$am-white}; |
| 330 | --am-c-main-heading-text: #{$shade-800}; |
| 331 | --am-c-main-text: #{$shade-900}; |
| 332 | // sidebar container colors - left part of the form |
| 333 | --am-c-sb-bgr: #17295A; |
| 334 | --am-c-sb-text: #{$am-white}; |
| 335 | // input global colors - usage input, textarea, checkbox, radio button, select input, adv select input |
| 336 | --am-c-inp-bgr: #{$am-white}; |
| 337 | --am-c-inp-border: #{$shade-250}; |
| 338 | --am-c-inp-text: #{$shade-900}; |
| 339 | --am-c-inp-placeholder: #{$shade-500}; |
| 340 | // dropdown global colors - usage select dropdown, adv select dropdown |
| 341 | --am-c-drop-bgr: #{$am-white}; |
| 342 | --am-c-drop-text: #{$shade-1000}; |
| 343 | // button global colors |
| 344 | --am-c-btn-prim: #{$blue-900}; |
| 345 | --am-c-btn-prim-text: #{$am-white}; |
| 346 | --am-c-btn-sec: #{$am-white}; |
| 347 | --am-c-btn-sec-text: #{$shade-900}; |
| 348 | |
| 349 | // Properties |
| 350 | // shortcuts |
| 351 | // -h- height |
| 352 | // -fs- font size |
| 353 | // -rad- border radius |
| 354 | --am-h-input: 40px; |
| 355 | --am-fs-input: 15px; |
| 356 | --am-rad-input: 6px; |
| 357 | --am-fs-label: 15px; |
| 358 | --am-fs-btn: 15px; |
| 359 | |
| 360 | // Font |
| 361 | --am-font-family: 'Amelia Roboto', sans-serif; |
| 362 | } |
| 363 | |
| 364 | #amelia-app-backend-new #amelia-container { |
| 365 | // am - amelia |
| 366 | // elf - events list form |
| 367 | &.am-ecf { |
| 368 | margin: 24px auto 0; |
| 369 | max-width: calc(100% - 60px); |
| 370 | background-color: var(--am-c-main-bgr); |
| 371 | padding: 0; |
| 372 | border-radius: 12px; |
| 373 | |
| 374 | &.am-ecf-dialog { |
| 375 | max-width: 650px; |
| 376 | padding: 0; |
| 377 | border-radius: 8px; |
| 378 | position: relative; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | .am-dialog-el { |
| 383 | &__main { |
| 384 | &-container { |
| 385 | height: var(--am-hd-main); |
| 386 | display: block; |
| 387 | overflow-x: hidden; |
| 388 | padding: 16px 24px 0; |
| 389 | |
| 390 | &::-webkit-scrollbar { |
| 391 | width: 6px; |
| 392 | } |
| 393 | |
| 394 | &::-webkit-scrollbar-thumb { |
| 395 | border-radius: 6px; |
| 396 | background: var(--am-c-scroll-op30); |
| 397 | } |
| 398 | |
| 399 | &::-webkit-scrollbar-track { |
| 400 | border-radius: 6px; |
| 401 | background: var(--am-c-scroll-op10); |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | </style> |