appointment.js
1 month ago
appointmentWaitingListOptions.js
1 month ago
attendee.js
1 month ago
auth.js
1 month ago
bookableType.js
1 month ago
booking.js
1 day ago
cabinet.js
1 month ago
cabinetFilters.js
1 month ago
coupon.js
1 month ago
customFields.js
1 month ago
customerInfo.js
1 month ago
employee.js
1 month ago
entities.js
1 day ago
event.js
1 month ago
eventBooking.js
1 month ago
eventEntities.js
1 month ago
eventWaitingListOptions.js
1 month ago
pagination.js
1 month ago
params.js
1 month ago
payment.js
1 month ago
persons.js
1 month ago
recurring.js
1 month ago
shortcodeParams.js
1 month ago
stepByStepFilters.js
1 month ago
tickets.js
1 week ago
booking.js
712 lines
| 1 | import { settings } from '../../plugins/settings' |
| 2 | |
| 3 | export default { |
| 4 | namespaced: true, |
| 5 | |
| 6 | state: () => ({ |
| 7 | appointment: { |
| 8 | bookingStartDate: '', |
| 9 | bookingStartTime: '', |
| 10 | bookings: [ |
| 11 | { |
| 12 | customer: { |
| 13 | email: '', |
| 14 | externalId: null, |
| 15 | firstName: '', |
| 16 | id: null, |
| 17 | lastName: '', |
| 18 | phone: '', |
| 19 | countryPhoneIso: '', |
| 20 | translations: null, |
| 21 | customFields: null, |
| 22 | subscribeToMailchimp: settings.mailchimp.checkedByDefault, |
| 23 | }, |
| 24 | customFields: {}, |
| 25 | customerId: 0, |
| 26 | extras: [], |
| 27 | persons: 1, |
| 28 | haveMandatoryExtras: false, |
| 29 | minSelectedExtras: 0, |
| 30 | }, |
| 31 | ], |
| 32 | duration: 0, |
| 33 | group: false, |
| 34 | notifyParticipants: '', |
| 35 | payment: { |
| 36 | amount: 0, |
| 37 | gateway: '', |
| 38 | deposit: false, |
| 39 | data: {}, |
| 40 | }, |
| 41 | categoryId: null, |
| 42 | serviceId: null, |
| 43 | locationId: null, |
| 44 | providerId: null, |
| 45 | packageId: null, |
| 46 | }, |
| 47 | coupon: { |
| 48 | code: '', |
| 49 | discount: '', |
| 50 | deduction: '', |
| 51 | limit: '', |
| 52 | required: false, |
| 53 | bookingsCount: 0, |
| 54 | }, |
| 55 | appointmentsIndex: 0, |
| 56 | currentCartItem: null, |
| 57 | shownCart: false, |
| 58 | appointments: [ |
| 59 | { |
| 60 | packageId: null, |
| 61 | serviceId: null, |
| 62 | index: 0, |
| 63 | services: {}, |
| 64 | }, |
| 65 | ], |
| 66 | attachments: {}, |
| 67 | recurringRules: { |
| 68 | repeat: { |
| 69 | type: 'daily', |
| 70 | interval: 1, |
| 71 | }, |
| 72 | occurrence: { |
| 73 | type: 'After', |
| 74 | date: null, |
| 75 | count: 1, |
| 76 | }, |
| 77 | days: [ |
| 78 | { value: 'monday', selected: false }, |
| 79 | { value: 'tuesday', selected: false }, |
| 80 | { value: 'wednesday', selected: false }, |
| 81 | { value: 'thursday', selected: false }, |
| 82 | { value: 'friday', selected: false }, |
| 83 | { value: 'saturday', selected: false }, |
| 84 | { value: 'sunday', selected: false }, |
| 85 | ], |
| 86 | monthly: 0, |
| 87 | }, |
| 88 | loading: false, |
| 89 | booked: null, |
| 90 | ready: false, |
| 91 | packageId: null, |
| 92 | error: '', |
| 93 | lastBookedProviderId: null, |
| 94 | }), |
| 95 | |
| 96 | getters: { |
| 97 | getSelection(state) { |
| 98 | return { |
| 99 | packageId: state.packageId, |
| 100 | categoryId: state.appointment.categoryId, |
| 101 | serviceId: state.appointment.serviceId, |
| 102 | providerId: state.appointment.providerId, |
| 103 | locationId: state.appointment.locationId, |
| 104 | type: state.appointment.type, |
| 105 | } |
| 106 | }, |
| 107 | |
| 108 | getServiceProviderSelection(state) { |
| 109 | return { |
| 110 | serviceId: state.appointment.serviceId, |
| 111 | providerId: state.appointment.providerId, |
| 112 | locationId: state.appointment.locationId, |
| 113 | } |
| 114 | }, |
| 115 | |
| 116 | getPackageId(state) { |
| 117 | return state.packageId |
| 118 | }, |
| 119 | |
| 120 | getCategoryId(state) { |
| 121 | return state.appointment.categoryId |
| 122 | }, |
| 123 | |
| 124 | getServiceId(state) { |
| 125 | return state.appointment.serviceId |
| 126 | }, |
| 127 | |
| 128 | getEmployeeId(state) { |
| 129 | return state.appointment.providerId |
| 130 | }, |
| 131 | |
| 132 | getLocationId(state) { |
| 133 | return state.appointment.locationId |
| 134 | }, |
| 135 | |
| 136 | getBooking(state) { |
| 137 | return state.appointment.bookings[0] |
| 138 | }, |
| 139 | |
| 140 | getBookingPersons(state) { |
| 141 | let i = state.appointmentsIndex |
| 142 | |
| 143 | return state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 144 | state.appointments[i].index |
| 145 | ].persons |
| 146 | }, |
| 147 | |
| 148 | getBookingDuration(state) { |
| 149 | let i = state.appointmentsIndex |
| 150 | |
| 151 | return state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 152 | state.appointments[i].index |
| 153 | ].duration |
| 154 | }, |
| 155 | |
| 156 | getBookableType(state) { |
| 157 | return state.appointment.type |
| 158 | }, |
| 159 | |
| 160 | getAllMultipleAppointments(state) { |
| 161 | return state.appointments |
| 162 | }, |
| 163 | |
| 164 | getMultipleAppointmentsServiceSlots(state) { |
| 165 | let selection = |
| 166 | state.appointments[state.appointmentsIndex].services[ |
| 167 | state.appointments[state.appointmentsIndex].serviceId |
| 168 | ] |
| 169 | |
| 170 | if (selection.providerId || selection.locationId) { |
| 171 | let slots = {} |
| 172 | |
| 173 | for (let date in selection.slots) { |
| 174 | for (let time in selection.slots[date]) { |
| 175 | for (let i = 0; i < selection.slots[date][time].length; i++) { |
| 176 | if ( |
| 177 | (selection.providerId && |
| 178 | selection.slots[date][time][i].e === selection.providerId) || |
| 179 | (selection.locationId && selection.slots[date][time][i].l === selection.locationId) |
| 180 | ) { |
| 181 | if (!(date in slots)) { |
| 182 | slots[date] = {} |
| 183 | } |
| 184 | |
| 185 | slots[date][time] = selection.slots[date][time] |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | return slots |
| 192 | } |
| 193 | |
| 194 | return state.appointments[state.appointmentsIndex].services[ |
| 195 | state.appointments[state.appointmentsIndex].serviceId |
| 196 | ].slots |
| 197 | }, |
| 198 | |
| 199 | getMultipleAppointmentsRange(state) { |
| 200 | let i = state.appointmentsIndex |
| 201 | |
| 202 | return state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 203 | state.appointments[i].index |
| 204 | ].range |
| 205 | }, |
| 206 | |
| 207 | getMultipleAppointmentsAppCount: (state) => (serviceId) => { |
| 208 | let i = state.appointmentsIndex |
| 209 | |
| 210 | return state.appointments[i].services[serviceId].appCount |
| 211 | }, |
| 212 | |
| 213 | getMultipleAppointmentsDate(state) { |
| 214 | let i = state.appointmentsIndex |
| 215 | |
| 216 | return state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 217 | state.appointments[i].index |
| 218 | ].date |
| 219 | }, |
| 220 | |
| 221 | getMultipleAppointmentsOccupied(state) { |
| 222 | return state.appointments[state.appointmentsIndex].services[ |
| 223 | state.appointments[state.appointmentsIndex].serviceId |
| 224 | ].occupied |
| 225 | }, |
| 226 | |
| 227 | getMultipleAppointmentsTime(state) { |
| 228 | let i = state.appointmentsIndex |
| 229 | |
| 230 | return state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 231 | state.appointments[i].index |
| 232 | ].time |
| 233 | }, |
| 234 | |
| 235 | getMultipleAppointmentsSlots(state) { |
| 236 | let i = state.appointmentsIndex |
| 237 | |
| 238 | return state.appointments[i].services[state.appointments[i].serviceId].slots |
| 239 | }, |
| 240 | |
| 241 | getMultipleAppointmentsLastDate(state) { |
| 242 | let i = state.appointmentsIndex |
| 243 | |
| 244 | return state.appointments[i].services[state.appointments[i].serviceId].lastDate |
| 245 | }, |
| 246 | |
| 247 | getSelectedExtras(state) { |
| 248 | let i = state.appointmentsIndex |
| 249 | |
| 250 | return state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 251 | state.appointments[i].index |
| 252 | ].extras |
| 253 | }, |
| 254 | |
| 255 | getCustomerId(state) { |
| 256 | return state.appointment.bookings[0].customer.id |
| 257 | }, |
| 258 | |
| 259 | getCustomerFirstName(state) { |
| 260 | return state.appointment.bookings[0].customer.firstName |
| 261 | }, |
| 262 | |
| 263 | getCustomerLastName(state) { |
| 264 | return state.appointment.bookings[0].customer.lastName |
| 265 | }, |
| 266 | |
| 267 | getCustomerEmail(state) { |
| 268 | return state.appointment.bookings[0].customer.email |
| 269 | }, |
| 270 | |
| 271 | getCustomerPhone(state) { |
| 272 | return state.appointment.bookings[0].customer.phone |
| 273 | }, |
| 274 | |
| 275 | getCustomerCountryPhoneIso(state) { |
| 276 | return state.appointment.bookings[0].customer.countryPhoneIso |
| 277 | }, |
| 278 | |
| 279 | getCustomerSubscribe(state) { |
| 280 | return state.appointment.bookings[0].customer.subscribeToMailchimp |
| 281 | }, |
| 282 | |
| 283 | getCustomerExternalId(state) { |
| 284 | return state.appointment.bookings[0].customer.externalId |
| 285 | }, |
| 286 | |
| 287 | getCustomerTranslations(state) { |
| 288 | return state.appointment.bookings[0].customer.translations |
| 289 | }, |
| 290 | |
| 291 | getCustomerCustomFields(state) { |
| 292 | return state.appointment.bookings[0].customer.customFields |
| 293 | }, |
| 294 | |
| 295 | getAvailableCustomFields(state) { |
| 296 | return state.appointment.bookings[0].customFields |
| 297 | }, |
| 298 | |
| 299 | getRecurringRepeatType(state) { |
| 300 | return state.recurringRules.repeat.type |
| 301 | }, |
| 302 | |
| 303 | getRecurringRepeatInterval(state) { |
| 304 | return state.recurringRules.repeat.interval |
| 305 | }, |
| 306 | |
| 307 | getRecurringOccurrenceType(state) { |
| 308 | return state.recurringRules.occurrence.type |
| 309 | }, |
| 310 | |
| 311 | getRecurringOccurrenceDate(state) { |
| 312 | return state.recurringRules.occurrence.date |
| 313 | }, |
| 314 | |
| 315 | getRecurringOccurrenceCount(state) { |
| 316 | return state.recurringRules.occurrence.count |
| 317 | }, |
| 318 | |
| 319 | getRecurringDays(state) { |
| 320 | return state.recurringRules.days |
| 321 | }, |
| 322 | |
| 323 | getRecurringMonthly(state) { |
| 324 | return state.recurringRules.monthly |
| 325 | }, |
| 326 | |
| 327 | getAttachments(state) { |
| 328 | return state.attachments |
| 329 | }, |
| 330 | |
| 331 | getCoupon(state) { |
| 332 | return state.coupon |
| 333 | }, |
| 334 | |
| 335 | getCouponCode(state) { |
| 336 | return state.coupon.code |
| 337 | }, |
| 338 | |
| 339 | getCouponValidated(state) { |
| 340 | return !state.coupon.required || state.coupon.code !== '' |
| 341 | }, |
| 342 | |
| 343 | getPaymentGateway(state) { |
| 344 | return state.appointment.payment.gateway |
| 345 | }, |
| 346 | |
| 347 | getPaymentDeposit(state) { |
| 348 | return state.appointment.payment.deposit |
| 349 | }, |
| 350 | |
| 351 | getLoading(state) { |
| 352 | return state.loading |
| 353 | }, |
| 354 | |
| 355 | getBooked(state) { |
| 356 | return state.booked |
| 357 | }, |
| 358 | |
| 359 | getError(state) { |
| 360 | return state.error |
| 361 | }, |
| 362 | |
| 363 | getBusyness(state) { |
| 364 | let i = state.appointmentsIndex |
| 365 | let serviceId = state.appointments[i].serviceId |
| 366 | |
| 367 | if (!serviceId || !state.appointments[i].services[serviceId]) { |
| 368 | return {} |
| 369 | } |
| 370 | |
| 371 | return state.appointments[i].services[serviceId].busyness || {} |
| 372 | }, |
| 373 | |
| 374 | getLastBookedProviderId(state) { |
| 375 | return state.lastBookedProviderId |
| 376 | }, |
| 377 | |
| 378 | getCurrentCartItem(state) { |
| 379 | return state.currentCartItem |
| 380 | }, |
| 381 | |
| 382 | getShownCart(state) { |
| 383 | return state.shownCart |
| 384 | }, |
| 385 | |
| 386 | getCartItemIndex(state) { |
| 387 | return state.appointmentsIndex |
| 388 | }, |
| 389 | }, |
| 390 | |
| 391 | mutations: { |
| 392 | setPackageId(state, payload) { |
| 393 | state.packageId = payload |
| 394 | }, |
| 395 | |
| 396 | setCategoryId(state, payload) { |
| 397 | state.appointment.categoryId = payload |
| 398 | }, |
| 399 | |
| 400 | setServiceId(state, payload) { |
| 401 | state.appointment.serviceId = payload |
| 402 | }, |
| 403 | |
| 404 | setEmployeeId(state, payload) { |
| 405 | state.appointment.providerId = payload |
| 406 | }, |
| 407 | |
| 408 | setLocationId(state, payload) { |
| 409 | state.appointment.locationId = payload |
| 410 | }, |
| 411 | |
| 412 | setCartItem(state, payload) { |
| 413 | state.appointments[state.appointmentsIndex] = payload |
| 414 | }, |
| 415 | |
| 416 | setCurrentCartItem(state, payload) { |
| 417 | state.currentCartItem = payload |
| 418 | }, |
| 419 | |
| 420 | setShownCart(state, payload) { |
| 421 | state.shownCart = payload |
| 422 | }, |
| 423 | |
| 424 | setCartItemIndex(state, payload) { |
| 425 | state.appointmentsIndex = payload |
| 426 | }, |
| 427 | |
| 428 | setMultipleAppointments(state, payload) { |
| 429 | state.appointments = payload |
| 430 | }, |
| 431 | |
| 432 | setMultipleAppointmentsServiceId(state, payload) { |
| 433 | state.appointments[state.appointmentsIndex].serviceId = payload |
| 434 | }, |
| 435 | |
| 436 | setMultipleAppointmentsIndex(state, payload) { |
| 437 | state.appointments[state.appointmentsIndex].index = payload |
| 438 | }, |
| 439 | |
| 440 | unsetMultipleAppointmentsData(state, payload) { |
| 441 | let i = state.appointmentsIndex |
| 442 | |
| 443 | if (payload !== '') { |
| 444 | state.appointments[i].services[state.appointments[i].serviceId].list[payload] = { |
| 445 | date: null, |
| 446 | time: null, |
| 447 | providerId: null, |
| 448 | locationId: null, |
| 449 | persons: |
| 450 | state.appointments[i].services[state.appointments[i].serviceId].list[payload].persons, |
| 451 | extras: |
| 452 | state.appointments[i].services[state.appointments[i].serviceId].list[payload].extras, |
| 453 | duration: null, |
| 454 | slots: [], |
| 455 | price: null, |
| 456 | } |
| 457 | } |
| 458 | }, |
| 459 | |
| 460 | unsetRecurringItems(state) { |
| 461 | let i = state.appointmentsIndex |
| 462 | |
| 463 | state.appointments[i].services[state.appointments[i].serviceId].list.length = 1 |
| 464 | }, |
| 465 | |
| 466 | setMultipleAppointmentsRange(state, payload) { |
| 467 | let i = state.appointmentsIndex |
| 468 | |
| 469 | state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 470 | state.appointments[i].index |
| 471 | ].range = payload |
| 472 | }, |
| 473 | |
| 474 | setMultipleAppointmentsExistingApp(state, payload) { |
| 475 | let i = state.appointmentsIndex |
| 476 | |
| 477 | state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 478 | state.appointments[i].index |
| 479 | ].existingApp = payload |
| 480 | }, |
| 481 | |
| 482 | setMultipleAppointmentsAppCount(state, payload) { |
| 483 | let i = state.appointmentsIndex |
| 484 | |
| 485 | state.appointments[i].services[state.appointments[i].serviceId].appCount = payload |
| 486 | }, |
| 487 | |
| 488 | setMultipleAppointmentsDate(state, payload) { |
| 489 | let i = state.appointmentsIndex |
| 490 | |
| 491 | state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 492 | state.appointments[i].index |
| 493 | ].date = payload |
| 494 | }, |
| 495 | |
| 496 | setMultipleAppointmentsTime(state, payload) { |
| 497 | let i = state.appointmentsIndex |
| 498 | |
| 499 | state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 500 | state.appointments[i].index |
| 501 | ].time = payload |
| 502 | }, |
| 503 | |
| 504 | setMultipleAppointmentsSlots(state, payload) { |
| 505 | let i = state.appointmentsIndex |
| 506 | |
| 507 | state.appointments[i].services[state.appointments[i].serviceId].slots = payload |
| 508 | }, |
| 509 | |
| 510 | setMultipleAppointmentsOccupied(state, payload) { |
| 511 | let i = state.appointmentsIndex |
| 512 | |
| 513 | state.appointments[i].services[state.appointments[i].serviceId].occupied = payload |
| 514 | }, |
| 515 | |
| 516 | setMultipleAppointmentsLastDate(state, payload) { |
| 517 | let i = state.appointmentsIndex |
| 518 | |
| 519 | state.appointments[i].services[state.appointments[i].serviceId].lastDate = payload |
| 520 | }, |
| 521 | |
| 522 | setMultipleAppointmentsServiceProvider(state, payload) { |
| 523 | let i = state.appointmentsIndex |
| 524 | |
| 525 | state.appointments[i].services[state.appointments[i].serviceId].providerId = payload |
| 526 | ? parseInt(payload) |
| 527 | : null |
| 528 | }, |
| 529 | |
| 530 | setMultipleAppointmentsServiceLocation(state, payload) { |
| 531 | let i = state.appointmentsIndex |
| 532 | |
| 533 | state.appointments[i].services[state.appointments[i].serviceId].locationId = payload |
| 534 | ? parseInt(payload) |
| 535 | : null |
| 536 | }, |
| 537 | |
| 538 | setBookingPersons(state, payload) { |
| 539 | let i = state.appointmentsIndex |
| 540 | |
| 541 | state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 542 | state.appointments[i].index |
| 543 | ].persons = payload + (settings.appointments.bringingAnyoneLogic === 'additional' ? 1 : 0) |
| 544 | }, |
| 545 | |
| 546 | setBookingDuration(state, payload) { |
| 547 | let i = state.appointmentsIndex |
| 548 | |
| 549 | state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 550 | state.appointments[i].index |
| 551 | ].duration = payload |
| 552 | }, |
| 553 | |
| 554 | setAvailableCustomFields(state, payload) { |
| 555 | let customFields = state.appointment.bookings[0].customer?.customFields |
| 556 | let populateAvailableCustomFields = { ...payload } |
| 557 | |
| 558 | if (state.appointment.bookings[0].customer?.id && customFields) { |
| 559 | let customerCustomFields = JSON.parse(customFields) |
| 560 | |
| 561 | for (let id in customerCustomFields) { |
| 562 | if (populateAvailableCustomFields.hasOwnProperty(id)) { |
| 563 | populateAvailableCustomFields[id].value = customerCustomFields[id].value |
| 564 | } |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | state.appointment.bookings[0].customFields = populateAvailableCustomFields |
| 569 | }, |
| 570 | |
| 571 | setBookableType(state, payload) { |
| 572 | state.appointment.type = payload |
| 573 | }, |
| 574 | |
| 575 | setSelectedExtras(state, payload) { |
| 576 | let i = state.appointmentsIndex |
| 577 | |
| 578 | state.appointments[i].services[state.appointments[i].serviceId].list[ |
| 579 | state.appointments[i].index |
| 580 | ].extras = payload ? payload : [] |
| 581 | }, |
| 582 | |
| 583 | setCustomerId(state, payload) { |
| 584 | state.appointment.bookings[0].customer.id = payload |
| 585 | }, |
| 586 | |
| 587 | setCustomerFirstName(state, payload) { |
| 588 | state.appointment.bookings[0].customer.firstName = payload |
| 589 | }, |
| 590 | |
| 591 | setCustomerLastName(state, payload) { |
| 592 | state.appointment.bookings[0].customer.lastName = payload |
| 593 | }, |
| 594 | |
| 595 | setCustomerEmail(state, payload) { |
| 596 | state.appointment.bookings[0].customer.email = payload |
| 597 | }, |
| 598 | |
| 599 | setCustomerPhone(state, payload) { |
| 600 | state.appointment.bookings[0].customer.phone = payload |
| 601 | }, |
| 602 | |
| 603 | setCustomerCountryPhoneIso(state, payload) { |
| 604 | state.appointment.bookings[0].customer.countryPhoneIso = payload |
| 605 | }, |
| 606 | |
| 607 | setCustomerSubscribe(state, payload) { |
| 608 | state.appointment.bookings[0].customer.subscribeToMailchimp = payload |
| 609 | }, |
| 610 | |
| 611 | setCustomerExternalId(state, payload) { |
| 612 | state.appointment.bookings[0].customer.externalId = payload |
| 613 | }, |
| 614 | |
| 615 | setRecurringRepeatType(state, payload) { |
| 616 | state.recurringRules.repeat.type = payload |
| 617 | }, |
| 618 | |
| 619 | setRecurringRepeatInterval(state, payload) { |
| 620 | state.recurringRules.repeat.interval = payload |
| 621 | }, |
| 622 | |
| 623 | setRecurringOccurrenceType(state, payload) { |
| 624 | state.recurringRules.occurrence.type = payload |
| 625 | }, |
| 626 | |
| 627 | setRecurringOccurrenceDate(state, payload) { |
| 628 | state.recurringRules.occurrence.date = payload |
| 629 | }, |
| 630 | |
| 631 | setRecurringOccurrenceCount(state, payload) { |
| 632 | state.recurringRules.occurrence.count = payload |
| 633 | }, |
| 634 | |
| 635 | setRecurringDays(state, payload) { |
| 636 | state.recurringRules.days.find((day) => day.value === payload.value).selected = |
| 637 | payload.selected |
| 638 | }, |
| 639 | |
| 640 | setRecurringMonthly(state, payload) { |
| 641 | state.recurringRules.monthly = payload |
| 642 | }, |
| 643 | |
| 644 | setCustomerTranslations(state, payload) { |
| 645 | state.appointment.bookings[0].customer.translations = payload |
| 646 | }, |
| 647 | |
| 648 | setCustomerCustomFields(state, payload) { |
| 649 | state.appointment.bookings[0].customer.customFields = payload |
| 650 | }, |
| 651 | |
| 652 | setAttachment(state, payload) { |
| 653 | state.attachments[payload.id] = payload.raw |
| 654 | }, |
| 655 | |
| 656 | setCoupon(state, payload) { |
| 657 | state.coupon = payload |
| 658 | }, |
| 659 | |
| 660 | setCouponCode(state, payload) { |
| 661 | state.coupon.code = payload |
| 662 | }, |
| 663 | |
| 664 | setCouponRequired(state, payload) { |
| 665 | state.coupon.required = payload |
| 666 | }, |
| 667 | |
| 668 | setBookingsCount(state, payload) { |
| 669 | state.coupon.bookingsCount = payload |
| 670 | }, |
| 671 | |
| 672 | setPaymentGateway(state, payload) { |
| 673 | state.appointment.payment.gateway = payload |
| 674 | }, |
| 675 | |
| 676 | setPaymentDeposit(state, payload) { |
| 677 | state.appointment.payment.deposit = payload |
| 678 | }, |
| 679 | |
| 680 | setLoading(state, payload) { |
| 681 | state.loading = payload |
| 682 | }, |
| 683 | |
| 684 | setBooked(state, payload) { |
| 685 | state.booked = payload |
| 686 | }, |
| 687 | |
| 688 | setError(state, payload) { |
| 689 | state.error = payload |
| 690 | }, |
| 691 | |
| 692 | setBusyness(state, payload) { |
| 693 | let i = |
| 694 | payload.cartItemIndex !== undefined && payload.cartItemIndex !== null |
| 695 | ? payload.cartItemIndex |
| 696 | : state.appointmentsIndex |
| 697 | let serviceId = payload.serviceId |
| 698 | |
| 699 | if (serviceId && state.appointments[i] && state.appointments[i].services[serviceId]) { |
| 700 | state.appointments[i].services[serviceId].busyness = payload.busyness |
| 701 | } |
| 702 | }, |
| 703 | |
| 704 | setLastBookedProviderId(state, payload) { |
| 705 | state.lastBookedProviderId = |
| 706 | !payload.fromBackend || (state.lastBookedProviderId === null && payload.providerId !== null) |
| 707 | ? payload.providerId |
| 708 | : state.lastBookedProviderId |
| 709 | }, |
| 710 | }, |
| 711 | } |
| 712 |