редактирование и удаление сопоставлений

список накладных с позициями
This commit is contained in:
2025-12-29 10:46:05 +03:00
parent c2d382cb6a
commit 310a64e3ba
30 changed files with 1250 additions and 8173 deletions

View File

@@ -24,7 +24,8 @@ import type {
DictionariesResponse,
UnifiedInvoice,
ServerUser,
UserRole
UserRole,
InvoiceDetails
} from './types';
// Базовый URL
@@ -134,6 +135,18 @@ export const api = {
const { data } = await apiClient.post<{ status: string }>('/ocr/match', payload);
return data;
},
deleteMatch: async (rawName: string): Promise<{ status: string }> => {
const { data } = await apiClient.delete<{ status: string }>('/ocr/match', {
params: { raw_name: rawName }
});
return data;
},
deleteUnmatched: async (rawName: string): Promise<{ status: string }> => {
const { data } = await apiClient.delete<{ status: string }>('/ocr/unmatched', {
params: { raw_name: rawName }
});
return data;
},
createInvoice: async (payload: CreateInvoiceRequest): Promise<InvoiceResponse> => {
const { data } = await apiClient.post<InvoiceResponse>('/invoices/send', payload);
@@ -233,4 +246,9 @@ export const api = {
const { data } = await apiClient.delete<{ status: string }>(`/settings/users/${userId}`);
return data;
},
getInvoice: async (id: string): Promise<InvoiceDetails> => {
const { data } = await apiClient.get<InvoiceDetails>(`/invoices/${id}`);
return data;
},
};

View File

@@ -166,7 +166,7 @@ export interface ProductGroup {
// --- Черновик Накладной (Draft) ---
export type DraftStatus = 'PROCESSING' | 'READY_TO_VERIFY' | 'COMPLETED' | 'ERROR' | 'CANCELED';
export type DraftStatus = 'PROCESSING' | 'READY_TO_VERIFY' | 'COMPLETED' | 'ERROR' | 'CANCELED' | 'NEW' | 'PROCESSED' | 'DELETED';
export interface DraftItem {
id: UUID;
@@ -205,6 +205,7 @@ export interface DraftInvoice {
id: UUID;
status: DraftStatus;
document_number: string;
incoming_document_number?: string
date_incoming: string | null; // YYYY-MM-DD
store_id: UUID | null;
supplier_id: UUID | null;
@@ -228,6 +229,7 @@ export interface CommitDraftRequest {
store_id: UUID;
supplier_id: UUID;
comment: string;
incoming_document_number?: string;
}
export interface MainUnit {
id: UUID;
@@ -249,4 +251,21 @@ export interface UnifiedInvoice {
store_name?: string;
created_at: string;
is_app_created: boolean; // Создано ли через наше приложение
items_preview: string; // Краткое содержание товаров
photo_url: string | null; // Ссылка на фото чека
}
export interface InvoiceDetails {
id: UUID;
number: string;
date: string;
status: DraftStatus;
supplier: Supplier;
items: {
name: string;
quantity: number;
price: number;
total: number;
}[];
photo_url: string | null;
}