SEPA-Mandatsauswahlen als Wörterbücher pflegen #183
This commit is contained in:
@@ -21,6 +21,9 @@ import { decrypt, encrypt } from "../../utils/crypt";
|
|||||||
|
|
||||||
const PORTAL_ALLOWED_RESOURCES = new Set(["customers", "contracts", "createddocuments", "contracttypes"])
|
const PORTAL_ALLOWED_RESOURCES = new Set(["customers", "contracts", "createddocuments", "contracttypes"])
|
||||||
const PORTAL_VISIBLE_DOCUMENT_TYPES = ["invoices", "advanceInvoices", "cancellationInvoices"]
|
const PORTAL_VISIBLE_DOCUMENT_TYPES = ["invoices", "advanceInvoices", "cancellationInvoices"]
|
||||||
|
const OUTGOING_SEPA_MANDATE_STATUSES = new Set(["Entwurf", "Aktiv", "Widerrufen", "Abgelaufen"])
|
||||||
|
const OUTGOING_SEPA_MANDATE_TYPES = new Set(["CORE", "B2B"])
|
||||||
|
const OUTGOING_SEPA_SEQUENCE_TYPES = new Set(["RCUR", "OOFF", "FRST", "FNAL"])
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
// SQL Suche auf mehreren Feldern (Haupttabelle + Relationen)
|
// SQL Suche auf mehreren Feldern (Haupttabelle + Relationen)
|
||||||
@@ -378,6 +381,21 @@ async function validateOutgoingSepaMandatePayload(
|
|||||||
return "Kunde und Bankverbindung sind Pflichtfelder."
|
return "Kunde und Bankverbindung sind Pflichtfelder."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const status = payload.status ?? existing?.status ?? "Entwurf"
|
||||||
|
if (!OUTGOING_SEPA_MANDATE_STATUSES.has(status)) {
|
||||||
|
return "Ungültiger Mandatsstatus."
|
||||||
|
}
|
||||||
|
|
||||||
|
const mandateType = payload.mandateType ?? existing?.mandateType ?? "CORE"
|
||||||
|
if (!OUTGOING_SEPA_MANDATE_TYPES.has(mandateType)) {
|
||||||
|
return "Ungültiger Mandatstyp."
|
||||||
|
}
|
||||||
|
|
||||||
|
const sequenceType = payload.sequenceType ?? existing?.sequenceType ?? "RCUR"
|
||||||
|
if (!OUTGOING_SEPA_SEQUENCE_TYPES.has(sequenceType)) {
|
||||||
|
return "Ungültige Mandatssequenz."
|
||||||
|
}
|
||||||
|
|
||||||
const [customer] = await server.db
|
const [customer] = await server.db
|
||||||
.select()
|
.select()
|
||||||
.from(customers)
|
.from(customers)
|
||||||
|
|||||||
@@ -56,6 +56,18 @@ import outgoingSepaMandate from "~/components/columnRenderings/outgoingSepaManda
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const useDataStore = defineStore('data', () => {
|
export const useDataStore = defineStore('data', () => {
|
||||||
|
|
||||||
|
const outgoingSepaMandateTypeOptions = [
|
||||||
|
{ key: "CORE", label: "Basislastschrift (CORE)" },
|
||||||
|
{ key: "B2B", label: "Firmenlastschrift (B2B)" }
|
||||||
|
]
|
||||||
|
|
||||||
|
const outgoingSepaSequenceTypeOptions = [
|
||||||
|
{ key: "RCUR", label: "Wiederkehrend (RCUR)" },
|
||||||
|
{ key: "OOFF", label: "Einmalig (OOFF)" },
|
||||||
|
{ key: "FRST", label: "Erstlastschrift (FRST)" },
|
||||||
|
{ key: "FNAL", label: "Letztlastschrift (FNAL)" }
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const dataTypes = {
|
const dataTypes = {
|
||||||
@@ -1224,11 +1236,9 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
required: true,
|
required: true,
|
||||||
defaultValue: "CORE",
|
defaultValue: "CORE",
|
||||||
inputType: "select",
|
inputType: "select",
|
||||||
selectValueAttribute: "label",
|
selectValueAttribute: "key",
|
||||||
selectManualOptions: [
|
selectOptionAttribute: "label",
|
||||||
{ label: "CORE" },
|
selectManualOptions: outgoingSepaMandateTypeOptions,
|
||||||
{ label: "B2B" }
|
|
||||||
],
|
|
||||||
inputColumn: "Mandat",
|
inputColumn: "Mandat",
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
@@ -1238,13 +1248,9 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
required: true,
|
required: true,
|
||||||
defaultValue: "RCUR",
|
defaultValue: "RCUR",
|
||||||
inputType: "select",
|
inputType: "select",
|
||||||
selectValueAttribute: "label",
|
selectValueAttribute: "key",
|
||||||
selectManualOptions: [
|
selectOptionAttribute: "label",
|
||||||
{ label: "RCUR" },
|
selectManualOptions: outgoingSepaSequenceTypeOptions,
|
||||||
{ label: "OOFF" },
|
|
||||||
{ label: "FRST" },
|
|
||||||
{ label: "FNAL" }
|
|
||||||
],
|
|
||||||
inputColumn: "Mandat",
|
inputColumn: "Mandat",
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
@@ -2287,7 +2293,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
isArchivable: true,
|
isArchivable: true,
|
||||||
label: "Dokumente",
|
label: "Dokumente",
|
||||||
labelSingle: "Dokument",
|
labelSingle: "Dokument",
|
||||||
selectWithInformation: "*, files(*), statementallocations(*)",
|
selectWithInformation: "*, files(*), statementallocations(*), outgoingsepamandate(*)",
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
name: "Archivierte ausblenden",
|
name: "Archivierte ausblenden",
|
||||||
@@ -3737,5 +3743,7 @@ export const useDataStore = defineStore('data', () => {
|
|||||||
return {
|
return {
|
||||||
dataTypes,
|
dataTypes,
|
||||||
documentTypesForCreation,
|
documentTypesForCreation,
|
||||||
|
outgoingSepaMandateTypeOptions,
|
||||||
|
outgoingSepaSequenceTypeOptions,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user