This commit is contained in:
2024-02-19 22:25:58 +01:00
parent d5c3034758
commit 6e2e419a1c
7 changed files with 121 additions and 27 deletions

View File

@@ -18,7 +18,8 @@ const uploadModalOpen = ref(false)
const uploadInProgress = ref(false) const uploadInProgress = ref(false)
const fileUploadFormData = ref({ const fileUploadFormData = ref({
tags: ["Dokument"], tags: ["Dokument"],
project: null project: null,
tenant: dataStore.currentTenant
}) })
const openModal = () => { const openModal = () => {

View File

@@ -248,11 +248,11 @@ const links = [[{
to: "/receipts", to: "/receipts",
icon: "i-heroicons-document-text" icon: "i-heroicons-document-text"
}, },
{ /* {
label: "Bank", label: "Bank",
to: "/banking", to: "/banking",
icon: "i-heroicons-currency-euro" icon: "i-heroicons-currency-euro"
}], [{ }*/], [{
label: "Projekte", label: "Projekte",
to: "/projects", to: "/projects",
icon: "i-heroicons-clipboard-document-check" icon: "i-heroicons-clipboard-document-check"
@@ -445,16 +445,16 @@ const links = [[{
/> />
</template> </template>
</UVerticalNavigation> </UVerticalNavigation>
<!-- <UButton <UButton
:icon="!isLight ? 'i-heroicons-moon-20-solid' : 'i-heroicons-sun-20-solid'" :icon="!isLight ? 'i-heroicons-moon-20-solid' : 'i-heroicons-sun-20-solid'"
color="white" color="white"
variant="outline" variant="outline"
aria-label="Theme" aria-label="Theme"
@click="isLight = !isLight" @click="isLight = !isLight"
/>--> />
</div> </div>
<div class="m-3" id="contentContainer"> <div class="pl-3 pr-3 mt-3" id="contentContainer">
<slot id="content"/> <slot id="content"/>
</div> </div>
</div> </div>

View File

@@ -16,9 +16,8 @@ const uploadModalOpen = ref(false)
const uploadInProgress = ref(false) const uploadInProgress = ref(false)
const fileUploadFormData = ref({ const fileUploadFormData = ref({
tags: ["Eingang"], tags: ["Eingang"],
project: null, path: "",
customer: null, tenant: dataStore.currentTenant
path: ""
}) })
@@ -40,7 +39,7 @@ const filteredDocuments = computed(() => {
const uploadFiles = async () => { const uploadFiles = async () => {
uploadInProgress.value = true; uploadInProgress.value = true;
await dataStore.uploadFiles(fileUploadFormData.value, document.getElementById("fileUploadInput").files) await dataStore.uploadFiles(fileUploadFormData.value, document.getElementById("fileUploadInput").files, true)
uploadModalOpen.value = false; uploadModalOpen.value = false;
uploadInProgress.value = false; uploadInProgress.value = false;

View File

@@ -63,6 +63,35 @@ const itemInfo = ref({
] ]
}) })
const taxOptions = ref([
{
label: "19% USt",
percentage: 19,
key: "19"
},{
label: "7% USt",
percentage: 7,
key: "7"
},{
label: "Innergemeintschaftlicher Erwerb 19%",
percentage: 0,
key: "19I"
},{
label: "Innergemeintschaftlicher Erwerb 7%",
percentage: 0,
key: "7I"
},{
label: "§13b UStG",
percentage: 0,
key: "13B"
},{
label: "Keine USt",
percentage: 0,
key: "null"
},
])
const totalCalculated = computed(() => { const totalCalculated = computed(() => {
let totalNet = 0 let totalNet = 0
let totalAmount19Tax = 0 let totalAmount19Tax = 0
@@ -90,9 +119,9 @@ const totalCalculated = computed(() => {
const setState = async (newState) => { const setState = async (newState) => {
if(mode.value === 'show') { if(mode.value === 'show') {
await dataStore.updateItem('incomingInvoices',{...currentVendorInvoice.value, state: newState}) await dataStore.updateItem('incominginvoices',{...currentVendorInvoice.value, state: newState})
} else if(mode.value === 'edit') { } else if(mode.value === 'edit') {
await dataStore.updateItem('incomingInvoices',{...itemInfo.value, state: newState}) await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState})
} }
await router.push("/receipts") await router.push("/receipts")
} }
@@ -113,7 +142,7 @@ setupPage()
<div class="w-4/5"> <div class="w-4/5">
<InputGroup class="mt-3" v-if="currentVendorInvoice"> <InputGroup class="mt-3" v-if="currentVendorInvoice">
<UButton <UButton
@click="dataStore.updateItem('incomingInvoices',itemInfo)" @click="dataStore.updateItem('incominginvoices',itemInfo)"
v-if="mode === 'edit'" v-if="mode === 'edit'"
> >
Speichern Speichern
@@ -303,12 +332,14 @@ setupPage()
:help="`Betrag: ${item.amountTax ? String(item.amountTax).replace('.',',') : '0,00'} €`" :help="`Betrag: ${item.amountTax ? String(item.amountTax).replace('.',',') : '0,00'} €`"
> >
<USelectMenu <USelectMenu
:options="[19,7,0]" :options="taxOptions"
v-model="item.taxType" v-model="item.taxType"
@change="item.amountTax = Number(((item.amountNet ? item.amountNet : 0) * (Number(item.taxType)/100)).toFixed(2))" value-attribute="key"
option-attribute="label"
@change="item.amountTax = Number(((item.amountNet ? item.amountNet : 0) * (Number(taxOptions.find(i => i.key === item.taxType).percentage)/100)).toFixed(2))"
> >
<template #label> <template #label>
{{item.taxType}} % <span class="truncate">{{taxOptions.find(i => i.key === item.taxType) ? taxOptions.find(i => i.key === item.taxType).label : ""}}</span>
</template> </template>
</USelectMenu> </USelectMenu>
</UFormGroup> </UFormGroup>

View File

@@ -1,8 +1,12 @@
<script setup> <script setup>
const dataStore = useDataStore() const dataStore = useDataStore()
const supabase = useSupabaseClient()
const router = useRouter()
const items = [{ const items = [{
label: 'Profil',
},{
label: 'Projekte', label: 'Projekte',
content: 'This is the content shown for Tab1' content: 'This is the content shown for Tab1'
}, { }, {
@@ -11,15 +15,72 @@ const items = [{
}, { }, {
label: 'Dokumente' label: 'Dokumente'
}] }]
const colorMode = useColorMode()
const isLight = computed({
get() {
return colorMode.value !== 'dark'
},
set() {
colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark'
}
})
</script> </script>
<template> <template>
<UTabs <UTabs
:items="items" :items="items"
class="h-100"
> >
<template #item="{item}"> <template #item="{item}">
<UCard class="mt-5 overflow-y-scroll scroll"> <UCard class="mt-5">
<div v-if="item.label === 'Projekte'"> <div v-if="item.label === 'Profil'">
<div v-if="dataStore.getOwnProfile.tenants.length > 1">
<UDivider
class="my-3"
label="Tenant"
/>
<USelectMenu
:options="dataStore.getOwnProfile.tenants"
option-attribute="name"
value-attribute="id"
v-model="dataStore.currentTenant"
@change="dataStore.changeTenant()"
/>
</div>
<UDivider
class="my-3"
label="Profil"
/>
<InputGroup>
<UButton
:icon="!isLight ? 'i-heroicons-moon-20-solid' : 'i-heroicons-sun-20-solid'"
color="white"
variant="outline"
aria-label="Theme"
@click="isLight = !isLight"
/>
<UButton
color="rose"
variant="outline"
@click="async () => {
await supabase.auth.signOut()
await dataStore.clearStore()
await router.push('/login')
}"
>
Ausloggen
</UButton>
</InputGroup>
</div>
<div v-else-if="item.label === 'Projekte'">
<UDivider <UDivider
label="Phasenvorlagen" label="Phasenvorlagen"
/> />

View File

@@ -19,7 +19,6 @@ let currentItem = ref(null)
//Working //Working
const mode = ref(route.params.mode || "show") const mode = ref(route.params.mode || "show")
const itemInfo = ref({ const itemInfo = ref({
id: null,
name: "", name: "",
licensePlate: "", licensePlate: "",
type: "", type: "",

View File

@@ -84,7 +84,7 @@ export const useDataStore = defineStore('data', () => {
label: "Dokumente", label: "Dokumente",
labelSingle: "Dokument" labelSingle: "Dokument"
}, },
incomingInvoices: { incominginvoices: {
label: "Eingangsrechnungen", label: "Eingangsrechnungen",
labelSingle: "Eingangsrechnung" labelSingle: "Eingangsrechnung"
}, },
@@ -146,7 +146,7 @@ export const useDataStore = defineStore('data', () => {
const contacts = ref([]) const contacts = ref([])
const vehicles = ref([]) const vehicles = ref([])
const vendors = ref([]) const vendors = ref([])
const incomingInvoices = ref([]) const incominginvoices = ref([])
const bankAccounts = ref([]) const bankAccounts = ref([])
const bankStatements = ref([]) const bankStatements = ref([])
const historyItems = ref([]) const historyItems = ref([])
@@ -303,7 +303,7 @@ export const useDataStore = defineStore('data', () => {
contacts.value= [] contacts.value= []
vehicles.value= [] vehicles.value= []
vendors.value= [] vendors.value= []
incomingInvoices.value= [] incominginvoices.value= []
bankAccounts.value= [] bankAccounts.value= []
bankStatements.value= [] bankStatements.value= []
historyItems.value = [] historyItems.value = []
@@ -421,6 +421,7 @@ export const useDataStore = defineStore('data', () => {
const uploadFiles = async (formData, files, upsert) => { const uploadFiles = async (formData, files, upsert) => {
console.log(files) console.log(files)
console.log(formData)
let documentsToInsert = [] let documentsToInsert = []
const uploadSingleFile = async (file) => { const uploadSingleFile = async (file) => {
@@ -428,7 +429,7 @@ export const useDataStore = defineStore('data', () => {
const {data, error} = await supabase const {data, error} = await supabase
.storage .storage
.from("files") .from("files")
.upload(`${currentTenant.value}/${file.name}`, file, {upsert}) .upload(`${currentTenant.value}/${file.name}`, file, {upsert: upsert})
if (error) { if (error) {
console.log(error) console.log(error)
@@ -450,6 +451,8 @@ export const useDataStore = defineStore('data', () => {
documentsToInsert.push({...formData, path: returnPath}) documentsToInsert.push({...formData, path: returnPath})
} }
console.log(data)
} }
//uploadInProgress.value = true //uploadInProgress.value = true
@@ -548,7 +551,7 @@ export const useDataStore = defineStore('data', () => {
vendors.value = (await supabase.from("vendors").select().eq('tenant', currentTenant.value).order("vendorNumber", {ascending:true})).data vendors.value = (await supabase.from("vendors").select().eq('tenant', currentTenant.value).order("vendorNumber", {ascending:true})).data
} }
async function fetchIncomingInvoices () { async function fetchIncomingInvoices () {
incomingInvoices.value = (await supabase.from("incominginvoices").select().eq('tenant', currentTenant.value)).data incominginvoices.value = (await supabase.from("incominginvoices").select().eq('tenant', currentTenant.value)).data
} }
async function fetchNumberRanges () { async function fetchNumberRanges () {
numberRanges.value = (await supabase.from("numberranges").select().eq('tenant', currentTenant.value)).data numberRanges.value = (await supabase.from("numberranges").select().eq('tenant', currentTenant.value)).data
@@ -728,7 +731,7 @@ export const useDataStore = defineStore('data', () => {
}) })
const getIncomingInvoicesByVehicleId = computed(() => (vehicleId) => { const getIncomingInvoicesByVehicleId = computed(() => (vehicleId) => {
return incomingInvoices.value.filter(i => i.accounts.find(a => a.costCentre === vehicleId)) return incominginvoices.value.filter(i => i.accounts.find(a => a.costCentre === vehicleId))
}) })
const getMovementsBySpaceId = computed(() => (spaceId) => { const getMovementsBySpaceId = computed(() => (spaceId) => {
@@ -917,7 +920,7 @@ export const useDataStore = defineStore('data', () => {
}) })
const getIncomingInvoiceById = computed(() => (itemId) => { const getIncomingInvoiceById = computed(() => (itemId) => {
return incomingInvoices.value.find(item => item.id === itemId) return incominginvoices.value.find(item => item.id === itemId)
}) })
const getContractById = computed(() => (itemId) => { const getContractById = computed(() => (itemId) => {
@@ -1020,7 +1023,7 @@ export const useDataStore = defineStore('data', () => {
contacts, contacts,
vehicles, vehicles,
vendors, vendors,
incomingInvoices, incominginvoices,
bankAccounts, bankAccounts,
bankStatements, bankStatements,
historyItems, historyItems,