diff --git a/R/app_server.R b/R/app_server.R index 4edbfe6..3bc9c41 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -16,19 +16,44 @@ app_server <- function(input, output, session) { # to modify a global variable use <<- instead of <- or = results <- shiny::reactiveValues() - # title page -------------------------------------------------------------- + # Bottom page buttons ------------------------------------------------------- shiny::observeEvent(input$start_new_protocol, { bs4Dash::updateTabItems(session, inputId = "sidebarmenu", selected = "Overview") }) + # Final observer events for continue buttons + shiny::observeEvent(input$go_home, { + bs4Dash::updateTabItems(session, inputId = "sidebarmenu", selected = "Home") + }) + shiny::observeEvent(input$go_overview, { + bs4Dash::updateTabItems(session, inputId = "sidebarmenu", selected = "Overview") + }) + shiny::observeEvent(input$go_design, { + bs4Dash::updateTabItems(session, inputId = "sidebarmenu", selected = "Design") + }) + shiny::observeEvent(input$go_specification, { + bs4Dash::updateTabItems(session, inputId = "sidebarmenu", selected = "Specification") + }) + shiny::observeEvent(input$go_context, { + bs4Dash::updateTabItems(session, inputId = "sidebarmenu", selected = "Context") + }) + shiny::observeEvent(input$go_prioritization, { + bs4Dash::updateTabItems(session, inputId = "sidebarmenu", selected = "Prioritization") + }) + shiny::observeEvent(input$go_export, { + bs4Dash::updateTabItems(session, inputId = "sidebarmenu", selected = "Export") + }) + # --------------------------------------------------------------------------- + + # title page ---------------------------------------------------------------- # Adding module server code - mod_Home_server("Home_1", results) - mod_Overview_server("Overview_1", results) - mod_Design_server("Design_1", results) - mod_Specification_server("Specification_1", results) - mod_Context_server("Context_1", results) - mod_Prioritization_server("Prioritization_1", results) + mod_Home_server("Home_1", results, session) + mod_Overview_server("Overview_1", results, session) + mod_Design_server("Design_1", results, session) + mod_Specification_server("Specification_1", results, session) + mod_Context_server("Context_1", results, session) + mod_Prioritization_server("Prioritization_1", results, session) # News mod_News_server("News_1") @@ -37,6 +62,6 @@ app_server <- function(input, output, session) { mod_Export_server("Export_1", results) # Automatically stop a Shiny app when closing the browser tab - session$onSessionEnded(stopApp) + # session$onSessionEnded(stopApp) } diff --git a/R/app_ui.R b/R/app_ui.R index 44f8b45..2a1456b 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -13,7 +13,7 @@ app_ui <- function(request) { bs4Dash::dashboardPage( # Preloader using waiter preloader = list(html = shiny::tagList( - waiter::spin_1(), "Loading ..."), color = "#3c8dbc"), + waiter::spin_balance(), "Loading ..."), color = "#3c8dbc"), # freshTheme = odpscp_theme(), # Theme designed with fresh # Other options dark = FALSE, @@ -73,7 +73,7 @@ app_ui <- function(request) { id = "sidebarmenu", bs4Dash::menuItem( "Home", - tabName = "Home", + tabName = "Home",selected = TRUE, icon = shiny::icon("home") ), bs4Dash::menuItem( @@ -115,7 +115,7 @@ app_ui <- function(request) { bs4Dash::menuItem( "Export protocol", tabName = "Export", - icon = shiny::icon("download") + icon = shiny::icon("file-export") ), bs4Dash::sidebarHeader("Info"), bs4Dash::menuItem( diff --git a/R/mod_Context.R b/R/mod_Context.R index 0a4029a..3a9c4fa 100644 --- a/R/mod_Context.R +++ b/R/mod_Context.R @@ -228,7 +228,33 @@ mod_Context_ui <- function(id){ ) ) ) - ) + ), + # End of page button row + shiny::fluidRow( + shiny::column(width = 2), + shiny::column(width = 8, + # Add backward button + shinyWidgets::actionBttn( + inputId = "go_specification", + label = "Back to specification", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-left") + ), + # Add forward button + shinyWidgets::actionBttn( + inputId = "go_prioritization", + label = "Continue with prioritization", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-right") + ) + ) + ) # End button box ) # End Fluid row ) # End Fluidpage ) @@ -238,7 +264,7 @@ mod_Context_ui <- function(id){ #' #' @importFrom shiny observe #' @noRd -mod_Context_server <- function(id, results){ +mod_Context_server <- function(id, results, parentsession){ shiny::moduleServer( id, function(input, output, session){ ns <- session$ns diff --git a/R/mod_Design.R b/R/mod_Design.R index e648429..25556c2 100644 --- a/R/mod_Design.R +++ b/R/mod_Design.R @@ -287,6 +287,33 @@ mod_Design_ui <- function(id){ ) ) # Box engagement ) + ), + + # End of page button row + shiny::fluidRow( + shiny::column(width = 2), + shiny::column(width = 8, + # Add backward button + shinyWidgets::actionBttn( + inputId = "go_overview", + label = "Back to Overview", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-left") + ), + # Add forward button + shinyWidgets::actionBttn( + inputId = "go_specification", + label = "Continue with specification", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-right") + ) + ) ) ) # FluidPage ) # TabItem @@ -296,7 +323,7 @@ mod_Design_ui <- function(id){ #' #' @importFrom shiny observe #' @noRd -mod_Design_server <- function(id, results){ +mod_Design_server <- function(id, results, parentsession){ shiny::moduleServer( id, function(input, output, session){ ns <- session$ns diff --git a/R/mod_Home.R b/R/mod_Home.R index 698c9a4..c6c13b6 100644 --- a/R/mod_Home.R +++ b/R/mod_Home.R @@ -90,7 +90,7 @@ mod_Home_ui <- function(id){ #' Home Server Functions #' #' @noRd -mod_Home_server <- function(id, results){ +mod_Home_server <- function(id, results, parentsession){ shiny::moduleServer( id, function(input, output, session){ ns <- session$ns diff --git a/R/mod_Overview.R b/R/mod_Overview.R index 073d4e5..cc5eac0 100644 --- a/R/mod_Overview.R +++ b/R/mod_Overview.R @@ -274,36 +274,46 @@ mod_Overview_ui <- function(id){ ) ) # End of column ) # End of fluid row - ) + ), # uiOutput("Overview_UI") # End of page button row - # fluidRow( - # column(width = 3), - # column(width = 8, - # # Add reset button - # shinyWidgets::actionBttn( - # inputId = ns("reset"), - # label = "Clear all fields?", - # style = "simple", - # color = "danger", - # size = "md", - # block = FALSE, - # icon = icon("broom") - # ), - # # Add forward button - # shinyWidgets::actionBttn( - # inputId = ns("next_design"), - # label = "Continue with the design", - # style = "simple", - # color = "royal", - # size = "md", - # block = FALSE, - # icon = icon("arrow-right") - # ) - # ) - # ) # End of fluid row for buttons + shiny::fluidRow( + shiny::column(width = 2), + shiny::column(width = 8, + # # Add reset button + # shinyWidgets::actionBttn( + # inputId = ns("reset"), + # label = "Clear all fields?", + # style = "simple", + # color = "danger", + # size = "md", + # block = FALSE, + # icon = icon("broom") + # ), + # Add backward button + shinyWidgets::actionBttn( + inputId = "go_home", + label = "Back to start", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-left") + ), + # Add forward button + shinyWidgets::actionBttn( + inputId = "go_design", + label = "Continue with the design", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-right") + ) + ) + ) # End of fluid row for buttons ) # End of fluid page ) # End of tab @@ -313,7 +323,7 @@ mod_Overview_ui <- function(id){ #' #' @importFrom shiny observe observeEvent #' @noRd -mod_Overview_server <- function(id, results){ +mod_Overview_server <- function(id, results, parentsession){ shiny::moduleServer( id, function(input, output, session){ ns <- session$ns @@ -383,11 +393,6 @@ mod_Overview_server <- function(id, results){ }) # ----- # - # Bottom page buttons -------------------------------------------------------------- - # Final observe event to continue - shiny::observeEvent(input$next_design, { - bs4Dash::updateTabItems(session, inputId = ns("sidebarmenu"), selected = "Design") - }) # Clear all shiny::observeEvent(input$reset, { diff --git a/R/mod_Prioritization.R b/R/mod_Prioritization.R index 876349e..a5ae05a 100644 --- a/R/mod_Prioritization.R +++ b/R/mod_Prioritization.R @@ -77,6 +77,22 @@ mod_Prioritization_ui <- function(id){ placeholder = 'Enter a version nr for the used algorithm', height = "45px", width = "100%", resize = "none") ), + # Objective functions + shiny::br(), + bs4Dash::box( + title = "Benefit functions", + closable = FALSE, + width = 12, + solidHeader = TRUE, + status = "secondary", + collapsible = FALSE, + shiny::p("In many optimizations benefits can accrue in varying ways, for example + through maximizing the targets achieved. If known or specific to the study, + provide information on benefit function used."), + shiny::textAreaInput(inputId = ns("benefitfunctions"), label = "What is being optimized and how?", + placeholder = 'If known, please provide further detail.', + height = "60px", width = "100%", resize = "vertical") + ), shiny::br(), bs4Dash::box( title = "Key parameters", @@ -158,7 +174,34 @@ mod_Prioritization_ui <- function(id){ ) ) ) # Column end - ) # Fluid row + ), # Fluid row + + # End of page button row + shiny::fluidRow( + shiny::column(width = 2), + shiny::column(width = 8, + # Add backward button + shinyWidgets::actionBttn( + inputId = "go_context", + label = "Back to Context", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-left") + ), + # Add forward button + shinyWidgets::actionBttn( + inputId = "go_export", + label = "Export the protocol", + style = "simple", + color = "success", + size = "sm", + block = FALSE, + icon = shiny::icon("file-export") + ) + ) + ) # Fluidrow button end ) # Fluidpage ) } @@ -167,7 +210,7 @@ mod_Prioritization_ui <- function(id){ #' #' @importFrom shiny observe observeEvent #' @noRd -mod_Prioritization_server <- function(id, results){ +mod_Prioritization_server <- function(id, results, parentsession){ shiny::moduleServer( id, function(input, output, session){ ns <- session$ns diff --git a/R/mod_Specification.R b/R/mod_Specification.R index 1fc59d5..f0096a8 100644 --- a/R/mod_Specification.R +++ b/R/mod_Specification.R @@ -331,8 +331,35 @@ mod_Specification_ui <- function(id){ ) ) ) # Fluid column end - ) # Fluidrow end - ) + ), # Fluidrow end + + # End of page button row + shiny::fluidRow( + shiny::column(width = 2), + shiny::column(width = 8, + # Add backward button + shinyWidgets::actionBttn( + inputId = "go_design", + label = "Back to Design", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-left") + ), + # Add forward button + shinyWidgets::actionBttn( + inputId = "go_context", + label = "Continue to context", + style = "simple", + color = "primary", + size = "sm", + block = FALSE, + icon = shiny::icon("arrow-right") + ) + ) + ) + ) # Fluidpage end ) # End tab } @@ -340,7 +367,7 @@ mod_Specification_ui <- function(id){ #' #' @importFrom shiny observe observeEvent #' @noRd -mod_Specification_server <- function(id, results){ +mod_Specification_server <- function(id, results, parentsession){ shiny::moduleServer( id, function(input, output, session){ ns <- session$ns diff --git a/inst/01_protocol.yaml b/inst/01_protocol.yaml index 6c3e5b3..4ac028e 100644 --- a/inst/01_protocol.yaml +++ b/inst/01_protocol.yaml @@ -496,8 +496,17 @@ prioritization: fieldtype: 'textbox' mandatory: true - software_parameters: + benefits: render-nr: 3 + render-id: 'benefitfunctions' + render-group: 'study_software' + question: 'What is being optimized and how?' + description: 'Was a specific benefit function being used the optimization, or are there any specifics on how benefits were identified?' + fieldtype: 'textbox' + mandatory: false + + software_parameters: + render-nr: 4 render-id: 'parameters' render-group: 'study_software' question: 'Are there key parameters related to the solving of the planning problem?' @@ -506,7 +515,7 @@ prioritization: mandatory: false solution_identification: - render-nr: 4 + render-nr: 5 render-id: 'identsolution' render-group: 'study_software' question: 'How were the final priorities identified?'