diff --git a/app/Service/Forms/FormSubmissionFormatter.php b/app/Service/Forms/FormSubmissionFormatter.php index c13bb25a2..44534e2dc 100644 --- a/app/Service/Forms/FormSubmissionFormatter.php +++ b/app/Service/Forms/FormSubmissionFormatter.php @@ -96,7 +96,7 @@ public function getCleanKeyValue() // If hide hidden fields if (!$this->showHiddenFields) { - if (FormLogicPropertyResolver::isHidden($field, $this->idFormData)) { + if (FormLogicPropertyResolver::isHidden($field, $this->idFormData ?? [])) { continue; } } diff --git a/resources/js/components/open/forms/components/FormSubmissions.vue b/resources/js/components/open/forms/components/FormSubmissions.vue index 72901b019..78b68d019 100644 --- a/resources/js/components/open/forms/components/FormSubmissions.vue +++ b/resources/js/components/open/forms/components/FormSubmissions.vue @@ -41,6 +41,10 @@
+
+ +
+ import axios from 'axios' +import Fuse from 'fuse.js' +import Form from 'vform' import ScrollShadow from '../../../common/ScrollShadow.vue' import OpenTable from '../../tables/OpenTable.vue' import clonedeep from "clone-deep"; @@ -83,6 +89,9 @@ export default { properties: [], removed_properties: [], displayColumns: {}, + searchForm: new Form({ + search: '' + }) } }, mounted() { @@ -112,6 +121,24 @@ export default { return '' } return '/api/open/forms/' + this.form.id + '/submissions/export' + }, + filteredData () { + if(!this.tableData) return [] + + let filteredData = clonedeep(this.tableData) + + if (this.searchForm.search === '' || this.searchForm.search === null) { + return filteredData + } + + // Fuze search + const fuzeOptions = { + keys: this.form.properties.map((field) => field.id) + } + const fuse = new Fuse(filteredData, fuzeOptions) + return fuse.search(this.searchForm.search).map((res) => { + return res.item + }) } }, methods: { @@ -178,8 +205,10 @@ export default { }) }, dataChanged() { - this.$refs.shadows.toggleShadow() - this.$refs.shadows.calcDimensions() + if (this.$refs.shadows) { + this.$refs.shadows.toggleShadow() + this.$refs.shadows.calcDimensions() + } }, onChangeDisplayColumns() { window.localStorage.setItem('display-columns-formid-' + this.form.id, JSON.stringify(this.displayColumns)) diff --git a/resources/js/components/open/tables/OpenTable.vue b/resources/js/components/open/tables/OpenTable.vue index dfb4255e2..f5135aabd 100644 --- a/resources/js/components/open/tables/OpenTable.vue +++ b/resources/js/components/open/tables/OpenTable.vue @@ -9,7 +9,7 @@ > @@ -42,7 +42,7 @@ { this.form.properties.forEach(col => { - if (!col.hasOwnProperty('width')) { + if (!col.hasOwnProperty('cell_width')) { if (this.allowResize && this.form !== null && document.getElementById('table-head-cell-' + col.id)) { // Within editor this.resizeCol(col, document.getElementById('table-head-cell-' + col.id).offsetWidth) @@ -230,7 +230,7 @@ export default { if (!this.form) return const columns = clonedeep(this.form.properties) const index = this.form.properties.findIndex(c => c.id === col.id) - columns[index].width = width + columns[index].cell_width = width this.$set(this.form, 'properties', columns) this.$nextTick(() => { this.$emit('resize')