Merge branch 'devCorrected' into 'beta'

Dev corrected

See merge request fedeo/software!3
This commit is contained in:
2025-09-13 15:39:19 +00:00
6 changed files with 128 additions and 45 deletions

View File

@@ -45,6 +45,7 @@ const router = useRouter()
const route = useRoute()
const dataStore = useDataStore()
const modal = useModal()
const auth = useAuthStore()
const dataType = dataStore.dataTypes[type]
@@ -97,6 +98,43 @@ const onTabChange = (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>
<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>
</template>
<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
@click="router.push(`/standardEntity/${type}/edit/${item.id}`)"
>

View File

@@ -16,6 +16,13 @@ const links = computed(() => {
target: "_blank",
pinned: true
}
}else if(pin.type === "standardEntity") {
return {
label: pin.label,
to: `/standardEntity/${pin.datatype}/show/${pin.id}`,
icon: pin.icon,
pinned: true
}
}
}),

View File

@@ -7,11 +7,29 @@ const props = defineProps({
</script>
<template>
<div class="flex justify-center h-100 w-100">
<div class="mt-20">
<h1 class="text-5xl text-center mb-3">Da ist etwas schief gelaufen</h1>
<UButton to="/">Zurück</UButton>
</div>
<UCard class="w-1/2 mx-auto mt-10 text-center">
<template #header>
<div class="text-center">
<span class="text-xl text-center font-bold">Es gab ein Problem - {{error.statusCode}}</span>
</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>

View File

@@ -38,13 +38,13 @@ const itemInfo = ref({
dateOfPerformance: null,
paymentDays: auth.activeTenantData.standardPaymentDays,
customSurchargePercentage: 0,
createdBy: profileStore.activeProfile.id,
createdBy: auth.user.id,
title: null,
description: null,
startText: null,
endText: null,
rows: [],
contactPerson: profileStore.activeProfile.id,
contactPerson: auth.user.id,
contactPersonName: null,
contactTel: 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.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.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({
message: "Es ist keine Straße im Adressat angegeben",
type: "breaking"
@@ -1370,49 +1371,59 @@ const saveDocument = async (state, resetup = false) => {
if (resetup) await setupPage()
}
const selectedTab = ref(0)
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.createddocument = itemInfo.value.id
fileData.project = itemInfo.value.project
fileData.createddocument = itemInfo.value.id
let mappedType = itemInfo.value.type
let mappedType = itemInfo.value.type
if (mappedType === "advanceInvoices" || mappedType === "cancellationInvoices") {
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);
if (mappedType === "advanceInvoices" || mappedType === "cancellationInvoices") {
mappedType = "invoices"
}
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 #right>
<ButtonWithConfirm
v-if="itemInfo.state === 'Entwurf'"
v-if="itemInfo.state === 'Entwurf' || itemInfo.type === 'serialInvoices'"
color="rose"
variant="outline"
@confirmed="dataStore.updateItem('createddocuments',{id:itemInfo.id,archived: true}),
router.push('/createDocument')"
@confirmed="useEntities('createddocuments').update(itemInfo.id,{archived: true}),
router.push('/')"
>
<template #button>
Archivieren
@@ -1538,7 +1549,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
@click="closeDocument"
v-if="itemInfo.id && itemInfo.type !== 'serialInvoices'"
>
Fertigstellen
{{selectedTab === 0 ? "Vorschau zeigen" : "Fertigstellen"}}
</UButton>
<UButton
icon="i-mdi-content-save"
@@ -1550,7 +1561,7 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</template>
</UDashboardNavbar>
<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}">
<div v-if="item.label === 'Editor'">

View File

@@ -39,6 +39,8 @@ const setupPage = async (sort_column = null, sort_direction = null) => {
//Load Data for Edit
item.value = JSON.stringify(await useEntities(type).selectSingle(route.params.id))
console.log(item.value)
} else if (mode.value === "create") {
//Load Data for Create
item.value = JSON.stringify({})
@@ -65,7 +67,7 @@ setupPage()
:platform="platform"
/>
<EntityEdit
v-else-if="(mode === 'edit' || mode === 'create')"
v-else-if="loaded && (mode === 'edit' || mode === 'create')"
:type="route.params.type"
:item="item"
:mode="mode"

View File

@@ -1,6 +1,6 @@
export default defineNuxtPlugin(() => {
const api = $fetch.create({
baseURL: "https://backend.fedeo.io",
baseURL: "http://localhost:3100" /*"https://backend.fedeo.io"*/,
credentials: "include",
onRequest({ options }) {
// Token aus Cookie holen