147 lines
3.4 KiB
R
147 lines
3.4 KiB
R
library(shiny)
|
|
library(magrittr)
|
|
library(ggplot2)
|
|
library(plotly)
|
|
library(DT)
|
|
|
|
profilUI <- function(id) {
|
|
ns <- NS(id)
|
|
fluidPage(
|
|
useShinyjs(),
|
|
tags$head(
|
|
tags$script(src="js.cookie.js"),
|
|
|
|
tags$style(HTML("
|
|
@import url('//fonts.googleapis.com/css?family=Lobster|Cabin:400,700');
|
|
@import url('//fonts.googleapis.com/css2?family=Fjalla+One');
|
|
|
|
|
|
"))),
|
|
|
|
theme = "style.css",
|
|
|
|
|
|
# App title ----
|
|
|
|
uiOutput("afterLogin"),
|
|
|
|
|
|
|
|
|
|
fluidRow(
|
|
column(12,
|
|
tags$span("© Copyright Wszystkie prawa zastrzeżone."))%>% tagAppendAttributes(id = 'column-copyright'),
|
|
|
|
)%>% tagAppendAttributes(id = 'row-footer')
|
|
|
|
|
|
)}
|
|
|
|
profilServer <- function(input, output,session) {
|
|
|
|
|
|
|
|
|
|
observe({
|
|
if(((session$clientData)$url_hash=="#!/profil") & (is.null(input$token) | length(input$token)<=0 )){
|
|
|
|
print("dziala")
|
|
shinyjs::runjs('window.location.replace(\'/#!/home\');')
|
|
}
|
|
})
|
|
|
|
|
|
|
|
output$afterLogin<-renderUI({
|
|
if(!is.null(input$token) & length(input$token)>0 ){
|
|
|
|
|
|
|
|
fluidRow(
|
|
column(3,
|
|
tags$div("Panel sterowania") %>% tagAppendAttributes(class="panel-title")
|
|
|
|
)%>% tagAppendAttributes(id = 'column-panel'),
|
|
column(9,
|
|
tabsetPanel(type = "tabs",
|
|
tabPanel("Zakładka 1", tags$div(plotlyOutput("plot1",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
|
|
tabPanel("Zakładka 2", tags$div(plotlyOutput("plot2",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
|
|
tabPanel("Zakładka 3", tags$div(plotlyOutput("plot3",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
|
|
tabPanel("Zakładka 4", tags$div(plotlyOutput("plot4",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
|
|
tabPanel("Zakładka 5", tags$div(DT::dataTableOutput("table1",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper'))
|
|
|
|
))%>% tagAppendAttributes(id = 'column-content')
|
|
) %>% tagAppendAttributes(id = 'row-content')
|
|
}else{
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
output$plot1 <- renderPlotly({
|
|
|
|
g<-ggplot(mpg) +
|
|
geom_point(mapping = aes(x = displ, y = hwy))
|
|
|
|
gg<-ggplotly(g)
|
|
|
|
gg
|
|
|
|
})
|
|
|
|
output$plot2 <- renderPlotly({
|
|
|
|
g<-ggplot(data = mpg, mapping = aes(x = cty, y = hwy)) +
|
|
geom_jitter()
|
|
|
|
gg<-ggplotly(g)
|
|
|
|
gg
|
|
|
|
})
|
|
|
|
output$plot3 <- renderPlotly({
|
|
|
|
g<-ggplot(data = mpg, mapping = aes(x = displ, y = hwy, color = drv)) +
|
|
geom_point() +
|
|
geom_smooth(se = FALSE)
|
|
|
|
gg<-ggplotly(g)
|
|
|
|
gg
|
|
|
|
})
|
|
|
|
output$plot4 <- renderPlotly({
|
|
|
|
g<-ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
|
|
geom_point(mapping = aes(color=drv)) +
|
|
geom_smooth(se = FALSE)
|
|
|
|
gg<-ggplotly(g)
|
|
|
|
gg
|
|
|
|
})
|
|
|
|
pl <- list(
|
|
sSearch = "Szukaj",
|
|
sInfo="Wyniki od _START_ do _END_ z _TOTAL_ rekordów",
|
|
sZeroRecords="Brak rekordów",
|
|
sEmptyTable="Pusta tabela",
|
|
oPaginate= list(
|
|
sFirst="Pierwsza", sPrevious="Poprzednia",sLast="Ostatnia", sNext="Następna"
|
|
),
|
|
sLengthMenu = "Pokaż _MENU_ rekordów na stronie"
|
|
)
|
|
|
|
output$table1 <- DT::renderDataTable(iris,options = list(scrollX = TRUE,language=pl))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|