34 lines
1.3 KiB
Go
34 lines
1.3 KiB
Go
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))
|
||
}
|