up
This commit is contained in:
@@ -244,34 +244,34 @@ func GetHistorialContrato(c *fiber.Ctx) error {
|
||||
|
||||
// Construir timeline unificado
|
||||
type Evento struct {
|
||||
Tipo string `json:"tipo"` // creacion | renovacion | notificacion | pago
|
||||
Icono string `json:"icono"`
|
||||
Titulo string `json:"titulo"`
|
||||
Detalle string `json:"detalle"`
|
||||
Estado string `json:"estado"` // ok | error | info
|
||||
FechaISO string `json:"fecha"`
|
||||
Tipo string `json:"tipo"` // creacion | renovacion | notificacion | pago
|
||||
Icono string `json:"icono"`
|
||||
Titulo string `json:"titulo"`
|
||||
Detalle string `json:"detalle"`
|
||||
Estado string `json:"estado"` // ok | error | info
|
||||
FechaISO string `json:"fecha"`
|
||||
}
|
||||
|
||||
var timeline []Evento
|
||||
|
||||
// Evento: creación del contrato
|
||||
timeline = append(timeline, Evento{
|
||||
Tipo: "creacion",
|
||||
Icono: "document",
|
||||
Titulo: "Contrato creado",
|
||||
Detalle: "Inicio: " + contrato.FechaInicio.Format("02/01/2006") + " · Vence: " + contrato.FechaVencimiento.Format("02/01/2006"),
|
||||
Estado: "info",
|
||||
Tipo: "creacion",
|
||||
Icono: "document",
|
||||
Titulo: "Contrato creado",
|
||||
Detalle: "Inicio: " + contrato.FechaInicio.Format("02/01/2006") + " · Vence: " + contrato.FechaVencimiento.Format("02/01/2006"),
|
||||
Estado: "info",
|
||||
FechaISO: contrato.CreatedAt.Format(time.RFC3339),
|
||||
})
|
||||
|
||||
// Evento: renovaciones (updated_at con estado renovado — heurístico por estado)
|
||||
if contrato.Estado == "renovado" {
|
||||
timeline = append(timeline, Evento{
|
||||
Tipo: "renovacion",
|
||||
Icono: "refresh",
|
||||
Titulo: "Contrato renovado",
|
||||
Detalle: "Nuevo vencimiento: " + contrato.FechaVencimiento.Format("02/01/2006"),
|
||||
Estado: "ok",
|
||||
Tipo: "renovacion",
|
||||
Icono: "refresh",
|
||||
Titulo: "Contrato renovado",
|
||||
Detalle: "Nuevo vencimiento: " + contrato.FechaVencimiento.Format("02/01/2006"),
|
||||
Estado: "ok",
|
||||
FechaISO: contrato.UpdatedAt.Format(time.RFC3339),
|
||||
})
|
||||
}
|
||||
@@ -293,11 +293,11 @@ func GetHistorialContrato(c *fiber.Ctx) error {
|
||||
reglaLabel = " (" + n.Regla.Nombre + ")"
|
||||
}
|
||||
timeline = append(timeline, Evento{
|
||||
Tipo: "notificacion",
|
||||
Icono: "mail",
|
||||
Titulo: "Notificación enviada" + reglaLabel,
|
||||
Detalle: detalle,
|
||||
Estado: estado,
|
||||
Tipo: "notificacion",
|
||||
Icono: "mail",
|
||||
Titulo: "Notificación enviada" + reglaLabel,
|
||||
Detalle: detalle,
|
||||
Estado: estado,
|
||||
FechaISO: n.CreatedAt.Format(time.RFC3339),
|
||||
})
|
||||
}
|
||||
@@ -316,11 +316,11 @@ func GetHistorialContrato(c *fiber.Ctx) error {
|
||||
detalle += " · " + p.Fuente
|
||||
}
|
||||
timeline = append(timeline, Evento{
|
||||
Tipo: "pago",
|
||||
Icono: "currency",
|
||||
Titulo: "Pago recibido",
|
||||
Detalle: detalle,
|
||||
Estado: estado,
|
||||
Tipo: "pago",
|
||||
Icono: "currency",
|
||||
Titulo: "Pago recibido",
|
||||
Detalle: detalle,
|
||||
Estado: estado,
|
||||
FechaISO: p.CreatedAt.Format(time.RFC3339),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user