Дашборд: переводы обоих направлений, переключатель «Сегодня / Всего»
На 9 при одном входящем переводе (Витвицкий) дашборд показывал «Переводов ещё нет»: сводка и «Последние переводы» считали только исходящие, и только последние 200. - Сводка по направлениям: исходящие и входящие — всего, исполнено, в работе, отказ / истёк срок; исход — по состоянию «чего ждёт заявка» (livestatus.go), то же, что в журнале: принятый, но не исполненный перевод — «в работе». - Период «Сегодня / Всего» (?period=, выбор помнится в куке; по умолчанию — сегодня, с 00:00 МСК). Плитка «Переводы» ведёт в журнал, счётчики за всё время. - «Последние переводы» — общая лента журнала (без анкет участника): направление, инвестор, контрагент, статус и строка состояния. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q7eREaYwUt1i4fNLZcGnjn
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"net/http"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.zetit.ru/zuevav/Bridge-and-Join-s/internal/m2mcore"
|
||||
@@ -23,6 +24,7 @@ type journalRow struct {
|
||||
Dir string // "Исходящий" | "Входящий"
|
||||
DirKind string // "out" | "in"
|
||||
Party string // контрагент (наименование + код/ИНН)
|
||||
Investor string // «Фамилия И.» (дашборд)
|
||||
SecN int
|
||||
Status string // класс бейджа (для цвета)
|
||||
StatusText string // человекочитаемый текст статуса (русский)
|
||||
@@ -58,6 +60,15 @@ func incomingJournalStatus(it *IncomingTransfer) (class, text, outcome string) {
|
||||
return "confirmed", "Отвечено", ""
|
||||
}
|
||||
|
||||
// investorShort — «Фамилия И.» (rune-safe, пусто для пустого имени).
|
||||
func investorShort(last, first string) string {
|
||||
s := strings.TrimSpace(last)
|
||||
for _, r := range strings.TrimSpace(first) {
|
||||
return strings.TrimSpace(s + " " + string(r) + ".")
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// incomingStatusVM — статус входящего для шаблонов (класс бейджа + текст + исход).
|
||||
type incomingStatusVM struct{ Class, Text, Outcome string }
|
||||
|
||||
@@ -86,7 +97,7 @@ func buildJournalRows(ctx context.Context, svc *Service, store *IncomingStore, f
|
||||
}
|
||||
rows = append(rows, journalRow{
|
||||
Time: c.CreatedAt, Dir: "Исходящий", DirKind: "out",
|
||||
Party: party, SecN: len(c.Securities),
|
||||
Party: party, Investor: investorShort(c.Investor.LastName, c.Investor.FirstName), SecN: len(c.Securities),
|
||||
Status: c.Status, StatusText: russianState(c.Status),
|
||||
Href: "/admin/claims/" + c.ID,
|
||||
LiveKey: "out:" + c.ID, Live: liveOutgoing(c),
|
||||
@@ -107,7 +118,7 @@ func buildJournalRows(ctx context.Context, svc *Service, store *IncomingStore, f
|
||||
cls, txt, outcome := incomingJournalStatus(it)
|
||||
rows = append(rows, journalRow{
|
||||
Time: it.ReceivedAt, Dir: "Входящий", DirKind: "in",
|
||||
Party: party, SecN: len(it.Securities),
|
||||
Party: party, Investor: investorShort(it.InvestorLast, it.InvestorFirst), SecN: len(it.Securities),
|
||||
Status: cls, StatusText: txt, Outcome: outcome,
|
||||
Href: "/admin/incoming/" + it.ID,
|
||||
LiveKey: "in:" + it.ID, Live: liveIncoming(it),
|
||||
|
||||
Reference in New Issue
Block a user