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 fileUploadFormData = ref({
tags: ["Dokument"],
project: null
project: null,
tenant: dataStore.currentTenant
})
const openModal = () => {

View File

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

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: "",

View File

@@ -84,7 +84,7 @@ export const useDataStore = defineStore('data', () => {
label: "Dokumente",
labelSingle: "Dokument"
},
incomingInvoices: {
incominginvoices: {
label: "Eingangsrechnungen",
labelSingle: "Eingangsrechnung"
},
@@ -146,7 +146,7 @@ export const useDataStore = defineStore('data', () => {
const contacts = ref([])
const vehicles = ref([])
const vendors = ref([])
const incomingInvoices = ref([])
const incominginvoices = ref([])
const bankAccounts = ref([])
const bankStatements = ref([])
const historyItems = ref([])
@@ -303,7 +303,7 @@ export const useDataStore = defineStore('data', () => {
contacts.value= []
vehicles.value= []
vendors.value= []
incomingInvoices.value= []
incominginvoices.value= []
bankAccounts.value= []
bankStatements.value= []
historyItems.value = []
@@ -421,6 +421,7 @@ export const useDataStore = defineStore('data', () => {
const uploadFiles = async (formData, files, upsert) => {
console.log(files)
console.log(formData)
let documentsToInsert = []
const uploadSingleFile = async (file) => {
@@ -428,7 +429,7 @@ export const useDataStore = defineStore('data', () => {
const {data, error} = await supabase
.storage
.from("files")
.upload(`${currentTenant.value}/${file.name}`, file, {upsert})
.upload(`${currentTenant.value}/${file.name}`, file, {upsert: upsert})
if (error) {
console.log(error)
@@ -450,6 +451,8 @@ export const useDataStore = defineStore('data', () => {
documentsToInsert.push({...formData, path: returnPath})
}
console.log(data)
}
//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
}
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 () {
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) => {
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) => {
@@ -917,7 +920,7 @@ export const useDataStore = defineStore('data', () => {
})
const getIncomingInvoiceById = computed(() => (itemId) => {
return incomingInvoices.value.find(item => item.id === itemId)
return incominginvoices.value.find(item => item.id === itemId)
})
const getContractById = computed(() => (itemId) => {
@@ -1020,7 +1023,7 @@ export const useDataStore = defineStore('data', () => {
contacts,
vehicles,
vendors,
incomingInvoices,
incominginvoices,
bankAccounts,
bankStatements,
historyItems,