Changes
This commit is contained in:
@@ -279,11 +279,13 @@ export const useDataStore = defineStore('data', () => {
|
||||
])
|
||||
|
||||
async function initializeData (userId) {
|
||||
console.log("init")
|
||||
|
||||
let profileconnections = (await supabase.from("profileconnections").select()).data
|
||||
let profiles = (await supabase.from("profiles").select()).data
|
||||
let activeProfileConnection = profileconnections.find(i => i.active)
|
||||
if(activeProfileConnection) {
|
||||
console.log("Active Profile Selected")
|
||||
activeProfile.value = profiles.find(i => i.id === activeProfileConnection.profile_id)
|
||||
currentTenant.value = activeProfile.value.tenant
|
||||
|
||||
@@ -329,11 +331,15 @@ export const useDataStore = defineStore('data', () => {
|
||||
}
|
||||
|
||||
async function fetchData () {
|
||||
console.log("Fetch Start")
|
||||
await fetchOwnProfiles()
|
||||
await fetchProfiles()
|
||||
await fetchDocuments()
|
||||
|
||||
await fetchTenants()
|
||||
await fetchOwnTenant()
|
||||
|
||||
//loaded.value = true
|
||||
await fetchDocuments()
|
||||
await fetchEvents()
|
||||
await fetchTasks()
|
||||
await fetchProjects()
|
||||
@@ -372,6 +378,9 @@ export const useDataStore = defineStore('data', () => {
|
||||
await fetchServiceCategories()
|
||||
await fetchResources()
|
||||
loaded.value = true
|
||||
|
||||
console.log("Data Fetched")
|
||||
|
||||
}
|
||||
|
||||
function clearStore () {
|
||||
@@ -1519,7 +1528,22 @@ export const useDataStore = defineStore('data', () => {
|
||||
|
||||
const getOpenDocuments = computed(() => (itemId) => {
|
||||
|
||||
return createddocuments.value.filter(i => (i.type === "invoices" || i.type === "advanceInvoices") && !bankstatements.value.some(x => x.createdDocument === i.id))
|
||||
let items = createddocuments.value.filter(i => i.type === "invoices" || i.type === "advanceInvoices")
|
||||
items = items.filter(i => bankstatements.value.filter(x => x.assignments.find(y => y.id === i.id)).length === 0)
|
||||
|
||||
/*let finalItems = []
|
||||
items.forEach(item => {
|
||||
if(bankstatements.value.filter(i => i.assignments.find(x => x.id === item.id))){
|
||||
finalItems.push(item)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
return finalItems*/
|
||||
|
||||
return items
|
||||
|
||||
//return createddocuments.value.filter(i => (i.type === "invoices" || i.type === "advanceInvoices") && !bankstatements.value.some(x => x.amount -))
|
||||
|
||||
})
|
||||
const getOpenIncomingInvoices = computed(() => (itemId) => {
|
||||
|
||||
Reference in New Issue
Block a user