Anzeige der Attachments

This commit is contained in:
2026-03-19 17:11:10 +01:00
parent 84026498d1
commit 581c6d9ecc
+23
View File
@@ -9,6 +9,11 @@ buchungenUI <- function(id) {
hr(),
h3("Details / Gegenbuchungen"),
reactableOutput(ns("details_table")),
h3("Anhänge"),
uiOutput(ns("attachments_ui")),
fileInput(ns("anhang"), NULL, multiple = TRUE,
accept = c(".pdf", ".jpg", ".png", ".xlsx", ".docx"),
width = "100%"),
br(),
actionBttn(ns("add_trans"), "Transaktion hinzu", size = "sm", style = "material-flat", color = "warning"),
actionBttn(ns("del_trans"), "Transaktion Löschen", size = "sm", style = "material-flat", color = "danger"),
@@ -146,5 +151,23 @@ buchungenServer <- function(id, conn, aktiver_filter = reactive("alle")) {
updateReactable("buchungen_table", data = postings_data())
# details_table re-rendert automatisch weil details_data(NULL) → req() schlägt fehl
})
## * Attachments anzeigen ----
output$attachments_ui <- renderUI({
req(selected_trans_id())
att <- dbxSelect(conn, paste0(
"SELECT * FROM attachments WHERE entry_id = ", selected_trans_id()
))
if (nrow(att) == 0) return(p("Keine Anhänge vorhanden."))
tagList(lapply(seq_len(nrow(att)), function(i) {
div(
tags$a(att$original_name[i], href = att$path[i], target = "_blank"),
actionLink(ns(paste0("del_att_", att$id[i])), "✕",
style = "color:red; margin-left:8px;")
)
}))
})
})
}