34 lines
655 B
R
34 lines
655 B
R
options(box.path = here::here())
|
|
box::use(
|
|
modules/utils,
|
|
)
|
|
|
|
#' @export
|
|
load_data_to_form <- function(
|
|
df,
|
|
table_name = "main",
|
|
mhcs,
|
|
ns
|
|
) {
|
|
|
|
input_types <- unname(mhcs()$get_id_type_list(table_name))
|
|
input_ids <- names(mhcs()$get_id_type_list(table_name))
|
|
if (missing(ns)) ns <- NULL
|
|
|
|
# rewrite input forms
|
|
purrr::walk2(
|
|
.x = input_types,
|
|
.y = input_ids,
|
|
.f = \(x_type, x_id) {
|
|
|
|
# updating forms with loaded data
|
|
utils$update_forms_with_data(
|
|
form_id = x_id,
|
|
form_type = x_type,
|
|
value = df[[x_id]],
|
|
scheme = mhcs()$get_scheme(table_name),
|
|
ns = ns
|
|
)
|
|
}
|
|
)
|
|
} |