modalDialog in my shiny app - Dashboard

I'm stuck to exploit the dataTableOutput('w.line'), valueBoxOutput("ecr"),valueBoxOutput("bem"),
In my modalDialog, I would like to have the values of the selected row in the be and SQ columns. Above these values I would like to put one the values of the valueBox if the be box is empty then red if not green and if SQ box is filled then green.
When a person enters a value in one of the boxes be or SQ (date) I would like to have the possibility to send an email.
I hope to be clear and if you have any ideas I'm interested.

Thank you in advance for your help

rrm(list = ls())
library(shiny)
library(shinydashboard)
library(data.table)
library(DT)


wf<-readRDS("dt.rds")

###########UI

ui<-dashboardPage(dashboardHeader(disable = T),
                  dashboardSidebar(disable = T),
                  dashboardBody(uiOutput("MainBody")
                )
              
)

###############SERVER

server<-function(input, output) {
  
  #vals<-reactiveValues()
  #vals$Data<-wf%>%
   # select(-.data$Description_du_defaut)
  
  
  vals<-reactiveValues()
  vals$Data<-data.table(
              pers=paste0("Brand",1:10),
              act=sample(1:20,10),
              be=c("09-11-2020","","","","","10-10-2020","","","",""),
              SQ=c("","2020-10-10"),
              Last_Year_Purchase=round(rnorm(10,1000,1000)^2),
              Contact=paste0(1:10,"@email.com")
  )
  
  
  output$MainBody<-renderUI({
    fluidPage(
      box(width=12,
          h3(strong("Actions on datatable with buttons"),align="center"),
          hr(),
           column(12,dataTableOutput("Main_table")),

          tags$script("$(document).on('click', '#Main_table button', function () {
                        Shiny.onInputChange('lastClickId',this.id);
                        Shiny.onInputChange('lastClick', Math.random())
  });")
          
      )
    )
  })
  
  output$Main_table<-renderDataTable({
    DT=vals$Data
   # DT[["Select"]]<-paste0('<input type="checkbox" name="row_selected" value="Row',1:nrow(vals$Data),'"><br>')
    
    DT[["Actions"]]<-
      paste0('
             <div class="btn-group" role="group" aria-label="Basic example">
                
                <button type="button" class="btn btn-secondary modify"id=workflow',1:nrow(vals$Data),'>Workflow</button>
             </div>
             
             ')
    datatable(DT,
              escape=F)}
  )
  

  ##Managing in row deletion
  modal_modify<-modalDialog(
                fluidPage(
                  h3(strong("WorkFLow : DT-DI-SQ"),align="center"),
                  hr(),
                  dataTableOutput('w.line'),
                  valueBoxOutput("ecr"),
                  valueBoxOutput("bem"),
                  actionButton("save_changes","Save changes"),
                  tags$script(HTML("$(document).on('click', '#save_changes', function () {
                                      var list_value=[]
                                      for (i = 0; i < $( '.new_input' ).length; i++)
                                                             {
                                                                list_value.push($( '.new_input' )[i].value)
                                                             }
                                      Shiny.onInputChange('newValue', list_value)
                                        });"))
                ),
                size="l"
              )
  
  
  observeEvent(input$lastClick,
               {
                 if (input$lastClickId%like%"workflow")
                 {
                   showModal(modal_modify)
                 }
               }
  )
  
}


shinyApp(ui, server)