-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_mainPanel.R
66 lines (62 loc) · 1.67 KB
/
mod_mainPanel.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
# Main Panel UI card Module
mainPanelUI_card <- function(id) {
ns <- NS(id)
# We want the output as a text
tagList(
verbatimTextOutput(ns('text'))
)
}
# Main Panel UI Module
mainPanelUI <- function(id) {
ns <- NS(id)
# We want to output a datatable
tagList(DTOutput(ns('dataTable')))
}
# Main Panel Server card Module
mainPanelServer_card <- function(id, problem) {
moduleServer(id, function(input, output, session) {
# Render the text as output
output$text <- renderText({
paste0(problem())
})
})
}
# Main Panel Server Module
# This module will display the Historic table
mainPanelServer <- function(id, pinned_cakes, when) {
moduleServer(id, function(input, output, session) {
output$dataTable <- renderDT({
# Hide secret ingredient
pinned_cakes <- pinned_cakes()[,c(1:5,7)]
if (when == "today") {
pinned_cakes <- pinned_cakes |>
filter(Date == Sys.Date())
}
if (when == "upcoming") {
pinned_cakes <- pinned_cakes |>
filter(Date > Sys.Date())
}
datatable(
pinned_cakes,
# Do not show row names
rownames = FALSE,
# Add filters for each column
filter = "top",
colnames = c(
"Date",
"Hour",
"Room",
"Section",
"Person Name",
"Cake Description"
),
options = list(
# order table by date and then time
order = list(list(0, 'asc'), list(1, 'asc')),
columnDefs = list(
list(targets = '_all', className = 'dt-center')
))
)
})
})
}