ruspet_portal_back/service/telegram_service/keyboard/builder.go

65 lines
2.4 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 (
"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) interface{} {
return tgkit.NewInlineKeyboard().
Row(tgkit.Btn("↩️ Ответить на комментарий", fmt.Sprintf("comment_reply:%d", approvalID))).
Build()
}
// BuildCommentReplyKeyboard — для согласующего/наблюдателя при получении ответа
func BuildCommentReplyKeyboard(approvalID uint64) interface{} {
return tgkit.NewInlineKeyboard().
Row(tgkit.Btn("↩️ Ответить на комментарий", fmt.Sprintf("comment_reply:%d", approvalID))).
Row(tgkit.Btn("💬 Добавить комментарий", fmt.Sprintf("appr_comment:%d", approvalID))).
Build()
}