Merge branch 'devCorrected' into 'beta'
Dev corrected See merge request fedeo/software!3
This commit is contained in:
@@ -45,6 +45,7 @@ const router = useRouter()
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const dataStore = useDataStore()
|
const dataStore = useDataStore()
|
||||||
const modal = useModal()
|
const modal = useModal()
|
||||||
|
const auth = useAuthStore()
|
||||||
|
|
||||||
const dataType = dataStore.dataTypes[type]
|
const dataType = dataStore.dataTypes[type]
|
||||||
|
|
||||||
@@ -97,6 +98,43 @@ const onTabChange = (index) => {
|
|||||||
router.push(`${router.currentRoute.value.path}?tabIndex=${index}`)
|
router.push(`${router.currentRoute.value.path}?tabIndex=${index}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const changePinned = async () => {
|
||||||
|
let newPins = []
|
||||||
|
|
||||||
|
if(auth.profile.pinned_on_navigation.find(i => i.datatype === type && i.id === props.item.id)){
|
||||||
|
//Remove Pin
|
||||||
|
|
||||||
|
newPins = auth.profile.pinned_on_navigation.filter(i => !(i.datatype === type && i.id === props.item.id))
|
||||||
|
} else {
|
||||||
|
//Add Pin
|
||||||
|
|
||||||
|
newPins = [
|
||||||
|
...auth.profile.pinned_on_navigation,
|
||||||
|
{
|
||||||
|
id: props.item.id,
|
||||||
|
icon: "i-heroicons-document",
|
||||||
|
type: "standardEntity",
|
||||||
|
datatype: type,
|
||||||
|
label: props.item[dataType.templateColumns.find(i => i.title).key]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await useNuxtApp().$api(`/api/user/${auth.user.id}/profile`,{
|
||||||
|
method: "PUT",
|
||||||
|
body: {
|
||||||
|
data: {
|
||||||
|
pinned_on_navigation: newPins
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
await auth.fetchMe()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -147,6 +185,13 @@ const onTabChange = (index) => {
|
|||||||
>{{item ? `${dataType.labelSingle}${props.item[dataType.templateColumns.find(i => i.title).key] ? ': ' + props.item[dataType.templateColumns.find(i => i.title).key] : ''}`: '' }}</h1>
|
>{{item ? `${dataType.labelSingle}${props.item[dataType.templateColumns.find(i => i.title).key] ? ': ' + props.item[dataType.templateColumns.find(i => i.title).key] : ''}`: '' }}</h1>
|
||||||
</template>
|
</template>
|
||||||
<template #right>
|
<template #right>
|
||||||
|
<UButton
|
||||||
|
v-if="auth.profile"
|
||||||
|
:variant="auth.profile?.pinned_on_navigation.find(i => i.datatype === type && i.id === props.item.id) ? 'solid' : 'outline'"
|
||||||
|
icon="i-heroicons-star"
|
||||||
|
color="yellow"
|
||||||
|
@click="changePinned"
|
||||||
|
></UButton>
|
||||||
<UButton
|
<UButton
|
||||||
@click="router.push(`/standardEntity/${type}/edit/${item.id}`)"
|
@click="router.push(`/standardEntity/${type}/edit/${item.id}`)"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ const links = computed(() => {
|
|||||||
target: "_blank",
|
target: "_blank",
|
||||||
pinned: true
|
pinned: true
|
||||||
}
|
}
|
||||||
|
}else if(pin.type === "standardEntity") {
|
||||||
|
return {
|
||||||
|
label: pin.label,
|
||||||
|
to: `/standardEntity/${pin.datatype}/show/${pin.id}`,
|
||||||
|
icon: pin.icon,
|
||||||
|
pinned: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
30
error.vue
30
error.vue
@@ -7,11 +7,29 @@ const props = defineProps({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex justify-center h-100 w-100">
|
<UCard class="w-1/2 mx-auto mt-10 text-center">
|
||||||
<div class="mt-20">
|
<template #header>
|
||||||
<h1 class="text-5xl text-center mb-3">Da ist etwas schief gelaufen</h1>
|
<div class="text-center">
|
||||||
<UButton to="/">Zurück</UButton>
|
<span class="text-xl text-center font-bold">Es gab ein Problem - {{error.statusCode}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
<UColorModeImage
|
||||||
|
light="/Logo.png"
|
||||||
|
dark="/Logo_Dark.png"
|
||||||
|
class="w-3/4 mx-auto "
|
||||||
|
/>
|
||||||
|
<UAccordion
|
||||||
|
class="mt-5"
|
||||||
|
:items="[{
|
||||||
|
label: 'Fehlerbeschreibung',
|
||||||
|
icon: 'i-heroicons-information-circle',
|
||||||
|
defaultOpen: false,
|
||||||
|
content: error
|
||||||
|
}]"
|
||||||
|
>
|
||||||
|
|
||||||
</div>
|
</UAccordion>
|
||||||
|
<UButton to="/" class="mt-5">Zurück zur Startseite</UButton>
|
||||||
|
|
||||||
|
</UCard>
|
||||||
</template>
|
</template>
|
||||||
@@ -38,13 +38,13 @@ const itemInfo = ref({
|
|||||||
dateOfPerformance: null,
|
dateOfPerformance: null,
|
||||||
paymentDays: auth.activeTenantData.standardPaymentDays,
|
paymentDays: auth.activeTenantData.standardPaymentDays,
|
||||||
customSurchargePercentage: 0,
|
customSurchargePercentage: 0,
|
||||||
createdBy: profileStore.activeProfile.id,
|
createdBy: auth.user.id,
|
||||||
title: null,
|
title: null,
|
||||||
description: null,
|
description: null,
|
||||||
startText: null,
|
startText: null,
|
||||||
endText: null,
|
endText: null,
|
||||||
rows: [],
|
rows: [],
|
||||||
contactPerson: profileStore.activeProfile.id,
|
contactPerson: auth.user.id,
|
||||||
contactPersonName: null,
|
contactPersonName: null,
|
||||||
contactTel: null,
|
contactTel: null,
|
||||||
contactEMail: null,
|
contactEMail: null,
|
||||||
@@ -621,6 +621,7 @@ const findDocumentErrors = computed(() => {
|
|||||||
if (itemInfo.value.customer === null) errors.push({message: "Es ist kein Kunde ausgewählt", type: "breaking"})
|
if (itemInfo.value.customer === null) errors.push({message: "Es ist kein Kunde ausgewählt", type: "breaking"})
|
||||||
if (itemInfo.value.contact === null) errors.push({message: "Es ist kein Kontakt ausgewählt", type: "info"})
|
if (itemInfo.value.contact === null) errors.push({message: "Es ist kein Kontakt ausgewählt", type: "info"})
|
||||||
if (itemInfo.value.letterhead === null) errors.push({message: "Es ist kein Briefpapier ausgewählt", type: "breaking"})
|
if (itemInfo.value.letterhead === null) errors.push({message: "Es ist kein Briefpapier ausgewählt", type: "breaking"})
|
||||||
|
if (itemInfo.value.created_by === null || !itemInfo.value.created_by) errors.push({message: "Es ist kein Ansprechpartner ausgewählt", type: "breaking"})
|
||||||
if (itemInfo.value.address.street === null) errors.push({
|
if (itemInfo.value.address.street === null) errors.push({
|
||||||
message: "Es ist keine Straße im Adressat angegeben",
|
message: "Es ist keine Straße im Adressat angegeben",
|
||||||
type: "breaking"
|
type: "breaking"
|
||||||
@@ -1370,49 +1371,59 @@ const saveDocument = async (state, resetup = false) => {
|
|||||||
if (resetup) await setupPage()
|
if (resetup) await setupPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectedTab = ref(0)
|
||||||
|
|
||||||
const closeDocument = async () => {
|
const closeDocument = async () => {
|
||||||
|
|
||||||
loaded.value = false
|
if(selectedTab.value === 0) {
|
||||||
|
await generateDocument()
|
||||||
|
selectedTab.value = 1
|
||||||
|
} else {
|
||||||
|
loaded.value = false
|
||||||
|
|
||||||
await saveDocument("Gebucht")
|
await saveDocument("Gebucht")
|
||||||
|
|
||||||
await generateDocument()
|
await generateDocument()
|
||||||
|
|
||||||
let fileData = {}
|
let fileData = {}
|
||||||
|
|
||||||
fileData.project = itemInfo.value.project
|
fileData.project = itemInfo.value.project
|
||||||
fileData.createddocument = itemInfo.value.id
|
fileData.createddocument = itemInfo.value.id
|
||||||
|
|
||||||
let mappedType = itemInfo.value.type
|
let mappedType = itemInfo.value.type
|
||||||
|
|
||||||
if (mappedType === "advanceInvoices" || mappedType === "cancellationInvoices") {
|
if (mappedType === "advanceInvoices" || mappedType === "cancellationInvoices") {
|
||||||
mappedType = "invoices"
|
mappedType = "invoices"
|
||||||
}
|
|
||||||
|
|
||||||
const folders = await useEntities("folders").select()
|
|
||||||
console.log(folders)
|
|
||||||
fileData.folder = folders.find(i => i.function === mappedType && i.year === Number(dayjs().format("YYYY"))).id
|
|
||||||
|
|
||||||
const tags = await useEntities("filetags").select()
|
|
||||||
fileData.type = tags.find(i => i.createddocumenttype === mappedType).id
|
|
||||||
|
|
||||||
function dataURLtoFile(dataurl, filename) {
|
|
||||||
var arr = dataurl.split(","),
|
|
||||||
mime = arr[0].match(/:(.*?);/)[1],
|
|
||||||
bstr = atob(arr[arr.length - 1]),
|
|
||||||
n = bstr.length,
|
|
||||||
u8arr = new Uint8Array(n);
|
|
||||||
while (n--) {
|
|
||||||
u8arr[n] = bstr.charCodeAt(n);
|
|
||||||
}
|
}
|
||||||
return new File([u8arr], filename, {type: mime});
|
|
||||||
|
const folders = await useEntities("folders").select()
|
||||||
|
console.log(folders)
|
||||||
|
fileData.folder = folders.find(i => i.function === mappedType && i.year === Number(dayjs().format("YYYY"))).id
|
||||||
|
|
||||||
|
const tags = await useEntities("filetags").select()
|
||||||
|
fileData.type = tags.find(i => i.createddocumenttype === mappedType).id
|
||||||
|
|
||||||
|
function dataURLtoFile(dataurl, filename) {
|
||||||
|
var arr = dataurl.split(","),
|
||||||
|
mime = arr[0].match(/:(.*?);/)[1],
|
||||||
|
bstr = atob(arr[arr.length - 1]),
|
||||||
|
n = bstr.length,
|
||||||
|
u8arr = new Uint8Array(n);
|
||||||
|
while (n--) {
|
||||||
|
u8arr[n] = bstr.charCodeAt(n);
|
||||||
|
}
|
||||||
|
return new File([u8arr], filename, {type: mime});
|
||||||
|
}
|
||||||
|
|
||||||
|
let file = dataURLtoFile(uri.value, `${itemInfo.value.documentNumber}.pdf`)
|
||||||
|
|
||||||
|
await useFiles().uploadFiles(fileData, [file])
|
||||||
|
|
||||||
|
await router.push(`/createDocument/show/${itemInfo.value.id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
let file = dataURLtoFile(uri.value, `${itemInfo.value.documentNumber}.pdf`)
|
|
||||||
|
|
||||||
await useFiles().uploadFiles(fileData, [file])
|
|
||||||
|
|
||||||
await router.push(`/createDocument/show/${itemInfo.value.id}`)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1512,11 +1523,11 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
</template>
|
</template>
|
||||||
<template #right>
|
<template #right>
|
||||||
<ButtonWithConfirm
|
<ButtonWithConfirm
|
||||||
v-if="itemInfo.state === 'Entwurf'"
|
v-if="itemInfo.state === 'Entwurf' || itemInfo.type === 'serialInvoices'"
|
||||||
color="rose"
|
color="rose"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@confirmed="dataStore.updateItem('createddocuments',{id:itemInfo.id,archived: true}),
|
@confirmed="useEntities('createddocuments').update(itemInfo.id,{archived: true}),
|
||||||
router.push('/createDocument')"
|
router.push('/')"
|
||||||
>
|
>
|
||||||
<template #button>
|
<template #button>
|
||||||
Archivieren
|
Archivieren
|
||||||
@@ -1538,7 +1549,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
@click="closeDocument"
|
@click="closeDocument"
|
||||||
v-if="itemInfo.id && itemInfo.type !== 'serialInvoices'"
|
v-if="itemInfo.id && itemInfo.type !== 'serialInvoices'"
|
||||||
>
|
>
|
||||||
Fertigstellen
|
{{selectedTab === 0 ? "Vorschau zeigen" : "Fertigstellen"}}
|
||||||
</UButton>
|
</UButton>
|
||||||
<UButton
|
<UButton
|
||||||
icon="i-mdi-content-save"
|
icon="i-mdi-content-save"
|
||||||
@@ -1550,7 +1561,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
|
|||||||
</template>
|
</template>
|
||||||
</UDashboardNavbar>
|
</UDashboardNavbar>
|
||||||
<UDashboardPanelContent>
|
<UDashboardPanelContent>
|
||||||
<UTabs class="p-5" :items="tabItems" @change="onChangeTab" v-if="loaded">
|
<UTabs class="p-5" :items="tabItems" @change="onChangeTab" v-if="loaded" v-model="selectedTab">
|
||||||
<template #item="{item}">
|
<template #item="{item}">
|
||||||
<div v-if="item.label === 'Editor'">
|
<div v-if="item.label === 'Editor'">
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ const setupPage = async (sort_column = null, sort_direction = null) => {
|
|||||||
//Load Data for Edit
|
//Load Data for Edit
|
||||||
item.value = JSON.stringify(await useEntities(type).selectSingle(route.params.id))
|
item.value = JSON.stringify(await useEntities(type).selectSingle(route.params.id))
|
||||||
|
|
||||||
|
console.log(item.value)
|
||||||
|
|
||||||
} else if (mode.value === "create") {
|
} else if (mode.value === "create") {
|
||||||
//Load Data for Create
|
//Load Data for Create
|
||||||
item.value = JSON.stringify({})
|
item.value = JSON.stringify({})
|
||||||
@@ -65,7 +67,7 @@ setupPage()
|
|||||||
:platform="platform"
|
:platform="platform"
|
||||||
/>
|
/>
|
||||||
<EntityEdit
|
<EntityEdit
|
||||||
v-else-if="(mode === 'edit' || mode === 'create')"
|
v-else-if="loaded && (mode === 'edit' || mode === 'create')"
|
||||||
:type="route.params.type"
|
:type="route.params.type"
|
||||||
:item="item"
|
:item="item"
|
||||||
:mode="mode"
|
:mode="mode"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export default defineNuxtPlugin(() => {
|
export default defineNuxtPlugin(() => {
|
||||||
const api = $fetch.create({
|
const api = $fetch.create({
|
||||||
baseURL: "https://backend.fedeo.io",
|
baseURL: "http://localhost:3100" /*"https://backend.fedeo.io"*/,
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
onRequest({ options }) {
|
onRequest({ options }) {
|
||||||
// Token aus Cookie holen
|
// Token aus Cookie holen
|
||||||
|
|||||||
Reference in New Issue
Block a user