R/app_ui.R

Defines functions golem_add_external_resources app_ui

#' The application User-Interface
#'
#' @param request Internal parameter for `{shiny}`.
#'     DO NOT REMOVE.
#' @import shiny
#' @import shinydashboard
#' @import shinydashboardPlus
#' @import shinyWidgets
#' @import DT
#' @import shinycssloaders
#' @noRd
app_ui <- function(request) {
  tagList(
    # Leave this function for adding external resources
    golem_add_external_resources(),
    # List the first level UI elements here
    dashboardPage(
      #enable_preloader = TRUE,
      dashboardHeader(disable = T),
      dashboardSidebar(disable = T),
      dashboardBody(
        fluidRow(
          boxPlus(
            title = "Inputs",closable = F,width = NULL,status = "primary",solidHeader = TRUE,collapsible = TRUE,
            boxPlus(
              title = "Filtros:",closable = F,width = NULL,status = "primary",solidHeader = F,collapsible = TRUE,
              column(width = 3,
                     pickerInput(inputId = "competencia",label="Competência",multiple = T,width = "100%",choices = competencia_id,selected = competencia_id,options = opt1)
                     ),
              column(width = 3,
                     pickerInput(inputId = "fonte",label="Fonte",multiple = T,width = "100%",choices = fonte_id, selected = fonte_id,options = opt1)
              ),
              column(width = 3,
                     pickerInput(inputId = "regiao",label="Região",multiple = T,width = "100%",choices = regiao_id,selected = regiao_id,options = opt1)
                     ),
              column(width = 3,
                     pickerInput(inputId = "uf",label="UF",multiple = T,width = "100%",choices = uf_id, selected = uf_id,options = opt1)
                     ),
              column(width = 3,
                     pickerInput(inputId = "municipio",label="Município",multiple = T,width = "100%",choices = municipio_id, selected = municipio_id,options = opt2)
                     ),
              column(width = 3,
                     pickerInput(inputId = "graudeinstrucao",label="Grau de Instrucao",multiple = T,width = "100%",choices = graudeinstrucao_id, selected = graudeinstrucao_id,options = opt1)
                     ),
              column(width = 3,
                     pickerInput(inputId = "racacor",label="Raca - Cor",multiple = T,width = "100%",choices = racacor_id, selected = racacor_id,options = opt1)
                     ),
              column(width = 3,
                     pickerInput(inputId = "sexo",label="Sexo",multiple = T,width = "100%",choices = sexo_id, selected = sexo_id,options = opt1)
                     ),
              column(width = 4,
                     pickerInput(inputId = "tipoempregador",label="Tipo Empregador",multiple = T,width = "100%",choices = tipoempregador_id, selected = tipoempregador_id,options = opt1)
                     ),
              column(width = 4,
                     pickerInput(inputId = "tipodedeficiencia",label="Tipo de Deficiência",multiple = T,width = "100%",choices = tipodedeficiencia_id, selected = tipodedeficiencia_id,options = opt1)
                     ),
              column(width = 4,
                     pickerInput(inputId = "tamestabjan",label="Vínculos",multiple = T,width = "100%",choices = tamestabjan_id, selected = tamestabjan_id,options = opt1)
                     ),
              column(width = 4,
                     pickerInput(inputId = "indtrabintermitente",label="Trabalho Intermitente",multiple = T,width = "100%",choices = indtrabintermitente_id, selected = indtrabintermitente_id,options = opt1)
                     ),
              column(width = 4,
                     pickerInput(inputId = "indtrabparcial",label="Trabalho Parcial",multiple = T,width = "100%",choices = indtrabparcial_id, selected = indtrabparcial_id,options = opt1)
                     ),
              column(width = 4,
                     pickerInput(inputId = "indicadoraprendiz",label="Aprendiz",multiple = T,width = "100%",choices = indicadoraprendiz_id, selected = indicadoraprendiz_id,options = opt1)
                     ),
              column(width = 6,
                     pickerInput(inputId = "subclasse",label="Subclasse",multiple = T,width = "100%",choices = subclasse_id, selected = subclasse_id,options = opt2)
                     ),
              column(width = 6,
                     pickerInput(inputId = "secao",label="Seção",multiple = T,width = "100%",choices = secao_id, selected = secao_id,options = opt2)
                     ),
              column(width = 6,
                     pickerInput(inputId = "cbo2002ocupacao",label="CBO 2002 ocupação",multiple = T,width = "100%",choices = cbo2002ocupacao_id, selected = cbo2002ocupacao_id, options = opt2)
                     ),
              column(width = 6,
                     pickerInput(inputId = "categoria",label="Categoria",multiple = T,width = "100%",choices = categoria_id, selected = categoria_id,options = opt2)
                     ),
              column(width = 3,
                     numericInput(inputId = "horascontratuaisMin",label = "Menor horas contratuais",min = 0,max = 99,step = 1,value = 0)
              ),
              column(width = 3,
                     numericInput(inputId = "horascontratuaisMax",label = "Maior horas contratuais",min = 0,max = 99,step = 1,value = 99)
              ),
              # column(width = 3,
              #        numericInput(inputId = "tempoempregoMin",label = "Menor tempo emprego",min = 0,max = 99,step = 1,value = 0)
              # ),
              # column(width = 3,
              #        numericInput(inputId = "tempoempregoMax",label = "Maior tempo emprego",min = 0,max = 50000,step = 1,value = 50000)
              # ),
              column(width = 3,
                     numericInput(inputId = "salMin",label = "Menor salário",min = 0,max = 10^6,step = 50,value = 0)
                     ),
              column(width = 3,
                     numericInput(inputId = "salMax",label = "Maior salário",min = 0,max = 10^6,step = 50,value = 10^6)
                     ),
              column(width = 3,
                     numericInput(inputId = "idadeMin",label = "Menor idade",min = 0,max = 120,step = 1,value = 0)
                     ),
              column(width = 3,
                     numericInput(inputId = "idadeMax",label = "Maior idade",min = 0,max = 120,step = 1,value = 120)
                     )
              ),
            boxPlus(
              title = "Agrupamentos:",closable = F,width = NULL,status = "primary",solidHeader = F,collapsible = TRUE,
              pickerInput(inputId = "group_id",label=NULL,multiple = T,width = "100%",
                          choices = base_vars$vars, selected = "regiao",options = opt2)
              ),
            boxPlus(
              title = "Estatísticas:",closable = F,width = NULL,status = "primary",solidHeader = F,collapsible = TRUE,
              pickerInput(inputId = "descritiva_id",label=NULL,multiple = T,width = "100%",
                          choices = descritivas$stats, selected = "Contagem",options = opt2)
              ),
            div(class="botao",
                actionButton("doGR", "Gerar Relatório",class="btn-primary")
                )

          )
        ),
        fluidRow(
          boxPlus(
            title = "Output",closable = F,width = NULL,status = "info",solidHeader = T,collapsible = TRUE,
            boxPlus(title = NULL,closable = F,width = NULL,status = "info",solidHeader = F,collapsible = TRUE,
                    DTOutput(outputId = "table") %>% withSpinner(type = 6,color="#9E003F",color.background="#ffffff")
                    ),
            div(class="botao",
                shiny::downloadButton(outputId = "downloadData",text = "Download",class = "btn-info")
                )
            )
        )

      )
    )
  )
}

#' Add external Resources to the Application
#'
#' This function is internally used to add external
#' resources inside the Shiny application.
#'
#' @import shiny
#' @importFrom golem add_resource_path activate_js favicon bundle_resources
#' @noRd
golem_add_external_resources <- function(){

  add_resource_path(
    'www', app_sys('app/www')
  )

  tags$head(
    favicon(),
    bundle_resources(
      path = app_sys('app/www'),
      app_title = 'CAGED'
    )
    # Add here other external resources
    # for example, you can add shinyalert::useShinyalert()
  )
}
Catho-ThiagoMiranda/CAGED documentation built on Dec. 31, 2020, 10:58 a.m.