Congratulations.vue
184 lines
| 1 | <template> |
| 2 | <div :style="cssVars"> |
| 3 | <div class="am-congrats__main"> |
| 4 | <img |
| 5 | v-if="props.type !== 'event'" |
| 6 | :src="baseUrls.wpAmeliaPluginURL + '/v3/src/assets/img/congratulations/congratulations.svg'" |
| 7 | /> |
| 8 | |
| 9 | <p v-if="type !== 'event'" class="am-congrats__main-heading"> |
| 10 | {{ labelsDisplay('congratulations') }} |
| 11 | </p> |
| 12 | |
| 13 | <p v-if="props.type === 'event'" class="am-congrats__main-heading"> |
| 14 | {{ selectedItem.title }} |
| 15 | </p> |
| 16 | |
| 17 | <span v-if="itemIdLabel"> |
| 18 | {{ itemIdLabel }} |
| 19 | </span> |
| 20 | |
| 21 | <slot name="positionBelowHeading"></slot> |
| 22 | </div> |
| 23 | |
| 24 | <CongratsInfo> |
| 25 | <template #info> |
| 26 | <component :is="componentTypes[props.type]"> |
| 27 | <template #payment> |
| 28 | <PaymentCongratsInfo /> |
| 29 | </template> |
| 30 | </component> |
| 31 | </template> |
| 32 | <template #customer> |
| 33 | <CustomerCongratsInfo /> |
| 34 | </template> |
| 35 | </CongratsInfo> |
| 36 | |
| 37 | <slot name="positionBottom"></slot> |
| 38 | </div> |
| 39 | </template> |
| 40 | |
| 41 | <script setup> |
| 42 | // * Parts |
| 43 | import CongratsInfo from '../../../../public/Parts/Congratulations/Parts/CongratsInfo.vue' |
| 44 | import PaymentCongratsInfo from '../parts/PaymentCongratsInfo.vue' |
| 45 | import CustomerCongratsInfo from '../parts/CustomerCongratsInfo.vue' |
| 46 | import EventCongratsInfo from '../Events/common/EventCustomerInfo/parts/EventCongratsInfo.vue' |
| 47 | |
| 48 | // * Import from Vue |
| 49 | import { ref, computed, inject, markRaw } from 'vue' |
| 50 | |
| 51 | // * Composables |
| 52 | import { useColorTransparency } from '../../../../../assets/js/common/colorManipulation' |
| 53 | import { useReactiveCustomize } from '../../../../../assets/js/admin/useReactiveCustomize.js' |
| 54 | |
| 55 | // * Component Properties |
| 56 | let props = defineProps({ |
| 57 | type: { |
| 58 | type: String, |
| 59 | required: true, |
| 60 | }, |
| 61 | selectedItem: { |
| 62 | type: Object, |
| 63 | required: true, |
| 64 | }, |
| 65 | }) |
| 66 | |
| 67 | // * Base Urls |
| 68 | const baseUrls = inject('baseUrls') |
| 69 | |
| 70 | // * Customize Object |
| 71 | const { amCustomize } = useReactiveCustomize() |
| 72 | |
| 73 | // * Form string recognition |
| 74 | let pageRenderKey = inject('pageRenderKey') |
| 75 | |
| 76 | // * Form step string recognition |
| 77 | let stepName = inject('stepName') |
| 78 | |
| 79 | // * Language string recognition |
| 80 | let langKey = inject('langKey') |
| 81 | |
| 82 | // * Labels |
| 83 | let amLabels = inject('labels') |
| 84 | |
| 85 | function labelsDisplay(label) { |
| 86 | let computedLabel = computed(() => { |
| 87 | let translations = amCustomize.value[pageRenderKey.value][stepName.value].translations |
| 88 | return translations && translations[label] && translations[label][langKey.value] |
| 89 | ? translations[label][langKey.value] |
| 90 | : amLabels[label] |
| 91 | }) |
| 92 | |
| 93 | return computedLabel.value |
| 94 | } |
| 95 | |
| 96 | // * Template heading string |
| 97 | let itemIdLabel = computed(() => { |
| 98 | if (props.type === 'appointment') { |
| 99 | return `${labelsDisplay('appointment_id')} #${props.selectedItem.id}` |
| 100 | } |
| 101 | |
| 102 | if (props.type === 'event') { |
| 103 | return `${labelsDisplay('event_id')} #${props.selectedItem.id}` |
| 104 | } |
| 105 | |
| 106 | return '' |
| 107 | }) |
| 108 | |
| 109 | let componentTypes = ref({ |
| 110 | event: markRaw(EventCongratsInfo), |
| 111 | }) |
| 112 | |
| 113 | // * Fonts |
| 114 | let amFonts = inject('amFonts') |
| 115 | |
| 116 | // * Colors |
| 117 | let amColors = inject('amColors') |
| 118 | |
| 119 | // * Css Vars |
| 120 | let cssVars = computed(() => { |
| 121 | return { |
| 122 | '--am-font-family': amFonts.value.fontFamily, |
| 123 | '--am-c-congrats-heading-text': amColors.value.colorMainHeadingText, |
| 124 | '--am-c-congrats-heading-text-op40': useColorTransparency( |
| 125 | amColors.value.colorMainHeadingText, |
| 126 | 0.4, |
| 127 | ), |
| 128 | '--am-c-congrats-text': amColors.value.colorMainText, |
| 129 | '--am-c-congrats-text-op30': useColorTransparency(amColors.value.colorMainText, 0.3), |
| 130 | '--am-c-congrats-text-op40': useColorTransparency(amColors.value.colorMainText, 0.4), |
| 131 | '--am-c-congrats-primary': amColors.value.colorPrimary, |
| 132 | } |
| 133 | }) |
| 134 | </script> |
| 135 | |
| 136 | <style lang="scss"> |
| 137 | #amelia-app-backend-new #amelia-container { |
| 138 | .am-congrats { |
| 139 | &__main { |
| 140 | display: flex; |
| 141 | margin-top: 22px; |
| 142 | flex-direction: column; |
| 143 | align-items: center; |
| 144 | font-family: var(--am-font-family); |
| 145 | margin-bottom: 16px; |
| 146 | |
| 147 | & > * { |
| 148 | $count: 5; |
| 149 | @for $i from 0 through $count { |
| 150 | &:nth-child(#{$i + 1}) { |
| 151 | animation: 600ms cubic-bezier(0.45, 1, 0.4, 1.2) #{$i * 100}ms am-animation-slide-up; |
| 152 | animation-fill-mode: both; |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | & img { |
| 158 | width: 54px; |
| 159 | margin-bottom: 8px; |
| 160 | } |
| 161 | |
| 162 | &-heading { |
| 163 | margin-bottom: 2px; |
| 164 | font-weight: 500; |
| 165 | font-size: 18px; |
| 166 | line-height: 28px; |
| 167 | color: var(--am-c-congrats-heading-text); |
| 168 | } |
| 169 | |
| 170 | &-atc { |
| 171 | margin-top: 16px; |
| 172 | } |
| 173 | |
| 174 | & span { |
| 175 | color: var(--am-c-congrats-heading-text-op40); |
| 176 | font-weight: 400; |
| 177 | font-size: 14px; |
| 178 | line-height: 1.42857; |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | } |
| 183 | </style> |
| 184 |