Rol medico: pagina Mis ventas con KPIs y comision estimada, menu restringido y bloqueo de endpoints de dinero global
This commit is contained in:
@@ -379,6 +379,31 @@ export interface Sale {
|
||||
refunded_at?: string | null;
|
||||
}
|
||||
|
||||
export interface MySaleItem {
|
||||
id: number;
|
||||
name: string;
|
||||
date: string;
|
||||
patient: string;
|
||||
items: string[];
|
||||
amount: number;
|
||||
payment_method: string;
|
||||
state: string;
|
||||
}
|
||||
|
||||
export interface MySalesResponse {
|
||||
status: string;
|
||||
medico_sin_employee?: boolean;
|
||||
doctor?: { id: number; name: string };
|
||||
range?: string;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
kpis: { ventas: number; total_mxn: number; total_usd: number | null; total_card: number };
|
||||
sales: MySaleItem[];
|
||||
commission_pct: number;
|
||||
commission_source?: string;
|
||||
commission_estimate: number;
|
||||
}
|
||||
|
||||
export interface CashClosing {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -1247,6 +1272,12 @@ export const odooApi = {
|
||||
return data;
|
||||
},
|
||||
|
||||
// "Mis ventas" (rol medico): el servidor filtra por el employee del token
|
||||
async getMySales(range: '30d' | 'month' | 'last_month' = '30d'): Promise<MySalesResponse> {
|
||||
const { data } = await axios.get(`${ODOO_BASE}/skeen/frontend/v1/my/sales`, { params: { range } });
|
||||
return data;
|
||||
},
|
||||
|
||||
async createSale(sale: Omit<Partial<Sale>, 'lines'> & { lines: Omit<SaleLine, 'subtotal'>[] }): Promise<{ status: string; sale: Sale }> {
|
||||
const { data } = await axios.post(`${ODOO_BASE}/skeen/frontend/v1/sales`, sale);
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user