ameliabooking
/
v3
/
src
/
views
/
admin
/
customize
/
steps
/
Cabinet
/
common
/
Appointments
/
Appointments.vue
ameliabooking
/
v3
/
src
/
views
/
admin
/
customize
/
steps
/
Cabinet
/
common
/
Appointments
Last commit date
parts
1 month ago
Appointments.vue
1 month ago
Appointments.vue
369 lines
| 1 | <template> |
| 2 | <div ref="pageContainer" class="am-cap"> |
| 3 | <CabinetFilters :param-list="paramList" :responsive-class="responsiveClass" /> |
| 4 | |
| 5 | <div v-if="pageRenderKey === 'cape'" class="am-cap__actions"> |
| 6 | <AmButton |
| 7 | prefix="plus" |
| 8 | size="small" |
| 9 | category="primary" |
| 10 | :type="amCustomize.cape.appointments.options.newAppBtn.buttonType" |
| 11 | > |
| 12 | <span>{{ amLabels.new_appointment }}</span> |
| 13 | </AmButton> |
| 14 | </div> |
| 15 | |
| 16 | <AppointmentsList |
| 17 | :grouped-appointments="dateGroupedAppointments" |
| 18 | :page-width="pageWidth" |
| 19 | :responsive-class="responsiveClass" |
| 20 | ></AppointmentsList> |
| 21 | </div> |
| 22 | </template> |
| 23 | |
| 24 | <script setup> |
| 25 | // * Import from libraries |
| 26 | import moment from 'moment' |
| 27 | |
| 28 | // * Import from Vue |
| 29 | import { ref, computed, watch, inject, onMounted, nextTick } from 'vue' |
| 30 | |
| 31 | // * Import composables |
| 32 | import { useReactiveCustomize } from '../../../../../../../assets/js/admin/useReactiveCustomize.js' |
| 33 | |
| 34 | import CabinetFilters from '../parts/Filters.vue' |
| 35 | import AppointmentsList from './parts/AppointmentsList.vue' |
| 36 | |
| 37 | // * Composables |
| 38 | import { useResponsiveClass } from '../../../../../../../assets/js/common/responsive' |
| 39 | import AmButton from '../../../../../../_components/button/AmButton.vue' |
| 40 | |
| 41 | let pageRenderKey = inject('pageRenderKey') |
| 42 | |
| 43 | // * Plugin Licence |
| 44 | let licence = inject('licence') |
| 45 | |
| 46 | // * Page Content width |
| 47 | let pageContainer = ref(null) |
| 48 | let pageWidth = ref(0) |
| 49 | |
| 50 | // * Global labels |
| 51 | let amLabels = inject('labels') |
| 52 | |
| 53 | // * Customize |
| 54 | const { amCustomize } = useReactiveCustomize() |
| 55 | |
| 56 | // * Sidebar collapsed var |
| 57 | let sidebarCollapsed = inject('sidebarCollapsed') |
| 58 | |
| 59 | // * window resize listener |
| 60 | window.addEventListener('resize', resize) |
| 61 | // * resize function |
| 62 | function resize() { |
| 63 | if (pageContainer.value) { |
| 64 | pageWidth.value = pageContainer.value.offsetWidth |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | watch(sidebarCollapsed, (current) => { |
| 69 | if (current) { |
| 70 | setTimeout(() => { |
| 71 | collapseTriggered() |
| 72 | }, 1500) |
| 73 | } else { |
| 74 | setTimeout(() => { |
| 75 | collapseTriggered() |
| 76 | }, 500) |
| 77 | } |
| 78 | }) |
| 79 | |
| 80 | function collapseTriggered() { |
| 81 | pageWidth.value = pageContainer.value.offsetWidth |
| 82 | } |
| 83 | |
| 84 | onMounted(() => { |
| 85 | nextTick(() => { |
| 86 | pageWidth.value = pageContainer.value.offsetWidth |
| 87 | }) |
| 88 | }) |
| 89 | |
| 90 | let responsiveClass = computed(() => { |
| 91 | return useResponsiveClass(pageWidth.value) |
| 92 | }) |
| 93 | |
| 94 | let paramList = ref({ |
| 95 | dates: { |
| 96 | name: 'dates', |
| 97 | }, |
| 98 | services: { |
| 99 | name: 'services', |
| 100 | icon: 'service', |
| 101 | ids: [], |
| 102 | }, |
| 103 | providers: { |
| 104 | name: 'providers', |
| 105 | icon: 'employee', |
| 106 | ids: [], |
| 107 | }, |
| 108 | locations: { |
| 109 | name: 'locations', |
| 110 | icon: 'locations', |
| 111 | ids: [], |
| 112 | }, |
| 113 | }) |
| 114 | |
| 115 | if (licence.isStarter) { |
| 116 | delete paramList.value.locations |
| 117 | } |
| 118 | |
| 119 | if (pageRenderKey.value === 'cape') { |
| 120 | delete paramList.value.providers |
| 121 | paramList.value.customers = { |
| 122 | name: 'customers', |
| 123 | icon: 'user', |
| 124 | ids: [], |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | let arrApp = [ |
| 129 | { |
| 130 | when: 0, |
| 131 | name: 'Entrepreneurial and private clients', |
| 132 | status: 'approved', |
| 133 | }, |
| 134 | { |
| 135 | when: 0, |
| 136 | name: 'Family business services', |
| 137 | status: 'approved', |
| 138 | }, |
| 139 | { |
| 140 | when: 2, |
| 141 | name: 'Sustainability and climate change', |
| 142 | status: 'pending', |
| 143 | }, |
| 144 | { |
| 145 | when: 2, |
| 146 | name: 'Audit and assurance', |
| 147 | status: 'canceled', |
| 148 | }, |
| 149 | { |
| 150 | when: 5, |
| 151 | name: 'Industrial engineering', |
| 152 | status: 'rejected', |
| 153 | }, |
| 154 | { |
| 155 | when: 5, |
| 156 | name: 'Operations management', |
| 157 | status: 'pending', |
| 158 | }, |
| 159 | { |
| 160 | when: 5, |
| 161 | name: 'Organizational Development', |
| 162 | status: 'approved', |
| 163 | }, |
| 164 | ] |
| 165 | |
| 166 | let dateGroupedAppointments = ref({}) |
| 167 | |
| 168 | arrApp.forEach((item, index) => { |
| 169 | if ( |
| 170 | Object.keys(dateGroupedAppointments.value).indexOf( |
| 171 | moment().add(item.when, 'days').format('YYYY-MM-DD'), |
| 172 | ) < 0 |
| 173 | ) { |
| 174 | dateGroupedAppointments.value[moment().add(item.when, 'days').format('YYYY-MM-DD')] = {} |
| 175 | dateGroupedAppointments.value[moment().add(item.when, 'days').format('YYYY-MM-DD')].date = |
| 176 | moment().add(item.when, 'days').format('YYYY-MM-DD') |
| 177 | dateGroupedAppointments.value[ |
| 178 | moment().add(item.when, 'days').format('YYYY-MM-DD') |
| 179 | ].appointments = [] |
| 180 | } |
| 181 | |
| 182 | let app = { |
| 183 | id: index, |
| 184 | bookingEnd: `${moment().add(item.when, 'days').format('YYYY-MM-DD')} 08:10:00`, |
| 185 | bookingStart: `${moment().add(item.when, 'days').format('YYYY-MM-DD')} 08:00:00`, |
| 186 | bookings: [ |
| 187 | { |
| 188 | actionsCompleted: null, |
| 189 | aggregatedPrice: true, |
| 190 | appointmentId: 1, |
| 191 | coupon: null, |
| 192 | couponId: null, |
| 193 | created: '2023-10-02 13:46:48', |
| 194 | customFields: [ |
| 195 | { label: 'Custom field 1', value: '' }, |
| 196 | { label: 'Custom field 2', value: '' }, |
| 197 | { label: 'Custom field 3', value: '' }, |
| 198 | ], |
| 199 | customer: { |
| 200 | birthday: null, |
| 201 | countryPhoneIso: 'us', |
| 202 | email: 'testjanedoe@test.com', |
| 203 | externalId: null, |
| 204 | firstName: 'Jane', |
| 205 | gender: null, |
| 206 | id: 1, |
| 207 | lastName: 'Doe', |
| 208 | note: null, |
| 209 | phone: '+15056260628', |
| 210 | pictureFullPath: null, |
| 211 | pictureThumbPath: null, |
| 212 | status: 'visible', |
| 213 | translations: null, |
| 214 | type: 'customer', |
| 215 | zoomUserId: null, |
| 216 | }, |
| 217 | customerId: 1, |
| 218 | duration: null, |
| 219 | extras: [ |
| 220 | { |
| 221 | aggregatedPrice: false, |
| 222 | customerBookingId: 2443, |
| 223 | description: '', |
| 224 | duration: 1800, |
| 225 | extraId: 1, |
| 226 | id: 1, |
| 227 | maxQuantity: 5, |
| 228 | name: 'Extra 1', |
| 229 | position: 1, |
| 230 | price: 10, |
| 231 | quantity: 2, |
| 232 | serviceId: null, |
| 233 | translations: null, |
| 234 | }, |
| 235 | { |
| 236 | aggregatedPrice: false, |
| 237 | customerBookingId: 2443, |
| 238 | description: '', |
| 239 | duration: 1800, |
| 240 | extraId: 2, |
| 241 | id: 2, |
| 242 | maxQuantity: 5, |
| 243 | name: 'Extra 2', |
| 244 | position: 2, |
| 245 | price: 20, |
| 246 | quantity: 3, |
| 247 | serviceId: null, |
| 248 | translations: null, |
| 249 | }, |
| 250 | { |
| 251 | aggregatedPrice: false, |
| 252 | customerBookingId: 2443, |
| 253 | description: '', |
| 254 | duration: 1800, |
| 255 | extraId: 3, |
| 256 | id: 3, |
| 257 | maxQuantity: 5, |
| 258 | name: 'Extra 3', |
| 259 | position: 3, |
| 260 | price: 15, |
| 261 | quantity: 1, |
| 262 | serviceId: null, |
| 263 | translations: null, |
| 264 | }, |
| 265 | ], |
| 266 | id: 1, |
| 267 | info: '{"firstName":"Jane","lastName":"Doe","phone":null,"locale":"en_US","timeZone":"Europe\\/Belgrade","urlParams":null}', |
| 268 | isChangedStatus: null, |
| 269 | isLastBooking: null, |
| 270 | isUpdated: null, |
| 271 | packageCustomerService: { |
| 272 | bookingsCount: null, |
| 273 | id: 243, |
| 274 | locationId: null, |
| 275 | packageCustomer: { |
| 276 | bookingsCount: null, |
| 277 | coupon: null, |
| 278 | couponId: null, |
| 279 | customerId: null, |
| 280 | end: null, |
| 281 | id: null, |
| 282 | packageId: null, |
| 283 | payments: [], |
| 284 | price: null, |
| 285 | purchased: null, |
| 286 | start: null, |
| 287 | status: null, |
| 288 | }, |
| 289 | providerId: null, |
| 290 | serviceId: null, |
| 291 | }, |
| 292 | payments: [], |
| 293 | persons: 1, |
| 294 | price: 0, |
| 295 | status: item.status, |
| 296 | ticketsData: [], |
| 297 | token: null, |
| 298 | utcOffset: null, |
| 299 | }, |
| 300 | ], |
| 301 | cancelable: true, |
| 302 | googleCalendarEventId: null, |
| 303 | googleMeetUrl: '#', |
| 304 | internalNotes: '', |
| 305 | isFull: null, |
| 306 | isGroup: false, |
| 307 | isRescheduled: null, |
| 308 | lessonSpace: '#', |
| 309 | location: 'Location 1', |
| 310 | locationId: 1, |
| 311 | notifyParticipants: 1, |
| 312 | outlookCalendarEventId: null, |
| 313 | microsoftTeamsUrl: '#', |
| 314 | parentId: null, |
| 315 | past: false, |
| 316 | provider: { |
| 317 | firstName: 'John', |
| 318 | lastName: 'Doe', |
| 319 | }, |
| 320 | providerId: 1, |
| 321 | reschedulable: true, |
| 322 | resources: [], |
| 323 | service: { |
| 324 | name: item.name, |
| 325 | }, |
| 326 | serviceId: index, |
| 327 | status: item.status, |
| 328 | type: 'appointment', |
| 329 | zoomMeeting: { |
| 330 | joinUrl: '#', |
| 331 | }, |
| 332 | } |
| 333 | |
| 334 | dateGroupedAppointments.value[ |
| 335 | moment().add(item.when, 'days').format('YYYY-MM-DD') |
| 336 | ].appointments.push(app) |
| 337 | }) |
| 338 | </script> |
| 339 | |
| 340 | <script> |
| 341 | export default { |
| 342 | name: 'CabinetAppointments', |
| 343 | key: 'appointments', |
| 344 | } |
| 345 | </script> |
| 346 | |
| 347 | <style lang="scss"> |
| 348 | @mixin am-cabinet-appointments { |
| 349 | .am-cap { |
| 350 | &__actions { |
| 351 | width: 100%; |
| 352 | display: flex; |
| 353 | justify-content: flex-end; |
| 354 | margin: 0 0 16px; |
| 355 | |
| 356 | .am-button { |
| 357 | .am-icon-plus { |
| 358 | font-size: 24px; |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | #amelia-app-backend-new #amelia-container { |
| 366 | @include am-cabinet-appointments; |
| 367 | } |
| 368 | </style> |
| 369 |