Accounts Tree erstellt
This commit is contained in:
@@ -1,14 +1,49 @@
|
||||
server <- function(input, output) {
|
||||
aktiver_filter <- reactive({
|
||||
if (input$filter_giro > 0 &&
|
||||
input$filter_giro == max(input$filter_giro, input$filter_monat, input$filter_alle))
|
||||
"giro"
|
||||
else if (input$filter_monat > 0 &&
|
||||
input$filter_monat == max(input$filter_giro, input$filter_monat, input$filter_alle))
|
||||
"monat"
|
||||
else
|
||||
"alle"
|
||||
})
|
||||
buchungenServer("buchungen_tab", conn, aktiver_filter = aktiver_filter)
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user