KI-AGENT: Mobile Kundenerfassung und Logbücher erweitern

This commit is contained in:
2026-09-08 21:50:31 +02:00
parent 1c39b69513
commit 5e1631e2d3
7 changed files with 621 additions and 27 deletions

View File

@@ -76,8 +76,32 @@ export type Customer = {
archived?: boolean;
infoData?: {
email?: string | null;
invoiceEmail?: string | null;
tel?: string | null;
mobileTel?: string | null;
street?: string | null;
special?: string | null;
zip?: string | null;
city?: string | null;
country?: string | null;
web?: string | null;
ustid?: string | null;
[key: string]: unknown;
} | null;
[key: string]: unknown;
};
export type HistoryItem = {
id: number;
text: string;
created_at?: string | null;
createdAt?: string | null;
created_by?: string | null;
createdBy?: string | null;
created_by_profile?: {
full_name?: string | null;
fullName?: string | null;
email?: string | null;
[key: string]: unknown;
} | null;
[key: string]: unknown;
@@ -874,6 +898,13 @@ export async function createCustomer(
name: string;
customerNumber?: string | null;
notes?: string | null;
isCompany?: boolean;
salutation?: string | null;
title?: string | null;
firstname?: string | null;
lastname?: string | null;
nameAddition?: string | null;
infoData?: Customer['infoData'];
}
): Promise<Customer> {
return apiRequest<Customer>('/api/resource/customers', {
@@ -887,6 +918,33 @@ export async function fetchCustomerById(token: string, customerId: number): Prom
return apiRequest<Customer>(`/api/resource/customers/${customerId}`, { token });
}
export async function fetchResourceHistory(
token: string,
resource: string,
resourceId: number | string
): Promise<HistoryItem[]> {
return apiRequest<HistoryItem[]>(
`/api/resource/${encodeURIComponent(resource)}/${encodeURIComponent(String(resourceId))}/history`,
{ token }
);
}
export async function createResourceHistoryItem(
token: string,
resource: string,
resourceId: number | string,
text: string
): Promise<HistoryItem> {
return apiRequest<HistoryItem>(
`/api/resource/${encodeURIComponent(resource)}/${encodeURIComponent(String(resourceId))}/history`,
{
method: 'POST',
token,
body: { text },
}
);
}
function resolveCustomerIdFromCustomerInventoryItem(item: CustomerInventoryItem): number | null {
const rawCustomer = item.customer;
if (!rawCustomer) return null;