mirror of
https://github.com/serty2005/rmser.git
synced 2026-02-05 03:12:34 -06:00
Настройки работают
Иерархия групп работает Полностью завязано на пользователя и серверы
This commit is contained in:
@@ -8,9 +8,13 @@ import type {
|
||||
ProductMatch,
|
||||
Recommendation,
|
||||
UnmatchedItem,
|
||||
UserSettings,
|
||||
InvoiceStats,
|
||||
ProductGroup,
|
||||
Store,
|
||||
Supplier,
|
||||
DraftInvoice,
|
||||
DraftItem,
|
||||
UpdateDraftItemRequest,
|
||||
CommitDraftRequest,
|
||||
ProductSearchResult,
|
||||
@@ -151,6 +155,15 @@ export const api = {
|
||||
return data;
|
||||
},
|
||||
|
||||
addDraftItem: async (draftId: string): Promise<DraftItem> => {
|
||||
const { data } = await apiClient.post<DraftItem>(`/drafts/${draftId}/items`, {});
|
||||
return data;
|
||||
},
|
||||
|
||||
deleteDraftItem: async (draftId: string, itemId: string): Promise<void> => {
|
||||
await apiClient.delete(`/drafts/${draftId}/items/${itemId}`);
|
||||
},
|
||||
|
||||
commitDraft: async (draftId: string, payload: CommitDraftRequest): Promise<{ document_number: string }> => {
|
||||
const { data } = await apiClient.post<{ document_number: string }>(`/drafts/${draftId}/commit`, payload);
|
||||
return data;
|
||||
@@ -159,4 +172,26 @@ export const api = {
|
||||
deleteDraft: async (id: string): Promise<void> => {
|
||||
await apiClient.delete(`/drafts/${id}`);
|
||||
},
|
||||
|
||||
// --- Настройки и Статистика ---
|
||||
|
||||
getSettings: async (): Promise<UserSettings> => {
|
||||
const { data } = await apiClient.get<UserSettings>('/settings');
|
||||
return data;
|
||||
},
|
||||
|
||||
updateSettings: async (payload: UserSettings): Promise<UserSettings> => {
|
||||
const { data } = await apiClient.post<UserSettings>('/settings', payload);
|
||||
return data;
|
||||
},
|
||||
|
||||
getStats: async (): Promise<InvoiceStats> => {
|
||||
const { data } = await apiClient.get<InvoiceStats>('/stats/invoices');
|
||||
return data;
|
||||
},
|
||||
|
||||
getProductGroups: async (): Promise<ProductGroup[]> => {
|
||||
const { data } = await apiClient.get<ProductGroup[]>('/dictionaries/groups');
|
||||
return data;
|
||||
},
|
||||
};
|
||||
@@ -124,6 +124,29 @@ export interface Supplier {
|
||||
export interface DictionariesResponse {
|
||||
stores: Store[];
|
||||
suppliers: Supplier[];
|
||||
// product_groups?: ProductGroup[]; // пока не реализовано
|
||||
}
|
||||
|
||||
// --- Настройки и Статистика ---
|
||||
|
||||
export interface UserSettings {
|
||||
root_group_id: UUID | null;
|
||||
default_store_id: UUID | null;
|
||||
auto_conduct: boolean;
|
||||
}
|
||||
|
||||
export interface InvoiceStats {
|
||||
last_month: number;
|
||||
last_24h: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
// Интерфейс группы товаров (рекурсивный)
|
||||
export interface ProductGroup {
|
||||
key: string;
|
||||
value: string;
|
||||
title: string;
|
||||
children?: ProductGroup[];
|
||||
}
|
||||
|
||||
// --- Черновик Накладной (Draft) ---
|
||||
|
||||
Reference in New Issue
Block a user