Start for Dev Branch

This commit is contained in:
2024-12-20 18:46:52 +01:00
parent a6c1eaf69f
commit acf5d1c2ea
16 changed files with 599 additions and 171 deletions

View File

@@ -57,7 +57,8 @@ const itemInfo = ref({
dateDirection: "Rückwirkend",
},
letterhead: null,
agriculture: {}
agriculture: {},
usedAdvanceInvoices: []
})
@@ -71,7 +72,10 @@ const selectedProductcategorie = ref(null)
const services = ref([])
const servicecategories = ref([])
const selectedServicecategorie = ref(null)
const customers = ref([])
const contacts = ref([])
const loaded = ref(false)
const setupPage = async () => {
letterheads.value = (await useSupabaseSelect("letterheads","*")).filter(i => i.documentTypes.length === 0 || i.documentTypes.includes(itemInfo.value.type))
@@ -81,6 +85,8 @@ const setupPage = async () => {
servicecategories.value = (await useSupabaseSelect("servicecategories","*"))
products.value = (await useSupabaseSelect("products","*"))
productcategories.value = (await useSupabaseSelect("productcategories","*"))
customers.value = (await useSupabaseSelect("customers","*","customerNumber"))
contacts.value = (await useSupabaseSelect("contacts","*"))
if(productcategories.value.length > 0) selectedProductcategorie.value = productcategories.value[0].id
if(servicecategories.value.length > 0) selectedServicecategorie.value = servicecategories.value[0].id
@@ -165,13 +171,33 @@ const setupPage = async () => {
}
if(route.query.project) itemInfo.value.project = Number(route.query.project)
if(route.query.project) {
itemInfo.value.project = Number(route.query.project)
checkForOpenAdvanceInvoices()
}
if(route.query.contact) itemInfo.value.contact = Number(route.query.contact)
if(route.query.customer) {
itemInfo.value.customer = Number(route.query.customer)
setCustomerData()
}
}
loaded.value = true
}
const openAdvanceInvoices = ref([])
const checkForOpenAdvanceInvoices = async () => {
const {data,error} = await supabase.from("createddocuments").select().eq("project", itemInfo.value.project).eq("advanceInvoiceResolved", false).eq("type","advanceInvoices")
console.log(data)
openAdvanceInvoices.value = data
}
const addAdvanceInvoiceToInvoice = (advanceInvoice) => {
itemInfo.value.usedAdvanceInvoices.push(advanceInvoice)
}
const setDocumentTypeConfig = (withTexts = false) => {
@@ -201,7 +227,6 @@ const setDocumentTypeConfig = (withTexts = false) => {
const setCustomerData = () => {
let customer = dataStore.getCustomerById(itemInfo.value.customer)
itemInfo.value.contact = null
if(customer) {
@@ -210,6 +235,8 @@ const setCustomerData = () => {
itemInfo.value.address.city = customer.infoData.city
itemInfo.value.address.special = customer.infoData.special
}
}
const setContactPersonData = async () => {
@@ -256,8 +283,6 @@ const importPositions = () => {
}
}
const getRowAmount = (row) => {
return String(Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(2)).replace('.',',')
}
@@ -332,13 +357,6 @@ const addPosition = (mode) => {
}
const showEditRowDescription = ref(false)
const rowToEdit = ref("")
const removePosition = (id) => {
let rows = itemInfo.value.rows.filter(row => row.id !== id)
/*rows = rows.sort((a,b) => a.pos - b.pos)
@@ -353,6 +371,15 @@ const removePosition = (id) => {
}
const getRowMargin = (row) => {
if(row.mode === "normal" && row.product) {
let purchasePrice = dataStore.getProductById(row.product).purchasePrice || 0
return row.price - purchasePrice
} else {
return 0
}
}
const findDocumentErrors = computed(() => {
let errors = []
@@ -405,6 +432,7 @@ const tabItems = computed(() => {
const renderCurrency = (value, currency = "€") => {
return Number(value).toFixed(2).replace(".",",") + " €"
}
const documentTotal = computed(() => {
let totalNet = 0
let total19 = 0
@@ -412,7 +440,7 @@ const documentTotal = computed(() => {
itemInfo.value.rows.forEach(row => {
if(!['pagebreak','title','text'].includes(row.mode)){
let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(2)
let rowPrice = Number(Number(row.quantity) * Number(row.price) * (1 - Number(row.discountPercent) /100) ).toFixed(3)
totalNet = totalNet + Number(rowPrice)
if(row.taxPercent === 19) {
@@ -421,11 +449,33 @@ const documentTotal = computed(() => {
}
})
totalGross = totalNet + total19
let totalGrossAlreadyPaid = 0
itemInfo.value.usedAdvanceInvoices.forEach(advanceInvoiceId => {
let advanceInvoice = openAdvanceInvoices.value.find(i => i.id === advanceInvoiceId)
let priceNet = advanceInvoice.rows.find(i => i.advanceInvoiceData).price
let partSum = priceNet * ((100 + advanceInvoice.rows.find(i => i.advanceInvoiceData).taxPercent) / 100)
totalGrossAlreadyPaid += partSum
})
console.log(totalGrossAlreadyPaid)
let sumToPay = totalGross - totalGrossAlreadyPaid
return {
totalNet: `${String(totalNet.toFixed(2)).replace(".",",")}`,
total19: `${String(total19.toFixed(2)).replace(".",",")}`,
totalGross: `${String(Number(totalNet + total19).toFixed(2)).replace(".",",")}`
totalGross: renderCurrency(totalGross),
totalGrossAlreadyPaid: renderCurrency(totalGrossAlreadyPaid),
totalSumToPay: renderCurrency(sumToPay)
}
@@ -476,7 +526,6 @@ const processDieselPosition = () => {
itemInfo.value.agriculture = {...itemInfo.value.agriculture, ...agricultureData}
}
const getDocumentData = () => {
let customerData = dataStore.getCustomerById(itemInfo.value.customer)
@@ -532,6 +581,7 @@ const getDocumentData = () => {
return {
vorname:contactData && contactData.firstName,
nachname: contactData && contactData.lastName,
kundenname: customerData && customerData.name,
zahlungsziel_in_tagen:itemInfo.paymentDays,
diesel_gesamtverbrauch: (itemInfo.agriculture && itemInfo.agriculture.dieselUsageTotal) && itemInfo.agriculture.dieselUsageTotal
}
@@ -566,7 +616,10 @@ const getDocumentData = () => {
startText: templateStartText(generateContext(itemInfo.value, contactData)),
rows: rows,
total: documentTotal.value,
agriculture: itemInfo.value.agriculture
agriculture: itemInfo.value.agriculture,
usedAdvanceInvoices: itemInfo.value.usedAdvanceInvoices.map(i => {
return openAdvanceInvoices.value.find(x => x.id === i)
})
}
//console.log(returnData)
@@ -574,7 +627,6 @@ const getDocumentData = () => {
return returnData
}
const showDocument = ref(false)
const uri = ref("")
const generateDocument = async () => {
@@ -712,7 +764,8 @@ const saveDocument = async (state) => {
contactPerson: itemInfo.value.contactPerson,
linkedDocument: itemInfo.value.linkedDocument,
agriculture: itemInfo.value.agriculture,
letterhead: itemInfo.value.letterhead
letterhead: itemInfo.value.letterhead,
usedAdvanceInvoices: itemInfo.value.usedAdvanceInvoices
}
if(route.params.id) {
@@ -796,7 +849,7 @@ setupPage()
</UDashboardNavbar>
<UDashboardPanelContent>
<UTabs class="p-5" :items="tabItems" @change="onChangeTab">
<UTabs class="p-5" :items="tabItems" @change="onChangeTab" v-if="loaded">
<template #item="{item}">
@@ -940,11 +993,9 @@ setupPage()
<UFormGroup
label="Kunde:"
>
<InputGroup
class="w-full"
>
<div class="flex flex-row">
<USelectMenu
:options="dataStore.customers"
:options="customers"
option-attribute="name"
value-attribute="id"
:search-attributes="['name']"
@@ -952,14 +1003,15 @@ setupPage()
searchable-placeholder="Suche..."
v-model="itemInfo.customer"
@change="setCustomerData"
class="flex-auto"
class="flex-auto mr-2"
>
<UButton
:color="itemInfo.customer ? 'primary' : 'rose'"
variant="outline"
class="w-full">
<span class="truncate">{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}</span>
class="w-full"
>
<!-- <span class="truncate text-left">{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}</span>-->
{{dataStore.getCustomerById(itemInfo.customer) ? dataStore.getCustomerById(itemInfo.customer).name : "Kein Kunde ausgewählt"}}
<UIcon name="i-heroicons-chevron-right-20-solid" class="w-5 h-5 transition-transform text-gray-400 dark:text-gray-500" :class="['transform rotate-90']" />
</UButton>
@@ -969,11 +1021,14 @@ setupPage()
</USelectMenu>
<UButton
variant="outline"
class="w-25"
v-if="itemInfo.customer"
icon="i-heroicons-arrow-right-end-on-rectangle"
@click="router.push(`/customers/show/${itemInfo.customer}`)"
>Kunde</UButton>
</InputGroup>
</div>
<UAlert
v-if="itemInfo.customer"
@@ -997,7 +1052,7 @@ setupPage()
>
<InputGroup>
<USelectMenu
:options="dataStore.getContactsByCustomerId(itemInfo.customer)"
:options="contacts.filter(i => i.customer === itemInfo.customer)"
option-attribute="fullName"
value-attribute="id"
:search-attributes="['name']"
@@ -1121,9 +1176,13 @@ setupPage()
</UFormGroup>
<UFormGroup
label="Zahlungziel in Tagen:"
class="flex-auto"
class="w-full"
>
<template #label>
<span class="truncate">
Zahlungsziel in Tagen:
</span>
</template>
<UInput
type="number"
v-model="itemInfo.paymentDays"
@@ -1169,6 +1228,7 @@ setupPage()
:search-attributes="['name']"
class="w-full"
:disabled="!itemInfo.customer"
@change="checkForOpenAdvanceInvoices"
>
<template #label>
{{dataStore.getProjectById(itemInfo.project) ? dataStore.getProjectById(itemInfo.project).name : "Kein Projekt ausgewählt"}}
@@ -1270,9 +1330,6 @@ setupPage()
</div>
<UDivider
class="my-3"
/>
@@ -1389,6 +1446,7 @@ setupPage()
<UInput
v-model="row.text"
placeholder="Name"
class="min-w-40"
/>
</td>
<td
@@ -1558,7 +1616,8 @@ setupPage()
<UInput
v-model="row.price"
type="number"
step="0.01"
step="0.001"
:color="getRowMargin(row) > 0 ? 'primary' : 'rose'"
>
<template #trailing>
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>
@@ -1715,18 +1774,21 @@ setupPage()
<UButton
@click="addPosition('service')"
class="mt-3"
:disabled="itemInfo.type === 'advanceInvoices'"
>
+ Leistung
</UButton>
<UButton
@click="addPosition('normal')"
class="mt-3"
:disabled="itemInfo.type === 'advanceInvoices'"
>
+ Artikel
</UButton>
<UButton
@click="addPosition('free')"
class="mt-3"
:disabled="itemInfo.type === 'advanceInvoices'"
>
+ Freie Position
</UButton>
@@ -1750,6 +1812,44 @@ setupPage()
</UButton>
</InputGroup>
<UDivider
class="mt-5 mb-3"
v-if="openAdvanceInvoices.length > 0"
>
Noch nicht abgerechnete Abschlagsrechnungen
</UDivider>
<!-- Abzurechnende Abschlagsrechnungen -->
<div
v-for="advanceInvoice in openAdvanceInvoices"
:key="advanceInvoice.id"
class="flex flex-row justify-between my-2"
>
<span>{{advanceInvoice.documentNumber}}</span>
<span>Summe: {{renderCurrency(advanceInvoice.rows[0].price * (1 + advanceInvoice.rows[0].taxPercent/100))}}</span>
<InputGroup>
<UButton
@click="addAdvanceInvoiceToInvoice(advanceInvoice.id)"
:disabled="itemInfo.usedAdvanceInvoices.includes(advanceInvoice.id)"
class="mr-2"
>
Verwenden
</UButton>
<UButton
@click="itemInfo.usedAdvanceInvoices = itemInfo.usedAdvanceInvoices.filter(i => i !== advanceInvoice.id)"
:disabled="!itemInfo.usedAdvanceInvoices.includes(advanceInvoice.id)"
color="rose"
variant="outline"
>
X
</UButton>
</InputGroup>
</div>
<UDivider class="my-3" v-if="itemInfo.rows.length > 0"/>
<div class="w-full flex justify-end" v-if="itemInfo.type !== 'deliveryNotes'">
<table class="w-1/3" v-if="itemInfo.rows.length > 0">
<tr>
@@ -1764,6 +1864,19 @@ setupPage()
<td class="font-bold">Brutto:</td>
<td class="text-right">{{documentTotal.totalGross}}</td>
</tr>
<tr v-if="documentTotal.totalGrossAlreadyPaid !== '0,00 €'">
<td class="font-bold">Bereits bezahlt:</td>
<td class="text-right">{{documentTotal.totalGrossAlreadyPaid}}</td>
</tr>
<tr v-if="documentTotal.totalGrossAlreadyPaid !== '0,00 €'">
<td class="font-bold">Offene Summe:</td>
<td class="text-right">{{documentTotal.totalSumToPay}}</td>
</tr>
</table>
</div>
@@ -1815,6 +1928,7 @@ setupPage()
</div>
</template>
</UTabs>
<UProgress animation="carousel" v-else/>
</UDashboardPanelContent>

View File

@@ -2,7 +2,7 @@
import {BlobReader, BlobWriter, ZipWriter} from "@zip.js/zip.js";
import {useSupabaseSelectDocuments} from "~/composables/useSupabase.js";
import {useSupabaseSelectDocuments, useSupabaseSelectSingle} from "~/composables/useSupabase.js";
definePageMeta({
middleware: "auth"
@@ -11,6 +11,8 @@ const dataStore = useDataStore()
const supabase = useSupabaseClient()
const user = useSupabaseUser()
const toast = useToast()
const router = useRouter()
const route = useRoute()
dataStore.fetchDocuments()
@@ -19,29 +21,31 @@ const uploadInProgress = ref(false)
const fileUploadFormData = ref({
tags: ["Eingang"],
path: "",
tenant: dataStore.currentTenant
tenant: dataStore.currentTenant,
folder: null
})
let tags = dataStore.getDocumentTags
const selectedTags = ref("Eingang")
const documents = ref([])
const folders = ref([])
const selectedPath = ref("_")
const currentFolder = ref(null)
const loadingDocs = ref(false)
const isDragTarget = ref(false)
const setupPage = async () => {
//documents.value = await useSupabaseSelectDocuments("*, project(id,name), customer(id,name), contract(id,name), vendor(id,name), plant(id,name), vehicle(id,licensePlate), product(id,name), profile(id,fullName) ")
//documents.value = await useSupabaseSelectDocuments("*",null, selectedPath.value)
//console.log(documents.value)
folders.value = await useSupabaseSelect("folders")
folders.value = dataStore.ownTenant.documentFolders
documents.value = await useSupabaseSelectDocuments("*",null)
documents.value = await useSupabaseSelectDocuments("*",null,selectedPath.value)
//await supabase.from("documents").select().eq("folderPath",selectedPath.value).eq("tenant",dataStore.currentTenant)
//console.log(await supabase.from("documents").select().eq("folderPath",selectedPath.value))
if(route.query) {
if(route.query.folder) {
console.log(route.query.folder)
currentFolder.value = await useSupabaseSelectSingle("folders", route.query.folder)
}
}
const dropZone = document.getElementById("drop_zone")
@@ -71,37 +75,63 @@ const setupPage = async () => {
setupPage()
const currentFolders = computed(() => {
if(folders.value.length > 0) {
/*console.log(folders.value[0].path.split("/").filter(x => x.length > 0))
console.log(selectedPath.value.split("/").filter(x => x.length > 0))*/
let tempFolders = folders.value.filter(i => (i.path.split("_").filter(x => x.length > 0) || []).length === selectedPath.value.split("_").filter(x => x.length > 0).length + 1)
tempFolders = tempFolders.filter(i => i.path.includes(selectedPath.value))
let tempFolders = folders.value.filter(i => currentFolder.value ? i.parent === currentFolder.value.id : !i.parent)
return tempFolders
}
} else return []
})
const breadcrumbLinks = computed(() => {
return [{
label: "Home",
click: () => {
changePath("_")
},
icon: "i-heroicons-folder"
},...selectedPath.value.split("_").filter(x => x.length > 0).map((i,index) => {
let re = new RegExp(".+?" + i )
let path = selectedPath.value.match(re)[0]
return {
label: folders.value.find(x => x.path === path).name ||path,
if(currentFolder.value) {
let parents = []
const addParent = (parent) => {
parents.push(parent)
if(parent.parent) {
addParent(folders.value.find(i => i.id === currentFolder.value.parent))
}
}
if(currentFolder.value.parent) {
addParent(folders.value.find(i => i.id === currentFolder.value.parent))
}
return [{
label: "Home",
click: () => {
changePath(path)
changeFolder(null)
},
icon: "i-heroicons-folder"
}
})]
},
...parents.map(i => {
return {
label: folders.value.find(x => x.id === i.id).name,
click: () => {
changeFolder(i)
},
icon: "i-heroicons-folder"
}
}),
{
label: currentFolder.value.name,
click: () => {
changeFolder(currentFolder.value)
},
icon: "i-heroicons-folder"
}]
} else {
return [{
label: "Home",
click: () => {
changeFolder(null)
},
icon: "i-heroicons-folder"
}]
}
})
@@ -110,23 +140,22 @@ const breadcrumbLinks = computed(() => {
const filteredDocuments = computed(() => {
/*if(selectedTags.value !== "Archiviert") {
return documents.value.filter(i => i.tags.find(t => selectedTags.value === t) && !i.tags.includes("Archiviert"))
} else {
return documents.value.filter(i => i.tags.find(t => selectedTags.value === t))
}*/
return documents.value
return documents.value.filter(i => currentFolder.value ? i.folder === currentFolder.value.id : !i.folder)
})
const changePath = async (newPath) => {
const changeFolder = async (newFolder) => {
loadingDocs.value = true
selectedPath.value = newPath
currentFolder.value = newFolder
if(newFolder) {
fileUploadFormData.value.folder = newFolder.id
await router.push(`/documents?folder=${newFolder.id}`)
} else {
fileUploadFormData.value.folder = null
await router.push(`/documents`)
}
setupPage()
}
@@ -134,7 +163,7 @@ const uploadFiles = async (files) => {
uploadInProgress.value = true;
if(files) {
await dataStore.uploadFiles({tags: ["Ablage"],tenant: dataStore.currentTenant, folderPath: selectedPath.value}, files, true)
await dataStore.uploadFiles({tags: ["Ablage"],tenant: dataStore.currentTenant,folder: currentFolder.value.id}, files, true)
} else {
await dataStore.uploadFiles(fileUploadFormData.value, document.getElementById("fileUploadInput").files, true)
@@ -213,7 +242,7 @@ const downloadSelected = async () => {
<template>
<UDashboardNavbar
title="Dokumente"
title="Dateien"
>
</UDashboardNavbar>
@@ -254,7 +283,7 @@ const downloadSelected = async () => {
<a
class="w-1/6 folderIcon flex flex-col p-5 m-2"
v-for="folder in currentFolders"
@click="changePath(folder.path)"
@click="changeFolder(folder)"
>
<UIcon
@@ -265,8 +294,8 @@ const downloadSelected = async () => {
</a>
</div>
<UDivider class="my-5" v-if="currentFolders.length > 0">Dokumente</UDivider>
<UDivider class="my-5" v-if="currentFolder">{{currentFolder.name}}</UDivider>
<UDivider class="my-5" v-else>Ablage</UDivider>
<div v-if="!loadingDocs">
<DocumentList

View File

@@ -43,6 +43,9 @@
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
@select="(i) => router.push(`/inventoryitems/show/${i.id}`) "
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Inventarartikel anzuzeigen' }"
v-model:sort="sortConfig"
sort-mode="manual"
@update:sort="setupPage"
>
@@ -50,6 +53,8 @@
</template>
<script setup>
import {sort} from "fast-sort"
definePageMeta({
middleware: "auth"
@@ -70,8 +75,13 @@ const dataStore = useDataStore()
const router = useRouter()
const items = ref([])
const sortConfig = ref({
column: "articleNumber",
direction: "desc"
})
const setupPage = async () => {
items.value = await useSupabaseSelect("inventoryitems","*", "articleNumber")
items.value = await useSupabaseSelect("inventoryitems","*")
}
setupPage()
@@ -96,17 +106,20 @@ const selectedColumns = ref(templateColumns)
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
const searchString = ref('')
const filteredRows = computed(() => {
if(!searchString.value) {
return items.value
let sorted = []
if(sortConfig.value.direction === "asc"){
sorted = sort(items.value).asc(i => i[sortConfig.value.column])
} else {
sorted = sort(items.value).desc(i => i[sortConfig.value.column])
}
return items.value.filter(product => {
return Object.values(product).some((value) => {
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
})
})
return useListFilter(searchString.value, sorted)
})

View File

@@ -237,7 +237,7 @@ setupPage()
<UInput
v-model="itemInfo.sellingPrice"
type="number"
steps="0.01"
steps="0.001"
>
<template #trailing>
<span class="text-gray-500 dark:text-gray-400 text-xs">EUR</span>

View File

@@ -0,0 +1,41 @@
<script setup>
const lexofficeActiveFunctions = ref({
sendInvoicesToLexoffice: true,
})
</script>
<template>
<UDashboardNavbar title="Integrationen"></UDashboardNavbar>
<UDashboardPanelContent>
<UAccordion
class="p-5"
color="primary"
variant="soft"
size="sm"
:items="[{ label: 'Lexoffice', content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit' }]"
>
<template #item="{item}">
<div v-if="item.label === 'Lexoffice'">
Scopes:
<UCheckbox v-model="lexofficeActiveFunctions.sendInvoicesToLexoffice" name="notifications" label="Rechnungen an Lexoffice übertragen" />
<UButton>
Kunden importieren
</UButton>
<UButton>
Lieferanten importieren
</UButton>
</div>
</template>
</UAccordion>
</UDashboardPanelContent>
</template>
<style scoped>
</style>

View File

@@ -48,9 +48,9 @@ const projects = ref([])
//Functions
const setupPage = async () => {
if(mode.value === "show" ){
itemInfo.value = await useSupabaseSelectSingle("trackingtrips",route.params.id,"*, trackingDevice(*, vehicle(*))")
itemInfo.value = await useSupabaseSelectSingle("trackingtripsgen",route.params.id,"*, trackingDevice(*, vehicle(*))")
} else if(mode.value === "edit") {
itemInfo.value = await useSupabaseSelectSingle("trackingtrips",route.params.id,"*")
itemInfo.value = await useSupabaseSelectSingle("trackingtripsgen",route.params.id,"*")
}
@@ -141,8 +141,6 @@ const zoom = ref(6)
</template>
</UDashboardNavbar>
<UTabs
:items="[{label: 'Informationen'}]"
v-if="mode === 'show' && itemInfo.id"
@@ -192,9 +190,9 @@ const zoom = ref(6)
</UCard>
<UCard class="mt-5">
<Map :markers="[[itemInfo.startLatitude, itemInfo.startLongitude],[itemInfo.endLatitude, itemInfo.endLongitude]]"
:startMarker="[itemInfo.startLatitude, itemInfo.startLongitude]"
:endMarker="[itemInfo.endLatitude, itemInfo.endLongitude]"
<Map :markers="[[itemInfo.startLat, itemInfo.startLon],[itemInfo.endLat, itemInfo.endLon]]"
:startMarker="[itemInfo.startLat, itemInfo.startLon]"
:endMarker="[itemInfo.endLat, itemInfo.endLon]"
/>

View File

@@ -57,8 +57,12 @@
<template #endTime-data="{row}">
{{dayjs(row.endTime).format("DD.MM.YY HH:mm")}}
</template>
<template #distance-data="{row}">
{{row.distance > 0 ? (row.distance/1000).toFixed(2) : 0 }} km
<template #gpsDistance-data="{row}">
{{row.gpsDistance > 0 ? (row.gpsDistance/1000).toFixed(2) : 0 }} km
</template>
<template #usedFuel-data="{row}">
<span v-if="row.endFuelLevel - row.startFuelLevel < 0">{{row.endFuelLevel - row.startFuelLevel}} / {{(row.vehicle.tankSize / 100 * Math.abs(row.endFuelLevel - row.startFuelLevel)).toFixed(2)}}</span>
<span v-else>0</span>
</template>
</UTable>
</template>
@@ -106,7 +110,8 @@ const items = ref([])
const selectedItem = ref(0)
const setupPage = async () => {
items.value = await useSupabaseSelect("trackingtrips","*, trackingDevice(*), vehicle (*)","startTime",false)
items.value = await useSupabaseSelect("trackingtripsgen","*, trackingDevice(*), vehicle(*)","startTime",false)
console.log(items.value)
}
setupPage()
@@ -137,9 +142,13 @@ const templateColumns = [
sortable: true
},
{
key: "distance",
key: "gpsDistance",
label: "Entfernung:",
sortable: true
},
{
key: "usedFuel",
label: "Kraftstoff:"
}
]
const selectedColumns = ref(templateColumns)

View File

@@ -121,6 +121,7 @@ setupPage()
<p>E-Mail: {{currentItem.infoData.email}}</p>
<p>Web: {{currentItem.infoData.web}}</p>
<p>USt-Id: {{currentItem.infoData.ustid}}</p>
<p>SEPA Mandat: {{currentItem.hasSEPA ? "Ja" : "Nein"}}</p>
<p>Notizen:<br> {{currentItem.notes}}</p>
</div>
</UCard>
@@ -251,6 +252,13 @@ setupPage()
v-model="itemInfo.infoData.web"
/>
</UFormGroup>
<UFormGroup
label="SEPA Mandat abgeschlossen:"
>
<UCheckbox
v-model="itemInfo.hasSEPA"
/>
</UFormGroup>
<UFormGroup
label="USt-Id:"
>