Render variables and change data type from uploaded file

I am creating a application, where I am uploading a file and displaying the variables from the uploaded file and changing their data type as desired from the user.

In most of the cases, they are either numeric/date.

Therefore, I tried the below piece of code. In the first half, I have created the code for file upload, and in second half, i tried to display the checkbox group input for the variables.

I have two problems with the below code.

In select variables, it is not displaying the Variable names, rather I find something with checkbox irrelevant.

On the other hand, i want them to be in my submenu item tab "prep", I have no idea why i find them in menu item Load.

Below is the screenshot, that helps you to figure out between the menu items.

Here is my code, i have tried so far.

library(shiny)
library(shinydashboard)
library(ggplot2)
library(DT)

ui<-dashboardPage(
  dashboardHeader(title = "Model"),
  dashboardSidebar(
    sidebarMenu(id="tabs",
                menuItem("Data", tabName = "data", icon = icon("table"),startExpanded = TRUE,
                         menuSubItem("Load", tabName = "data1"),
                         menuSubItem("Prep", tabName = "prep")
                ),
                menuItem("Visualisation",icon=icon("bar-chart-o"), tabName = "vis"),
                menuItem("Result", icon=icon("cog"), tabName = "result")
    )
  ),
  dashboardBody(
    tags$style(type="text/css",
               ".shiny-output-error { visibility: hidden; }",
               ".shiny-output-error:before { visibility: hidden; }"
    ),
    tabItems(
      tabItem(tabName = "data1",
              fluidPage(
                fluidRow(
                  fileInput("file1","Choose CSV File",
                            accept = c("text/csv",
                                       "text/comma-seperated-values, text/plain",
                                       ".csv")
                  ),
                  tags$hr(),
                  checkboxInput("header", "Header", TRUE),
                  radioButtons("sep","Separator",
                               choices=c(Comma=",",
                                         semicolon=";",
                                         Tab="\t"),
                               selected = ";")
                ),
                mainPanel(
                  uiOutput("tb")
                )
              )
      )
    ),
    tabItem(tabName = "prep",
            fluidPage(
              fluidRow(
                 mainPanel(
                   uiOutput("Pre")
                 )
              )
            ))
  )
) 


server <- shinyServer(function(input,output){
  data <- reactive({
    file1 <- input$file1
    if(is.null(file1)){return()}
    read.csv(file = file1$datapath, sep=input$sep)
  })

  output$filedf <- renderTable({
    if(is.null(data())){return()}
    input$file1
  })
  output$sum <- renderTable({
    if(is.null(data())){return()}
    summary(data())
  })
  output$table <- renderTable({
    if(is.null(data())){return()}
    data()
  })
  output$tb <- renderUI({
    if(is.null(data())){return()}
    tabsetPanel(tabPanel("About file", tableOutput("filedf")),tabPanel("Data", tableOutput("table")),tabPanel("Summary", tableOutput("sum")))

  })

#----- Data Preparation------
 output$Pre <- renderUI({checkboxGroupInput(inputId = "select_vars",
                                            label="Select Variables",
                                            choices = names(filedf))

   })
filedf_sel <- reactive({
  req(input$select_vars)
  filedf_sel<- data()%>% select(input$select_var)
})
})

shinyApp(ui,server)

Could anyone help me on how i can avoid those errors, and then structure out on how i could change their datatype