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 <UBadge
v-if="documentData.inDatev" v-if="documentData.inDatev"
>DATEV</UBadge> >DATEV</UBadge>
{{documentData}}
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -27,8 +27,10 @@ const itemInfo = ref({
const tabItems = [{ const tabItems = [{
label: 'Informationen', label: 'Informationen',
}, { },/* {
label: 'Eingangsrechnungen', label: 'Eingangsrechnungen',
},*/ {
label: 'Dokumente',
}] }]
const incomingInvoicesColumns = [ const incomingInvoicesColumns = [
@@ -154,6 +156,18 @@ setupPage()
</UTable> </UTable>
</div> </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> </template>
</UTabs> </UTabs>

View File

@@ -370,7 +370,7 @@ export const useDataStore = defineStore('data', () => {
else { else {
console.log(data) console.log(data)
fetchDocuments() await fetchDocuments()
//documents.value.push(...data) //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")) 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) => { const getEventsByProjectId = computed(() => (projectId) => {
return events.value.filter(item => item.project === projectId) return events.value.filter(item => item.project === projectId)
}) })
@@ -914,6 +922,8 @@ export const useDataStore = defineStore('data', () => {
getContactsByVendorId, getContactsByVendorId,
getDocumentsByProjectId, getDocumentsByProjectId,
getDocumentsByPlantId, getDocumentsByPlantId,
getDocumentsByContractId,
getDocumentsByVehicleId,
getEventsByProjectId, getEventsByProjectId,
getTimesByProjectId, getTimesByProjectId,
getTasksByProjectId, getTasksByProjectId,