Merge branch 'devCorrected' into 'beta'

Dev corrected

See merge request fedeo/software!16
This commit is contained in:
2025-10-05 15:30:41 +00:00
8 changed files with 267 additions and 46 deletions

View File

@@ -305,9 +305,8 @@ const links = computed(() => {
icon: "i-heroicons-key"
},*/{
label: "E-Mail Konten",
to: "/settings/emailAccounts",
icon: "i-heroicons-envelope",
disabled: true
to: "/settings/emailaccounts",
icon: "i-heroicons-envelope"
},{
label: "Bankkonten",
to: "/settings/banking",

View File

@@ -12,6 +12,7 @@ defineShortcuts({
const tempStore = useTempStore()
const router = useRouter()
const route = useRoute()
const bankstatements = ref([])
const bankaccounts = ref([])
@@ -80,17 +81,25 @@ const selectedFilters = ref(tempStore.filters["banking"] ? tempStore.filters["ba
const filteredRows = computed(() => {
let temp = bankstatements.value
if(selectedFilters.value.includes("Nur offene anzeigen")){
temp = temp.filter(i => Number(calculateOpenSum(i)) !== 0)
if(route.query.filter) {
console.log(route.query.filter)
temp = temp.filter(i => JSON.parse(route.query.filter).includes(i.id))
} else {
if(selectedFilters.value.includes("Nur offene anzeigen")){
temp = temp.filter(i => Number(calculateOpenSum(i)) !== 0)
}
if(selectedFilters.value.includes("Nur positive anzeigen")){
temp = temp.filter(i => i.amount >= 0)
}
if(selectedFilters.value.includes("Nur negative anzeigen")){
temp = temp.filter(i => i.amount < 0)
}
}
if(selectedFilters.value.includes("Nur positive anzeigen")){
temp = temp.filter(i => i.amount >= 0)
}
if(selectedFilters.value.includes("Nur negative anzeigen")){
temp = temp.filter(i => i.amount < 0)
}
return useSearch(searchString.value, temp.filter(i => filterAccount.value.find(x => x.id === i.account)))
})

View File

@@ -36,6 +36,7 @@ const itemInfo = ref({
deliveryDateType: "Lieferdatum",
dateOfPerformance: null,
paymentDays: auth.activeTenantData.standardPaymentDays,
payment_type: "transfer",
customSurchargePercentage: 0,
createdBy: auth.user.id,
title: null,
@@ -73,6 +74,7 @@ const servicecategories = ref([])
const selectedServicecategorie = ref(null)
const customers = ref([])
const contacts = ref([])
const contracts = ref([])
const texttemplates = ref([])
const units = ref([])
const tenantUsers = ref([])
@@ -88,6 +90,7 @@ const setupData = async () => {
productcategories.value = await useEntities("productcategories").select("*")
customers.value = await useEntities("customers").select("*", "customerNumber")
contacts.value = await useEntities("contacts").select("*")
contracts.value = await useEntities("contracts").select("*")
texttemplates.value = await useEntities("texttemplates").select("*")
units.value = await useEntities("units").selectSpecial("*")
tenantUsers.value = (await useNuxtApp().$api(`/api/tenant/users`, {
@@ -295,6 +298,7 @@ const setupPage = async () => {
if (optionsToImport.deliveryDateEnd) itemInfo.value.deliveryDateEnd = linkedDocument.deliveryDateEnd
if (optionsToImport.documentDate) itemInfo.value.documentDate = linkedDocument.documentDate
if (optionsToImport.paymentDays) itemInfo.value.paymentDays = linkedDocument.paymentDays
if (optionsToImport.payment_type) itemInfo.value.payment_type = linkedDocument.payment_type
if (optionsToImport.customSurchargePercentage) itemInfo.value.customSurchargePercentage = linkedDocument.customSurchargePercentage
if (optionsToImport.contactPerson) itemInfo.value.contactPerson = linkedDocument.contactPerson
if (optionsToImport.plant) itemInfo.value.plant = linkedDocument.plant
@@ -320,6 +324,7 @@ const setupPage = async () => {
itemInfo.value.deliveryDateEnd = linkedDocument.deliveryDateEnd
itemInfo.value.documentDate = linkedDocument.documentDate
itemInfo.value.paymentDays = linkedDocument.paymentDays
itemInfo.value.payment_type = linkedDocument.payment_type
itemInfo.value.customSurchargePercentage = linkedDocument.customSurchargePercentage
itemInfo.value.contactPerson = linkedDocument.contactPerson
itemInfo.value.plant = linkedDocument.plant
@@ -460,6 +465,7 @@ const setCustomerData = async (customerId, loadOnlyAdress = false) => {
itemInfo.value.address.special = customer.infoData.special
if (!loadOnlyAdress && customer.customPaymentDays) itemInfo.value.paymentDays = customer.customPaymentDays
if (!loadOnlyAdress && customer.custom_payment_type) itemInfo.value.payment_type = customer.custom_payment_type
if (!loadOnlyAdress && customer.customSurchargePercentage) {
itemInfo.value.customSurchargePercentage = customer.customSurchargePercentage
@@ -1054,6 +1060,7 @@ const getDocumentData = async () => {
nachname: (contactData && contactData.lastName) || (customerData && customerData.lastname),
kundenname: customerData && customerData.name,
zahlungsziel_in_tagen: itemInfo.paymentDays,
zahlungsart: itemInfo.payment_type === "transfer" ? "Überweisung" : "Lastschrift",
diesel_gesamtverbrauch: (itemInfo.agriculture && itemInfo.agriculture.dieselUsageTotal) && itemInfo.agriculture.dieselUsageTotal
}
}
@@ -1153,6 +1160,10 @@ const getDocumentData = async () => {
...itemInfo.value.project ? [{
label: "Projekt",
content: projects.value.find(i => i.id === itemInfo.value.project).name
}] : [],
...itemInfo.value.contract ? [{
label: "Vertrag",
content: contracts.value.find(i => i.id === itemInfo.value.contract).contractNumber
}] : []
],
title: itemInfo.value.title,
@@ -1254,9 +1265,11 @@ const saveSerialInvoice = async () => {
state: 'Erstellt',
customer: itemInfo.value.customer,
contact: itemInfo.value.contact,
contract: itemInfo.value.contract,
address: itemInfo.value.address,
project: itemInfo.value.project,
paymentDays: itemInfo.value.paymentDays,
payment_type: itemInfo.value.payment_type,
deliveryDateType: "Leistungszeitraum",
createdBy: itemInfo.value.createdBy,
title: itemInfo.value.title,
@@ -1336,6 +1349,7 @@ const saveDocument = async (state, resetup = false) => {
state: itemInfo.value.state || "Entwurf",
customer: itemInfo.value.customer,
contact: itemInfo.value.contact,
contract: itemInfo.value.contract,
address: itemInfo.value.address,
project: itemInfo.value.project,
plant: itemInfo.value.plant,
@@ -1344,6 +1358,7 @@ const saveDocument = async (state, resetup = false) => {
deliveryDate: itemInfo.value.deliveryDate,
deliveryDateEnd: itemInfo.value.deliveryDateEnd,
paymentDays: itemInfo.value.paymentDays,
payment_type: itemInfo.value.payment_type,
deliveryDateType: itemInfo.value.deliveryDateType,
info: {},
createdBy: itemInfo.value.createdBy,
@@ -1950,6 +1965,29 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
v-model="itemInfo.paymentDays"
/>
</UFormGroup>
<UFormGroup
class="w-full"
label="Zahlungsart:"
>
<USelectMenu
v-model="itemInfo.payment_type"
value-attribute="key"
option-attribute="label"
:options="[
{
key: 'transfer',
label: 'Überweisung'
},{
key: 'direct-debit',
label: 'SEPA Lastschrift'
}
]"
>
<template #label>
{{itemInfo.payment_type === 'transfer' ? "Überweisung" : "SEPA-Lastschrift"}}
</template>
</USelectMenu>
</UFormGroup>
<UFormGroup
class="w-full"
label="Individueller Aufschlag:"
@@ -2067,6 +2105,45 @@ const setRowData = async (row, service = {sellingPriceComposed: {}}, product = {
</InputGroup>
</UFormGroup>
<UFormGroup
label="Vertrag:"
>
<InputGroup>
<USelectMenu
:options="contracts.filter(i => i.customer === itemInfo.customer && (itemInfo.plant ? itemInfo.plant === i.plant : true))"
v-model="itemInfo.contract"
value-attribute="id"
option-attribute="name"
searchable
searchable-placeholder="Suche..."
:search-attributes="['contractNumber','name']"
class="w-full"
:disabled="!itemInfo.customer"
>
<template #label>
{{ itemInfo.contract ? contracts.find(i => i.id === itemInfo.contract).name : "Kein Vertrag ausgewählt" }}
</template>
<template #option="{option: contract}">
{{ customers.find(i => i.id === contract.customer) ? customers.find(i => i.id === contract.customer).name : "" }}
- {{ contract.contractNumber }} - {{ contract.name }}
</template>
</USelectMenu>
<UButton
variant="outline"
color="rose"
v-if="itemInfo.contract"
icon="i-heroicons-x-mark"
@click="itemInfo.contract = null"
/>
<EntityModalButtons
type="projects"
:id="itemInfo.contract"
:create-query="{customer: itemInfo.customer}"
@return-data="(data) => itemInfo.contract = data.id"
/>
</InputGroup>
</UFormGroup>
</div>
</InputGroup>

View File

@@ -19,7 +19,7 @@ const itemInfo = ref({})
const linkedDocument =ref({})
const setupPage = async () => {
if(route.params) {
if(route.params.id) itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id,"*,files(*),linkedDocument(*)")
if(route.params.id) itemInfo.value = await useEntities("createddocuments").selectSingle(route.params.id,"*,files(*),linkedDocument(*), statementallocations(bs_id)")
console.log(itemInfo.value)
@@ -36,6 +36,14 @@ const openEmail = () => {
router.push(`/email/new?loadDocuments=["${linkedDocument.value.id}"]`)
}
}
const openBankstatements = () => {
if(itemInfo.value.statementallocations.length > 1) {
navigateTo(`/banking/?filter=${JSON.stringify(itemInfo.value.statementallocations.map(i => i.bs_id))}`)
} else {
navigateTo(`/banking/statements/edit/${itemInfo.value.statementallocations[0].bs_id}`)
}
}
</script>
<template>
@@ -104,6 +112,14 @@ const openEmail = () => {
>
{{dataStore.documentTypesForCreation[itemInfo.linkedDocument.type].labelSingle}} - {{itemInfo.linkedDocument.documentNumber}}
</UButton>
<UButton
v-if="itemInfo.statementallocations?.length > 0"
@click="openBankstatements"
icon="i-heroicons-link"
variant="outline"
>
Bankbuchungen
</UButton>
</template>
</UDashboardToolbar>

View File

@@ -0,0 +1,137 @@
<script setup lang="ts">
const route = useRoute()
const mode = route.params.mode
const itemInfo = ref({})
const setup = async () => {
if(mode === "create") {
} else {
itemInfo.value = await useNuxtApp().$api(`/api/email/accounts/${route.params.id}`)
}
}
setup()
const createAccount = async () => {
const res = await useNuxtApp().$api(`/api/email/accounts`, {
method: "POST",
body: itemInfo.value,
})
if(res.success) {
navigateTo("/settings/emailaccounts")
}
}
const saveAccount = async () => {
const res = await useNuxtApp().$api(`/api/email/accounts/${route.params.id}`, {
method: "POST",
body: itemInfo.value,
})
if(res.success) {
navigateTo("/settings/emailaccounts")
}
}
</script>
<template>
<UDashboardNavbar :title="`E-Mail Konto ${mode === 'create' ? 'erstellen' : 'bearbeiten'}`">
<template #right>
<UButton
v-if="mode === 'create'"
@click="createAccount"
>
Erstellen
</UButton>
<UButton
v-if="mode === 'edit'"
@click="saveAccount"
>
Speichern
</UButton>
</template>
</UDashboardNavbar>
<UForm class="w-2/3 mx-auto mt-5">
<UFormGroup
label="E-Mail Adresse"
>
<UInput
v-model="itemInfo.email"
/>
</UFormGroup>
<UFormGroup
label="Passwort"
>
<UInput
type="password"
v-model="itemInfo.password"
placeholder="********"
/>
</UFormGroup>
<UDivider> IMAP </UDivider>
<UFormGroup
label="IMAP Host"
>
<UInput
v-model="itemInfo.imap_host"
/>
</UFormGroup>
<UFormGroup
label="IMAP Port"
>
<UInput
type="number"
v-model="itemInfo.imap_port"
/>
</UFormGroup>
<UFormGroup
label="IMAP SSL"
>
<UToggle
v-model="itemInfo.imap_ssl"
/>
</UFormGroup>
<UDivider> SMTP </UDivider>
<UFormGroup
label="SMTP Host"
>
<UInput
v-model="itemInfo.smtp_host"
/>
</UFormGroup>
<UFormGroup
label="SMTP Port"
>
<UInput
type="number"
v-model="itemInfo.smtp_port"
/>
</UFormGroup>
<UFormGroup
label="SMTP SSL"
>
<UToggle
v-model="itemInfo.smtp_ssl"
/>
</UFormGroup>
</UForm>
</template>
<style scoped>
</style>

View File

@@ -9,28 +9,13 @@ const createEMailType = ref("imap")
const showEmailAddressModal = ref(false)
const items = ref([])
const profiles = ref([])
const setupPage = async () => {
items.value = await useSupabaseSelect("emailAccounts","*")
profiles.value = await useSupabaseSelect("profiles","*")
items.value = await useNuxtApp().$api("/api/email/accounts")
}
const createAccount = async () => {
showEmailAddressModal.value = false
const {data,error} = await supabase.functions.invoke('emailengine_authenticate',{
body: {
emailAddress: createEMailAddress.value,
accountType: createEMailType.value,
profile: profileStore.activeProfile.id
}
})
console.log(error)
console.log(data)
window.open(data.url, '_blank').focus();
}
setupPage()
@@ -38,16 +23,8 @@ setupPage()
const templateColumns = [
{
key: "emailAddress",
label: "Adresse:"
},
{
key: "profiles",
label: "Bneutzer"
},
{
key: "mailboxes",
label: "Ordner"
key: "email",
label: "E-Mail Adresse:"
},
]
const selectedColumns = ref(templateColumns)
@@ -98,7 +75,7 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
<template #right>
<UTooltip title="In der Beta nicht verfügbar">
<UButton
@click="showEmailAddressModal = true"
@click="navigateTo('/settings/emailaccounts/create')"
>
+ E-Mail Konto
</UButton>
@@ -110,15 +87,10 @@ const columns = computed(() => templateColumns.filter((column) => selectedColumn
:rows="items"
:columns="columns"
class="w-full"
@select="(i) => navigateTo(`/settings/emailaccounts/edit/${i.id}`)"
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine E-Mail Konten anzuzeigen' }"
>
<template #profiles-data="{row}">
{{row.profiles}}
</template>
<template #mailboxes-data="{row}">
{{row.mailboxes}}
</template>
</UTable>
</template>

View File

@@ -70,7 +70,6 @@ export const useAuthStore = defineStore("auth", {
jwt
}}
})
console.log(me)
this.user = me.user
this.permissions = me.permissions
this.tenants = me.tenants

View File

@@ -347,6 +347,18 @@ export const useDataStore = defineStore('data', () => {
inputType: "number",
inputColumn: "Allgemeines",
sortable: true
},{
key: "custom_payment_type",
label: "Zahlungsart",
inputType: "select",
selectValueAttribute:"key",
selectOptionAttribute: "label",
selectManualOptions: [
{label:'Überweisung', key: 'transfer'},
{label:'SEPA Lastschrift', key: 'direct-debit'},
],
inputColumn: "Allgemeines",
sortable: true
}, {
key: "customSurchargePercentage",
label: "Individueller Aufschlag",