bot changes

This commit is contained in:
Artem Tsyrulnikov
2026-01-03 11:24:24 +03:00
parent 0577d2a00e
commit 922067d194
13 changed files with 312 additions and 182 deletions

View File

@@ -10,10 +10,11 @@ import (
)
type PurchaseDetails struct {
WorkspaceID string
ProjectID string
PurchaseID string
BackState bot.State
WorkspaceID string
ProjectID string
ProjectTitle string
PurchaseID string
BackState bot.State
}
func (s *PurchaseDetails) Enter(b *bot.Bot, mode bot.RenderMode) {
@@ -53,21 +54,23 @@ func (s *PurchaseDetails) renderDetails(b *bot.Bot, mode bot.RenderMode, jwt str
creative = nil
}
text := "<b>📦 Детали закупа</b>\n\n"
text := "<i>… Закупы Детали</i>\n\n<b>Детали закупа</b>\n\n"
// Информация о креативе
if creative != nil {
text += fmt.Sprintf("<b>Креатив:</b> %s\n", creative.Name)
text += fmt.Sprintf("<b>Креатив:</b> %s\n", creative.Name)
} else {
text += fmt.Sprintf("<b>Креатив ID:</b> %s\n", purchase.CreativeID)
text += fmt.Sprintf("<b>Креатив ID:</b> %s\n", purchase.CreativeID)
}
// Статус закупа
statusSymbol := "●"
statusText := "Активный"
if purchase.Status == "archived" {
statusSymbol = "■"
statusText = "Архивирован"
}
text += fmt.Sprintf("<b>Статус:</b> %s\n\n", statusText)
text += fmt.Sprintf("<b>Статус:</b> %s %s\n\n", statusSymbol, statusText)
// Информация о каналах
if len(purchase.Channels) == 0 {
@@ -76,19 +79,19 @@ func (s *PurchaseDetails) renderDetails(b *bot.Bot, mode bot.RenderMode, jwt str
text += fmt.Sprintf("<b>Каналы (%d):</b>\n\n", len(purchase.Channels))
for i, ch := range purchase.Channels {
// Определяем статус emoji
statusEmoji := "📌"
// Определяем статус
statusSymbol := ""
switch ch.Status {
case "planned":
statusEmoji = "📝"
statusSymbol = ""
case "approved":
statusEmoji = ""
statusSymbol = ""
case "rejected":
statusEmoji = ""
statusSymbol = ""
case "in_progress":
statusEmoji = "🔄"
statusSymbol = ""
case "completed":
statusEmoji = "✔️"
statusSymbol = ""
}
// Название канала
@@ -99,16 +102,16 @@ func (s *PurchaseDetails) renderDetails(b *bot.Bot, mode bot.RenderMode, jwt str
channelName = "@" + *ch.Channel.Username
}
text += fmt.Sprintf("%d. %s <b>%s</b>\n", i+1, statusEmoji, channelName)
text += fmt.Sprintf("%d. %s <b>%s</b>\n", i+1, statusSymbol, channelName)
// Стоимость
if ch.PlannedCost != nil {
text += fmt.Sprintf(" 💰 Стоимость: %.0f₽\n", *ch.PlannedCost)
text += fmt.Sprintf(" Стоимость: %.0f₽\n", *ch.PlannedCost)
}
// Комментарий
if ch.Comment != nil && *ch.Comment != "" {
text += fmt.Sprintf(" 💬 %s\n", *ch.Comment)
text += fmt.Sprintf(" %s\n", *ch.Comment)
}
// Тип invite link
@@ -116,7 +119,7 @@ func (s *PurchaseDetails) renderDetails(b *bot.Bot, mode bot.RenderMode, jwt str
if ch.InviteLinkType == "approval" {
inviteLinkTypeText = "с одобрением"
}
text += fmt.Sprintf(" 🔗 Ссылка: %s\n", inviteLinkTypeText)
text += fmt.Sprintf(" Ссылка: %s\n", inviteLinkTypeText)
text += "\n"
}