ameliabooking
/
v3
/
src
/
views
/
common
/
SbsFormConstruction
/
MainContent
/
parts
/
MainContentFooter.vue
ameliabooking
/
v3
/
src
/
views
/
common
/
SbsFormConstruction
/
MainContent
/
parts
Last commit date
MainContentFooter.vue
1 month ago
MainContentHeader.vue
2 weeks ago
MainPanelHeader.vue
1 month ago
MainProfileFooter.vue
1 month ago
MainContentFooter.vue
332 lines
| 1 | <template> |
| 2 | <div |
| 3 | v-if="!props.loading" |
| 4 | class="am-fs__main-footer" |
| 5 | :class="[ |
| 6 | { 'am-fs__main-footer-cp': props.secondButtonShow }, |
| 7 | { 'am-fs__main-footer-cp-mobile-s': mobileS && props.secondButtonShow }, |
| 8 | { |
| 9 | 'am-fs__main-footer__cart': props.addToCartButtonShow || props.backToCartButtonShow, |
| 10 | }, |
| 11 | { |
| 12 | 'am-fs__main-footer__cart-mobile-s': |
| 13 | (props.addToCartButtonShow || props.backToCartButtonShow) && mobileS, |
| 14 | }, |
| 15 | ]" |
| 16 | :style="cssVars" |
| 17 | > |
| 18 | <template v-if="ready"> |
| 19 | <AmButton |
| 20 | v-if="props.secondButtonShow" |
| 21 | category="secondary" |
| 22 | :type="props.secondaryFooterButtonType" |
| 23 | @click="secondButtonClick" |
| 24 | > |
| 25 | {{ displayLabels('congrats_panel') }} |
| 26 | </AmButton> |
| 27 | <AmButton |
| 28 | v-if="props.addToCartButtonShow" |
| 29 | class="am-button-cart" |
| 30 | category="secondary" |
| 31 | :type="props.addToCartButtonType" |
| 32 | @click="addToCartButtonClick" |
| 33 | > |
| 34 | <span class="am-icon-plus"></span>{{ displayLabels('cart_add_button') }} |
| 35 | </AmButton> |
| 36 | <AmButton |
| 37 | v-if="props.backToCartButtonShow" |
| 38 | class="am-button-cart" |
| 39 | category="secondary" |
| 40 | :type="props.backToCartButtonType" |
| 41 | @click="backToCartButtonClick" |
| 42 | > |
| 43 | {{ props.backToCartLabel }} |
| 44 | </AmButton> |
| 45 | <div |
| 46 | v-if="props.paymentGateway === 'payPal' && !isCongratzStep" |
| 47 | :id="'am-paypal-element-' + shortcodeData.counter" |
| 48 | ></div> |
| 49 | <AmButton |
| 50 | v-if="props.paymentGateway !== 'payPal' || isCongratzStep" |
| 51 | class="am-button-continue" |
| 52 | :class="{ 'square-continue': props.paymentGateway === 'square' }" |
| 53 | :disabled="isCongratzStep ? false : footerBtnDisabled" |
| 54 | :type="props.primaryFooterButtonType" |
| 55 | @click="continueClick" |
| 56 | > |
| 57 | {{ displayLabels(labelValue) }} |
| 58 | </AmButton> |
| 59 | </template> |
| 60 | <template v-else> |
| 61 | <!-- Skeleton --> |
| 62 | <div class="am-fs__main-footer-skeleton"> |
| 63 | <el-skeleton animated> |
| 64 | <template #template> |
| 65 | <el-skeleton-item /> |
| 66 | </template> |
| 67 | </el-skeleton> |
| 68 | </div> |
| 69 | <!-- /Skeleton --> |
| 70 | </template> |
| 71 | </div> |
| 72 | </template> |
| 73 | |
| 74 | <script setup> |
| 75 | import AmButton from '../../../../_components/button/AmButton.vue' |
| 76 | import { computed, inject, ref, watch } from 'vue' |
| 77 | import { useColorTransparency } from '../../../../../assets/js/common/colorManipulation' |
| 78 | |
| 79 | let props = defineProps({ |
| 80 | loading: { |
| 81 | type: Boolean, |
| 82 | default: false, |
| 83 | }, |
| 84 | ready: { |
| 85 | type: Boolean, |
| 86 | default: true, |
| 87 | }, |
| 88 | customizedLabels: { |
| 89 | type: Object, |
| 90 | default: () => { |
| 91 | return {} |
| 92 | }, |
| 93 | }, |
| 94 | primaryFooterButtonType: { |
| 95 | type: String, |
| 96 | default: 'filled', |
| 97 | }, |
| 98 | secondaryFooterButtonType: { |
| 99 | type: String, |
| 100 | default: 'filled', |
| 101 | }, |
| 102 | paymentGateway: { |
| 103 | type: String, |
| 104 | default: '', |
| 105 | }, |
| 106 | secondButtonShow: { |
| 107 | type: Boolean, |
| 108 | required: false, |
| 109 | }, |
| 110 | addToCartButtonShow: { |
| 111 | type: Boolean, |
| 112 | required: false, |
| 113 | }, |
| 114 | addToCartButtonType: { |
| 115 | type: String, |
| 116 | required: 'text', |
| 117 | }, |
| 118 | backToCartButtonShow: { |
| 119 | type: Boolean, |
| 120 | required: false, |
| 121 | }, |
| 122 | backToCartButtonType: { |
| 123 | type: String, |
| 124 | required: 'text', |
| 125 | }, |
| 126 | backToCartLabel: { |
| 127 | type: String, |
| 128 | default: '', |
| 129 | }, |
| 130 | }) |
| 131 | |
| 132 | const emits = defineEmits(['addToCart', 'backToCart']) |
| 133 | |
| 134 | // * Step Functions |
| 135 | const { secondButtonClick } = inject('secondButton', { |
| 136 | secondButtonClick: () => {}, |
| 137 | }) |
| 138 | |
| 139 | const { footerButtonClick, footerBtnDisabled } = inject('changingStepsFunctions', { |
| 140 | footerButtonClick: () => {}, |
| 141 | }) |
| 142 | |
| 143 | function removeFocusFromButton(e) { |
| 144 | if (e.target.classList.value.split(' ').indexOf('am-button') === -1) { |
| 145 | e.target.parentNode.blur() |
| 146 | } else { |
| 147 | e.target.blur() |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | function continueClick(e) { |
| 152 | removeFocusFromButton(e) |
| 153 | footerButtonClick() |
| 154 | } |
| 155 | |
| 156 | // * Labels |
| 157 | const amLabels = inject('labels') |
| 158 | |
| 159 | // * Check current step for button text (continue/finish) |
| 160 | const sidebarSteps = inject('sidebarSteps') |
| 161 | const stepIndex = inject('stepIndex') |
| 162 | |
| 163 | let labelValue = ref('continue') |
| 164 | |
| 165 | // flag for payPal button on congratz step |
| 166 | let isCongratzStep = ref(false) |
| 167 | |
| 168 | watch(stepIndex, (value) => { |
| 169 | if (value === sidebarSteps.value.length) { |
| 170 | labelValue.value = 'finish_appointment' |
| 171 | isCongratzStep.value = true |
| 172 | } else { |
| 173 | labelValue.value = 'continue' |
| 174 | } |
| 175 | }) |
| 176 | |
| 177 | const shortcodeData = inject( |
| 178 | 'shortcodeData', |
| 179 | ref({ |
| 180 | counter: 1000, |
| 181 | }), |
| 182 | ) |
| 183 | |
| 184 | function displayLabels(label) { |
| 185 | return Object.keys(props.customizedLabels).length && props.customizedLabels[label] |
| 186 | ? props.customizedLabels[label] |
| 187 | : amLabels[label] |
| 188 | } |
| 189 | |
| 190 | function addToCartButtonClick() { |
| 191 | emits('addToCart') |
| 192 | } |
| 193 | |
| 194 | function backToCartButtonClick() { |
| 195 | emits('backToCart') |
| 196 | } |
| 197 | |
| 198 | // * Colors |
| 199 | let amColors = inject( |
| 200 | 'amColors', |
| 201 | ref({ |
| 202 | colorPrimary: '#1246D6', |
| 203 | colorSuccess: '#019719', |
| 204 | colorError: '#B4190F', |
| 205 | colorWarning: '#CCA20C', |
| 206 | colorMainBgr: '#FFFFFF', |
| 207 | colorMainHeadingText: '#33434C', |
| 208 | colorMainText: '#1A2C37', |
| 209 | colorSbBgr: '#17295A', |
| 210 | colorSbText: '#FFFFFF', |
| 211 | colorInpBgr: '#FFFFFF', |
| 212 | colorInpBorder: '#D1D5D7', |
| 213 | colorInpText: '#1A2C37', |
| 214 | colorInpPlaceHolder: '#1A2C37', |
| 215 | colorDropBgr: '#FFFFFF', |
| 216 | colorDropBorder: '#D1D5D7', |
| 217 | colorDropText: '#0E1920', |
| 218 | colorBtnPrim: '#265CF2', |
| 219 | colorBtnPrimText: '#FFFFFF', |
| 220 | colorBtnSec: '#1A2C37', |
| 221 | colorBtnSecText: '#FFFFFF', |
| 222 | }), |
| 223 | ) |
| 224 | let cssVars = computed(() => { |
| 225 | return { |
| 226 | '--am-c-main-text-op15': useColorTransparency(amColors.value.colorMainText, 0.15), |
| 227 | '--am-c-success-op20': useColorTransparency(amColors.value.colorSuccess, 0.2), |
| 228 | } |
| 229 | }) |
| 230 | |
| 231 | let cWidth = inject('containerWidth', 0) |
| 232 | let mobileS = computed(() => cWidth.value < 420) |
| 233 | </script> |
| 234 | |
| 235 | <script> |
| 236 | export default { |
| 237 | name: 'MainContentFooter', |
| 238 | } |
| 239 | </script> |
| 240 | |
| 241 | <style lang="scss"> |
| 242 | @mixin main-content-footer { |
| 243 | // am -- amelia |
| 244 | // fs -- form steps |
| 245 | // Amelia Form Steps |
| 246 | .am-fs { |
| 247 | // Main Container |
| 248 | &__main { |
| 249 | &-footer { |
| 250 | position: absolute; |
| 251 | left: 0; |
| 252 | bottom: 0; |
| 253 | display: flex; |
| 254 | align-items: center; |
| 255 | justify-content: flex-end; |
| 256 | width: 100%; |
| 257 | padding: 8px 32px; |
| 258 | background-color: transparent; |
| 259 | box-shadow: 0 -2px 3px var(--am-c-main-text-op15); |
| 260 | |
| 261 | // cp - customer panel - button on congratulations page |
| 262 | &-cp, |
| 263 | &-ba { |
| 264 | display: flex; |
| 265 | justify-content: space-between; |
| 266 | |
| 267 | &-mobile-s { |
| 268 | padding: 8px; |
| 269 | |
| 270 | .am-button--secondary { |
| 271 | padding: 8px; |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | &__cart { |
| 277 | justify-content: space-between; |
| 278 | |
| 279 | &-mobile-s { |
| 280 | padding: 8px; |
| 281 | |
| 282 | .am-button--secondary { |
| 283 | padding: 8px; |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | .am-button-cart { |
| 289 | .am-icon-plus { |
| 290 | display: flex; |
| 291 | align-items: center; |
| 292 | justify-content: center; |
| 293 | font-size: 20px; |
| 294 | color: var(--am-c-success); |
| 295 | background-color: var(--am-c-success-op20); |
| 296 | width: 20px; |
| 297 | height: 20px; |
| 298 | border-radius: 50%; |
| 299 | margin: 0 4px 0 0; |
| 300 | &:before { |
| 301 | width: 20px; |
| 302 | height: 20px; |
| 303 | line-height: 20px; |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | &-skeleton { |
| 309 | .el-skeleton { |
| 310 | padding: 0; |
| 311 | &__item { |
| 312 | width: 109px; |
| 313 | height: 40px; |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | // Public |
| 323 | .amelia-v2-booking #amelia-container { |
| 324 | @include main-content-footer; |
| 325 | } |
| 326 | |
| 327 | // Admin |
| 328 | #amelia-app-backend-new { |
| 329 | @include main-content-footer; |
| 330 | } |
| 331 | </style> |
| 332 |