import type { F4Config } from "../types/reports"; export interface HtmlReportSelectOption { value: string; label: string; } export interface HtmlReportParameter { name: string; label: string; inputType: "text" | "number" | "date" | "select" | "f4-modal"; required?: boolean; placeholder?: string; defaultValue?: any; options?: HtmlReportSelectOption[]; f4Config?: F4Config; } export interface HtmlReportDefinition { id: string; title: string; description?: string; icon?: string; /** Sufijo del endpoint bajo /api/reports/, ej. "stickers" -> POST /api/reports/stickers */ endpoint: string; parameters: HtmlReportParameter[]; } // Reportes propios (Jinja2 + HTML, con salida PDF vía WeasyPrint), en // contraste con crystalReportsConfig que va vía APIGateway/Crystal Reports. export const htmlReportsConfig: Record = { socios: [], ventas: [], compras: [], inventario: [ { id: "stickers", title: "Impresión de Etiquetas", description: "Etiquetas de guía de remisión, generadas con plantilla propia (no pasa por Crystal Reports)", icon: "tag", endpoint: "stickers", parameters: [ { name: "doc_entry", label: "Documento", inputType: "f4-modal", required: true, f4Config: { endpoint: "DeliveryNotes", fields: ["DocNum", "FolioPrefixString", "FolioNumber", "CardCode", "CardName", "DocDate", "DocEntry"], columns: [ { key: "DocNum", title: "Número", width: "100px" }, { key: "FolioPrefixString", title: "Serie", width: "50px" }, { key: "FolioNumber", title: "Correlativo", width: "100px" }, { key: "CardCode", title: "Código", width: "100px" }, { key: "CardName", title: "Cliente", width: "200px" }, { key: "DocDate", title: "Fecha", width: "100px", type: "date" }, { key: "DocEntry", title: "Documento", width: "100px" }, ], baseFilter: "Cancelled eq 'tNO'", orderby: "DocEntry desc", valueField: "DocEntry", labelField: "DocNum", selectionMode: "unica", }, }, { name: "cantidad", label: "Cantidad", inputType: "number", required: true, placeholder: "0", defaultValue: "1", }, { name: "formato", label: "Formato de salida", inputType: "select", required: true, defaultValue: "pdf", options: [ { value: "pdf", label: "PDF" }, { value: "html", label: "HTML" }, ], }, { name: "papel", label: "Tamaño de papel", inputType: "select", required: true, defaultValue: "Carta", options: [ { value: "A4", label: "A4" }, { value: "Carta", label: "Carta" }, ], }, ], }, ], };