feat: automatización de cotizaciones, contratos, actas y cuentas de cobro con IA
Implementa las 4 fases de la especificación de automatización: módulo de plantillas/tarifas editable por el equipo, generación de PDF (HTML+JS vía Chrome headless) para cotizaciones/contratos/arquitecturas/cuentas de cobro, chat propio en el dashboard reutilizando el mismo motor y tools del bot de Telegram, y nuevas tools del agente para crear estos documentos end-to-end. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
772a4a5656
commit
516220a8a1
@@ -462,3 +462,19 @@ func MarcarPagoManual(c *fiber.Ctx) error {
|
||||
go services.EnviarCorreoConfirmacionPago(uint(id), "manual")
|
||||
return c.JSON(fiber.Map{"ok": true, "mensaje": "Pago marcado como confirmado"})
|
||||
}
|
||||
|
||||
// GenerarDocumentoContrato produce el PDF del contrato (cláusulas estándar) a partir
|
||||
// de la plantilla activa tipo 'contrato'. La lógica real vive en
|
||||
// services.GenerarDocumentoContrato, compartida con la tool del agente.
|
||||
// POST /api/v2/contratos/:id/generar-documento
|
||||
func GenerarDocumentoContrato(c *fiber.Ctx) error {
|
||||
id, err := strconv.ParseUint(c.Params("id"), 10, 32)
|
||||
if err != nil {
|
||||
return c.Status(400).JSON(fiber.Map{"error": "ID inválido"})
|
||||
}
|
||||
doc, err := services.GenerarDocumentoContrato(uint(id), generadoPorFromContext(c))
|
||||
if err != nil {
|
||||
return c.Status(400).JSON(fiber.Map{"error": err.Error()})
|
||||
}
|
||||
return c.Status(201).JSON(fiber.Map{"ok": true, "documento": doc})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user