Fixed FinalInvoice
This commit is contained in:
@@ -99,6 +99,10 @@ const setupData = async () => {
|
||||
}
|
||||
|
||||
const loaded = ref(false)
|
||||
const normalizeEntityId = (value) => {
|
||||
if (value === null || typeof value === "undefined") return null
|
||||
return typeof value === "object" ? (value.id ?? null) : value
|
||||
}
|
||||
const setupPage = async () => {
|
||||
|
||||
await setupData()
|
||||
@@ -138,14 +142,15 @@ const setupPage = async () => {
|
||||
|
||||
if (route.query.loadMode === "deliveryNotes") {
|
||||
let linkedDocuments = (await useEntities("createddocuments").select()).filter(i => JSON.parse(route.query.linkedDocuments).includes(i.id))
|
||||
if (linkedDocuments.length === 0) return
|
||||
|
||||
//TODO: Implement Checking for Same Customer, Contact and Project
|
||||
|
||||
itemInfo.value.customer = linkedDocuments[0].customer ? linkedDocuments[0].customer.id : null
|
||||
itemInfo.value.project = linkedDocuments[0].project ? linkedDocuments[0].project.id : null
|
||||
itemInfo.value.contact = linkedDocuments[0].contact ? linkedDocuments[0].contact.id : null
|
||||
itemInfo.value.customer = normalizeEntityId(linkedDocuments[0].customer)
|
||||
itemInfo.value.project = normalizeEntityId(linkedDocuments[0].project)
|
||||
itemInfo.value.contact = normalizeEntityId(linkedDocuments[0].contact)
|
||||
|
||||
setCustomerData()
|
||||
await setCustomerData(null, true)
|
||||
|
||||
let firstDate = null
|
||||
let lastDate = null
|
||||
@@ -207,21 +212,23 @@ const setupPage = async () => {
|
||||
}
|
||||
else if (route.query.loadMode === "finalInvoice") {
|
||||
let linkedDocuments = (await useEntities("createddocuments").select()).filter(i => JSON.parse(route.query.linkedDocuments).includes(i.id))
|
||||
if (linkedDocuments.length === 0) return
|
||||
|
||||
//TODO: Implement Checking for Same Customer, Contact and Project
|
||||
|
||||
console.log(linkedDocuments)
|
||||
|
||||
itemInfo.value.customer = linkedDocuments[0].customer
|
||||
itemInfo.value.project = linkedDocuments[0].project
|
||||
itemInfo.value.contact = linkedDocuments[0].contact
|
||||
itemInfo.value.customer = normalizeEntityId(linkedDocuments[0].customer)
|
||||
itemInfo.value.project = normalizeEntityId(linkedDocuments[0].project)
|
||||
itemInfo.value.contact = normalizeEntityId(linkedDocuments[0].contact)
|
||||
|
||||
setCustomerData()
|
||||
await setCustomerData(null, true)
|
||||
|
||||
for await (const doc of linkedDocuments.filter(i => i.type === "confirmationOrders")) {
|
||||
let linkedDocument = await useEntities("createddocuments").selectSingle(doc.id)
|
||||
|
||||
itemInfo.value.rows.push({
|
||||
id: uuidv4(),
|
||||
mode: "title",
|
||||
text: linkedDocument.title,
|
||||
})
|
||||
@@ -233,6 +240,7 @@ const setupPage = async () => {
|
||||
let linkedDocument = await useEntities("createddocuments").selectSingle(doc.id)
|
||||
|
||||
itemInfo.value.rows.push({
|
||||
id: uuidv4(),
|
||||
mode: "title",
|
||||
text: linkedDocument.title,
|
||||
})
|
||||
@@ -241,6 +249,7 @@ const setupPage = async () => {
|
||||
}
|
||||
|
||||
itemInfo.value.rows.push({
|
||||
id: uuidv4(),
|
||||
mode: "title",
|
||||
text: "Abschlagsrechnungen",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user