Update absense delegation #182
|
|
@ -683,6 +683,15 @@ func (s *UpdateHandler) handleCallback(bot *tgbotapi.BotAPI, cq *tgbotapi.Callba
|
|||
id := parseID(data, "appr_task_deleg_sel:")
|
||||
s.approvalHandler.HandleTaskDelegateSelectionAbsence(bot, cq, id)
|
||||
|
||||
case strings.HasPrefix(data, "appr_task_deleg_sel:"):
|
||||
id := parseID(data, "appr_task_deleg_sel:")
|
||||
s.approvalHandler.HandleTaskDelegateSelectionAbsence(bot, cq, id)
|
||||
|
||||
// ДОБАВИТЬ ЭТОТ БЛОК:
|
||||
case strings.HasPrefix(data, "appr_task_deleg_pg:"):
|
||||
page := 0
|
||||
fmt.Sscanf(strings.TrimPrefix(data, "appr_task_deleg_pg:"), "%d", &page)
|
||||
s.approvalHandler.HandleTaskDelegateSelectionPageAbsence(bot, cq, page)
|
||||
// ── ПРОЧЕЕ ──────────────────────────────────────────────────
|
||||
case data == "restart_bot":
|
||||
bot.Request(tgbotapi.NewCallback(cq.ID, "")) //nolint:errcheck
|
||||
|
|
|
|||
|
|
@ -377,3 +377,24 @@ func delegationValidUntil(collected map[string]string) (time.Time, bool) {
|
|||
}
|
||||
return maxDate, true
|
||||
}
|
||||
|
||||
// HandleTaskDelegateSelectionPageAbsence — пагинация списка кандидатов для делегирования задач (отпуск)
|
||||
func (h *Handler) HandleTaskDelegateSelectionPageAbsence(bot *tgbotapi.BotAPI, cq *tgbotapi.CallbackQuery, page int) {
|
||||
ctx := context.Background()
|
||||
bot.Request(tgbotapi.NewCallback(cq.ID, "")) //nolint:errcheck
|
||||
|
||||
flowState, err := h.States.Get(ctx, cq.From.ID)
|
||||
if err != nil || flowState == nil || !flowState.AwaitTaskDelegateSelection {
|
||||
return
|
||||
}
|
||||
|
||||
candidates, _ := h.getAvailableDelegateCandidates(ctx, cq.From.ID)
|
||||
|
||||
editMsg := tgbotapi.NewEditMessageReplyMarkup(
|
||||
cq.Message.Chat.ID,
|
||||
cq.Message.MessageID,
|
||||
// Убедитесь, что эта функция у вас возвращает tgbotapi.InlineKeyboardMarkup
|
||||
keyboard.BuildAbsenceTaskDelegateMenu(candidates, page).(tgbotapi.InlineKeyboardMarkup),
|
||||
)
|
||||
bot.Request(editMsg) //nolint:errcheck
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue