@worksafevictoria/wcl7.5 1.1.0-beta.78 → 1.1.0-beta.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<single-taxonomy
|
|
6
6
|
v-for="(t, i) in computedPropFilters"
|
|
7
7
|
:key="i"
|
|
8
|
-
|
|
8
|
+
ref="items"
|
|
9
9
|
:data="t"
|
|
10
10
|
:results="filteredList.length"
|
|
11
11
|
:loading="isFiltering"
|
|
@@ -62,7 +62,7 @@ import Row from '../../Containers/Row/index.vue'
|
|
|
62
62
|
import FilterButton from '../../Common/FilterButton/index.vue' // Reset
|
|
63
63
|
import SingleTaxonomy from '../../Global/DirectoryFilters/SingleTaxonomy/index.vue'
|
|
64
64
|
import { BFormGroup, BFormSelect } from 'bootstrap-vue-next'
|
|
65
|
-
import { defineProps, computed, toRefs, ref } from 'vue'
|
|
65
|
+
import { defineProps, computed, toRefs, ref, useTemplateRef } from 'vue'
|
|
66
66
|
|
|
67
67
|
const props = defineProps({
|
|
68
68
|
statsData: { type: Array, default: () => [] },
|
|
@@ -83,7 +83,8 @@ const graphSelected = ref(null)
|
|
|
83
83
|
const chartHeight = ref(
|
|
84
84
|
chart.value.options.height ? chart.value.options.height : 600,
|
|
85
85
|
)
|
|
86
|
-
|
|
86
|
+
|
|
87
|
+
const itemRefs = useTemplateRef('items')
|
|
87
88
|
|
|
88
89
|
const graphOptions = computed(() => {
|
|
89
90
|
return filterFields.value.slice(1).map((field) => {
|
|
@@ -161,11 +162,13 @@ const filteredList = computed(() => {
|
|
|
161
162
|
|
|
162
163
|
const onFilter = (filterParam) => {
|
|
163
164
|
hideReset.value = false
|
|
164
|
-
const allFiltersUnselected = Object.values(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
const allFiltersUnselected = Object.values(itemRefs.value).every(
|
|
166
|
+
(taxonomy) => {
|
|
167
|
+
return Object.values(taxonomy.selectedFilters).every(
|
|
168
|
+
(filter) => filter.filter((item) => !item.preselected).length === 0,
|
|
169
|
+
)
|
|
170
|
+
},
|
|
171
|
+
)
|
|
169
172
|
if (allFiltersUnselected) {
|
|
170
173
|
hideReset.value = true
|
|
171
174
|
}
|
|
@@ -175,8 +178,8 @@ const onFilter = (filterParam) => {
|
|
|
175
178
|
}
|
|
176
179
|
const reset = () => {
|
|
177
180
|
hideReset.value = true
|
|
178
|
-
Object.keys(
|
|
179
|
-
|
|
181
|
+
Object.keys(itemRefs.value).forEach((key) => {
|
|
182
|
+
itemRefs.value[key].reset()
|
|
180
183
|
})
|
|
181
184
|
filters.value.selected = {}
|
|
182
185
|
}
|
|
@@ -169,9 +169,9 @@ export default {
|
|
|
169
169
|
// Check for search
|
|
170
170
|
//
|
|
171
171
|
if (this.selectedFilters.query) {
|
|
172
|
-
this
|
|
172
|
+
this.qs['query'] = this.selectedFilters.query
|
|
173
173
|
} else {
|
|
174
|
-
|
|
174
|
+
delete this.qs['query']
|
|
175
175
|
}
|
|
176
176
|
//
|
|
177
177
|
// Sort by Date and AZ
|
|
@@ -193,7 +193,7 @@ export default {
|
|
|
193
193
|
Object.keys(this.selectedFilters.filters).forEach((filterName) => {
|
|
194
194
|
if (Array.isArray(this.selectedFilters.filters[filterName])) {
|
|
195
195
|
if (this.selectedFilters.filters[filterName]) {
|
|
196
|
-
this
|
|
196
|
+
this.qs[filterName] = []
|
|
197
197
|
this.selectedFilters.filters[filterName].forEach((item) => {
|
|
198
198
|
if (item.tid) {
|
|
199
199
|
this.qs[filterName].push(item.tid)
|
|
@@ -208,11 +208,11 @@ export default {
|
|
|
208
208
|
//
|
|
209
209
|
if (this.selectedFilters.location?.location) {
|
|
210
210
|
this.qs.sort = 'distance'
|
|
211
|
-
this
|
|
212
|
-
this
|
|
211
|
+
this.qs['lat'] = this.selectedFilters.location.location.lat
|
|
212
|
+
this.qs['lon'] = this.selectedFilters.location.location.lng
|
|
213
213
|
} else {
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
delete this.qs['lat']
|
|
215
|
+
delete this.qs['lon']
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
},
|
|
@@ -267,18 +267,18 @@ export default {
|
|
|
267
267
|
}
|
|
268
268
|
},
|
|
269
269
|
updateFilters(opts) {
|
|
270
|
-
this
|
|
270
|
+
this.selectedFilters['filters'] = opts
|
|
271
271
|
},
|
|
272
272
|
updateSort(opts) {
|
|
273
|
-
this
|
|
273
|
+
this.selectedFilters['sorting'] = opts
|
|
274
274
|
},
|
|
275
275
|
updateSearch(opts) {
|
|
276
|
-
this
|
|
276
|
+
this.selectedFilters['query'] = opts
|
|
277
277
|
},
|
|
278
278
|
updateLocation(opts) {
|
|
279
279
|
this.filters.sorting[0].terms[0].title = 'Nearest'
|
|
280
280
|
this.filters.sorting[0].terms[1].title = 'Farthest'
|
|
281
|
-
this
|
|
281
|
+
this.selectedFilters['location'] = opts
|
|
282
282
|
},
|
|
283
283
|
loadMore() {
|
|
284
284
|
this.qs.start += this.qs.rows
|
|
@@ -39,31 +39,31 @@ export default {
|
|
|
39
39
|
name: 'FormHandler',
|
|
40
40
|
components: {
|
|
41
41
|
FormRenderer,
|
|
42
|
-
FormAlert
|
|
42
|
+
FormAlert,
|
|
43
43
|
},
|
|
44
44
|
props: {
|
|
45
45
|
formid: {
|
|
46
46
|
type: String,
|
|
47
|
-
required: true
|
|
47
|
+
required: true,
|
|
48
48
|
},
|
|
49
49
|
contentApiUrl: {
|
|
50
50
|
type: String,
|
|
51
51
|
required: false,
|
|
52
|
-
default: ''
|
|
52
|
+
default: '',
|
|
53
53
|
},
|
|
54
54
|
webFormJson: {
|
|
55
55
|
type: Object,
|
|
56
56
|
required: false,
|
|
57
|
-
default: () => null
|
|
57
|
+
default: () => null,
|
|
58
58
|
},
|
|
59
59
|
preview: {
|
|
60
60
|
type: Boolean,
|
|
61
|
-
required: false
|
|
61
|
+
required: false,
|
|
62
62
|
},
|
|
63
63
|
processID: {
|
|
64
64
|
type: String,
|
|
65
|
-
required: true
|
|
66
|
-
}
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
67
|
},
|
|
68
68
|
data() {
|
|
69
69
|
return {
|
|
@@ -77,7 +77,7 @@ export default {
|
|
|
77
77
|
sid: '',
|
|
78
78
|
successMessage: `<h1>Your submission has been successful.</h1><p>A confirmation email will be sent to the email account provided.</p><p><a class="cta-button" href="/">Back to Homepage</a></p>`,
|
|
79
79
|
submitErrorMessage: `<h1>Unable to submit</h1><p>Unfortunately something has gone wrong when processing your submission. Please try again.</p><p><a class="cta-button" href="/">Back to Homepage</a></p>`,
|
|
80
|
-
notFoundMessage: `<h1>Unable to find form</h1><p>Unfortunately the form you are looking for cannot be found. Please try again or return to the our home page.</p><p><a class="cta-button" href="/">Back to Homepage</a></p
|
|
80
|
+
notFoundMessage: `<h1>Unable to find form</h1><p>Unfortunately the form you are looking for cannot be found. Please try again or return to the our home page.</p><p><a class="cta-button" href="/">Back to Homepage</a></p>`,
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
async mounted() {
|
|
@@ -89,7 +89,7 @@ export default {
|
|
|
89
89
|
if (!webFormJson || !this.form) {
|
|
90
90
|
this.setAlert(!webFormJson ? this.notFoundMessage : this.notFoundMessage)
|
|
91
91
|
}
|
|
92
|
-
this.scrollToTopOfForm()
|
|
92
|
+
// this.scrollToTopOfForm()
|
|
93
93
|
this.loading = false
|
|
94
94
|
},
|
|
95
95
|
methods: {
|
|
@@ -98,7 +98,7 @@ export default {
|
|
|
98
98
|
? {
|
|
99
99
|
message,
|
|
100
100
|
isError: isError ?? true,
|
|
101
|
-
fields: fields ?? []
|
|
101
|
+
fields: fields ?? [],
|
|
102
102
|
}
|
|
103
103
|
: null
|
|
104
104
|
if (sid) {
|
|
@@ -109,7 +109,7 @@ export default {
|
|
|
109
109
|
this.formApi.initialise(
|
|
110
110
|
this.contentApiUrl,
|
|
111
111
|
this.formid,
|
|
112
|
-
this.$axios || axios
|
|
112
|
+
this.$axios || axios,
|
|
113
113
|
)
|
|
114
114
|
this.formSubmitParser.initialise(this.formid, this.$axios || axios)
|
|
115
115
|
this.formRenderParser.initialise(this.contentApiUrl, this.preview)
|
|
@@ -120,20 +120,16 @@ export default {
|
|
|
120
120
|
const submitPayload = this.formSubmitParser.parse(
|
|
121
121
|
submission,
|
|
122
122
|
this.form,
|
|
123
|
-
formioinstance
|
|
123
|
+
formioinstance,
|
|
124
124
|
)
|
|
125
125
|
const isFormStandAlone = submitPayload && !submitPayload.webform_id
|
|
126
126
|
if (!isFormStandAlone) {
|
|
127
|
-
const {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
submitPayload,
|
|
134
|
-
this.preview,
|
|
135
|
-
this.form.tree
|
|
136
|
-
)
|
|
127
|
+
const { submitted, message, fields, sid } =
|
|
128
|
+
await this.formApi.submitForm(
|
|
129
|
+
submitPayload,
|
|
130
|
+
this.preview,
|
|
131
|
+
this.form.tree,
|
|
132
|
+
)
|
|
137
133
|
if (!submitPayload) {
|
|
138
134
|
this.setAlert(this.submitErrorMessage)
|
|
139
135
|
} else if (!submitted) {
|
|
@@ -152,13 +148,13 @@ export default {
|
|
|
152
148
|
FormCallbackQueue.enqueue(async () => {
|
|
153
149
|
await element.onRender(this.$refs.formhandler)
|
|
154
150
|
this.$emit(eventName)
|
|
155
|
-
})
|
|
151
|
+
}),
|
|
156
152
|
)
|
|
157
153
|
},
|
|
158
154
|
changed(event) {
|
|
159
155
|
const getSubmitButton = () =>
|
|
160
156
|
this.$refs.formhandler?.querySelector(
|
|
161
|
-
"button[type='submit'], .btn-wizard-nav-submit"
|
|
157
|
+
"button[type='submit'], .btn-wizard-nav-submit",
|
|
162
158
|
)
|
|
163
159
|
|
|
164
160
|
let isSubmitDisabledWhileUpdating
|
|
@@ -174,7 +170,7 @@ export default {
|
|
|
174
170
|
await elementModel.onchange(
|
|
175
171
|
event.component,
|
|
176
172
|
event.instance,
|
|
177
|
-
this.$axios || axios
|
|
173
|
+
this.$axios || axios,
|
|
178
174
|
)
|
|
179
175
|
}
|
|
180
176
|
submitButton = getSubmitButton()
|
|
@@ -200,9 +196,9 @@ export default {
|
|
|
200
196
|
},
|
|
201
197
|
getFormOptions() {
|
|
202
198
|
return {
|
|
203
|
-
noAlerts: true
|
|
199
|
+
noAlerts: true,
|
|
204
200
|
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
201
|
+
},
|
|
202
|
+
},
|
|
207
203
|
}
|
|
208
204
|
</script>
|