B8e23 submission list UI fixes (#426)
* fix password reset bug * fix vSwitch component, column toggle, table ordering
This commit is contained in:
parent
289bdf93e0
commit
f9dacd0a74
|
|
@ -23,7 +23,7 @@ import { defineEmits, defineProps } from "vue"
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: { type: Boolean, default: false },
|
modelValue: { type: Boolean, default: false },
|
||||||
disabled: { type: Boolean, default: false },
|
disabled: { type: Boolean, default: false },
|
||||||
color: { type: String, default: null },
|
color: { type: String, default: '#3B82F6' },
|
||||||
})
|
})
|
||||||
const emit = defineEmits(["update:modelValue"])
|
const emit = defineEmits(["update:modelValue"])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,22 +254,21 @@ export default {
|
||||||
},
|
},
|
||||||
initFormStructure() {
|
initFormStructure() {
|
||||||
// check if form properties already has a created_at column
|
// check if form properties already has a created_at column
|
||||||
this.properties = this.candidatesProperties
|
|
||||||
if (!this.properties.find((property) => {
|
if (!this.properties.find((property) => {
|
||||||
if (property.id === 'created_at') {
|
if (property.id === 'created_at') {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})) {
|
})) {
|
||||||
// Add a "created at" column
|
// Add a "created at" column
|
||||||
this.properties.push({
|
this.candidatesProperties.push({
|
||||||
name: 'Created at',
|
name: 'Created at',
|
||||||
id: 'created_at',
|
id: 'created_at',
|
||||||
type: 'date',
|
type: 'date',
|
||||||
width: 140
|
width: 140
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.properties = this.candidatesProperties
|
||||||
this.removed_properties = (this.form.removed_properties) ? clonedeep(this.form.removed_properties) : []
|
this.removed_properties = (this.form.removed_properties) ? clonedeep(this.form.removed_properties) : []
|
||||||
|
|
||||||
// Get display columns from local storage
|
// Get display columns from local storage
|
||||||
const tmpColumns = window.localStorage.getItem('display-columns-formid-' + this.form.id)
|
const tmpColumns = window.localStorage.getItem('display-columns-formid-' + this.form.id)
|
||||||
if (tmpColumns !== null && tmpColumns) {
|
if (tmpColumns !== null && tmpColumns) {
|
||||||
|
|
@ -312,7 +311,7 @@ export default {
|
||||||
onChangeDisplayColumns() {
|
onChangeDisplayColumns() {
|
||||||
if (!import.meta.client) return
|
if (!import.meta.client) return
|
||||||
window.localStorage.setItem('display-columns-formid-' + this.form.id, JSON.stringify(this.displayColumns))
|
window.localStorage.setItem('display-columns-formid-' + this.form.id, JSON.stringify(this.displayColumns))
|
||||||
this.properties = clonedeep(this.form.properties).concat(this.removed_properties).filter((field) => {
|
this.properties = clonedeep(this.candidatesProperties).concat(this.removed_properties).filter((field) => {
|
||||||
return this.displayColumns[field.id] === true
|
return this.displayColumns[field.id] === true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody
|
<tbody
|
||||||
v-if="data.length > 0"
|
v-if="formData.length > 0"
|
||||||
class="n-table-body bg-white dark:bg-notion-dark-light"
|
class="n-table-body bg-white dark:bg-notion-dark-light"
|
||||||
>
|
>
|
||||||
<tr
|
<tr
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr
|
<tr
|
||||||
v-for="(row, index) in data"
|
v-for="(row, index) in formData"
|
||||||
:key="row.id"
|
:key="row.id"
|
||||||
class="n-table-row"
|
class="n-table-row"
|
||||||
:class="{ first: index === 0 }"
|
:class="{ first: index === 0 }"
|
||||||
|
|
@ -224,6 +224,12 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
formData(){
|
||||||
|
return this.data.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.internalColumns = clonedeep(this.columns)
|
this.internalColumns = clonedeep(this.columns)
|
||||||
const parent = this.scrollParent ?? document.getElementById("table-page")
|
const parent = this.scrollParent ?? document.getElementById("table-page")
|
||||||
|
|
@ -235,7 +241,6 @@ export default {
|
||||||
this.onStructureChange()
|
this.onStructureChange()
|
||||||
this.handleScroll()
|
this.handleScroll()
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
const parent = this.scrollParent ?? document.getElementById("table-page")
|
const parent = this.scrollParent ?? document.getElementById("table-page")
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,8 @@ export default {
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async reset() {
|
async reset() {
|
||||||
const { data } = await this.form.post("/password/reset")
|
|
||||||
|
|
||||||
|
const data = await this.form.post("/password/reset")
|
||||||
this.status = data.status
|
this.status = data.status
|
||||||
|
|
||||||
this.form.reset()
|
this.form.reset()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue