im new in R, so i want create input something which if input not unique then the pop up show, i try a lot of source i found on internet but no one can running excellent, please let me know how to do this thanks you before
observeEvent(input$Addprospek, {
## POPUP WITH INPUTS
shinyalert(html = TRUE, showCancelButton = TRUE, confirmButtonText = "Submit",
closeOnClickOutside = TRUE, closeOnEsc = TRUE,
text = tagList(
selectInput("nama_cmo", "Nama CMO",choices = c(df_cmo$nama)),
textInput("nama_customer", "Nama Customer"),
textInput("no_hp_customer", "No. HP"),
dateInput("tgl_prospek", "Tanggal Prospek"),
selectInput("tipe_prospek", "Tipe Prospek",
choices = c('Hot','Warm', 'Cold')),
selectInput("produk", "Produk",
choices = c('Multiguna: BPKB Motor',
'Multiguna: BPKB Mobil',
'Multiguna: Sertifikat',
'Kredit Motor: Baru',
'Kredit Motor: Second',
'Kredit Mobil: Baru',
'Kredit Mobil: Second')
)
),
here is my code and after input the code will send in the database like this :
add_row <- dplyr::tibble(
nama_cmo = input$nama_cmo,
nama_customer = input$nama_customer,
tipe_prospek = input$tipe_prospek,
tgl_prospek = as.character(input$tgl_prospek),
scheduled_followup = if (tipe_prospek == "Hot"){
as.character(as.Date(tgl_prospek)+1)
}else if(tipe_prospek == "Warm"){
as.character(as.Date(tgl_prospek)+3)
}else{as.character(as.Date(tgl_prospek)+7)},
status = if(as.Date(scheduled_followup) > as.Date(Sys.Date())){
"Terjadwal"
} else if (as.Date(scheduled_followup) < as.Date(Sys.Date())) {
"Terlewati"
} else if (as.Date(scheduled_followup) == as.Date(Sys.Date())) {
"Today"
},
produk = input$produk,
no_hp_customer = if(input$no_hp_customer == "123123"){
shinyalert(html = TRUE, showCancelButton = TRUE, confirmButtonText = "Repeat Customer !",
closeOnClickOutside = TRUE, closeOnEsc = TRUE)
no_hp_customer = input$no_hp_customer
}
else{shinyalert("No hp tidak boleh kosong / Sama !", type = "error")},
# showNotification("Repeat Customer ?"),
Buttons = create_btns(rv_p$keep_track_id)
)