PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
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 16 hours ago appointmentWaitingListOptions.js 16 hours ago attendee.js 16 hours ago auth.js 16 hours ago bookableType.js 16 hours ago booking.js 16 hours ago cabinet.js 16 hours ago cabinetFilters.js 16 hours ago coupon.js 16 hours ago customFields.js 16 hours ago customerInfo.js 16 hours ago employee.js 16 hours ago entities.js 16 hours ago event.js 16 hours ago eventBooking.js 16 hours ago eventEntities.js 16 hours ago eventWaitingListOptions.js 16 hours ago pagination.js 16 hours ago params.js 16 hours ago payment.js 16 hours ago persons.js 16 hours ago recurring.js 16 hours ago shortcodeParams.js 16 hours ago stepByStepFilters.js 16 hours ago tickets.js 16 hours ago
customFields.js
112 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 setCustomField(state, payload) {
39 state.customFields[payload.key] = payload
40 },
41
42 setCustomFieldValue(state, payload) {
43 state.customFields[payload.key].value = payload.value
44 },
45
46 setAllData(state, payoad) {
47 // state.customFieldsArray = payoad.customFieldsArray
48 state.customFields = payoad.customFields
49 },
50
51 populateCustomerCustomFields(state, payload) {
52 let customerCustomFields = payload.customFields ? JSON.parse(payload.customFields) : {}
53 let populateAvailableCustomFields = state.customFields
54
55 for (let id in customerCustomFields) {
56 if (populateAvailableCustomFields.hasOwnProperty('cf' + id)) {
57 populateAvailableCustomFields['cf' + id].value = customerCustomFields[id].value
58 }
59 }
60
61 state.customFields = populateAvailableCustomFields
62 },
63 },
64
65 actions: {
66 filterEventCustomFields({ commit, getters, rootGetters }) {
67 let eventId = rootGetters['eventBooking/getSelectedEventId']
68 let filteredCustomFieldsArr = []
69 let customFields = {}
70 rootGetters['eventEntities/getCustomFields'].forEach((c) => {
71 if (
72 c.events.find((event) => event.id === parseInt(eventId)) ||
73 c.allEvents ||
74 c.saveType === 'customer'
75 ) {
76 filteredCustomFieldsArr.push(c)
77
78 customFields[`cf${c.id}`] = {
79 id: c.id,
80 label: c.label,
81 type: c.type,
82 position: c.position,
83 options: c.options,
84 required: c.required,
85 width: c.width,
86 saveFirstChoice: c.saveFirstChoice,
87 saveType: c.saveType,
88 }
89
90 switch (c.type) {
91 case 'checkbox':
92 case 'file':
93 customFields[`cf${c.id}`].value = []
94
95 break
96
97 default:
98 customFields[`cf${c.id}`].value = ''
99 }
100
101 if (getters['getCustomFields'][`cf${c.id}`]) {
102 customFields[`cf${c.id}`].value = getters['getCustomFields'][`cf${c.id}`]['value']
103 }
104 }
105 })
106
107 commit('setFilteredCustomFieldsArray', filteredCustomFieldsArr)
108 commit('setCustomFields', customFields)
109 },
110 },
111 }
112