Storno Fix createddocument link. Added Disable and Tooltip for Storno Button
This commit is contained in:
@@ -1387,7 +1387,7 @@ const saveDocument = async (state, resetup = false) => {
|
||||
endText: itemInfo.value.endText,
|
||||
rows: itemInfo.value.rows,
|
||||
contactPerson: itemInfo.value.contactPerson,
|
||||
linkedDocument: itemInfo.value.linkedDocument,
|
||||
createddocument: itemInfo.value.createddocument,
|
||||
agriculture: itemInfo.value.agriculture,
|
||||
letterhead: itemInfo.value.letterhead,
|
||||
usedAdvanceInvoices: itemInfo.value.usedAdvanceInvoices,
|
||||
|
||||
@@ -17,11 +17,18 @@ const dataStore = useDataStore()
|
||||
|
||||
const itemInfo = ref({})
|
||||
const linkedDocument =ref({})
|
||||
const links = ref([])
|
||||
|
||||
const setupPage = async () => {
|
||||
if(route.params) {
|
||||
if(route.params.id) itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id,"*,files(*),linkedDocument(*), statementallocations(bs_id)")
|
||||
|
||||
console.log(itemInfo.value)
|
||||
if(itemInfo.value.type === "invoices"){
|
||||
const createddocuments = await useEntities("createddocuments").select()
|
||||
console.log(createddocuments)
|
||||
links.value = createddocuments.filter(i => i.createddocument?.id === itemInfo.value.id)
|
||||
console.log(links.value)
|
||||
}
|
||||
|
||||
linkedDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
|
||||
}
|
||||
@@ -80,14 +87,20 @@ const openBankstatements = () => {
|
||||
>
|
||||
E-Mail
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="router.push(`/createDocument/edit/?createddocument=${itemInfo.id}&loadMode=storno`)"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
<UTooltip
|
||||
v-if="itemInfo.type === 'invoices' || itemInfo.type === 'advanceInvoices'"
|
||||
:text="links.find(i => i.type === 'cancellationInvoices') ? 'Bereits stoniert' : ''"
|
||||
>
|
||||
Stornieren
|
||||
</UButton>
|
||||
<UButton
|
||||
@click="router.push(`/createDocument/edit/?createddocument=${itemInfo.id}&loadMode=storno`)"
|
||||
variant="outline"
|
||||
color="rose"
|
||||
:disabled="links.find(i => i.type === 'cancellationInvoices')"
|
||||
>
|
||||
Stornieren
|
||||
</UButton>
|
||||
</UTooltip>
|
||||
|
||||
<UButton
|
||||
v-if="itemInfo.project"
|
||||
@click="router.push(`/standardEntity/projects/show/${itemInfo.project?.id}`)"
|
||||
|
||||
Reference in New Issue
Block a user