Many Changes

This commit is contained in:
2024-02-01 22:17:56 +01:00
parent 34d1eb9c71
commit bd09d07698
12 changed files with 91 additions and 29 deletions

View File

@@ -117,7 +117,6 @@ const archiveDocument = () => {
<UBadge
v-if="documentData.inDatev"
>DATEV</UBadge>
{{documentData}}
</div>

View File

@@ -15,7 +15,7 @@ export const useNumberRange = (resourceType) => {
let nextNumber = numberRange.nextNumber
const {data,error} = await supabase
.from("numberRanges")
.from("numberranges")
.update({nextNumber: nextNumber + 1})
.eq('id',numberRange.id)

View File

@@ -328,7 +328,7 @@ export const useCreatePdf = async (invoiceData) => {
opacity: 1,
maxWidth: 240
})
pages[pageCounter - 1].drawText("Projekt:", {
/*pages[pageCounter - 1].drawText("Projekt:", {
...getCoordinatesForPDFLib(126,90, page1),
size:10,
color:rgb(0,0,0),
@@ -339,13 +339,13 @@ export const useCreatePdf = async (invoiceData) => {
pages[pageCounter - 1].drawText(invoiceData.info.project, {
y: getCoordinatesForPDFLib(126,90, page1).y,
x: getCoordinatesForPDFLib(126,90,page1).x + 340 - font.widthOfTextAtSize(invoiceData.info.project,10),
x: getCoordinatesForPDFLib(126,90,page1).x + 50 /!*+ 210 - font.widthOfTextAtSize(invoiceData.info.project,10)*!/,
size:10,
color:rgb(0,0,0),
lineHeight:10,
opacity: 1,
maxWidth: 100
})
maxWidth: 150
})*/
/*page1.drawLine({
start: getCoordinatesForPDFLib(125,90,page1),
@@ -366,12 +366,12 @@ export const useCreatePdf = async (invoiceData) => {
})*/
pages[pageCounter - 1].drawText(invoiceData.title, {
...getCoordinatesForPDFLib(20,102, page1),
size:15,
...getCoordinatesForPDFLib(20,100, page1),
size:13,
color:rgb(0,0,0),
lineHeight:15,
opacity: 1,
maxWidth: 240
maxWidth: 500
})
/*page1.drawLine({
@@ -384,11 +384,11 @@ export const useCreatePdf = async (invoiceData) => {
pages[pageCounter - 1].drawText(invoiceData.description, {
...getCoordinatesForPDFLib(20,112, page1),
size:15,
size:13,
color:rgb(0,0,0),
lineHeight:15,
opacity: 1,
maxWidth: 240
maxWidth: 500
})
pages[pageCounter - 1].drawText(invoiceData.startText,{
@@ -674,7 +674,8 @@ export const useCreatePdf = async (invoiceData) => {
//Footer
rowHeight += 25
console.log(rowHeight)
//rowHeight += 25
pages[pageCounter - 1].drawRectangle({
...getCoordinatesForPDFLib(20,rowHeight, page1),
width: 180 * 2.83,

View File

@@ -160,7 +160,7 @@ setupPage()
v-model="itemInfo.customer"
option-attribute="name"
value-attribute="id"
:options="customers"
:options="dataStore.customers"
searchable
:search-attributes="['name']"
>
@@ -176,7 +176,7 @@ setupPage()
v-model="itemInfo.vendor"
option-attribute="name"
value-attribute="id"
:options="vendors"
:options="dataStore.vendors"
searchable
:search-attributes="['name']"
>
@@ -227,13 +227,13 @@ setupPage()
<template #footer>
<UButton
v-if="mode == 'edit'"
@click="dataStore.updateItem('contacts',itemInfo)"
@click="dataStore.updateItem('contacts',{...itemInfo, fullName: `${itemInfo.firstName} ${itemInfo.lastName}`})"
>
Speichern
</UButton>
<UButton
v-else-if="mode == 'create'"
@click="dataStore.createNewItem('contacts',itemInfo)"
@click="dataStore.createNewItem('contacts',{...itemInfo, fullName: `${itemInfo.firstName} ${itemInfo.lastName}`})"
>
Erstellen
</UButton>

View File

@@ -80,6 +80,17 @@ setupPage()
Beschreibung:<br>
{{currentContract.description}}<br>
<InputGroup>
<DocumentUpload
type="contract"
:element-id="currentContract.id"
/>
</InputGroup>
<DocumentList
:documents="dataStore.getDocumentsByContractId(currentContract.id)"
/>
<DevOnly>
{{currentContract}}
</DevOnly>
@@ -92,14 +103,6 @@ setupPage()
>
Bearbeiten
</UButton>
<UButton
color="red"
class="ml-2"
disabled
>
Archivieren
</UButton>
<!-- TODO: Vertrag archivieren -->
</template>

View File

@@ -239,13 +239,13 @@ const setPosNumbers = () => {
const saveDocument = async () => {
let createData = {
type: itemInfo.value.type,
state: itemInfo.value.state || "Entwurf",
customer: itemInfo.value.customer,
contact: itemInfo.value.contact,
address: itemInfo.value.address,
project: itemInfo.value.project,
documentNumber: itemInfo.value.documentNumber,
documentDate: itemInfo.value.documentDate,
state: "Entwurf",
info: {
},
@@ -277,6 +277,8 @@ const saveDocument = async () => {
const closeDocument = async () => {
itemInfo.value.state = "Gebucht"
await saveDocument()
await generateDocument()
@@ -308,6 +310,9 @@ const closeDocument = async () => {
await dataStore.uploadFiles(fileData, [file], true)
await router.push(`/createDocument/show/${itemInfo.value.id}`)
//console.log(uri)
}

View File

@@ -2,6 +2,7 @@
const dataStore = useDataStore()
const route = useRoute()
const router = useRouter()
const itemInfo = ref({})
@@ -16,8 +17,21 @@ setupPage()
<template>
<InputGroup>
<UButton
@click="router.push(`/createDocument/edit/${itemInfo.id}`)"
>
Bearbeiten
</UButton>
</InputGroup>
{{itemInfo}}
<DocumentDisplay
:document-data="dataStore.documents.find(i => i.createdDocument === itemInfo.id)"
/>
</template>
<style scoped>

View File

@@ -1,7 +1,6 @@
<template>
<div>
Offene Aufgaben: {{openTasks}}<br>
Laufende Projekte:
</div>
</template>

View File

@@ -45,7 +45,7 @@ const resources = {
const updateNumberRange = async (range) => {
const {data,error} = await supabase
.from("numberRanges")
.from("numberranges")
.update(range)
.eq('id',range.id)

View File

@@ -21,6 +21,13 @@
@select="selectItem"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }"
>
<template #finish-data="{row}">
<UButton
icon="i-heroicons-check"
variant="ghost"
@click="markAsFinished(row)"
/>
</template>
<template #created_at-data="{row}">
{{row.created_at ? dayjs(row.created_at).format("DD.MM.YY HH:mm") : ''}}
</template>
@@ -33,6 +40,9 @@
<template #customer-data="{row}">
{{dataStore.customers.find(customer => customer.id === row.customer) ? dataStore.customers.find(customer => customer.id === row.customer).name : "" }}
</template>
<template #plant-data="{row}">
{{dataStore.getPlantById(row.plant) ? dataStore.getPlantById(row.plant).name : "" }}
</template>
</UTable>
</div>
@@ -50,7 +60,10 @@ const router = useRouter()
const mode = ref("show")
const columns = [
{
key:"finish"
},{
key: "created_at",
label: "Erstellt am:",
sortable: true
@@ -106,6 +119,10 @@ const filteredRows = computed(() => {
const selectItem = (item) => {
router.push(`/tasks/show/${item.id} `)
}
const markAsFinished = (item) => {
dataStore.updateItem("tasks", {...item, categorie: "Erledigt"})
}
</script>
<style scoped>

View File

@@ -27,8 +27,10 @@ const itemInfo = ref({
const tabItems = [{
label: 'Informationen',
}, {
},/* {
label: 'Eingangsrechnungen',
},*/ {
label: 'Dokumente',
}]
const incomingInvoicesColumns = [
@@ -154,6 +156,18 @@ setupPage()
</UTable>
</div>
<div v-else-if="item.label === 'Dokumente'">
<InputGroup>
<DocumentUpload
type="vehicle"
:element-id="currentItem.id"
/>
</InputGroup>
<DocumentList
:documents="dataStore.getDocumentsByContractId(currentItem.id)"
/>
</div>
</template>
</UTabs>

View File

@@ -370,7 +370,7 @@ export const useDataStore = defineStore('data', () => {
else {
console.log(data)
fetchDocuments()
await fetchDocuments()
//documents.value.push(...data)
}
@@ -551,6 +551,14 @@ export const useDataStore = defineStore('data', () => {
return documents.value.filter(item => item.plant === itemId && !item.tags.includes("Archiviert"))
})
const getDocumentsByContractId = computed(() => (itemId) => {
return documents.value.filter(item => item.contract === itemId && !item.tags.includes("Archiviert"))
})
const getDocumentsByVehicleId = computed(() => (itemId) => {
return documents.value.filter(item => item.vehicle === itemId && !item.tags.includes("Archiviert"))
})
const getEventsByProjectId = computed(() => (projectId) => {
return events.value.filter(item => item.project === projectId)
})
@@ -914,6 +922,8 @@ export const useDataStore = defineStore('data', () => {
getContactsByVendorId,
getDocumentsByProjectId,
getDocumentsByPlantId,
getDocumentsByContractId,
getDocumentsByVehicleId,
getEventsByProjectId,
getTimesByProjectId,
getTasksByProjectId,