diff --git a/R/fct_explorer_mesures.R b/R/fct_explorer_mesures.R index 67d270fa750826af6aaaff102af4ed7d1af6cb0b..7599b310ea44fb6489a3a89ea6bb265f79f2b93b 100644 --- a/R/fct_explorer_mesures.R +++ b/R/fct_explorer_mesures.R @@ -43,11 +43,13 @@ explorer_sage_station_fct <- function(SelectSage, station){ #' #' @export #' @importFrom dplyr filter between select -explorer_data_fct <- function(explorer_SelectStation, - explorer_SelectSage, - matrice, - explorer_SelectAnnee, - explorer_SelectConcentrationmin){ +explorer_data_fct <- function( + explorer_SelectStation, + explorer_SelectSage, + matrice, + explorer_SelectAnnee, + explorer_SelectConcentrationmin + ){ if(length(explorer_SelectStation) > 1){ matrice %>% dplyr::filter( @@ -70,7 +72,7 @@ explorer_data_fct <- function(explorer_SelectStation, resultat_analyse >= explorer_SelectConcentrationmin ) %>% dplyr::select( - annee_prelevement, date_prelevement, code_station,libelle_station,insee_dep, + annee_prelevement, date_prelevement, code_station, libelle_station, insee_dep, nom_parametre, code_remarque, resultat_analyse, Exigenceeaudistribuee ) } @@ -82,7 +84,7 @@ explorer_data_fct <- function(explorer_SelectStation, resultat_analyse >= explorer_SelectConcentrationmin ) %>% dplyr::select( - annee_prelevement, date_prelevement, code_station,libelle_station,insee_dep, + annee_prelevement, date_prelevement, code_station, libelle_station, insee_dep, nom_parametre, code_remarque, resultat_analyse, Exigenceeaudistribuee ) } @@ -94,7 +96,7 @@ explorer_data_fct <- function(explorer_SelectStation, resultat_analyse >= explorer_SelectConcentrationmin ) %>% dplyr::select( - annee_prelevement, date_prelevement, code_station,libelle_station,insee_dep, + annee_prelevement, date_prelevement, code_station, libelle_station, insee_dep, nom_parametre, code_remarque, resultat_analyse, Exigenceeaudistribuee ) } @@ -108,7 +110,7 @@ explorer_data_fct <- function(explorer_SelectStation, resultat_analyse >= explorer_SelectConcentrationmin ) %>% dplyr::select( - annee_prelevement, date_prelevement, code_station,libelle_station,insee_dep, + annee_prelevement, date_prelevement, code_station, libelle_station, insee_dep, nom_parametre, code_remarque, resultat_analyse, Exigenceeaudistribuee ) } diff --git a/R/mod_selection_explorer_mesures.R b/R/mod_selection_explorer_mesures.R index 303c48557fc921a94bc21c92ad01d30f120ce754..705d7a8b34c2098a2948a95b9baa5af4b7ef0931 100644 --- a/R/mod_selection_explorer_mesures.R +++ b/R/mod_selection_explorer_mesures.R @@ -121,7 +121,7 @@ mod_selection_explorer_mesures_server <- function(input, output, session, global locale$parametres <- parametres_esu } else{ - locale$parametres <- parametres_esu + locale$parametres <- parametres_eso } output$liste_parametre <- shiny::renderUI({ @@ -143,30 +143,50 @@ mod_selection_explorer_mesures_server <- function(input, output, session, global locale$station <- global$station_eso %>% sf::st_drop_geometry() } - }) + }) - shiny::observeEvent(input$explorer_SelectSage, { - locale$sage_station <- explorer_sage_station_fct(input$explorer_SelectSage, locale$station) + shiny::observeEvent(c(input$explorer_SelectSage, input$explorer_SelectCodeNatureEau), { - output$liste_station_sage <- shiny::renderUI({ - shiny::selectizeInput( - inputId = ns("explorer_SelectStation"), - label = "Stations", - choices = locale$station %>% - dplyr::select(code_station, libelle_station) %>% - dplyr::filter(code_station %in% locale$sage_station) %>% - dplyr::mutate(libelle_station = as.character(libelle_station)) %>% - dplyr::arrange(libelle_station) %>% - dplyr::pull(libelle_station) %>% - c("Toutes",.), - selected = "Toutes", - multiple = TRUE, - options = list("plugins" = list("remove_button")) - ) - }) + if(is.null(input$explorer_SelectSage)){ + output$liste_station_sage <- shiny::renderUI({ + shiny::selectizeInput( + inputId = ns("explorer_SelectStation"), + label = "Stations", + choices = locale$station %>% + dplyr::select(code_station, libelle_station) %>% + dplyr::mutate(libelle_station = as.character(libelle_station)) %>% + dplyr::arrange(libelle_station) %>% + dplyr::pull(libelle_station) %>% + c("Toutes",.), + selected = "Toutes", + multiple = TRUE, + options = list("plugins" = list("remove_button")) + ) + }) + }else{ + + locale$sage_station <- explorer_sage_station_fct(input$explorer_SelectSage, locale$station) + + output$liste_station_sage <- shiny::renderUI({ + shiny::selectizeInput( + inputId = ns("explorer_SelectStation"), + label = "Stations", + choices = locale$station %>% + dplyr::select(code_station, libelle_station) %>% + dplyr::filter(code_station %in% locale$sage_station) %>% + dplyr::mutate(libelle_station = as.character(libelle_station)) %>% + dplyr::arrange(libelle_station) %>% + dplyr::pull(libelle_station) %>% + c("Toutes",.), + selected = "Toutes", + multiple = TRUE, + options = list("plugins" = list("remove_button")) + ) + }) + } })