added new view in contracts customer and contracts
This commit is contained in:
@@ -508,12 +508,37 @@ export const cachedEmailApi = {
|
||||
},
|
||||
};
|
||||
|
||||
// Contracts
|
||||
// Contracts - Vertragsbaum für Kundenansicht
|
||||
export interface ContractTreeNodeContract {
|
||||
id: number;
|
||||
contractNumber: string;
|
||||
type: string;
|
||||
status: string;
|
||||
startDate: string | null;
|
||||
endDate: string | null;
|
||||
providerName: string | null;
|
||||
tariffName: string | null;
|
||||
previousContractId: number | null;
|
||||
provider?: { id: number; name: string } | null;
|
||||
tariff?: { id: number; name: string } | null;
|
||||
contractCategory?: { id: number; name: string } | null;
|
||||
}
|
||||
|
||||
export interface ContractTreeNode {
|
||||
contract: ContractTreeNodeContract;
|
||||
predecessors: ContractTreeNode[];
|
||||
hasHistory: boolean;
|
||||
}
|
||||
|
||||
export const contractApi = {
|
||||
getAll: async (params?: { customerId?: number; type?: string; status?: string; search?: string; page?: number; limit?: number }) => {
|
||||
const res = await api.get<ApiResponse<Contract[]>>('/contracts', { params });
|
||||
return res.data;
|
||||
},
|
||||
getTreeForCustomer: async (customerId: number) => {
|
||||
const res = await api.get<ApiResponse<ContractTreeNode[]>>('/contracts', { params: { customerId, tree: 'true' } });
|
||||
return res.data;
|
||||
},
|
||||
getById: async (id: number) => {
|
||||
const res = await api.get<ApiResponse<Contract>>(`/contracts/${id}`);
|
||||
return res.data;
|
||||
|
||||
Reference in New Issue
Block a user