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

@@ -16,9 +16,8 @@ const uploadModalOpen = ref(false)
const uploadInProgress = ref(false)
const fileUploadFormData = ref({
tags: ["Eingang"],
project: null,
customer: null,
path: ""
path: "",
tenant: dataStore.currentTenant
})
@@ -40,7 +39,7 @@ const filteredDocuments = computed(() => {
const uploadFiles = async () => {
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;
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(() => {
let totalNet = 0
let totalAmount19Tax = 0
@@ -90,9 +119,9 @@ const totalCalculated = computed(() => {
const setState = async (newState) => {
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') {
await dataStore.updateItem('incomingInvoices',{...itemInfo.value, state: newState})
await dataStore.updateItem('incominginvoices',{...itemInfo.value, state: newState})
}
await router.push("/receipts")
}
@@ -113,7 +142,7 @@ setupPage()
<div class="w-4/5">
<InputGroup class="mt-3" v-if="currentVendorInvoice">
<UButton
@click="dataStore.updateItem('incomingInvoices',itemInfo)"
@click="dataStore.updateItem('incominginvoices',itemInfo)"
v-if="mode === 'edit'"
>
Speichern
@@ -303,12 +332,14 @@ setupPage()
:help="`Betrag: ${item.amountTax ? String(item.amountTax).replace('.',',') : '0,00'} €`"
>
<USelectMenu
:options="[19,7,0]"
:options="taxOptions"
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>
{{item.taxType}} %
<span class="truncate">{{taxOptions.find(i => i.key === item.taxType) ? taxOptions.find(i => i.key === item.taxType).label : ""}}</span>
</template>
</USelectMenu>
</UFormGroup>

View File

@@ -1,8 +1,12 @@
<script setup>
const dataStore = useDataStore()
const supabase = useSupabaseClient()
const router = useRouter()
const items = [{
label: 'Profil',
},{
label: 'Projekte',
content: 'This is the content shown for Tab1'
}, {
@@ -11,15 +15,72 @@ const items = [{
}, {
label: 'Dokumente'
}]
const colorMode = useColorMode()
const isLight = computed({
get() {
return colorMode.value !== 'dark'
},
set() {
colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark'
}
})
</script>
<template>
<UTabs
:items="items"
class="h-100"
>
<template #item="{item}">
<UCard class="mt-5 overflow-y-scroll scroll">
<div v-if="item.label === 'Projekte'">
<UCard class="mt-5">
<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
label="Phasenvorlagen"
/>

View File

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