EventPayment.vue
122 lines
| 1 | <template> |
| 2 | <div :class="props.globalClass" :style="cssVars"> |
| 3 | <Payment |
| 4 | v-if="selectedEvent" |
| 5 | :selected-item="selectedEvent" |
| 6 | :tax-visibility="taxVisible" |
| 7 | :in-dialog="true" |
| 8 | ></Payment> |
| 9 | </div> |
| 10 | </template> |
| 11 | |
| 12 | <script setup> |
| 13 | // * Components |
| 14 | import Payment from '../../../Parts/Payment/Page/Payment.vue' |
| 15 | |
| 16 | // * Import from Vue |
| 17 | import { inject, provide, reactive, computed } from 'vue' |
| 18 | |
| 19 | // * Import from Vuex |
| 20 | import { useStore } from 'vuex' |
| 21 | |
| 22 | // * Composables |
| 23 | import { useColorTransparency } from '../../../../../assets/js/common/colorManipulation' |
| 24 | import { useTaxVisibility } from '../../../../../assets/js/common/pricing' |
| 25 | |
| 26 | let props = defineProps({ |
| 27 | globalClass: { |
| 28 | type: String, |
| 29 | default: '', |
| 30 | }, |
| 31 | inDialog: { |
| 32 | type: Boolean, |
| 33 | default: false, |
| 34 | }, |
| 35 | }) |
| 36 | |
| 37 | // * Store |
| 38 | const store = useStore() |
| 39 | |
| 40 | const { footerButtonReset } = inject('changingStepsFunctions', { |
| 41 | footerButtonReset: () => {}, |
| 42 | }) |
| 43 | |
| 44 | footerButtonReset() |
| 45 | |
| 46 | let stepsArray = inject('stepsArray') |
| 47 | let stepIndex = inject('stepIndex') |
| 48 | |
| 49 | // * Form Key |
| 50 | let formKey = computed(() => store.getters['getFormKey']) |
| 51 | |
| 52 | // * Amelia Settings |
| 53 | let amSettings = computed(() => store.getters['getSettings']) |
| 54 | |
| 55 | // * labels |
| 56 | const labels = inject('labels') |
| 57 | |
| 58 | // * local language short code |
| 59 | const localLanguage = inject('localLanguage') |
| 60 | |
| 61 | // * Computed labels |
| 62 | let amLabels = computed(() => { |
| 63 | let computedLabels = reactive({ ...labels }) |
| 64 | let componentKey = stepsArray.value[stepIndex.value].key |
| 65 | |
| 66 | if ( |
| 67 | amSettings.value.customizedData && |
| 68 | formKey.value in amSettings.value.customizedData && |
| 69 | amSettings.value.customizedData[formKey.value][componentKey].translations |
| 70 | ) { |
| 71 | let customizedLabels = amSettings.value.customizedData[formKey.value][componentKey].translations |
| 72 | Object.keys(customizedLabels).forEach((labelKey) => { |
| 73 | if (customizedLabels[labelKey][localLanguage.value]) { |
| 74 | computedLabels[labelKey] = customizedLabels[labelKey][localLanguage.value] |
| 75 | } else if (customizedLabels[labelKey].default) { |
| 76 | computedLabels[labelKey] = customizedLabels[labelKey].default |
| 77 | } |
| 78 | }) |
| 79 | } |
| 80 | return computedLabels |
| 81 | }) |
| 82 | |
| 83 | provide('amLabels', amLabels.value) |
| 84 | |
| 85 | // * Event obj |
| 86 | let selectedEvent = computed(() => |
| 87 | store.getters['eventEntities/getEvent'](store.getters['eventBooking/getSelectedEventId']), |
| 88 | ) |
| 89 | |
| 90 | // * Tax |
| 91 | let taxVisible = computed(() => { |
| 92 | return useTaxVisibility(store, selectedEvent.value.id, 'event') |
| 93 | }) |
| 94 | |
| 95 | // * Colors |
| 96 | let amColors = inject('amColors') |
| 97 | |
| 98 | const cssVars = computed(() => { |
| 99 | return { |
| 100 | '--am-c-ps-price-bgr': useColorTransparency(amColors.value.colorBtnPrim, 0.05), |
| 101 | '--am-c-ps-total-price': amColors.value.colorBtnPrim, |
| 102 | '--am-c-ps-text-op50': useColorTransparency(amColors.value.colorMainText, 0.5), |
| 103 | '--am-c-ps-text-op25': useColorTransparency(amColors.value.colorMainText, 0.25), |
| 104 | '--am-c-ps-text-op20': useColorTransparency(amColors.value.colorMainText, 0.2), |
| 105 | '--am-c-ps-text-op06': useColorTransparency(amColors.value.colorMainText, 0.06), |
| 106 | '--am-c-ps-primary': amColors.value.colorPrimary, |
| 107 | '--am-c-ps-primary-op10': useColorTransparency(amColors.value.colorPrimary, 0.1), |
| 108 | '--am-c-ps-primary-op06': useColorTransparency(amColors.value.colorPrimary, 0.06), |
| 109 | } |
| 110 | }) |
| 111 | </script> |
| 112 | |
| 113 | <script> |
| 114 | export default { |
| 115 | name: 'EventPayment', |
| 116 | key: 'payment', |
| 117 | label: 'event_payment', |
| 118 | } |
| 119 | </script> |
| 120 | |
| 121 | <style lang="scss"></style> |
| 122 |