From 3f8ce5daf738fad3a251bdfc16b4514bb8fccd04 Mon Sep 17 00:00:00 2001 From: florianfederspiel Date: Sun, 15 Feb 2026 22:02:16 +0100 Subject: [PATCH] Tasks und Vertragstyp fix #17 --- .../0007_bright_default_tax_type.sql | 1 + .../migrations/0008_quick_contracttypes.sql | 16 + .../0009_heavy_contract_contracttype.sql | 3 + .../0010_sudden_billing_interval.sql | 3 + backend/db/migrations/meta/_journal.json | 21 + backend/db/schema/contracts.ts | 5 + backend/db/schema/contracttypes.ts | 40 + backend/db/schema/index.ts | 1 + backend/src/utils/diffTranslations.ts | 2 + backend/src/utils/resource.config.ts | 11 +- frontend/components/EntityShowSub.vue | 5 +- frontend/components/EntityTable.vue | 8 +- frontend/components/EntityTableMobile.vue | 5 +- frontend/components/MainNav.vue | 10 +- .../columnRenderings/contracttype.vue | 13 + frontend/components/displayOpenTasks.vue | 11 +- frontend/composables/useDashboard.ts | 4 +- frontend/composables/useRole.js | 14 +- .../standardEntity/[type]/[mode]/[[id]].vue | 9 +- .../pages/standardEntity/[type]/index.vue | 7 +- frontend/pages/tasks/[mode]/[[id]].vue | 22 + frontend/pages/tasks/index.vue | 746 ++++++++++++++++++ frontend/stores/data.js | 104 ++- 23 files changed, 1037 insertions(+), 24 deletions(-) create mode 100644 backend/db/migrations/0007_bright_default_tax_type.sql create mode 100644 backend/db/migrations/0008_quick_contracttypes.sql create mode 100644 backend/db/migrations/0009_heavy_contract_contracttype.sql create mode 100644 backend/db/migrations/0010_sudden_billing_interval.sql create mode 100644 backend/db/schema/contracttypes.ts create mode 100644 frontend/components/columnRenderings/contracttype.vue create mode 100644 frontend/pages/tasks/[mode]/[[id]].vue create mode 100644 frontend/pages/tasks/index.vue diff --git a/backend/db/migrations/0007_bright_default_tax_type.sql b/backend/db/migrations/0007_bright_default_tax_type.sql new file mode 100644 index 0000000..f4c8b74 --- /dev/null +++ b/backend/db/migrations/0007_bright_default_tax_type.sql @@ -0,0 +1 @@ +ALTER TABLE "customers" ADD COLUMN "customTaxType" text; diff --git a/backend/db/migrations/0008_quick_contracttypes.sql b/backend/db/migrations/0008_quick_contracttypes.sql new file mode 100644 index 0000000..de5a770 --- /dev/null +++ b/backend/db/migrations/0008_quick_contracttypes.sql @@ -0,0 +1,16 @@ +CREATE TABLE "contracttypes" ( + "id" bigint PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "contracttypes_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 1 CACHE 1), + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "tenant" bigint NOT NULL, + "name" text NOT NULL, + "description" text, + "paymentType" text, + "recurring" boolean DEFAULT false NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "updated_at" timestamp with time zone, + "updated_by" uuid +); +--> statement-breakpoint +ALTER TABLE "contracttypes" ADD CONSTRAINT "contracttypes_tenant_tenants_id_fk" FOREIGN KEY ("tenant") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action; +--> statement-breakpoint +ALTER TABLE "contracttypes" ADD CONSTRAINT "contracttypes_updated_by_auth_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."auth_users"("id") ON DELETE no action ON UPDATE no action; diff --git a/backend/db/migrations/0009_heavy_contract_contracttype.sql b/backend/db/migrations/0009_heavy_contract_contracttype.sql new file mode 100644 index 0000000..4ca4599 --- /dev/null +++ b/backend/db/migrations/0009_heavy_contract_contracttype.sql @@ -0,0 +1,3 @@ +ALTER TABLE "contracts" ADD COLUMN "contracttype" bigint; +--> statement-breakpoint +ALTER TABLE "contracts" ADD CONSTRAINT "contracts_contracttype_contracttypes_id_fk" FOREIGN KEY ("contracttype") REFERENCES "public"."contracttypes"("id") ON DELETE no action ON UPDATE no action; diff --git a/backend/db/migrations/0010_sudden_billing_interval.sql b/backend/db/migrations/0010_sudden_billing_interval.sql new file mode 100644 index 0000000..c1f23c8 --- /dev/null +++ b/backend/db/migrations/0010_sudden_billing_interval.sql @@ -0,0 +1,3 @@ +ALTER TABLE "contracttypes" ADD COLUMN "billingInterval" text; +--> statement-breakpoint +ALTER TABLE "contracts" ADD COLUMN "billingInterval" text; diff --git a/backend/db/migrations/meta/_journal.json b/backend/db/migrations/meta/_journal.json index c4e1e7a..2bb6588 100644 --- a/backend/db/migrations/meta/_journal.json +++ b/backend/db/migrations/meta/_journal.json @@ -57,6 +57,27 @@ "when": 1772000100000, "tag": "0007_bright_default_tax_type", "breakpoints": true + }, + { + "idx": 8, + "version": "7", + "when": 1773000000000, + "tag": "0008_quick_contracttypes", + "breakpoints": true + }, + { + "idx": 9, + "version": "7", + "when": 1773000100000, + "tag": "0009_heavy_contract_contracttype", + "breakpoints": true + }, + { + "idx": 10, + "version": "7", + "when": 1773000200000, + "tag": "0010_sudden_billing_interval", + "breakpoints": true } ] } diff --git a/backend/db/schema/contracts.ts b/backend/db/schema/contracts.ts index 3673395..2a32e67 100644 --- a/backend/db/schema/contracts.ts +++ b/backend/db/schema/contracts.ts @@ -11,6 +11,7 @@ import { import { tenants } from "./tenants" import { customers } from "./customers" import { contacts } from "./contacts" +import { contracttypes } from "./contracttypes" import { authUsers } from "./auth_users" export const contracts = pgTable( @@ -48,6 +49,9 @@ export const contracts = pgTable( contact: bigint("contact", { mode: "number" }).references( () => contacts.id ), + contracttype: bigint("contracttype", { mode: "number" }).references( + () => contracttypes.id + ), bankingIban: text("bankingIban"), bankingBIC: text("bankingBIC"), @@ -57,6 +61,7 @@ export const contracts = pgTable( sepaDate: timestamp("sepaDate", { withTimezone: true }), paymentType: text("paymentType"), + billingInterval: text("billingInterval"), invoiceDispatch: text("invoiceDispatch"), ownFields: jsonb("ownFields").notNull().default({}), diff --git a/backend/db/schema/contracttypes.ts b/backend/db/schema/contracttypes.ts new file mode 100644 index 0000000..2567501 --- /dev/null +++ b/backend/db/schema/contracttypes.ts @@ -0,0 +1,40 @@ +import { + pgTable, + bigint, + timestamp, + text, + boolean, + uuid, +} from "drizzle-orm/pg-core" + +import { tenants } from "./tenants" +import { authUsers } from "./auth_users" + +export const contracttypes = pgTable("contracttypes", { + id: bigint("id", { mode: "number" }) + .primaryKey() + .generatedByDefaultAsIdentity(), + + createdAt: timestamp("created_at", { withTimezone: true }) + .notNull() + .defaultNow(), + + tenant: bigint("tenant", { mode: "number" }) + .notNull() + .references(() => tenants.id), + + name: text("name").notNull(), + description: text("description"), + + paymentType: text("paymentType"), + recurring: boolean("recurring").notNull().default(false), + billingInterval: text("billingInterval"), + + archived: boolean("archived").notNull().default(false), + + updatedAt: timestamp("updated_at", { withTimezone: true }), + updatedBy: uuid("updated_by").references(() => authUsers.id), +}) + +export type ContractType = typeof contracttypes.$inferSelect +export type NewContractType = typeof contracttypes.$inferInsert diff --git a/backend/db/schema/index.ts b/backend/db/schema/index.ts index c029ad2..5e25eac 100644 --- a/backend/db/schema/index.ts +++ b/backend/db/schema/index.ts @@ -13,6 +13,7 @@ export * from "./checks" export * from "./citys" export * from "./contacts" export * from "./contracts" +export * from "./contracttypes" export * from "./costcentres" export * from "./countrys" export * from "./createddocuments" diff --git a/backend/src/utils/diffTranslations.ts b/backend/src/utils/diffTranslations.ts index 26e496c..e5b57ab 100644 --- a/backend/src/utils/diffTranslations.ts +++ b/backend/src/utils/diffTranslations.ts @@ -296,6 +296,8 @@ export const diffTranslations: Record< }, projecttype: { label: "Projekttyp" }, + contracttype: { label: "Vertragstyp" }, + billingInterval: { label: "Abrechnungsintervall" }, fixed: { label: "Festgeschrieben", diff --git a/backend/src/utils/resource.config.ts b/backend/src/utils/resource.config.ts index a487bad..5f8c0b3 100644 --- a/backend/src/utils/resource.config.ts +++ b/backend/src/utils/resource.config.ts @@ -5,6 +5,7 @@ import { bankstatements, contacts, contracts, + contracttypes, costcentres, createddocuments, customers, @@ -55,9 +56,13 @@ export const resourceConfig = { }, contracts: { table: contracts, - searchColumns: ["name", "notes", "contractNumber", "paymentType", "sepaRef", "bankingName"], + searchColumns: ["name", "notes", "contractNumber", "paymentType", "billingInterval", "sepaRef", "bankingName"], numberRangeHolder: "contractNumber", - mtoLoad: ["customer"], + mtoLoad: ["customer", "contracttype"], + }, + contracttypes: { + table: contracttypes, + searchColumns: ["name", "description", "paymentType", "billingInterval"], }, plants: { table: plants, @@ -173,4 +178,4 @@ export const resourceConfig = { serialexecutions: { table: serialExecutions } -} \ No newline at end of file +} diff --git a/frontend/components/EntityShowSub.vue b/frontend/components/EntityShowSub.vue index e788fee..2aa0091 100644 --- a/frontend/components/EntityShowSub.vue +++ b/frontend/components/EntityShowSub.vue @@ -31,6 +31,7 @@ const dataStore = useDataStore() const tempStore = useTempStore() const router = useRouter() +const createRoute = computed(() => type.value === "tasks" ? `/tasks/create?${props.queryStringData}` : `/standardEntity/${type.value}/create?${props.queryStringData}`) let dataType = null @@ -80,7 +81,7 @@ setup() + {{dataType.labelSingle}} @@ -125,4 +126,4 @@ setup() \ No newline at end of file + diff --git a/frontend/components/EntityTable.vue b/frontend/components/EntityTable.vue index 1542770..1fb3d6d 100644 --- a/frontend/components/EntityTable.vue +++ b/frontend/components/EntityTable.vue @@ -1,4 +1,6 @@