Fix Createddocs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -31,11 +31,11 @@
|
|||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
<UDashboardToolbar>
|
<UDashboardToolbar>
|
||||||
<template #left>
|
<template #left>
|
||||||
<!-- <UCheckbox
|
<!-- <UCheckbox
|
||||||
v-model="showDrafts"
|
v-model="showDrafts"
|
||||||
label="Entwürfe Anzeigen"
|
label="Entwürfe Anzeigen"
|
||||||
class="my-auto mr-3"
|
class="my-auto mr-3"
|
||||||
/>-->
|
/>-->
|
||||||
<USelectMenu
|
<USelectMenu
|
||||||
v-model="selectedTypes"
|
v-model="selectedTypes"
|
||||||
icon="i-heroicons-adjustments-horizontal-solid"
|
icon="i-heroicons-adjustments-horizontal-solid"
|
||||||
@@ -204,7 +204,6 @@ const items = ref([])
|
|||||||
const selectedItem = ref(0)
|
const selectedItem = ref(0)
|
||||||
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
//items.value = (await useSupabaseSelect("createddocuments","*, customer(id,name), statementallocations(id,amount),linkedDocument(*)","documentNumber")).filter(i => !i.archived)
|
|
||||||
items.value = (await useEntities("createddocuments").select("*, customer(id,name), statementallocations(id,amount),linkedDocument(*)","documentNumber")).filter(i => !i.archived)
|
items.value = (await useEntities("createddocuments").select("*, customer(id,name), statementallocations(id,amount),linkedDocument(*)","documentNumber")).filter(i => !i.archived)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +219,7 @@ const templateColumns = [
|
|||||||
key: 'type',
|
key: 'type',
|
||||||
label: "Typ",
|
label: "Typ",
|
||||||
sortable: true
|
sortable: true
|
||||||
},{
|
}, {
|
||||||
key: 'state',
|
key: 'state',
|
||||||
label: "Status",
|
label: "Status",
|
||||||
sortable: true
|
sortable: true
|
||||||
@@ -288,19 +287,19 @@ const types = computed(() => {
|
|||||||
const selectItem = (item) => {
|
const selectItem = (item) => {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
|
|
||||||
if(item.state === "Entwurf"){
|
if (item.state === "Entwurf") {
|
||||||
router.push(`/createDocument/edit/${item.id}`)
|
router.push(`/createDocument/edit/${item.id}`)
|
||||||
} else if(item.state !== "Entwurf") {
|
} else if (item.state !== "Entwurf") {
|
||||||
router.push(`/createDocument/show/${item.id}`)
|
router.push(`/createDocument/show/${item.id}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const displayCurrency = (value, currency = "€") => {
|
const displayCurrency = (value, currency = "€") => {
|
||||||
return `${Number(value).toFixed(2).replace(".",",")} ${currency}`
|
return `${Number(value).toFixed(2).replace(".", ",")} ${currency}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const searchString = ref(tempStore.searchStrings['createddocuments'] ||'')
|
const searchString = ref(tempStore.searchStrings['createddocuments'] || '')
|
||||||
|
|
||||||
const clearSearchString = () => {
|
const clearSearchString = () => {
|
||||||
tempStore.clearSearchString('createddocuments')
|
tempStore.clearSearchString('createddocuments')
|
||||||
@@ -309,7 +308,7 @@ const clearSearchString = () => {
|
|||||||
const selectedFilters = ref([])
|
const selectedFilters = ref([])
|
||||||
const filteredRows = computed(() => {
|
const filteredRows = computed(() => {
|
||||||
|
|
||||||
let temp = items.value.filter(i => types.value.find(x => x.key === 'invoices' ? ['invoices','advanceInvoices','cancellationInvoices'].includes(i.type) : x.key === i.type))
|
let temp = items.value.filter(i => types.value.find(x => x.key === 'invoices' ? ['invoices', 'advanceInvoices', 'cancellationInvoices'].includes(i.type) : x.key === i.type))
|
||||||
temp = temp.filter(i => i.type !== "serialInvoices")
|
temp = temp.filter(i => i.type !== "serialInvoices")
|
||||||
|
|
||||||
/*if(showDrafts.value === true) {
|
/*if(showDrafts.value === true) {
|
||||||
@@ -318,7 +317,7 @@ const filteredRows = computed(() => {
|
|||||||
temp = temp.filter(i => i.state !== "Entwurf")
|
temp = temp.filter(i => i.state !== "Entwurf")
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if(selectedFilters.value.includes("Nur offene anzeigen")){
|
if (selectedFilters.value.includes("Nur offene anzeigen")) {
|
||||||
temp = temp.filter(i => !isPaid(i))
|
temp = temp.filter(i => !isPaid(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ const items = ref([])
|
|||||||
const selectedItem = ref(0)
|
const selectedItem = ref(0)
|
||||||
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
//items.value = await useSupabaseSelect("createddocuments","*, customer(id,name)","documentDate")
|
|
||||||
items.value = await useEntities("createddocuments").select("*, customer(id,name)","documentDate")
|
items.value = await useEntities("createddocuments").select("*, customer(id,name)","documentDate")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,41 +9,28 @@ defineShortcuts({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const supabase = useSupabaseClient()
|
|
||||||
const modal = useModal()
|
const modal = useModal()
|
||||||
const dataStore = useDataStore()
|
|
||||||
const profileStore = useProfileStore()
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const auth = useAuthStore()
|
||||||
|
|
||||||
const itemInfo = ref({})
|
const itemInfo = ref({})
|
||||||
const linkedDocument =ref({})
|
const linkedDocument =ref({})
|
||||||
const currentTenant = ref({})
|
|
||||||
const setupPage = async () => {
|
const setupPage = async () => {
|
||||||
if(route.params) {
|
if(route.params) {
|
||||||
if(route.params.id) itemInfo.value = await useSupabaseSelectSingle("createddocuments",route.params.id,"*, files(*)")
|
if(route.params.id) itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id,"*, files(*)")
|
||||||
|
|
||||||
console.log(itemInfo.value)
|
console.log(itemInfo.value)
|
||||||
|
|
||||||
linkedDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
|
linkedDocument.value = await useFiles().selectDocument(itemInfo.value.files[0].id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//const {data,error} = await supabase.from("files").select("id").eq("createddocument", route.params.id).order("id",{ascending:true})
|
|
||||||
//linkedDocument.value = data[data.length -1]
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTenant.value = (await supabase.from("tenants").select().eq("id",profileStore.currentTenant).single()).data
|
|
||||||
console.log(currentTenant.value)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupPage()
|
setupPage()
|
||||||
|
|
||||||
const openEmail = () => {
|
const openEmail = () => {
|
||||||
if(["invoices","advanceInvoices"].includes(itemInfo.value.type)){
|
if(["invoices","advanceInvoices"].includes(itemInfo.value.type)){
|
||||||
router.push(`/email/new?loadDocuments=["${linkedDocument.value.id}"]&bcc=${encodeURIComponent(currentTenant.value.standardEmailForInvoices || "")}`)
|
router.push(`/email/new?loadDocuments=["${linkedDocument.value.id}"]&bcc=${encodeURIComponent(auth.activeTenantData.standardEmailForInvoices || "")}`)
|
||||||
} else {
|
} else {
|
||||||
router.push(`/email/new?loadDocuments=["${linkedDocument.value.id}"]`)
|
router.push(`/email/new?loadDocuments=["${linkedDocument.value.id}"]`)
|
||||||
}
|
}
|
||||||
@@ -52,7 +39,7 @@ const openEmail = () => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UDashboardNavbar
|
<UDashboardNavbar
|
||||||
title="Erstelltes Dokument anzeigen"
|
title="Erstelltes Dokument anzeigen"
|
||||||
>
|
>
|
||||||
|
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
@@ -64,10 +51,10 @@ const openEmail = () => {
|
|||||||
>
|
>
|
||||||
Bearbeiten
|
Bearbeiten
|
||||||
</UButton>
|
</UButton>
|
||||||
<!-- <UButton
|
<!-- <UButton
|
||||||
:to="dataStore.documents.find(i => i.createdDocument === itemInfo.id) ? dataStore.documents.find(i => i.createdDocument === itemInfo.id).url : ''"
|
:to="dataStore.documents.find(i => i.createdDocument === itemInfo.id) ? dataStore.documents.find(i => i.createdDocument === itemInfo.id).url : ''"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>In neuen Tab anzeigen</UButton>-->
|
>In neuen Tab anzeigen</UButton>-->
|
||||||
<UButton
|
<UButton
|
||||||
icon="i-heroicons-arrow-right-end-on-rectangle"
|
icon="i-heroicons-arrow-right-end-on-rectangle"
|
||||||
@click="modal.open(CopyCreatedDocumentModal, {
|
@click="modal.open(CopyCreatedDocumentModal, {
|
||||||
@@ -79,8 +66,8 @@ const openEmail = () => {
|
|||||||
Kopieren
|
Kopieren
|
||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
@click="openEmail"
|
@click="openEmail"
|
||||||
icon="i-heroicons-envelope"
|
icon="i-heroicons-envelope"
|
||||||
>
|
>
|
||||||
E-Mail
|
E-Mail
|
||||||
</UButton>
|
</UButton>
|
||||||
@@ -94,16 +81,16 @@ const openEmail = () => {
|
|||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
v-if="itemInfo.project"
|
v-if="itemInfo.project"
|
||||||
@click="router.push(`/standardEntity/projects/show/${itemInfo.project}`)"
|
@click="router.push(`/standardEntity/projects/show/${itemInfo.project}`)"
|
||||||
icon="i-heroicons-link"
|
icon="i-heroicons-link"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
>
|
>
|
||||||
Projekt
|
Projekt
|
||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
v-if="itemInfo.customer"
|
v-if="itemInfo.customer"
|
||||||
@click="router.push(`/standardEntity/customers/show/${itemInfo.customer}`)"
|
@click="router.push(`/standardEntity/customers/show/${itemInfo.customer}`)"
|
||||||
icon="i-heroicons-link"
|
icon="i-heroicons-link"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
>
|
>
|
||||||
Kunde
|
Kunde
|
||||||
|
|||||||
Reference in New Issue
Block a user