Allowed Filters to stay Persistent, Introduced Extra Column for ActivePhase
This commit is contained in:
@@ -86,9 +86,7 @@ const changePage = (number) => {
|
|||||||
setupPage()
|
setupPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
const resetColum = (column) => {
|
|
||||||
columnsToFilter.value[column] = itemsMeta.value.distinctValues[column]
|
|
||||||
}
|
|
||||||
|
|
||||||
const changeSort = (column) => {
|
const changeSort = (column) => {
|
||||||
if(sort.value.column === column) {
|
if(sort.value.column === column) {
|
||||||
@@ -131,7 +129,11 @@ const setupPage = async () => {
|
|||||||
items.value = data
|
items.value = data
|
||||||
itemsMeta.value = meta
|
itemsMeta.value = meta
|
||||||
if(!initialSetupDone.value){
|
if(!initialSetupDone.value){
|
||||||
Object.keys(itemsMeta.value.distinctValues).forEach(distinctValue => {
|
Object.keys(tempStore.filters[type]).forEach((column) => {
|
||||||
|
columnsToFilter.value[column] = tempStore.filters[type][column]
|
||||||
|
})
|
||||||
|
|
||||||
|
Object.keys(itemsMeta.value.distinctValues).filter(i => !Object.keys(tempStore.filters[type]).includes(i)).forEach(distinctValue => {
|
||||||
columnsToFilter.value[distinctValue] = itemsMeta.value.distinctValues[distinctValue]
|
columnsToFilter.value[distinctValue] = itemsMeta.value.distinctValues[distinctValue]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -144,8 +146,14 @@ const setupPage = async () => {
|
|||||||
|
|
||||||
setupPage()
|
setupPage()
|
||||||
|
|
||||||
|
const handleFilterChange = async (action,column) => {
|
||||||
|
if(action === 'reset') {
|
||||||
|
columnsToFilter.value[column] = itemsMeta.value.distinctValues[column]
|
||||||
|
} else if(action === 'change') {
|
||||||
|
tempStore.modifyFilter(type,column,columnsToFilter.value[column])
|
||||||
|
}
|
||||||
|
setupPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -328,7 +336,7 @@ setupPage()
|
|||||||
:options="itemsMeta?.distinctValues?.[column.key]"
|
:options="itemsMeta?.distinctValues?.[column.key]"
|
||||||
v-model="columnsToFilter[column.key]"
|
v-model="columnsToFilter[column.key]"
|
||||||
multiple
|
multiple
|
||||||
@change="setupPage"
|
@change="handleFilterChange('change', column.key)"
|
||||||
searchable
|
searchable
|
||||||
searchable-placeholder="Suche..."
|
searchable-placeholder="Suche..."
|
||||||
:search-attributes="[column.key]"
|
:search-attributes="[column.key]"
|
||||||
@@ -367,7 +375,7 @@ setupPage()
|
|||||||
v-if="columnsToFilter[column.key]?.length !== itemsMeta.distinctValues?.[column.key]?.length && column.distinct"
|
v-if="columnsToFilter[column.key]?.length !== itemsMeta.distinctValues?.[column.key]?.length && column.distinct"
|
||||||
>
|
>
|
||||||
<UButton
|
<UButton
|
||||||
@click="resetColum(column.key)"
|
@click="handleFilterChange('reset',column.key)"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
color="rose"
|
color="rose"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ export const useAuthStore = defineStore("auth", {
|
|||||||
console.log("Auth initStore")
|
console.log("Auth initStore")
|
||||||
await this.fetchMe()
|
await this.fetchMe()
|
||||||
|
|
||||||
const tempStore = useTempStore()
|
|
||||||
|
|
||||||
if(this.profile.temp_config) tempStore.setStoredTempConfig(this.profile.temp_config)
|
|
||||||
if(this.activeTenant > 0) {
|
if(this.activeTenant > 0) {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
if(useCapacitor().getIsNative()) {
|
if(useCapacitor().getIsNative()) {
|
||||||
@@ -99,6 +96,8 @@ export const useAuthStore = defineStore("auth", {
|
|||||||
|
|
||||||
async fetchMe(jwt= null) {
|
async fetchMe(jwt= null) {
|
||||||
console.log("Auth fetchMe")
|
console.log("Auth fetchMe")
|
||||||
|
const tempStore = useTempStore()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const me = await useNuxtApp().$api("/api/me", {
|
const me = await useNuxtApp().$api("/api/me", {
|
||||||
headers: { Authorization: `Bearer ${jwt}`,
|
headers: { Authorization: `Bearer ${jwt}`,
|
||||||
@@ -117,6 +116,8 @@ export const useAuthStore = defineStore("auth", {
|
|||||||
|
|
||||||
this.profile = me.profile
|
this.profile = me.profile
|
||||||
|
|
||||||
|
if(this.profile.temp_config) tempStore.setStoredTempConfig(this.profile.temp_config)
|
||||||
|
|
||||||
if(me.activeTenant > 0) {
|
if(me.activeTenant > 0) {
|
||||||
this.activeTenant = me.activeTenant
|
this.activeTenant = me.activeTenant
|
||||||
this.activeTenantData = me.tenants.find(i => i.id === me.activeTenant)
|
this.activeTenantData = me.tenants.find(i => i.id === me.activeTenant)
|
||||||
|
|||||||
@@ -1088,9 +1088,9 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
},
|
},
|
||||||
sortable: true
|
sortable: true
|
||||||
},{
|
},{
|
||||||
key: "phase",
|
key: "active_phase",
|
||||||
label: "Phase",
|
label: "Phase",
|
||||||
component: phase
|
distinct:true
|
||||||
},{
|
},{
|
||||||
key: "name",
|
key: "name",
|
||||||
label: "Name",
|
label: "Name",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export const useTempStore = defineStore('temp', () => {
|
|||||||
columns: columns.value,
|
columns: columns.value,
|
||||||
pages: pages.value,
|
pages: pages.value,
|
||||||
settings: settings.value,
|
settings: settings.value,
|
||||||
|
filters: filters.value
|
||||||
}
|
}
|
||||||
|
|
||||||
await useNuxtApp().$api(`/api/profiles/${auth.profile.id}`,{
|
await useNuxtApp().$api(`/api/profiles/${auth.profile.id}`,{
|
||||||
@@ -30,6 +31,7 @@ export const useTempStore = defineStore('temp', () => {
|
|||||||
columns.value = config.columns
|
columns.value = config.columns
|
||||||
pages.value = config.pages
|
pages.value = config.pages
|
||||||
settings.value = config.settings
|
settings.value = config.settings
|
||||||
|
filters.value = config.filters
|
||||||
}
|
}
|
||||||
|
|
||||||
function modifySearchString(type,input) {
|
function modifySearchString(type,input) {
|
||||||
@@ -42,8 +44,10 @@ export const useTempStore = defineStore('temp', () => {
|
|||||||
storeTempConfig()
|
storeTempConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
function modifyFilter(type,input) {
|
function modifyFilter(domain,type,input) {
|
||||||
filters.value[type] = input
|
if(!filters.value[domain]) filters.value[domain] = {}
|
||||||
|
|
||||||
|
filters.value[domain][type] = input
|
||||||
storeTempConfig()
|
storeTempConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user