forked from vilnius/kiss-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.R
110 lines (101 loc) · 4.09 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(magrittr)
library(shiny)
library(data.table)
library(dplyr)
library(dtplyr)
#seniunija <- readRDS("dists.RDS") %>% sort
seniunija <- fread("data/seniunijos.csv", encoding = "UTF-8")
# darzeliai <- readRDS("darzeliai.RDS") %>% sort
darzeliai <- fread("data/darzeliai.csv", encoding = "UTF-8") %>%
arrange(LABEL)
md <- format(Sys.Date(), "%m-%d")
curyear <- format(Sys.Date(), "%Y") %>% as.numeric
year <- ifelse(md > "06-01", curyear + 1, curyear)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
tags$link(rel = "stylesheet", type = "text/css", href = "maps.css"),
tags$script(src = "addMap.js"),
tags$script("
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-72198439-2', 'auto');
ga('send', 'pageview');"),
# Application title
tags$a(
tags$img(src='vilnius-logo.svg', class="city-logo"),
href="http://www.vilnius.lt"),
titlePanel(paste("Darželių eilių prognozė", year, " metams (KISS)")),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
dateInput("birthdate", "Gimimo data", min = "2009-01-01",
max = "2030-01-01"),
selectizeInput("district", label = "Pasirinkite seniūnijas, kuriose bent vienas iš tėvų registruotas ne mažiau 2 metų",
choices = setNames(seniunija$ID, seniunija$LABEL),
multiple = TRUE),
selectizeInput(
"city", label = "Deklaruoti mieste",
choices = setNames(1:3, c("Abu tėvai", "Vienas iš tėvų",
"Nei vienas iš tėvų"))),
# checkboxInput(
# "twoyears",
# label = "Bent vienas iš tėvų registruotas Vilniuje ne mažiau 2 metų?"),
checkboxInput(
"school",
label = "Vienas iš tėvų mokosi bendrojo ugdymo mokykloje?"),
# checkboxInput("citydeclared", label = "Deklaruotas mieste"),
checkboxInput("threemore", label = "3 ir daugiau vaikų"),
checkboxInput("unable", label = "Žemas darbingumo lygis"),
conditionalPanel(
condition = "input.city == 1",
checkboxInput("lonely", label = "Augina vienas iš tėvų")
),
checkboxInput("otherkids", label = "Ar turite kitų vaikų Vilniaus darželiuose?"),
conditionalPanel(
condition = "input.otherkids",
selectizeInput("otherkg", label = "Kuriuose?",
choices = setNames(darzeliai$ID, darzeliai$LABEL),
multiple = TRUE)
),
selectizeInput(
"language", label = "Kalba",
choices = setNames(1:4, c("Hebrajų", "Lenkų", "Lietuvių", "Rusų")),
selected = 3),
checkboxInput("special", label = "Specialūs poreikiai"),
checkboxInput("disclaimer", label = "Suprantu, kad šis įrankis yra tik rekomendacinio pobūdžio, ir tikroji eilė gali skirtis nuo prognozuojamos."),
actionButton("go", label = "Prognozuoti")
),
# Show a plot of the generated distribution
mainPanel(
fluidRow(
column(6,
HTML('<input id="home-input" class="controls" type="text" placeholder="Namų adresas">'),
div(id='home-map')
),
column(6,
HTML('<input id="work-input" class="controls" type="text" placeholder="Darbovietės adresas">'),
div(id='work-map')
)
),
#plotOutput("distPlot")
uiOutput("priority"),
uiOutput("disclaimer"),
tags$br(),
uiOutput("no_work_home"),
tags$h4("Rezultatai"),
DT::dataTableOutput("table")
)
),
uiOutput("google_maps_API")#,
# uiOutput("coords")
))