Many Changes
This commit is contained in:
@@ -125,6 +125,11 @@ export const useDataStore = defineStore('data', () => {
|
||||
texttemplates: {
|
||||
label: "Textvorlagen",
|
||||
labelSingle: "Textvorlage"
|
||||
},
|
||||
bankstatements: {
|
||||
label: "Kontobewegungen",
|
||||
labelSingle: "Kontobewegung",
|
||||
historyItemHolder: "bankStatement",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +198,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
const vendors = ref([])
|
||||
const incominginvoices = ref([])
|
||||
const bankAccounts = ref([])
|
||||
const bankStatements = ref([])
|
||||
const bankstatements = ref([])
|
||||
const bankrequisitions = ref([])
|
||||
const historyItems = ref([])
|
||||
const numberRanges = ref([])
|
||||
@@ -394,7 +399,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
vendors.value= []
|
||||
incominginvoices.value= []
|
||||
bankAccounts.value= []
|
||||
bankStatements.value= []
|
||||
bankstatements.value= []
|
||||
bankrequisitions.value= []
|
||||
historyItems.value = []
|
||||
numberRanges.value = []
|
||||
@@ -722,7 +727,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
|
||||
|
||||
//Realtime Update
|
||||
const channelA = supabase
|
||||
/*const channelA = supabase
|
||||
.channel('schema-db-changes')
|
||||
.on(
|
||||
'postgres_changes',
|
||||
@@ -733,16 +738,16 @@ export const useDataStore = defineStore('data', () => {
|
||||
(payload) => {
|
||||
//console.log(payload)
|
||||
|
||||
/*if(payload.eventType === 'INSERT') {
|
||||
/!*if(payload.eventType === 'INSERT') {
|
||||
const c = payload.table + '.value.push(' + JSON.stringify(payload.new) + ')'
|
||||
eval(c)
|
||||
} else if(payload.eventType === 'UPDATE'){
|
||||
const c = payload.table + '.value[' + payload.table + '.value.findIndex(i => i.id === ' + JSON.stringify(payload.old.id) + ')] = ' + JSON.stringify(payload.new)
|
||||
eval(c)
|
||||
}*/
|
||||
}*!/
|
||||
}
|
||||
)
|
||||
.subscribe()
|
||||
.subscribe()*/
|
||||
|
||||
async function createNewItem (dataType,data){
|
||||
if(typeOf(data) === 'object') {
|
||||
@@ -927,7 +932,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
bankAccounts.value = (await supabase.from("bankaccounts").select().eq('tenant', currentTenant.value)).data
|
||||
}
|
||||
async function fetchBankStatements () {
|
||||
bankStatements.value = (await supabase.from("bankstatements").select().eq('tenant', currentTenant.value).order("date", {ascending:false})).data
|
||||
bankstatements.value = (await supabase.from("bankstatements").select().eq('tenant', currentTenant.value).order("date", {ascending:false})).data
|
||||
}
|
||||
async function fetchBankRequisitions () {
|
||||
bankrequisitions.value = (await supabase.from("bankrequisitions").select().eq('status', "LN")).data
|
||||
@@ -1193,6 +1198,10 @@ export const useDataStore = defineStore('data', () => {
|
||||
return createddocuments.value.filter(i => i.project === project)
|
||||
})
|
||||
|
||||
const getCreatedDocumentsByType = computed(() => (type) => {
|
||||
return createddocuments.value.filter(i => i.type === type)
|
||||
})
|
||||
|
||||
const getWorkingTimesByProfileId = computed(() => (profileId) => {
|
||||
return workingtimes.value.filter(i => i.profile === profileId)
|
||||
})
|
||||
@@ -1508,6 +1517,17 @@ export const useDataStore = defineStore('data', () => {
|
||||
return workingtimes.value.find(item => item.id === itemId)
|
||||
})
|
||||
|
||||
const getOpenDocuments = computed(() => (itemId) => {
|
||||
|
||||
return createddocuments.value.filter(i => (i.type === "invoices" || i.type === "advanceInvoices") && !bankstatements.value.some(x => x.createdDocument === i.id))
|
||||
|
||||
})
|
||||
const getOpenIncomingInvoices = computed(() => (itemId) => {
|
||||
|
||||
return incominginvoices.value.filter(i => !i.paid)
|
||||
|
||||
})
|
||||
|
||||
const getProjectById = computed(() => (itemId) => {
|
||||
if(projects.value.find(i => i.id === itemId)) {
|
||||
let project = projects.value.find(project => project.id === itemId)
|
||||
@@ -1563,7 +1583,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
vendors,
|
||||
incominginvoices,
|
||||
bankAccounts,
|
||||
bankStatements,
|
||||
bankstatements,
|
||||
bankrequisitions,
|
||||
historyItems,
|
||||
numberRanges,
|
||||
@@ -1646,6 +1666,7 @@ export const useDataStore = defineStore('data', () => {
|
||||
getMessagesByChatId,
|
||||
getTextTemplatesByDocumentType,
|
||||
getCreatedDocumentsByProject,
|
||||
getCreatedDocumentsByType,
|
||||
getWorkingTimesByProfileId,
|
||||
getStartedWorkingTimes,
|
||||
getStockByProductId,
|
||||
@@ -1680,7 +1701,9 @@ export const useDataStore = defineStore('data', () => {
|
||||
getInventoryItemById,
|
||||
getBankAccountById,
|
||||
getEventById,
|
||||
getWorkingTimeById
|
||||
getWorkingTimeById,
|
||||
getOpenDocuments,
|
||||
getOpenIncomingInvoices
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user