output$substance_add_P2 <- renderUI({
fluidRow(
column(
12,
radioGroupButtons(
"event_substance_P2",
NULL,
choices = c("Event", "Substance"),
selected = "Event",
checkIcon = list(yes = icon("ok", lib = "glyphicon")),
width = "100%"
),
airDatepickerInput(
"substance_date_P2",
NULL,
minDate = dates_study()$P2[1] |> as.character(tz = "US/Pacific"),
maxDate = dates_study()$P2[2] |> as.character(tz = "US/Pacific"),
startView = dates_study()$P2[1] |> as.character(tz = "US/Pacific"),
multiple = TRUE,
clearButton = TRUE,
inline = TRUE,
width = "350"
),
conditionalPanel(
"input.event_substance_P2 == 'Event'",
textAreaInput(
"event_P2",
"Description:",
placeholder = "e.g. Birthday Party"
),
actionBttn(
"add_event_P2",
span(icon("plus"), "Add Event"),
style = "material-flat",
color = "danger"
)
),
conditionalPanel(
"input.event_substance_P2 == 'Substance'",
virtualSelectInput(
"substance_P2",
"Substance:",
choices = substances_names_grouped(),
selected = NULL,
disableOptionGroupCheckbox = TRUE,
optionsCount = 8,
html = TRUE
),
virtualSelectInput(
"frequency_P2",
"Frequency:",
choices = 1:100,
selected = character(0),
optionsCount = 6
),
htmlOutput("unit_P2"),
br(),
actionBttn(
"add_substance_P2",
span(icon("plus"), "Add Substance"),
style = "material-flat",
color = "danger"
)
)
)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.