Fixed most of the form/show pages

This commit is contained in:
Julien Nahum
2023-12-20 18:38:43 +01:00
parent af5656ce81
commit bab8517879
19 changed files with 317 additions and 335 deletions

View File

@@ -9,13 +9,13 @@
</h3>
</div>
</template>
<toggle-switch-input :value="value.hide_title" name="hide_title" class="mt-4"
<toggle-switch-input :model-value="modelValue.hide_title" name="hide_title" class="mt-4"
label="Hide Form Title"
:disabled="(form.hide_title===true)?true:null"
:help="hideTitleHelp"
@update:model-value="onChangeHideTitle"
/>
<toggle-switch-input :value="value.auto_submit" name="auto_submit" class="mt-4"
<toggle-switch-input :model-value="modelValue.auto_submit" name="auto_submit" class="mt-4"
label="Auto Submit Form"
help="Form will auto submit immediate after open URL"
@update:model-value="onChangeAutoSubmit"
@@ -33,7 +33,7 @@ export default {
type: Object,
required: true
},
value: {
modelValue: {
type: Object,
required: true
}
@@ -56,10 +56,10 @@ export default {
methods: {
onChangeHideTitle (val) {
this.value.hide_title = val
this.modelValue.hide_title = val
},
onChangeAutoSubmit (val) {
this.value.auto_submit = val
this.modelValue.auto_submit = val
}
}
}

View File

@@ -163,7 +163,7 @@ export default {
computed: {
createdForm () {
return this.formsStore.getBySlug(this.createdFormSlug)
return this.formsStore.getByKey(this.createdFormSlug)
},
steps () {
return [
@@ -246,7 +246,7 @@ export default {
this.form.put('/open/forms/{id}/'.replace('{id}', this.form.id)).then((data) => {
this.formsStore.addOrUpdate(data.form)
this.$emit('on-save')
this.$router.push({ name: 'forms.show', params: { slug: this.form.slug } })
this.$router.push({ name: 'forms-slug-show', params: { slug: this.form.slug } })
this.amplitude.logEvent('form_saved', { form_id: this.form.id, form_slug: this.form.slug })
this.displayFormModificationAlert(data)
}).catch((error) => {

View File

@@ -105,8 +105,7 @@ export default {
getChartData () {
if (!this.form) { return null }
this.isLoading = true
axios.get('/api/open/workspaces/' + this.form.workspace_id + '/form-stats/' + this.form.id).then((response) => {
const statsData = response.data
opnFetch('/open/workspaces/' + this.form.workspace_id + '/form-stats/' + this.form.id).then((statsData) => {
if (statsData && statsData.views !== undefined) {
this.chartData.labels = Object.keys(statsData.views)
this.chartData.datasets[0].data = statsData.views

View File

@@ -210,9 +210,7 @@ export default {
return
}
this.isLoading = true
axios.get('/api/open/forms/' + this.form.id + '/submissions?page=' + this.currentPage).then((response) => {
const resData = response.data
opnFetch('/open/forms/' + this.form.id + '/submissions?page=' + this.currentPage).then((resData) => {
this.tableData = this.tableData.concat(resData.data.map((record) => record.data))
this.dataChanged()
@@ -235,6 +233,7 @@ export default {
}
},
onChangeDisplayColumns () {
if (process.client)
window.localStorage.setItem('display-columns-formid-' + this.form.id, JSON.stringify(this.displayColumns))
this.form.properties = this.properties.concat(this.removed_properties).filter((field) => {
return this.displayColumns[field.id] === true

View File

@@ -117,7 +117,7 @@ export default {
related_templates: null,
questions: []
})
this.templatesStore.loadIfEmpty()
loadAllTemplates(this.templatesStore)
},
computed: {