Files
gemfin-shiny/R/entry_edit_modal.R
T

51 lines
2.0 KiB
R

# --- MODUL UI ---
postingModuleUI <- function(id) {
ns <- NS(id)
tagList(
)
}
# --- MODUL SERVER ---
postingModuleServer <- function(id, conn, idwert) {
moduleServer(id, function(input, output, session) {
ns <- session$ns # Wichtig für das Namespacing innerhalb des Modals
record <- read_posting(conn, idwert)
trans <- dbxSelect(conn, paste0("SELECT * FROM entries WHERE id=", record$entry_id))
# Modal öffnen
showModal(modalDialog(
title = "Buchung-Eingabe",
f_airdatepicker_UI(ns("valuta"), "Wertstellung", record$valuta),
f_airdatepicker_UI(ns("buchungsdatum"), "Buchungsdatum", record$booking_date),
selectizeInput(ns("kontakt"), "Kontakt:",selected = trans$adress_id, choices = get_contact_choices(conn), width = "100%"),
selectizeInput(ns("konto"), "Kontoname:",selected = record$account_id, choices = get_account_choices(conn), width = "100%"),
selectizeInput(ns("projekt"), "Projektname", selected = NULL, choices = get_project_choices(conn), width = "100%"),
splitLayout(cellWidths = c("70%", "30%"),
numericInput(ns("amount"), "Betrag:", value = record$amount, width = "100%"),
numericInput(ns("coin_share_amount"), "Münzne:", value = record$coin_share_amount, width = "100%")
),
textAreaInput(ns("trans_notiz"), label= "Notiz (Transaktion)", value = trans$note, width = "100%"),
splitLayout(cellWidths = c("50%", "50%"),
numericInput(ns("receipt_id"), "Umsatz_id:", value = record$receipt_id, width = "100%"),
numericInput(ns("wiso_id"), "Wiso_id:", value = record$wiso_id, width = "100%")
),
#
footer = tagList(
modalButton("Abbrechen"),
actionButton(ns("confirm"), "Bestätigen", class = "btn-success")
),
easyClose = TRUE
))
# Aktion beim Bestätigen
observeEvent(input$confirm, ignoreInit = T, {
message("Eingabe im Modul ", id, ": ", input$user_name)
removeModal()
})
#
})
}