step 9 : add notif saran mcu, perbaikan utils hx include
This commit is contained in:
@@ -50,11 +50,7 @@ func (lh *SurveyMcuHandler) HandlerShowSurveyMcu(c echo.Context) error {
|
||||
var idClearMsg []models.IdClearErrorMessage
|
||||
|
||||
if len(dataSurveyMcu) > 0 {
|
||||
for _, v := range dataSurveyMcu {
|
||||
if len(v.DataListItemSurveyMcu) > 0 {
|
||||
hxInclude = utils.ConcatHxIncludeSurveyMcu(v.DataListItemSurveyMcu)
|
||||
}
|
||||
}
|
||||
hxInclude = utils.ConcatHxIncludeSurveyMcu(dataSurveyMcu)
|
||||
}
|
||||
|
||||
si := surveymcu.ShowSurveyMcu("Survey Mcu",
|
||||
@@ -84,13 +80,12 @@ func (lh *SurveyMcuHandler) HandlerProcessSurveyMcu(c echo.Context) error {
|
||||
zap.Any("prm", nomorRegistrasi),
|
||||
)
|
||||
|
||||
form := c.Request().PostForm
|
||||
// form := c.Request().PostForm
|
||||
|
||||
// stringUrl := "surveymcuproses/" + nomorRegistrasi
|
||||
|
||||
logger.Info("CEK POST handler",
|
||||
zap.Any("c.FormValue", c.FormValue(form.Get("radio-1"))),
|
||||
zap.Any("name dari inputan", form.Get("radio-1")),
|
||||
zap.Any("c.FormValue Saran", c.FormValue("saranmcu-11")),
|
||||
)
|
||||
|
||||
// proses validasi
|
||||
@@ -103,8 +98,11 @@ func (lh *SurveyMcuHandler) HandlerProcessSurveyMcu(c echo.Context) error {
|
||||
var idSaranMcuAlert string = ""
|
||||
// var idSaranMcuClear string = ""
|
||||
|
||||
hasError := false
|
||||
|
||||
if len(dataSurveyMcu) > 0 {
|
||||
for _, v := range dataSurveyMcu {
|
||||
// radio button
|
||||
if len(v.DataListItemSurveyMcu) > 0 {
|
||||
for _, x := range v.DataListItemSurveyMcu {
|
||||
|
||||
@@ -113,27 +111,44 @@ func (lh *SurveyMcuHandler) HandlerProcessSurveyMcu(c echo.Context) error {
|
||||
}
|
||||
|
||||
if "default-"+x.NameRadioButton == c.FormValue("default-"+x.NameRadioButton) && len(c.FormValue("radio-"+x.IDItemSurvey)) == 0 {
|
||||
stringMessage += "Pertanyaan ke-" + x.IDItemSurvey + " wajib diisi,"
|
||||
idFormKosong += utils.GetIdSurveyMcu(x.IDItemSurvey)
|
||||
stringMessage = "Pertanyaan ke-" + x.IDItemSurvey + " wajib diisi,"
|
||||
idFormKosong = utils.GetIdSurveyMcu(x.IDItemSurvey)
|
||||
isFormEmpty = true
|
||||
hasError = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if hasError {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if len(c.FormValue("saranMcu")) == 0 {
|
||||
// isFormEmpty = true
|
||||
// stringMessage += " Kemudian Saran Mcu Wajib Diisi"
|
||||
// idSaranMcuAlert = "alertSaranMcu"
|
||||
// }
|
||||
// saran mcu
|
||||
if !hasError && len(dataSurveyMcu) > 0 {
|
||||
for _, v := range dataSurveyMcu {
|
||||
if len(v.DataListItemSurveyMcuSaran) > 0 {
|
||||
for _, x := range v.DataListItemSurveyMcuSaran {
|
||||
if len(c.FormValue("saranmcu-"+x.IDItemSurveyMcuSaran)) > 0 {
|
||||
idClearMsg = append(idClearMsg, models.IdClearErrorMessage{IdItem: x.IDItemSurveyMcuSaran})
|
||||
}
|
||||
|
||||
// if len(c.FormValue("saranMcu")) > 0 {
|
||||
// isFormEmpty = false
|
||||
// stringMessage += ""
|
||||
// idSaranMcuAlert = "alertSaranMcu"
|
||||
// }
|
||||
if "default-"+x.NameSurveyMcuSaran == c.FormValue("default-"+x.NameSurveyMcuSaran) && len(c.FormValue("saranmcu-"+x.IDItemSurveyMcuSaran)) == 0 {
|
||||
stringMessage = "Saran Wajib Diisi"
|
||||
idFormKosong = utils.GetIdSurveyMcu(x.IDItemSurveyMcuSaran)
|
||||
isFormEmpty = true
|
||||
hasError = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if hasError {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if isFormEmpty {
|
||||
si = surveymcu.ErrorMessageSurveyMcu(stringMessage, idFormKosong, idClearMsg, idSaranMcuAlert)
|
||||
@@ -141,7 +156,6 @@ func (lh *SurveyMcuHandler) HandlerProcessSurveyMcu(c echo.Context) error {
|
||||
// surveymcu.MainContentSurveyMcuLayout(dataSurveyMcu, nomorRegistrasi, surveymcu.ErrorMessageSurveyMcu(stringMessage, idFormKosong)), surveymcu.CssSurveyMcu(), surveymcu.JsSurveyMcu())
|
||||
// si = surveymcu.FormSurvey(dataSurveyMcu, stringUrl)
|
||||
} else {
|
||||
// var idClearMsgEmpty []models.IdClearErrorMessage
|
||||
si = surveymcu.ErrorMessageSurveyMcu("", "", idClearMsg, "")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user