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