Congratulations.vue
205 lines
| 1 | <template> |
| 2 | <div> |
| 3 | <div class="am-congrats__main"> |
| 4 | <img |
| 5 | v-if="props.booked.type !== 'event'" |
| 6 | :src=" |
| 7 | props.baseUrls.wpAmeliaPluginURL + |
| 8 | '/v3/src/assets/img/congratulations/congratulations.svg' |
| 9 | " |
| 10 | :alt="props.labels.congratulations" |
| 11 | /> |
| 12 | |
| 13 | <p v-if="props.booked.type !== 'event'" class="am-congrats__main-heading"> |
| 14 | {{ props.labels.congratulations }} |
| 15 | </p> |
| 16 | |
| 17 | <div v-if="props.booked.type === 'event'" class="am-congrats__main-heading-waiting-list"> |
| 18 | <!-- Waiting List info --> |
| 19 | <p |
| 20 | v-if="props.booked.event.bookings[0].status === 'waiting'" |
| 21 | class="am-congrats__main-heading" |
| 22 | > |
| 23 | {{ props.labels.your_position_on_waiting_list }} |
| 24 | {{ '#' + (event.waitingList.peopleWaiting + 1) }} |
| 25 | <br /> |
| 26 | <span> |
| 27 | {{ props.labels.waiting_list_notify_message }} |
| 28 | </span> |
| 29 | </p> |
| 30 | <!-- /Waiting List info --> |
| 31 | |
| 32 | <p class="am-congrats__main-heading"> |
| 33 | {{ event.name }} |
| 34 | </p> |
| 35 | </div> |
| 36 | |
| 37 | <span v-if="itemIdLabel"> |
| 38 | {{ itemIdLabel }} |
| 39 | </span> |
| 40 | |
| 41 | <slot name="positionBelowHeading"></slot> |
| 42 | </div> |
| 43 | |
| 44 | <CongratsInfo> |
| 45 | <template #info> |
| 46 | <component |
| 47 | :is="componentTypes[props.booked.type].template" |
| 48 | v-bind="componentTypes[props.booked.type].props" |
| 49 | > |
| 50 | <template #payment> |
| 51 | <PaymentCongratsInfo |
| 52 | :coupon="props.coupon" |
| 53 | :labels="props.labels" |
| 54 | :booked="props.booked" |
| 55 | :in-dialog="props.inDialog" |
| 56 | ></PaymentCongratsInfo> |
| 57 | </template> |
| 58 | </component> |
| 59 | </template> |
| 60 | <template #customer> |
| 61 | <CustomerCongratsInfo |
| 62 | :labels="props.labels" |
| 63 | :customer="props.customer" |
| 64 | :in-dialog="props.inDialog" |
| 65 | ></CustomerCongratsInfo> |
| 66 | </template> |
| 67 | </CongratsInfo> |
| 68 | |
| 69 | <slot name="positionBottom"></slot> |
| 70 | </div> |
| 71 | </template> |
| 72 | |
| 73 | <script setup> |
| 74 | // * Parts |
| 75 | import CongratsInfo from '../Parts/CongratsInfo.vue' |
| 76 | import EventCongratsInfo from '../Parts/EventCongratsInfo.vue' |
| 77 | import PaymentCongratsInfo from '../Parts/PaymentCongratsInfo.vue' |
| 78 | |
| 79 | // * Import from Vue |
| 80 | import { computed, markRaw } from 'vue' |
| 81 | import CustomerCongratsInfo from '../Parts/CustomerCongratsInfo.vue' |
| 82 | import { useStore } from 'vuex' |
| 83 | |
| 84 | let store = useStore() |
| 85 | |
| 86 | let props = defineProps({ |
| 87 | baseUrls: { |
| 88 | type: Object, |
| 89 | required: true, |
| 90 | }, |
| 91 | labels: { |
| 92 | type: Object, |
| 93 | required: true, |
| 94 | }, |
| 95 | booked: { |
| 96 | type: Object, |
| 97 | required: true, |
| 98 | }, |
| 99 | customer: { |
| 100 | type: Object, |
| 101 | required: true, |
| 102 | }, |
| 103 | coupon: { |
| 104 | type: Object, |
| 105 | required: true, |
| 106 | }, |
| 107 | inDialog: { |
| 108 | type: Boolean, |
| 109 | default: false, |
| 110 | }, |
| 111 | }) |
| 112 | |
| 113 | let event = computed(() => { |
| 114 | if (props.booked.type === 'event') { |
| 115 | return store.getters['eventEntities/getEvent'](props.booked.event.id) |
| 116 | } |
| 117 | |
| 118 | return null |
| 119 | }) |
| 120 | |
| 121 | const componentTypes = { |
| 122 | event: { |
| 123 | template: markRaw(EventCongratsInfo), |
| 124 | props: { |
| 125 | booked: props.booked, |
| 126 | labels: props.labels, |
| 127 | 'in-dialog': props.inDialog, |
| 128 | }, |
| 129 | }, |
| 130 | } |
| 131 | |
| 132 | let itemIdLabel = computed(() => { |
| 133 | if (props.booked && props.booked.data.length) { |
| 134 | if (props.booked.type === 'appointment') { |
| 135 | return `${props.labels.appointment_id} #${props.booked.data[0].appointmentId}` |
| 136 | } |
| 137 | |
| 138 | if (props.booked.type === 'event') { |
| 139 | return `${props.labels.event_id} #${props.booked.data[0].eventId}` |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | return '' |
| 144 | }) |
| 145 | </script> |
| 146 | |
| 147 | <script> |
| 148 | export default { |
| 149 | name: 'CongratulationsPage', |
| 150 | } |
| 151 | </script> |
| 152 | |
| 153 | <style lang="scss"> |
| 154 | .amelia-v2-booking #amelia-container { |
| 155 | .am-congrats { |
| 156 | &__main { |
| 157 | display: flex; |
| 158 | margin-top: 22px; |
| 159 | flex-direction: column; |
| 160 | align-items: center; |
| 161 | font-family: var(--am-font-family); |
| 162 | margin-bottom: 16px; |
| 163 | |
| 164 | & > * { |
| 165 | $count: 5; |
| 166 | @for $i from 0 through $count { |
| 167 | &:nth-child(#{$i + 1}) { |
| 168 | animation: 600ms cubic-bezier(0.45, 1, 0.4, 1.2) #{$i * 100}ms am-animation-slide-up; |
| 169 | animation-fill-mode: both; |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | & img { |
| 175 | width: 54px; |
| 176 | margin-bottom: 8px; |
| 177 | } |
| 178 | |
| 179 | &-heading { |
| 180 | margin-bottom: 2px; |
| 181 | font-weight: 500; |
| 182 | font-size: 18px; |
| 183 | line-height: 28px; |
| 184 | color: var(--am-c-atc-heading-text); |
| 185 | |
| 186 | &-waiting-list { |
| 187 | text-align: center; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | &-atc { |
| 192 | margin-top: 16px; |
| 193 | } |
| 194 | |
| 195 | & span { |
| 196 | color: var(--am-c-atc-heading-text-op40); |
| 197 | font-weight: 400; |
| 198 | font-size: 14px; |
| 199 | line-height: 1.42857; |
| 200 | } |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | </style> |
| 205 |