library(shiny)
library(DT)
library(plyr)
library(dplyr)
library(shinydashboard)
library(shinyBS)
library(shinythemes)
library(shinyWidgets)
library(formattable)
library(shinyjs)
library(shinyalert)
library(googlesheets)
library(RCurl)
library(gsheet)

#--------------------------------------------------------
# UI
#-------------------------------------------
shinyUI(navbarPage(
 
 
   theme = shinytheme("readable"), img(src = "acai_banner2.png", height = "80px", width = "500px"),id ="bar",
    
  #HOME PANEL     
       tabPanel("Home",
               
                  includeCSS("www/AdminLTE.css"),
                  includeScript("www/app.js"), 
                  tags$style(HTML('.info-box {min-height: 60px;} .info-box-icon {height: 60px; line-height: 60px;} .info-box-content {padding-top: 0px; padding-bottom: 0px;}')),
             
                     div(style = " text-align: left;", img(src = "acai_banner.png"),br()),
                  br(),
                  br(),
                  fluidRow(
                    column(8, offset = 2,
                           p("African Cassava Agronomy Initiative (ACAI)
                              is a 5 year Bill & Melinda Gates Foundation funded project in 5 countries in Africa 
                             (Nigeria, Tanzania, DRC, Ghana and Kenya) aiming to increase the availability of appropriate and 
                             affordable technologies to sustainably improve short and long-term agricultural productivity in cassava 
                             in the target countries.")
                           ) 
                        )
                ),
# ==================================================================== OVERVIEW PANEL
  
  tabPanel("Make selection",
           tags$head(tags$style("#text1{color: red;
                                 font-size: 20px;
                                 font-style: bold;
                                 }"
           )),

		   br(),
	    
    		fluidRow(
    		  column(width = 2, uiOutput(outputId="country")),
    		 # column(width = 2, offset=1, selectizeInput("entity", "Sample Type", c("Plant samples", "Soil samples"), multiple = FALSE)),
    		  column(width = 2, uiOutput(outputId="entityST")),
    		  column(width = 2, offset=1,	uiOutput(outputId="searchIDs"))
    	  
    		),
    		fluidRow(
    		  column(width = 2, uiOutput(outputId="searchtrialC")),
    		 # column(width = 2, selectizeInput("searchtrialCode", "Trial Code", c("All", "NOT", "BPP", "CIM", "SPT","CIS"), selected = "All", multiple = FALSE)),
    		  column(width=7, offset = 1, wellPanel(tableOutput('searchDetails')))
    		),
		
       fluidRow(
	    	 column(width = 2, checkboxInput("processedBatch", "Hide processed batch", TRUE, width="600px")),
	    	 column(width = 1, checkboxInput("requestData", "Show data", TRUE, width="600px")),
         column(width = 7, verbatimTextOutput("value")),
	    	 column(width = 12, DT::dataTableOutput("Tabledtest"))
	    	 #column(width = 12, tags$hr(style="border-color: green; border-top: 3px solid green;"),	status="success",	 dataTableOutput("Tabledt"), br())
	    	 
	    	),

		  br(),
	
		
		fluidRow(
		  column(1, offset=1, actionBttn(inputId = "forward1", label = "Forward", color = "success", icon=icon("forward"))),
		  column(1, actionBttn(inputId = "discard1", label = "Discard", color= "danger", icon=icon("trash"))),
		  column(1, actionBttn(inputId = "restore1", label = "Store", icon=icon("home"))),
		  column(1, downloadButton('downloadData', 'Download')),
		  
		 
		  #column(1, offset=5, uiOutput(outputId="updateid")),
		  column(1, offset=5, actionBttn(inputId = "refresh1", label = "Refresh", color = "warning", icon=icon("glyphicon glyphicon-asterisk")))
		),
		
  br()
  ),

tabPanel("Forwarded Samples",
         tags$head(tags$style("#text1{color: red;
                              font-size: 20px;
                              font-style: bold;
                              }"
         )),
         fluidRow(
           column(width = 2,  uiOutput(outputId="sampletype")),
           column(width = 2,  uiOutput(outputId="forwardedbatchid")),
           column(width = 2,  uiOutput(outputId="forwardedbatchdescription")),
           column(width = 2,  wellPanel(tableOutput('samplelist')))
          
         ),
         br(),
  
         fluidRow(
           column(width = 2, uiOutput(outputId="Batchactions")),
           column(width = 2,   uiOutput(outputId="lab")),
           column(width = 2,  uiOutput(outputId="selectanalysis"))
         )

         
),

tabPanel("Check samples",
         tags$head(tags$style("#text1{color: red;
                              font-size: 20px;
                              font-style: bold;
                              }"
         )),
         fluidRow(
           column(width = 2,  textInput("soilid", "Please enter soilSampleiD", value="enterID")),
           column(width = 6, tableOutput('soilSampleInfo'))
         ),
         br(),
         br(),
         br(),
         fluidRow(
           column(width = 2,  textInput("plantid", "Please enter plantSampleiD", value="enterID")),
           column(width = 4,  tableOutput('plantSampleInfo')))
),


useShinyjs(),
           windowTitle = "ACAI"
)
)



