diff --git a/components/EntityShow.vue b/components/EntityShow.vue index 26f570a..0d68aaa 100644 --- a/components/EntityShow.vue +++ b/components/EntityShow.vue @@ -123,25 +123,41 @@ const invoiceDeliveryNotes = () => { router.push(`/createDocument/edit?type=invoices&linkedDocuments=[${props.item.createddocuments.filter(i => i.type === "deliveryNotes").map(i => i.id)}]`) } -const getAvailableQueryStringData = () => { +const getAvailableQueryStringData = (keys) => { let returnString ="" + function addParam (key,value) { + if(returnString.length === 0) { + returnString += `${key}=${value}` + } else { + returnString += `&${key}=${value}` + + } + } + + if(props.item.customer) { - returnString += `&customer=${props.item.customer.id}` + addParam("customer", props.item.customer.id) } else if(type === "customers") { - returnString += `&customer=${props.item.id}` + addParam("customer", props.item.id) } if(props.item.project) { - returnString += `&project=${props.item.project.id}` + addParam("project", props.item.project.id) } else if(type === "projects") { - returnString += `&project=${props.item.id}` + addParam("project", props.item.id) } if(props.item.plant) { - returnString += `&plant=${props.item.plant.id}` + addParam("plant", props.item.plant.id) } else if(type === "plants") { - returnString += `&plant=${props.item.id}` + addParam("plant", props.item.id) + } + + if(keys) { + Object.keys(keys).forEach(key => { + addParam(key, keys[key]) + }) } return returnString @@ -439,27 +455,27 @@ const getAvailableQueryStringData = () => { + Angebot + Auftragsbestätigung + Lieferschein + Abschlagsrechnung + Rechnung @@ -473,7 +489,7 @@ const getAvailableQueryStringData = () => {