Changes in Dashboard Display
Added Project Card Commented Graph Card
This commit is contained in:
@@ -6,18 +6,16 @@ let draftInvoicesSum = ref(0)
|
||||
let draftInvoicesCount = ref(0)
|
||||
let unallocatedStatements = ref(0)
|
||||
const setupPage = async () => {
|
||||
let documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices").filter(i => !i.archived)
|
||||
let documents = (await useSupabaseSelect("createddocuments","*, statementallocations(*), customer(id,name)")).filter(i => i.type === "invoices" ||i.type === "advanceInvoices"||i.type === "cancellationInvoices").filter(i => !i.archived)
|
||||
|
||||
let draftDocuments = documents.filter(i => i.state === "Entwurf")
|
||||
let finalizedDocuments = documents.filter(i => i.state === "Gebucht")
|
||||
|
||||
console.log(finalizedDocuments)
|
||||
|
||||
|
||||
finalizedDocuments = finalizedDocuments.filter(i => i.statementallocations.reduce((n,{amount}) => n + amount, 0).toFixed(2) !== getDocumentSum(i).toFixed(2))
|
||||
|
||||
finalizedDocuments.forEach(i => {
|
||||
console.log(getDocumentSum(i))
|
||||
unpaidInvoicesSum.value += getDocumentSum(i) - i.statementallocations.reduce((n,{amount}) => n + amount, 0)
|
||||
})
|
||||
unpaidInvoicesCount.value = finalizedDocuments.length
|
||||
|
||||
43
components/displayProjectsInPhases.vue
Normal file
43
components/displayProjectsInPhases.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<script setup>
|
||||
|
||||
const phasesCounter = ref({})
|
||||
|
||||
const setupPage = async () => {
|
||||
const projects = await useSupabaseSelect("projects")
|
||||
|
||||
projects.forEach(project => {
|
||||
if(project.phases && project.phases.length > 0){
|
||||
let activePhase = project.phases.find(p => p.active)
|
||||
|
||||
if(phasesCounter.value[activePhase.label]) {
|
||||
phasesCounter.value[activePhase.label] += 1
|
||||
} else {
|
||||
phasesCounter.value[activePhase.label] = 1
|
||||
}
|
||||
|
||||
} else {
|
||||
if(phasesCounter.value.none) {
|
||||
phasesCounter.value.none += 1
|
||||
} else {
|
||||
phasesCounter.value.none = 1
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
setupPage()
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<table class="w-full">
|
||||
<tr v-for="label in Object.keys(phasesCounter)">
|
||||
<td>{{label}}</td>
|
||||
<td>{{ phasesCounter[label] }} Stk</td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user