feat: задачи - в отдельном модуле

This commit is contained in:
2026-04-23 11:51:04 +03:00
parent 985cf99f5f
commit 696f2e3ac8
4 changed files with 359 additions and 354 deletions

39
app/forms.R Normal file
View File

@@ -0,0 +1,39 @@
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
# transform df to list
# loaded_df_for_id <- as.list(df)
# loaded_df_for_id <- df[input_ids]
# 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
)
}
)
}