refactor: вся основа кода в отдельной папке

This commit is contained in:
2026-06-15 16:24:42 +03:00
parent 2ececc8029
commit e6e15392c3
11 changed files with 26 additions and 26 deletions

34
R/app/forms.R Normal file
View File

@@ -0,0 +1,34 @@
options(box.path = here::here())
box::use(
R/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
)
}
)
}