Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(shiny)
- library(rhandsontable)
- library(shinythemes)
- df <- data.frame(
- "project number" = c( ''),
- "project name" = c( ''),
- "description" = c(''),
- "estimated delivery date" = seq(from = Sys.Date(), by = "days", length.out = 10),
- "actual delivery date" =seq(from = Sys.Date(), by = "days", length.out = 10),
- "current status " = c(''),
- "note" = c(''),
- "GA status" = factor(NA, c('approved','awaiting','no needed')),
- "GA hours" = c(''),
- "GA actual" = c(''),
- "SSEC hours" = c(''),
- "SSEC actual" = c(''),
- "steel hours" = c(''),
- "steel actual" = c(''),
- "steel drawing sent" = FALSE,
- "steel drawing date" = seq(from = Sys.Date(), by = "days", length.out = 10),
- "tarp hours" = c(''),
- "tarp actual" = c(''),
- "tarp drawing sent" = FALSE,
- "tarp drawing date" = seq(from = Sys.Date(), by = "days", length.out = 10),
- "installation hours " = c(''),
- "installation actual " = c(''),
- "generate component list " = FALSE,
- "drawings checked"= FALSE,
- "tarp drawing" = FALSE,
- "estimated completion date"= c(''),
- "material"= factor(NA, c("Armourtex", "Landmark", "Armourtex FR", "Armourtex White/Silver")),
- "drawing availability date"= c(''),
- "tarp production status" = c(""),
- "estimated completion date" = c(""),
- "estimated completion date" = c(""),
- "drawing availability date" = c(""),
- "rolling group" = c(""),
- "rolling date" = c(""),
- "Hoop group" = c(""),
- "Hoop date" = c(""),
- "mounting rail group" = c(""),
- "mounting rail date" = c(""),
- "P-B group" = c(""),
- "P-B date" = c(""),
- "Posts group" = c(""),
- "Posts date" = c(""),
- "Endwall group" = c(""),
- "Endwall date" = c(""),
- "galv sent date" = seq(from = Sys.Date(), by = "days", length.out = 10),
- "galv return date" = seq(from = Sys.Date(), by = "days", length.out = 10),
- "tarp received" = FALSE,
- "steel received" = FALSE,
- "instruction list" = FALSE,
- "packing" = FALSE,
- "delivery target date" = seq(from = Sys.Date(), by = "days", length.out = 1),
- "project comment" = c(""),
- stringsAsFactors = FALSE, check.names = FALSE)
- fields <- c("project number",
- "project name",
- "description",
- "estimated delivery date")
- #########################################
- shinyApp(
- ui = tagList(
- navbarPage(
- theme = shinytheme("flatly"),
- "Group Production Portal",
- tabPanel("production panel",
- sidebarPanel(
- fileInput("file", "File input:"),
- textInput("project number", "Project Number"),
- textInput("project name", "Project Name"),
- textInput("description", "Job Description: "),
- dateInput("estimated delivery date",h3("Due Date")),
- #sliderInput("slider", "Slider input:", 1, 100, 30),
- tags$h5("Deafult actionButton:"),
- #actionButton("actionAdd", "Add Project"),
- tags$h5("actionButton with CSS class:"),
- actionButton("actionAdd", "Add Project", class = "btn-primary")
- , width = 2
- ),
- mainPanel(
- tabsetPanel(
- tabPanel("Resource Allocation", "This panel is intentionally left blank"
- ),
- tabPanel("Timeline",
- h4("Table"),
- DT::dataTableOutput("responses", width = 500), tags$hr(),
- h4("Verbatim text output"),
- verbatimTextOutput("txtout"),
- h1("Header 1"),
- h2("Header 2"),
- h3("Header 3"),
- h4("Header 4"),
- h5("Header 5")),
- tabPanel("Gantt Chart", "This panel is intentionally left blank")
- )
- )
- ),
- tabPanel("logistic", rHandsontableOutput("table")
- ),
- tabPanel("drafting", rHandsontableOutput("table1")
- ),
- tabPanel("tarp production", rHandsontableOutput("table2")
- ),
- tabPanel(" steel fabrication", rHandsontableOutput("table3"))
- )
- ),
- #########################################################################################SERVERWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
- server = function(input, output, session) {
- responses <-df
- saveData <- function(data) {
- data <- as.data.frame(t(data))
- if (exists("responses")) {
- responses <<- rbind.fill(responses, data)
- } else {
- responses <<- data
- }
- }
- loadData <- function() {
- if (exists("responses")) {
- responses
- }
- }
- formData <- reactive({
- data <- sapply(fields, function(x) input[[x]])
- data
- })
- observeEvent(input$actionAdd, {
- saveData(formData())
- })
- output$responses <- DT::renderDataTable({
- input$actionAdd
- loadData()
- })
- output$txtout <- renderText({
- paste(input$txt, input$slider, format(input$date), sep = ", ")
- })
- df<-responses
- output$table = renderRHandsontable({
- rhandsontable(responses[,c("project number","project name","description","estimated delivery date","actual delivery date","current status ", "drawings checked", "tarp received",
- "steel received","instruction list", "packing", "delivery target date",
- "project comment" )], search = TRUE,columnSorting = TRUE) %>%
- hot_context_menu(customOpts = list(search = list(name = "Search",
- callback = htmlwidgets::JS(
- "function (key, options) {
- var srch = prompt('Search criteria');
- this.search.query(srch);
- this.render();
- }"))))
- })
- #####################################################################################################
- ##############################################drafting
- output$table1 = renderRHandsontable({
- if (!is.null(input$hot)) {
- DF = hot_to_r(input$hot)
- } else {
- DF = df
- }
- rhandsontable(DF[,c("project number","project name","description","estimated delivery date","GA status", "GA hours", "GA actual","SSEC hours", "SSEC actual", "steel hours","steel actual", "tarp hours", "tarp actual","installation hours ", "installation actual " )], search = TRUE,columnSorting = TRUE)
- })
- ###############################################################################tarp table
- output$table2 = renderRHandsontable({
- if (!is.null(input$hot)) {
- DF = hot_to_r(input$hot)
- } else {
- DF = df
- }
- rhandsontable(DF[,c("project number","project name","description","estimated delivery date","drawings checked","tarp drawing sent","material", "drawing availability date", "tarp production status","estimated completion date" )], search = TRUE,columnSorting = TRUE)%>% hot_col("material", type = "dropdown" )
- })
- ################################################### Steel Fabrication
- output$table3 = renderRHandsontable({
- if (!is.null(input$hot)) {
- DF = hot_to_r(input$hot)
- } else {
- DF = df
- }
- rhandsontable(DF[,c("project number","project name","description","estimated delivery date","drawings checked", "rolling group", "rolling date","Hoop group", "Hoop date","mounting rail group",
- "mounting rail date", "P-B group", "P-B date","Posts group", "Posts date", "Endwall group", "Endwall date","galv sent date", "galv return date" )], search = TRUE,columnSorting = TRUE)
- })
- }
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement