Footer.vue
282 lines
| 1 | <template> |
| 2 | <div |
| 3 | v-if="props.ready && !props.loading && !props.loadingUpcoming" |
| 4 | class="am-elf__footer" |
| 5 | :class="{ 'am-congrats': isCongratzStep && props.secondButtonShow }" |
| 6 | :style="cssVars" |
| 7 | > |
| 8 | <AmButton |
| 9 | v-if="props.secondButtonShow" |
| 10 | category="secondary" |
| 11 | :type="props.secondaryFooterButtonType" |
| 12 | size="medium" |
| 13 | @click="secondButtonClick" |
| 14 | > |
| 15 | {{ displayLabels(secondaryBtnLabel) }} |
| 16 | </AmButton> |
| 17 | <div |
| 18 | v-if="props.paymentGateway === 'payPal' && !isCongratzStep" |
| 19 | :id="`am-paypal-element-${shortcodeData.counter}`" |
| 20 | ></div> |
| 21 | <AmButton |
| 22 | v-if="props.paymentGateway !== 'payPal' || isCongratzStep" |
| 23 | :class="[{ mainBtnClass }, { 'square-continue': props.paymentGateway === 'square' }]" |
| 24 | :type="props.primaryFooterButtonType" |
| 25 | :category="isWaitingListStep() ? 'waiting' : 'primary'" |
| 26 | size="medium" |
| 27 | :disabled="footerBtnDisabled" |
| 28 | @click="footerButtonClick" |
| 29 | > |
| 30 | {{ displayLabels(primaryBtnLabel) }} |
| 31 | </AmButton> |
| 32 | </div> |
| 33 | <!-- Skeleton --> |
| 34 | <div v-else class="am-elf__footer-skeleton"> |
| 35 | <el-skeleton animated> |
| 36 | <template #template> |
| 37 | <el-skeleton-item /> |
| 38 | <el-skeleton-item /> |
| 39 | </template> |
| 40 | </el-skeleton> |
| 41 | </div> |
| 42 | <!-- /Skeleton --> |
| 43 | </template> |
| 44 | |
| 45 | <script setup> |
| 46 | import AmButton from '../../../_components/button/AmButton.vue' |
| 47 | import { useColorTransparency } from '../../../../assets/js/common/colorManipulation' |
| 48 | import { inject, ref, computed, unref } from 'vue' |
| 49 | |
| 50 | let props = defineProps({ |
| 51 | ready: { |
| 52 | type: Boolean, |
| 53 | default: true, |
| 54 | }, |
| 55 | loading: { |
| 56 | type: Boolean, |
| 57 | default: false, |
| 58 | }, |
| 59 | loadingUpcoming: { |
| 60 | type: Boolean, |
| 61 | default: false, |
| 62 | }, |
| 63 | customizedLabels: { |
| 64 | type: Object, |
| 65 | default: () => { |
| 66 | return {} |
| 67 | }, |
| 68 | }, |
| 69 | primaryFooterButtonType: { |
| 70 | type: String, |
| 71 | default: 'filled', |
| 72 | }, |
| 73 | secondaryFooterButtonType: { |
| 74 | type: String, |
| 75 | default: 'plain', |
| 76 | }, |
| 77 | waitingFooterButtonType: { |
| 78 | type: String, |
| 79 | default: 'filled', |
| 80 | }, |
| 81 | paymentGateway: { |
| 82 | type: String, |
| 83 | default: '', |
| 84 | }, |
| 85 | secondButtonShow: { |
| 86 | type: Boolean, |
| 87 | default: true, |
| 88 | }, |
| 89 | isWaitingList: { |
| 90 | type: Boolean, |
| 91 | default: false, |
| 92 | }, |
| 93 | }) |
| 94 | |
| 95 | // * Step Functions |
| 96 | const { secondButtonClick } = inject('secondButton', { |
| 97 | secondButtonClick: () => {}, |
| 98 | }) |
| 99 | |
| 100 | const { footerButtonClick, footerBtnDisabled } = inject('changingStepsFunctions', { |
| 101 | footerButtonClick: () => {}, |
| 102 | footerBtnDisabled: ref(false), |
| 103 | }) |
| 104 | |
| 105 | const steps = inject('stepsArray') |
| 106 | const currentStep = inject('stepIndex') |
| 107 | |
| 108 | const isCongratzStep = computed(() => { |
| 109 | return currentStep.value === steps.value.length - 1 |
| 110 | }) |
| 111 | |
| 112 | let primaryBtnLabel = computed(() => { |
| 113 | if (isWaitingListStep()) { |
| 114 | // TODO - check from where to pass waitingList settings |
| 115 | return 'join_waiting_list' |
| 116 | } |
| 117 | |
| 118 | if ( |
| 119 | steps.value[currentStep.value].name === 'EventInfo' || |
| 120 | steps.value[currentStep.value].name === 'EventPayment' |
| 121 | ) { |
| 122 | return 'event_book_event' |
| 123 | } |
| 124 | |
| 125 | if (steps.value[currentStep.value].name === 'CongratulationsStep') return 'finish_appointment' |
| 126 | |
| 127 | return 'continue' |
| 128 | }) |
| 129 | |
| 130 | let secondaryBtnLabel = computed(() => { |
| 131 | if (steps.value[currentStep.value].name === 'CongratulationsStep') return 'congrats_panel' |
| 132 | |
| 133 | return 'event_close' |
| 134 | }) |
| 135 | |
| 136 | let mainBtnClass = computed(() => { |
| 137 | if (steps.value[currentStep.value].name === 'CongratulationsStep') |
| 138 | return 'am-elf__footer-btn__finish' |
| 139 | |
| 140 | return '' |
| 141 | }) |
| 142 | |
| 143 | const shortcodeData = inject( |
| 144 | 'shortcodeData', |
| 145 | ref({ |
| 146 | counter: 1000, |
| 147 | }), |
| 148 | ) |
| 149 | |
| 150 | // * Labels |
| 151 | const amLabels = inject('labels') |
| 152 | function displayLabels(label) { |
| 153 | return Object.keys(props.customizedLabels).length && props.customizedLabels[label] |
| 154 | ? props.customizedLabels[label] |
| 155 | : amLabels[label] |
| 156 | } |
| 157 | |
| 158 | function isWaitingListStep() { |
| 159 | return ( |
| 160 | (steps.value[currentStep.value].name === 'EventInfo' || |
| 161 | steps.value[currentStep.value].name === 'EventTickets') && |
| 162 | props.isWaitingList |
| 163 | ) |
| 164 | } |
| 165 | |
| 166 | // * Colors |
| 167 | let amColors = inject( |
| 168 | 'amColors', |
| 169 | ref({ |
| 170 | colorPrimary: '#1246D6', |
| 171 | colorSuccess: '#019719', |
| 172 | colorError: '#B4190F', |
| 173 | colorWarning: '#CCA20C', |
| 174 | colorMainBgr: '#FFFFFF', |
| 175 | colorMainHeadingText: '#33434C', |
| 176 | colorMainText: '#1A2C37', |
| 177 | colorSbBgr: '#17295A', |
| 178 | colorSbText: '#FFFFFF', |
| 179 | colorInpBgr: '#FFFFFF', |
| 180 | colorInpBorder: '#D1D5D7', |
| 181 | colorInpText: '#1A2C37', |
| 182 | colorInpPlaceHolder: '#1A2C37', |
| 183 | colorDropBgr: '#FFFFFF', |
| 184 | colorDropBorder: '#D1D5D7', |
| 185 | colorDropText: '#0E1920', |
| 186 | colorBtnPrim: '#265CF2', |
| 187 | colorBtnPrimText: '#FFFFFF', |
| 188 | colorBtnSec: '#1A2C37', |
| 189 | colorBtnSecText: '#FFFFFF', |
| 190 | }), |
| 191 | ) |
| 192 | |
| 193 | // * Css Vars |
| 194 | let cssVars = computed(() => { |
| 195 | return { |
| 196 | '--am-c-el-text-op15': useColorTransparency(unref(amColors).colorMainText, 0.15), |
| 197 | } |
| 198 | }) |
| 199 | </script> |
| 200 | |
| 201 | <script> |
| 202 | export default { |
| 203 | name: 'EventListFooter', |
| 204 | } |
| 205 | </script> |
| 206 | |
| 207 | <style lang="scss"> |
| 208 | @mixin main-content-footer { |
| 209 | // am -- amelia |
| 210 | // elf -- event list form |
| 211 | // Amelia Form Steps |
| 212 | .am-elf { |
| 213 | &__footer { |
| 214 | display: flex; |
| 215 | justify-content: flex-end; |
| 216 | align-items: center; |
| 217 | gap: 28px; |
| 218 | |
| 219 | &.am-congrats { |
| 220 | justify-content: space-between; |
| 221 | } |
| 222 | |
| 223 | .am-button { |
| 224 | &--primary { |
| 225 | &.is-disabled { |
| 226 | cursor: not-allowed; |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | &-btn { |
| 232 | &__finish { |
| 233 | margin-left: auto !important; |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | &-skeleton { |
| 238 | display: flex; |
| 239 | align-items: center; |
| 240 | justify-content: flex-end; |
| 241 | width: 100%; |
| 242 | box-shadow: 0 -2px 3px rgba(26, 44, 55, 0.15); |
| 243 | |
| 244 | .el-skeleton { |
| 245 | display: flex; |
| 246 | align-items: center; |
| 247 | justify-content: flex-end; |
| 248 | width: 100%; |
| 249 | padding: 16px 24px; |
| 250 | |
| 251 | &__item { |
| 252 | width: 109px; |
| 253 | height: 40px; |
| 254 | |
| 255 | &:first-child { |
| 256 | margin-right: 12px; |
| 257 | } |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | // Public |
| 266 | .amelia-v2-booking { |
| 267 | @include main-content-footer; |
| 268 | } |
| 269 | |
| 270 | // Admin |
| 271 | #amelia-app-backend-new { |
| 272 | @include main-content-footer; |
| 273 | |
| 274 | .am-elf { |
| 275 | &__footer { |
| 276 | padding: 16px; |
| 277 | box-shadow: 0 -2px 3px var(--am-c-el-text-op15, rgba(26, 44, 55, 0.15)); |
| 278 | } |
| 279 | } |
| 280 | } |
| 281 | </style> |
| 282 |