Fix Createddocs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@
|
||||
</UDashboardNavbar>
|
||||
<UDashboardToolbar>
|
||||
<template #left>
|
||||
<!-- <UCheckbox
|
||||
<!-- <UCheckbox
|
||||
v-model="showDrafts"
|
||||
label="Entwürfe Anzeigen"
|
||||
class="my-auto mr-3"
|
||||
@@ -204,7 +204,6 @@ const items = ref([])
|
||||
const selectedItem = ref(0)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -220,7 +219,7 @@ const templateColumns = [
|
||||
key: 'type',
|
||||
label: "Typ",
|
||||
sortable: true
|
||||
},{
|
||||
}, {
|
||||
key: 'state',
|
||||
label: "Status",
|
||||
sortable: true
|
||||
@@ -288,19 +287,19 @@ const types = computed(() => {
|
||||
const selectItem = (item) => {
|
||||
console.log(item)
|
||||
|
||||
if(item.state === "Entwurf"){
|
||||
if (item.state === "Entwurf") {
|
||||
router.push(`/createDocument/edit/${item.id}`)
|
||||
} else if(item.state !== "Entwurf") {
|
||||
} else if (item.state !== "Entwurf") {
|
||||
router.push(`/createDocument/show/${item.id}`)
|
||||
}
|
||||
}
|
||||
|
||||
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 = () => {
|
||||
tempStore.clearSearchString('createddocuments')
|
||||
@@ -309,7 +308,7 @@ const clearSearchString = () => {
|
||||
const selectedFilters = ref([])
|
||||
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")
|
||||
|
||||
/*if(showDrafts.value === true) {
|
||||
@@ -318,7 +317,7 @@ const filteredRows = computed(() => {
|
||||
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))
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,6 @@ const items = ref([])
|
||||
const selectedItem = ref(0)
|
||||
|
||||
const setupPage = async () => {
|
||||
//items.value = await useSupabaseSelect("createddocuments","*, 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 dataStore = useDataStore()
|
||||
const profileStore = useProfileStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const auth = useAuthStore()
|
||||
|
||||
const itemInfo = ref({})
|
||||
const linkedDocument =ref({})
|
||||
const currentTenant = ref({})
|
||||
const setupPage = async () => {
|
||||
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)
|
||||
|
||||
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()
|
||||
|
||||
const openEmail = () => {
|
||||
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 {
|
||||
router.push(`/email/new?loadDocuments=["${linkedDocument.value.id}"]`)
|
||||
}
|
||||
@@ -64,7 +51,7 @@ const openEmail = () => {
|
||||
>
|
||||
Bearbeiten
|
||||
</UButton>
|
||||
<!-- <UButton
|
||||
<!-- <UButton
|
||||
:to="dataStore.documents.find(i => i.createdDocument === itemInfo.id) ? dataStore.documents.find(i => i.createdDocument === itemInfo.id).url : ''"
|
||||
target="_blank"
|
||||
>In neuen Tab anzeigen</UButton>-->
|
||||
|
||||
Reference in New Issue
Block a user