KI-AGENT: Mobile Kundenerfassung und Logbücher erweitern
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user