Compare commits
5 Commits
e903cd975d
...
a09ab10cdf
| Author | SHA1 | Date | |
|---|---|---|---|
| a09ab10cdf | |||
| 4a06d93e64 | |||
| 6a9535ffbb | |||
| 975dee11cc | |||
| 18eb9e928a |
@@ -1,3 +1,7 @@
|
|||||||
|
options(box.path = here::here())
|
||||||
|
box::use(
|
||||||
|
R/modules/utils
|
||||||
|
)
|
||||||
|
|
||||||
#' @export
|
#' @export
|
||||||
#' @description Function to open connection to db, disigned to easy dubugging.
|
#' @description Function to open connection to db, disigned to easy dubugging.
|
||||||
@@ -102,9 +106,6 @@ get_dummy_data = function(type) {
|
|||||||
#' типу данных
|
#' типу данных
|
||||||
get_dummy_df = function(forms_id_type_list) {
|
get_dummy_df = function(forms_id_type_list) {
|
||||||
|
|
||||||
options(box.path = here::here())
|
|
||||||
box::use(R/modules/utils)
|
|
||||||
|
|
||||||
purrr::map(
|
purrr::map(
|
||||||
.x = forms_id_type_list,
|
.x = forms_id_type_list,
|
||||||
.f = utils$get_empty_data
|
.f = utils$get_empty_data
|
||||||
@@ -113,6 +114,20 @@ get_dummy_df = function(forms_id_type_list) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' @description
|
||||||
|
#' Генерация пустого датасета с пустыми значениями соответствующие
|
||||||
|
#' типу данных
|
||||||
|
get_query_df = function(forms_id_type_list) {
|
||||||
|
|
||||||
|
names_and_types <- purrr::map(
|
||||||
|
.x = forms_id_type_list,
|
||||||
|
.f = utils$get_sql_format
|
||||||
|
)
|
||||||
|
|
||||||
|
paste(names(names_and_types), unname(names_and_types), collapse = ",\n")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#' @description
|
#' @description
|
||||||
#' Сравнение полей в существующей в базе данных таблице и попытка
|
#' Сравнение полей в существующей в базе данных таблице и попытка
|
||||||
#' коррекции таблицы
|
#' коррекции таблицы
|
||||||
|
|||||||
@@ -117,7 +117,9 @@ render_forms = function(
|
|||||||
},
|
},
|
||||||
if (!is.na(description) && !is.na(form_label)) shiny::br(),
|
if (!is.na(description) && !is.na(form_label)) shiny::br(),
|
||||||
if (!is.na(description)) {
|
if (!is.na(description)) {
|
||||||
shiny::span(shiny::markdown(description)) |> htmltools::tagAppendAttributes(style = "color:gray; font-size:small; line-height: 1.4;")
|
shiny::markdown(description) |>
|
||||||
|
shiny::span() |>
|
||||||
|
htmltools::tagAppendAttributes(style = "color:gray; font-size:small; line-height: 1.4;")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -169,6 +171,7 @@ render_forms = function(
|
|||||||
options = list(
|
options = list(
|
||||||
create = TRUE,
|
create = TRUE,
|
||||||
onInitialize = I('function() { this.setValue(""); }')
|
onInitialize = I('function() { this.setValue(""); }')
|
||||||
|
# dropdownParent = "body" # overfrlow in card
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -183,7 +186,8 @@ render_forms = function(
|
|||||||
multiple = TRUE,
|
multiple = TRUE,
|
||||||
options = list(
|
options = list(
|
||||||
create = TRUE,
|
create = TRUE,
|
||||||
onInitialize = I('function() { this.setValue(""); }')
|
onInitialize = I('function() { this.setValue(""); }'),
|
||||||
|
dropdownParent = "body"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -225,7 +229,7 @@ render_forms = function(
|
|||||||
if (form_type == "description_header") {
|
if (form_type == "description_header") {
|
||||||
form <- shiny::h5(
|
form <- shiny::h5(
|
||||||
label,
|
label,
|
||||||
style = "margin-bottom: -8px; margin-top: 10px;"
|
style = "margin-bottom: 0px; margin-top: 10px;"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,9 +240,11 @@ render_forms = function(
|
|||||||
form,
|
form,
|
||||||
ns = ifelse(missing(ns), shiny::NS(NULL), ns)
|
ns = ifelse(missing(ns), shiny::NS(NULL), ns)
|
||||||
)
|
)
|
||||||
|
form <- shiny::tagAppendAttributes(form, style = "margin-top: -10px;")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is.null(form)) cli::cli_abort("невозможно создать форму типа '{form_type}' (id: '{form_id}') !")
|
if (is.null(form)) cli::cli_abort("невозможно создать форму типа '{form_type}' (id: '{form_id}') !")
|
||||||
|
|
||||||
form
|
form
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,6 +260,16 @@ get_empty_data = function(type) {
|
|||||||
if (type %in% c("number")) as.character(NA)
|
if (type %in% c("number")) as.character(NA)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#' @export
|
||||||
|
#' @description
|
||||||
|
#' Функция возращает пустое значение для каждого типа формы
|
||||||
|
get_sql_format = function(type) {
|
||||||
|
if (type %in% c("text", "select_one", "select_multiple")) return("TEXT")
|
||||||
|
if (type %in% c("radio", "checkbox")) return("TEXT")
|
||||||
|
if (type %in% c("date")) return("REAL")
|
||||||
|
if (type %in% c("number")) return("TEXT")
|
||||||
|
}
|
||||||
|
|
||||||
#' @export
|
#' @export
|
||||||
#' @description Function to update input forms (default variants only)
|
#' @description Function to update input forms (default variants only)
|
||||||
#' @param id - input form id;
|
#' @param id - input form id;
|
||||||
|
|||||||
Reference in New Issue
Block a user