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