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
1 year ago
cabinetFilters.js
1 year ago
coupon.js
2 years ago
customFields.js
2 years 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
2 years ago
persons.js
1 year ago
recurring.js
1 year ago
shortcodeParams.js
2 years ago
tickets.js
1 year ago
coupon.js
103 lines
| 1 | export default { |
| 2 | namespaced: true, |
| 3 | |
| 4 | state: () => ({ |
| 5 | code: '', |
| 6 | discount: '', |
| 7 | deduction: '', |
| 8 | limit: '', |
| 9 | error: '', |
| 10 | loading: false, |
| 11 | required: false, |
| 12 | payPalActions: null, |
| 13 | servicesIds: [], |
| 14 | }), |
| 15 | |
| 16 | getters: { |
| 17 | getCoupon (state) { |
| 18 | return { |
| 19 | code: state.code, |
| 20 | discount: state.discount, |
| 21 | deduction: state.deduction, |
| 22 | limit: state.limit, |
| 23 | required: state.required, |
| 24 | servicesIds: state.servicesIds, |
| 25 | } |
| 26 | }, |
| 27 | |
| 28 | getCouponValidated (state) { |
| 29 | return !state.required || (state.code !== '') |
| 30 | }, |
| 31 | |
| 32 | getCode (state) { |
| 33 | return state.code |
| 34 | }, |
| 35 | |
| 36 | getError (state) { |
| 37 | return state.error |
| 38 | }, |
| 39 | |
| 40 | getLoading (state) { |
| 41 | return state.loading |
| 42 | }, |
| 43 | |
| 44 | getPayPalActions (state) { |
| 45 | return state.payPalActions |
| 46 | }, |
| 47 | }, |
| 48 | |
| 49 | mutations: { |
| 50 | setCoupon (state, payload) { |
| 51 | state.code = payload.code |
| 52 | state.discount = payload.discount |
| 53 | state.deduction = payload.deduction |
| 54 | state.limit = payload.limit |
| 55 | state.servicesIds = payload.servicesIds |
| 56 | }, |
| 57 | |
| 58 | setCode (state, payload) { |
| 59 | state.code = payload |
| 60 | }, |
| 61 | |
| 62 | setError (state, payload) { |
| 63 | state.error = payload |
| 64 | }, |
| 65 | |
| 66 | setLoading (state, payload) { |
| 67 | state.loading = payload |
| 68 | }, |
| 69 | |
| 70 | setCouponRequired (state, payload) { |
| 71 | state.required = payload |
| 72 | }, |
| 73 | |
| 74 | setPayPalActions (state, payload) { |
| 75 | state.payPalActions = payload |
| 76 | }, |
| 77 | |
| 78 | enablePayPalActions (state) { |
| 79 | if (state.payPalActions) { |
| 80 | state.payPalActions.enable() |
| 81 | } |
| 82 | }, |
| 83 | |
| 84 | disablePayPalActions (state) { |
| 85 | if (state.payPalActions) { |
| 86 | state.payPalActions.disable() |
| 87 | } |
| 88 | }, |
| 89 | }, |
| 90 | |
| 91 | actions: { |
| 92 | resetCoupon ({commit}) { |
| 93 | commit('setCoupon', { |
| 94 | code: '', |
| 95 | discount: '', |
| 96 | deduction: '', |
| 97 | limit: '', |
| 98 | servicesIds: [], |
| 99 | }) |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 |