fix: nested forms for select_one and et cetera
This commit is contained in:
13
app.R
13
app.R
@@ -342,8 +342,13 @@ server <- function(input, output, session) {
|
||||
this_nested_form_scheme <- mhcs()$get_scheme(values$nested_form_id)
|
||||
|
||||
# мини-схема для ключа
|
||||
this_nested_form_key_scheme <- subset(this_nested_form_scheme, form_id == key_id)
|
||||
if (nrow(this_nested_form_key_scheme) > 1) cli::cli_abort("количество строк не может быть больше одного для ключа")
|
||||
this_nested_form_key_scheme <- this_nested_form_scheme |>
|
||||
dplyr::filter(form_id == {{key_id}})
|
||||
|
||||
this_nested_form_key_scheme_smoll <- this_nested_form_key_scheme |>
|
||||
dplyr::distinct(form_id, form_label, form_type)
|
||||
|
||||
if (nrow(this_nested_form_key_scheme_smoll) > 1) cli::cli_abort("количество строк не может быть больше одного для ключа")
|
||||
|
||||
# выбираем все ключи из баз данных
|
||||
kyes_for_this_table <- db$get_nested_keys_from_table(values$nested_form_id, mhcs(), values$main_key, con)
|
||||
@@ -352,7 +357,7 @@ server <- function(input, output, session) {
|
||||
values$nested_key <- if (length(kyes_for_this_table) == 0) NULL else kyes_for_this_table[[1]]
|
||||
|
||||
# если ключ в формате даты - дать человекочитаемые данные
|
||||
if (this_nested_form_key_scheme$form_type == "date") {
|
||||
if (this_nested_form_key_scheme_smoll$form_type == "date") {
|
||||
kyes_for_this_table <- setNames(
|
||||
kyes_for_this_table,
|
||||
format(as.Date(kyes_for_this_table), "%d.%m.%Y")
|
||||
@@ -390,7 +395,7 @@ server <- function(input, output, session) {
|
||||
width = 300,
|
||||
selectizeInput(
|
||||
inputId = "nested_key_selector",
|
||||
label = strong(this_nested_form_key_scheme$form_label),
|
||||
label = strong(this_nested_form_key_scheme_smoll$form_label),
|
||||
choices = kyes_for_this_table,
|
||||
selected = values$nested_key,
|
||||
# options = list(placeholder = "действие комиссии", create = FALSE, onInitialize = I('function() { this.setValue(""); }'))
|
||||
|
||||
Reference in New Issue
Block a user