diff --git a/components/MainNav.vue b/components/MainNav.vue index 69c45b0..4639d9e 100644 --- a/components/MainNav.vue +++ b/components/MainNav.vue @@ -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", diff --git a/pages/banking/index.vue b/pages/banking/index.vue index a2ebb1f..3e7c4c1 100644 --- a/pages/banking/index.vue +++ b/pages/banking/index.vue @@ -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))) }) diff --git a/pages/createDocument/edit/[[id]].vue b/pages/createDocument/edit/[[id]].vue index 4975eba..a38f014 100644 --- a/pages/createDocument/edit/[[id]].vue +++ b/pages/createDocument/edit/[[id]].vue @@ -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" /> + + + + + + + + + + + + + + + + diff --git a/pages/createDocument/show/[id].vue b/pages/createDocument/show/[id].vue index a91fc71..199f8ff 100644 --- a/pages/createDocument/show/[id].vue +++ b/pages/createDocument/show/[id].vue @@ -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}`) + } +} diff --git a/pages/settings/emailaccounts/[mode]/[[id]].vue b/pages/settings/emailaccounts/[mode]/[[id]].vue new file mode 100644 index 0000000..de51c82 --- /dev/null +++ b/pages/settings/emailaccounts/[mode]/[[id]].vue @@ -0,0 +1,137 @@ + + + + + \ No newline at end of file diff --git a/pages/settings/emailAccounts.vue b/pages/settings/emailaccounts/index.vue similarity index 69% rename from pages/settings/emailAccounts.vue rename to pages/settings/emailaccounts/index.vue index 1d68a7d..98db27a 100644 --- a/pages/settings/emailAccounts.vue +++ b/pages/settings/emailaccounts/index.vue @@ -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 diff --git a/stores/auth.ts b/stores/auth.ts index 3039e26..d3fd5a6 100644 --- a/stores/auth.ts +++ b/stores/auth.ts @@ -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 diff --git a/stores/data.js b/stores/data.js index efd076a..554177b 100644 --- a/stores/data.js +++ b/stores/data.js @@ -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",