PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.20
Booking for Appointments and Events Calendar – Amelia v1.2.20
2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / v3 / src / store / modules / customFields.js
ameliabooking / v3 / src / store / modules Last commit date
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
customFields.js
88 lines
1 export default {
2 namespaced: true,
3
4 state: () => ({
5 customFieldsArray: [],
6 customFields: {},
7 }),
8
9 getters: {
10 getFilteredCustomFieldsArray (state) {
11 return state.customFieldsArray
12 },
13 getCustomFields (state) {
14 return state.customFields
15 },
16
17 getCustomFieldValue: (state) => (field) => {
18 return state.customFields[field].value
19 },
20
21 getAllData (state) {
22 return {
23 // customFieldsArray: state.customFieldsArray,
24 customFields: state.customFields,
25 }
26 }
27 },
28
29 mutations: {
30 setFilteredCustomFieldsArray (state, payload) {
31 state.customFieldsArray = payload
32 },
33
34 setCustomFields (state, payload) {
35 state.customFields = payload
36 },
37
38 setCustomFieldValue (state, payload) {
39 state.customFields[payload.key].value = payload.value
40 },
41
42 setAllData (state, payoad) {
43 // state.customFieldsArray = payoad.customFieldsArray
44 state.customFields = payoad.customFields
45 }
46 },
47
48 actions: {
49 filterEventCustomFields ({ commit, getters, rootGetters }) {
50 let eventId = rootGetters['eventBooking/getSelectedEventId']
51 let filteredCustomFieldsArr = []
52 let customFields = {}
53 rootGetters['eventEntities/getCustomFields'].forEach(c => {
54 if (c.events.find(event => event.id === parseInt(eventId)) || c.allEvents) {
55 filteredCustomFieldsArr.push(c)
56
57 customFields[`cf${c.id}`] = {
58 id: c.id,
59 label: c.label,
60 type: c.type,
61 position: c.position,
62 options: c.options,
63 required: c.required,
64 width: c.width
65 }
66
67 switch (c.type) {
68 case ('checkbox'):
69 case ('file'):
70 customFields[`cf${c.id}`].value = []
71
72 break
73
74 default:
75 customFields[`cf${c.id}`].value = ''
76 }
77
78 if (getters['getCustomFields'][`cf${c.id}`]) {
79 customFields[`cf${c.id}`].value = getters['getCustomFields'][`cf${c.id}`]['value']
80 }
81 }
82 })
83
84 commit('setFilteredCustomFieldsArray', filteredCustomFieldsArr)
85 commit('setCustomFields', customFields)
86 }
87 }
88 }