up
This commit is contained in:
@@ -147,10 +147,15 @@ func DispatchFacturaSubida(factura *models.Factura) {
|
||||
clienteNombre = factura.Cliente.Nombre
|
||||
}
|
||||
|
||||
baseURL := getAppURL()
|
||||
// Construir URL apuntando a la pestaña Facturas del proyecto (o dashboard si no tiene proyecto)
|
||||
portalURL := baseURL + "/portal/dashboard"
|
||||
if factura.ProyectoID != nil && factura.Proyecto != nil && factura.Proyecto.Slug != "" {
|
||||
portalURL = baseURL + "/portal/proyecto/" + factura.Proyecto.Slug + "?tab=Facturas"
|
||||
}
|
||||
|
||||
for _, u := range portalUsers {
|
||||
u := u
|
||||
baseURL := getAppURL()
|
||||
portalURL := baseURL + "/portal/dashboard"
|
||||
titulo := fmt.Sprintf("Nueva factura disponible: %s", factura.Numero)
|
||||
cuerpo := fmt.Sprintf("Factura %s por %s %.2f", factura.Numero, factura.Moneda, factura.Monto)
|
||||
|
||||
@@ -169,8 +174,8 @@ func DispatchFacturaSubida(factura *models.Factura) {
|
||||
}
|
||||
if cfg.CanalTelegram && u.TelegramChatID != "" {
|
||||
ts := NewTelegramService()
|
||||
msg := fmt.Sprintf("🧾 <b>Nueva factura disponible</b>\nNúmero: <b>%s</b>\nMonto: %s %.2f",
|
||||
factura.Numero, factura.Moneda, factura.Monto)
|
||||
msg := fmt.Sprintf("🧾 <b>Nueva factura disponible</b>\nNúmero: <b>%s</b>\nMonto: %s %.2f\n\n🔗 <a href=\"%s\">Ver en el portal</a>",
|
||||
factura.Numero, factura.Moneda, factura.Monto, portalURL)
|
||||
if err := ts.SendMessageWithToken(u.TelegramChatID, msg, getAdminBotToken()); err != nil {
|
||||
log.Printf("[Notif] Error telegram portal_user %d: %v", u.ID, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user