package keyboard import ( "bitrix_balancer_api/core/lib/external/tgkit" "fmt" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" ) // ApprovalsSubmenuKeyboard - подменю "Согласования" func ApprovalsSubmenuKeyboard(isObserver, isApprover bool) tgbotapi.ReplyKeyboardMarkup { rows := [][]tgbotapi.KeyboardButton{ tgbotapi.NewKeyboardButtonRow( tgbotapi.NewKeyboardButton("Согласования"), tgbotapi.NewKeyboardButton("Создать согласование"), ), } if isApprover { rows = append(rows, tgbotapi.NewKeyboardButtonRow( tgbotapi.NewKeyboardButton("Сформировать отчёт"), tgbotapi.NewKeyboardButton("Делегирование прав"), )) rows = append(rows, tgbotapi.NewKeyboardButtonRow( tgbotapi.NewKeyboardButton("Добавить согласующего"), )) } rows = append(rows, tgbotapi.NewKeyboardButtonRow( tgbotapi.NewKeyboardButton("← Назад"), )) return tgbotapi.NewReplyKeyboard(rows...) } // ApprovalsListSubmenuKeyboard - подменю "Список согласований" func ApprovalsListSubmenuKeyboard() tgbotapi.ReplyKeyboardMarkup { return tgbotapi.NewReplyKeyboard( tgbotapi.NewKeyboardButtonRow( tgbotapi.NewKeyboardButton("Все"), tgbotapi.NewKeyboardButton("Принятые"), ), tgbotapi.NewKeyboardButtonRow( tgbotapi.NewKeyboardButton("Отклонённые"), tgbotapi.NewKeyboardButton("На согласовании"), ), tgbotapi.NewKeyboardButtonRow( tgbotapi.NewKeyboardButton("← Назад"), ), ) } // BuildCommentNotificationKeyboard — для уведомления инициатора о комментарии func BuildCommentNotificationKeyboard(approvalID uint64, commentsCount int) interface{} { viewLabel := "💬 Посмотреть все комментарии" if commentsCount > 0 { viewLabel = fmt.Sprintf("💬 Посмотреть все комментарии (%d)", commentsCount) } return tgkit.NewInlineKeyboard(). Row(tgkit.Btn("↩️ Ответить на комментарий", fmt.Sprintf("comment_reply:%d", approvalID))). Row(tgkit.Btn("💬 Добавить комментарий", fmt.Sprintf("appr_comment:%d", approvalID))). Row(tgkit.Btn(viewLabel, fmt.Sprintf("appr_view_comments:%d", approvalID))). Build() } // BuildCommentReplyKeyboard — для согласующего/наблюдателя при получении ответа func BuildCommentReplyKeyboard(approvalID uint64, commentsCount int) interface{} { viewLabel := "💬 Посмотреть все комментарии" if commentsCount > 0 { viewLabel = fmt.Sprintf("💬 Посмотреть все комментарии (%d)", commentsCount) } return tgkit.NewInlineKeyboard(). Row(tgkit.Btn("↩️ Ответить на комментарий", fmt.Sprintf("comment_reply:%d", approvalID))). Row(tgkit.Btn("💬 Добавить комментарий", fmt.Sprintf("appr_comment:%d", approvalID))). Row(tgkit.Btn(viewLabel, fmt.Sprintf("appr_view_comments:%d", approvalID))). Build() }