ruspet_portal_back/service/telegram_service/keyboard/observer.go

34 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package keyboard
import (
"fmt"
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
)
// BuildObserverApprovalDetail — карточка заявки с кнопками наблюдателя.
func BuildObserverApprovalDetail(approvalID uint64, topicCode string, commentsCount int) tgbotapi.InlineKeyboardMarkup {
return tgbotapi.NewInlineKeyboardMarkup(
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData("🔔 Напомнить согласующему", fmt.Sprintf("obs_remind:%d", approvalID)),
tgbotapi.NewInlineKeyboardButtonData("💬 Добавить комментарий", fmt.Sprintf("appr_comment:%d", approvalID)),
),
tgbotapi.NewInlineKeyboardRow(
buildCommentsButtonData(approvalID, commentsCount),
),
tgbotapi.NewInlineKeyboardRow(
tgbotapi.NewInlineKeyboardButtonData(
"🔙 Назад к списку",
fmt.Sprintf("obs_back:%s", topicCode),
),
),
)
}
func buildCommentsButtonData(approvalID uint64, commentsCount int) tgbotapi.InlineKeyboardButton {
label := "💬 Посмотреть все комментарии"
if commentsCount > 0 {
label = fmt.Sprintf("💬 Посмотреть все комментарии (%d)", commentsCount)
}
return tgbotapi.NewInlineKeyboardButtonData(label, fmt.Sprintf("appr_view_comments:%d", approvalID))
}