49 lines
2.1 KiB
R
49 lines
2.1 KiB
R
server <- function(input, output, session) {
|
|
|
|
# ── Globaler Navigations-Bus ───────────────────────────────────────────────
|
|
r_global <- reactiveValues(
|
|
# Navigation
|
|
active_tab = NULL,
|
|
nav_history = list(), # ← Stack der letzten Positionen
|
|
|
|
# Filter + Sprungziele
|
|
buchungen_filter = "alle",
|
|
jump_to_entry_id = NULL,
|
|
jump_to_account_id = NULL,
|
|
jump_to_contact_id = NULL,
|
|
jump_to_project_id = NULL
|
|
)
|
|
|
|
# ── Tab-Wechsel ────────────────────────────────────────────────────────────
|
|
observeEvent(r_global$active_tab, ignoreInit = TRUE, {
|
|
req(r_global$active_tab)
|
|
cat("Tab-Wechsel zu:", r_global$active_tab, "\n")
|
|
updateTabItems(session, "tabs", selected = r_global$active_tab)
|
|
r_global$active_tab <- NULL
|
|
})
|
|
|
|
observeEvent(input$back_btn, {
|
|
req(length(r_global$nav_history) > 0)
|
|
|
|
# Letzten Zustand holen und Stack kürzen
|
|
last <- tail(r_global$nav_history, 1)[[1]]
|
|
r_global$nav_history <- head(r_global$nav_history, -1)
|
|
|
|
# Zurückspringen
|
|
updateTabItems(session, "tabs", selected = last$tab)
|
|
|
|
# Zustand wiederherstellen — je nach Tab
|
|
if (last$tab == "konten") {
|
|
r_global$jump_to_account_name <- last$account_name
|
|
}
|
|
})
|
|
|
|
# ── Filter-Buttons (falls in der Navbar oder UI definiert) ─────────────────
|
|
observeEvent(input$filter_alle, { r_global$buchungen_filter <- "alle" })
|
|
observeEvent(input$filter_giro, { r_global$buchungen_filter <- "giro" })
|
|
observeEvent(input$filter_monat, { r_global$buchungen_filter <- "monat" })
|
|
|
|
# ── Module ─────────────────────────────────────────────────────────────────
|
|
accountsServer("accounts_tab", conn, r_global)
|
|
buchungenServer("buchungen_tab", conn, r_global)
|
|
} |