-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathui.R
executable file
·120 lines (104 loc) · 4.03 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
111
112
113
114
115
116
117
118
119
120
#Function to add nice collapse in menu sidebar
convertMenuItem <- function(mi,tabName) {
mi$children[[1]]$attribs['data-toggle']="tab"
mi$children[[1]]$attribs['data-value'] = tabName
if(length(mi$attribs$class)>0 && mi$attribs$class=="treeview"){
mi$attribs$class=NULL
}
mi
}
#------------------------------------------------------
sidebar <- dashboardSidebar(
sidebarMenu(id="sbmenu",
useShinyjs(),
#Price optimization
convertMenuItem(
menuItem(text = "Price optimization", tabName = "price_optimization", icon = icon("money"),
selectInput(inputId = "po_input_product",
label = "Select product ID",
choices = excelent_prods),
uiOutput("po_render_price"),
div(
h4("Marketing options", id = "custom_header"),
checkboxInput(inputId = "po_input_display", label = "Display on TV in store"),
checkboxInput(inputId = "po_input_letter", label = "Print in promo-letters")
)
), "price_optimization"
)
)
)
#------------------------------------------------------
body <- dashboardBody(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "shiny.css")
),
tabItems(
tabItem(tabName = "price_optimization",
box(title = NULL,
status = "primary",
solidHeader = FALSE,
width = 12,
fluidRow(
valueBoxOutput("po_box_description", width = 6),
valueBoxOutput("po_box_category", width = 6)
),
fluidRow(
valueBoxOutput("po_box_predicted_demand_level", width = 6),
valueBoxOutput("po_box_elasticity", width = 6)
),
fluidRow(
valueBoxOutput("po_box_current_price", width = 4),
valueBoxOutput("po_box_predicted_demand", width = 4),
valueBoxOutput("po_box_current_profit", width = 4)
),
fluidRow(
valueBoxOutput("po_box_optimum_price", width = 4),
valueBoxOutput("po_box_optimum_demand", width = 4),
valueBoxOutput("po_box_optimum_profit", width = 4)
)
),
fluidRow(
box(title = "Historical data",
status = "primary",
solidHeader = FALSE,
width = 12,
box(title = "Price",
status = "primary",
solidHeader = TRUE,
width = 6,
dygraphOutput("price_history")
),
box(title = "Demand",
status = "primary",
solidHeader = TRUE,
width = 6,
verticalLayout(
dygraphOutput("demand_history", height = 300),
dygraphOutput("demand_levels", height = 100)
)
)
)
),
fluidRow(
box(title = "Profit vs. price",
status = "primary",
solidHeader = FALSE,
width = 6,
plotlyOutput("po_profit_plot")
),
box(title = "Demand vs. price",
status = "primary",
solidHeader = FALSE,
width = 6,
plotlyOutput("po_demand_vs_price_plot")
)
)
)
)
)
dashboardPage(
skin = "black",
dashboardHeader(title = "Analytics Prototype"),
sidebar,
body
)