Add initial Code
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-10-20 08:57:51 +02:00
parent d204098d8e
commit 8703e5ff40
449 changed files with 34565 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import { AppPageProps } from '@/types/index';
// Extend ImportMeta interface for Vite...
declare module 'vite/client' {
interface ImportMetaEnv {
readonly VITE_APP_NAME: string;
[key: string]: string | boolean | undefined;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
readonly glob: <T>(pattern: string) => Record<string, () => Promise<T>>;
}
}
declare module '@inertiajs/core' {
interface PageProps extends InertiaPageProps, AppPageProps {}
}
declare module 'vue' {
interface ComponentCustomProperties {
$inertia: typeof Router;
$page: Page;
$headManager: ReturnType<typeof createHeadManager>;
}
}
+227
View File
@@ -0,0 +1,227 @@
import { InertiaLinkProps } from '@inertiajs/vue3';
import type { LucideIcon } from 'lucide-vue-next';
import { calcDueDate } from '@/lib/utils';
export interface Auth {
user: User;
}
export interface BreadcrumbItem {
title: string;
href: string;
}
export type BreadcrumbItemType = BreadcrumbItem;
export interface NavGroup {
title: string;
items: NavItem[];
}
export interface NavItem {
title: string;
href: NonNullable<InertiaLinkProps['href']>;
icon?: LucideIcon;
color?: string;
isActive?: boolean;
}
export type AppPageProps<T extends Record<string, unknown> = Record<string, unknown>> = T & {
name: string;
quote: { message: string; author: string };
auth: Auth;
sidebarOpen: boolean;
}
export interface User {
id: number;
name: string;
email: string;
avatar?: string;
email_verified_at: string | null;
created_at: string;
updated_at: string;
}
export interface Address {
lineOne: string | null;
lineTwo: string | null;
city: string | null;
postalCode: string | null;
countryCode: string | null;
}
export function newAddress(): Address {
return {
lineOne: null,
lineTwo: null,
city: null,
postalCode: null,
countryCode: null,
}
}
export interface Contact {
id: number;
firstName: string;
lastName: string;
email?: string;
phone?: string;
position?: string;
isPrimary?: boolean;
avatar?: string;
}
export type ContactType = Contact
export function newContact(): Contact {
return {
id: 0,
firstName: '',
lastName: '',
email: '',
phone: '',
position: '',
isPrimary: false,
avatar: ''
}
}
export interface Customer {
id: number;
type: string;
companyName: string | null;
vatId: string | null;
contacts: Contact[];
email?: string;
phone?: string;
billingAddress?: Address;
paymentTerms: PaymentTerms;
status: string;
avatar?: string | null;
notes?: string;
}
export type CustomerType = Customer
export function newCustomer(): Customer {
return {
id: 0,
type: 'business',
companyName: '',
vatId: '',
contacts: [],
billingAddress: newAddress(),
paymentTerms: newPaymentTerms(),
status: 'active',
}
}
export interface Invoice {
id: number;
nr: string;
invoiceDate: Date;
dueDate: Date | null;
serviceStartDate: Date | null;
serviceEndDate: Date | null;
isRecurring: boolean;
isPartialService: boolean;
customer?: Customer | null;
paymentStatus: 'draft' | 'issued' | 'paid' | 'due' | 'reminded';
totalAmount: number;
title: string;
text: string;
items: LineItem[]
billingData: {
companyName: string | null;
vatId: string | null;
billingAddress: Address | null;
contactFirstName: string | null;
contactLastName: string | null;
paymentTerms: PaymentTerms | null;
} | null;
}
export type InvoiceType = Invoice
export function newInvoice(): Invoice {
const date = new Date();
return {
id: 0,
nr: '',
invoiceDate: date,
dueDate: calcDueDate(date, 14),
serviceStartDate: date,
serviceEndDate: date,
isRecurring: false,
isPartialService: false,
customer: newCustomer(),
paymentStatus: "draft",
totalAmount: 0,
title: "",
text: "",
items: [],
billingData: newBillingData()
}
}
export function newBillingData() {
return {
companyName: "",
vatId: "",
billingAddress: newAddress(),
contactFirstName: "",
contactLastName: "",
paymentTerms: newPaymentTerms()
}
}
export interface LineItem {
id: number;
invoiceId: number,
position: number;
type: string,
title: string,
description: string,
quantity: number,
unit: string,
price: number,
}
export type LineItemType = LineItem
export function newLineItem(): LineItem {
return {
id: 0,
invoiceId: 0,
position: 0,
type: 'service',
title: '',
description: '',
quantity: 1,
unit: 'Stunden',
price: 93.75,
}
}
export interface PaymentTerms {
id: number;
name: string;
description: string;
isFixed: boolean;
days: number;
}
export type PaymentTermsType = PaymentTerms
export function newPaymentTerms(): PaymentTerms {
return {
id: 3,
name: "daysAfterInvoice",
description: "Zahlungsziel in Tagen",
isFixed: false,
days: 14
}
}