package views import ( "whereismymoney/internal/models" "fmt" "time" ) func min(a, b int) int { if a < b { return a } return b } func max(a, b int) int { if a > b { return a } return b } templ Transactions(userName string, transactions []models.Transaction, bankAccounts []models.BankAccount, categories []models.Category, recurrenceRules []models.RecurrenceRule, currentPage int, totalPages int, totalCount int64) { @Layout("Transaktionen - WhereIsMyMoney") { @Navigation(userName)

Transaktionen

Verwalte deine Einnahmen und Ausgaben

Filter & Suche

Alle Transaktionen werden angezeigt

Letzte Transaktionen

if len(transactions) == 0 { } for _, transaction := range transactions { }
Datum Beschreibung Kategorie Konto Betrag Aktionen
Noch keine Transaktionen vorhanden
{ transaction.Date.Format("02.01.2006") } { transaction.Description } if transaction.IsRecurring { 🔄 Regelmäßig } if transaction.Category != nil { { transaction.Category.Icon } { transaction.Category.Name } } else { Ohne Kategorie } if transaction.BankAccount != nil { { transaction.BankAccount.Name } } else { Ohne Konto } if transaction.Type == "income" { +{ fmt.Sprintf("%.2f", transaction.Amount) } € } else { -{ fmt.Sprintf("%.2f", transaction.Amount) } € }
if totalPages > 1 {
Zeige { fmt.Sprintf("%d", (currentPage-1)*20+1) } bis { fmt.Sprintf("%d", min(currentPage*20, int(totalCount))) } von { fmt.Sprintf("%d", totalCount) } Transaktionen
if currentPage > 1 { Vorherige } else { Vorherige }
if currentPage > 3 { 1 if currentPage > 4 { ... } } for i := max(1, currentPage-2); i <= min(totalPages, currentPage+2); i++ { if i == currentPage { { fmt.Sprintf("%d", i) } } else { { fmt.Sprintf("%d", i) } } } if currentPage < totalPages-2 { if currentPage < totalPages-3 { ... } { fmt.Sprintf("%d", totalPages) } }
if currentPage < totalPages { Nächste } else { Nächste }
}
} } func getIntervalText(interval string, count int) string { var base string switch interval { case "daily": base = "Tag" if count > 1 { base = "Tage" } case "weekly": base = "Woche" if count > 1 { base = "Wochen" } case "monthly": base = "Monat" if count > 1 { base = "Monate" } case "yearly": base = "Jahr" if count > 1 { base = "Jahre" } default: return interval } if count == 1 { return fmt.Sprintf("Jeden %s", base) } return fmt.Sprintf("Alle %d %s", count, base) } func getNextExecutionDate(rule models.RecurrenceRule) string { if !rule.IsActive { return "Pausiert" } lastDate := rule.StartDate if rule.LastGenerated != nil { lastDate = *rule.LastGenerated } nextDate := rule.GetNextOccurrence(lastDate) if nextDate == nil { return "Beendet" } return nextDate.Format("02.01.2006") }