step 3 : edit data group result
This commit is contained in:
@@ -22,12 +22,12 @@ import (
|
||||
|
||||
type GroupResultService interface {
|
||||
// GetUserGroup() ([]models.UserGroup, error)
|
||||
// GetUserGroupByID(id string) (models.UserGroup, error)
|
||||
GetGroupResultByIDV1(id string) (models.GroupResult, error)
|
||||
// try
|
||||
// GetListMasterUserGroup() ([]models.UserGroupV1, error)
|
||||
GetListBreadCrumb(title string) (models.BreadCrumbV1, error)
|
||||
// AddUserGroup(code string, name string) (models.UserGroupV1, error)
|
||||
// EditUserGroup(id string, code string, name string) (models.UserGroupV1, error)
|
||||
EditGroupResult(id string, groupresultname string, groupresultflagpertest string, groupresultflagnonlab string, groupresultresumemcu string) (models.GroupResult, error)
|
||||
// DeleteUserGroup(id string) (models.UserGroupV1, error)
|
||||
GetListGroupResult(search string, currentPage int, rowPerPage int) ([]models.GroupResult, int, error)
|
||||
GetGroupResultResumeMcu() ([]models.GroupResultResumeMcu, error)
|
||||
@@ -79,7 +79,7 @@ func (lh *GroupResultHandler) HandlerShowGroupResultPaginationV1(c echo.Context)
|
||||
}
|
||||
|
||||
contentUserGroupComponent := groupresult.TableGroupResult(
|
||||
dataGroupResult, tableID, "/dev/usergroupshoweditform",
|
||||
dataGroupResult, tableID, "/dev/groupresultshoweditform",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
@@ -157,6 +157,60 @@ func (lh *GroupResultHandler) HandleCloseForm(c echo.Context) error {
|
||||
return utils.View(c, form)
|
||||
}
|
||||
|
||||
// CLOSE FORM EDIT
|
||||
func (lh *GroupResultHandler) HandleCloseFormEdit(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
|
||||
// listItem
|
||||
dataResultMcu, err := lh.GroupResultService.GetGroupResultResumeMcu()
|
||||
fmt.Println(dataResultMcu)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR BREADCRUMB DEV",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
fmt.Println(dataResultMcu)
|
||||
return err
|
||||
}
|
||||
// Component Dropdown MCU
|
||||
listItemResultMcuComponent := groupresult.ItemDropdown(dataResultMcu, 0)
|
||||
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
form := groupresult.DialogNewBodyV1(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result name",
|
||||
Name: "groupresultid",
|
||||
Placeholder: "Group Result name",
|
||||
Type: "hidden",
|
||||
ID: "groupresultid",
|
||||
},
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result Name",
|
||||
Name: "groupresultname",
|
||||
Placeholder: "Group Result Name",
|
||||
Type: "text", ID: "groupresultname"},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagpertest",
|
||||
ID: "groupresultflagpertest",
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagnonlab",
|
||||
ID: "groupresultflagnonlab",
|
||||
},
|
||||
models.CustomDropdownv1Prm{
|
||||
Label: "Group Result Resume MCU",
|
||||
Name: "groupresultresumemcu",
|
||||
ID: "groupresultresumemcu",
|
||||
},
|
||||
listItemResultMcuComponent,
|
||||
dialogEditBodyID, groupresult.HandleJSModalAddGR(""))
|
||||
return utils.View(c, form)
|
||||
}
|
||||
|
||||
// LISTING FUNCTION INITIAL
|
||||
func (lh *GroupResultHandler) HandlerShowGroupResultV1(c echo.Context) error {
|
||||
|
||||
@@ -305,7 +359,51 @@ func (lh *GroupResultHandler) HandlerShowGroupResultV1(c echo.Context) error {
|
||||
})
|
||||
|
||||
//Component modal edit usergroup
|
||||
modalEditcomponent := groupresult.EmptyDiv1()
|
||||
// modalEditcomponent := groupresult.EmptyDiv1()
|
||||
//Component modal edit usergroup
|
||||
modalEditcomponent := groupresult.GroupResultForm(models.GroupResultFormComponent{
|
||||
IDComponent: "formgroupresultedit",
|
||||
Link: "/dev/groupresult/edit",
|
||||
HxTarget: "#" + dialogEditBodyID,
|
||||
HxSwap: "outerHTML",
|
||||
HxInclude: "#tableID, #paginationID, #searchID, #dialogEditBodyID, #dialogEditID, #" + searchID + ", #currpage" + paginationID,
|
||||
ModalID: dialogEditID,
|
||||
ModalTitle: "Edit-Group Result",
|
||||
DialogBody: groupresult.DialogNewBodyV1(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result name",
|
||||
Name: "groupresultid",
|
||||
Placeholder: "Group Result name",
|
||||
Type: "hidden",
|
||||
ID: "groupresultid",
|
||||
},
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result Name",
|
||||
Name: "groupresultname",
|
||||
Placeholder: "Group Result Name",
|
||||
Type: "text", ID: "groupresultname"},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagpertest",
|
||||
ID: "groupresultflagpertest",
|
||||
Value: "N",
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagnonlab",
|
||||
ID: "groupresultflagnonlab",
|
||||
Value: "N",
|
||||
},
|
||||
models.CustomDropdownv1Prm{
|
||||
Label: "Group Result Resume MCU",
|
||||
Name: "groupresultresumemcu",
|
||||
ID: "groupresultresumemcu",
|
||||
},
|
||||
listItemResultMcuComponent,
|
||||
dialogEditBodyID, groupresult.HandleJSModalAddGR("")),
|
||||
DialogAction: groupresult.DialogNewActionV1("/dev/groupresulthandlecloseformedit", "#"+dialogEditBodyID, "outerHTML", "#"+dialogEditID),
|
||||
ButtonCLose: groupresult.BtnCloseNewV1("/dev/groupresulthandlecloseformedit", "#"+dialogEditBodyID, "outerHTML", "#"+dialogEditID),
|
||||
})
|
||||
|
||||
//Component modal delete usergroup
|
||||
modalDeletecomponent := groupresult.EmptyDiv1()
|
||||
@@ -313,7 +411,7 @@ func (lh *GroupResultHandler) HandlerShowGroupResultV1(c echo.Context) error {
|
||||
//table listing user group component
|
||||
contentUserGroupComponent := groupresult.TableGroupResult(
|
||||
dataGroupResult, tableID,
|
||||
"/dev/usergroupshoweditform",
|
||||
"/dev/groupresultshoweditform",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
@@ -379,7 +477,7 @@ func (lh *GroupResultHandler) HandlerShowGroupResultV1(c echo.Context) error {
|
||||
}
|
||||
|
||||
// PROSES ADD DATA
|
||||
func (lh *GroupResultHandler) AddUserGroup(c echo.Context) error {
|
||||
func (lh *GroupResultHandler) AddGroupResult(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
|
||||
@@ -729,3 +827,400 @@ func (lh *GroupResultHandler) HandlerShowGroupResultSearchV1(c echo.Context) err
|
||||
return utils.ViewMulti(c, retval)
|
||||
// return utils.View(c, si)
|
||||
}
|
||||
|
||||
// FORM EDIT SHOW
|
||||
func (lh *GroupResultHandler) HandleEditForm(c echo.Context) error {
|
||||
println("Masuk change edit form")
|
||||
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
|
||||
id := c.QueryParam("id")
|
||||
dialogEditID := c.QueryParam("dialogEditID")
|
||||
dialogEditBodyID := c.QueryParam("dialogEditBodyID")
|
||||
|
||||
// listItem
|
||||
dataResultMcu, err := lh.GroupResultService.GetGroupResultResumeMcu()
|
||||
fmt.Println(dataResultMcu)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR BREADCRUMB DEV",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
fmt.Println(dataResultMcu)
|
||||
return err
|
||||
}
|
||||
// Component Dropdown MCU default
|
||||
listItemResultMcuComponent := groupresult.ItemDropdown(dataResultMcu, 0)
|
||||
|
||||
// get data by id
|
||||
dataGroupList, err := lh.GroupResultService.GetGroupResultByIDV1(id)
|
||||
if err != nil {
|
||||
test := groupresult.DialogNewBodyV1(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result name",
|
||||
Name: "groupresultid",
|
||||
Placeholder: "Group Result name",
|
||||
Type: "hidden",
|
||||
ID: "groupresultid",
|
||||
},
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result Name",
|
||||
Name: "groupresultname",
|
||||
Placeholder: "Group Result Name",
|
||||
Type: "text", ID: "groupresultname"},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagpertest",
|
||||
ID: "groupresultflagpertest",
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagnonlab",
|
||||
ID: "groupresultflagnonlab",
|
||||
},
|
||||
models.CustomDropdownv1Prm{
|
||||
Label: "Group Result Resume MCU",
|
||||
Name: "groupresultresumemcu",
|
||||
ID: "groupresultresumemcu",
|
||||
},
|
||||
listItemResultMcuComponent,
|
||||
dialogEditBodyID, groupresult.HandleJSModalAddGRShow("#"+dialogEditID))
|
||||
coba := utils.ViewMulti(c, []templ.Component{
|
||||
customtoastv2.CustomToastV2Show("Error", err.Error(), "danger"),
|
||||
test})
|
||||
return coba
|
||||
|
||||
}
|
||||
|
||||
// Component Dropdown MCU
|
||||
var idSelectedGroupResultResumeMcu int = 0
|
||||
for _, x := range dataResultMcu {
|
||||
if x.Text == dataGroupList.Group_ResultResumeMcu {
|
||||
idSelectedGroupResultResumeMcu = x.ID
|
||||
}
|
||||
}
|
||||
|
||||
listItemResultMcuComponentPopulate := groupresult.ItemDropdown(dataResultMcu, idSelectedGroupResultResumeMcu)
|
||||
form := groupresult.DialogNewBodyV1(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result name",
|
||||
Name: "groupresultid",
|
||||
Placeholder: "Group Result name",
|
||||
Type: "hidden",
|
||||
ID: "groupresultid",
|
||||
Value: strconv.Itoa(dataGroupList.Group_ResultID),
|
||||
},
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result Name",
|
||||
Name: "groupresultname",
|
||||
Placeholder: "Group Result Name",
|
||||
Type: "text", ID: "groupresultname",
|
||||
Value: dataGroupList.Group_ResultName,
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagpertest",
|
||||
ID: "groupresultflagpertest",
|
||||
Value: dataGroupList.Group_ResultFlagPerTest,
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagnonlab",
|
||||
ID: "groupresultflagnonlab",
|
||||
Value: dataGroupList.Group_ResultFlagNonLab,
|
||||
},
|
||||
models.CustomDropdownv1Prm{
|
||||
Label: "Group Result Resume MCU",
|
||||
Name: "groupresultresumemcu",
|
||||
ID: "groupresultresumemcu",
|
||||
},
|
||||
listItemResultMcuComponentPopulate,
|
||||
dialogEditBodyID, groupresult.HandleJSModalAddGRShow("#"+dialogEditID))
|
||||
coba := utils.ViewMulti(c, []templ.Component{form})
|
||||
return coba
|
||||
|
||||
}
|
||||
|
||||
// PROSES EDIT DATA
|
||||
func (lh *GroupResultHandler) EditGroupResult(c echo.Context) error {
|
||||
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
|
||||
// DARI FORM ADD NYA
|
||||
groupresultname := c.FormValue("groupresultname")
|
||||
groupresultflagpertest := c.FormValue("groupresultflagpertest")
|
||||
groupresultflagnonlab := c.FormValue("groupresultflagnonlab")
|
||||
groupresultresumemcu := c.FormValue("groupresultresumemcu")
|
||||
|
||||
// setting flag test dan flagnonlab
|
||||
var flagPerTest string = "N"
|
||||
var flagNonLab string = "N"
|
||||
|
||||
id := c.FormValue("groupresultid")
|
||||
tableID := c.FormValue("tableID")
|
||||
paginationID := c.FormValue("paginationID")
|
||||
searchID := c.FormValue("searchID")
|
||||
search := c.FormValue("search")
|
||||
dialogEditBodyID := c.FormValue("dialogEditBodyID")
|
||||
dialogEditID := c.FormValue("dialogEditID")
|
||||
dialogDeleteBodyID := c.FormValue("dialogDeleteBodyID")
|
||||
currPagePrm := c.FormValue("currpage" + paginationID)
|
||||
|
||||
currPage, err := strconv.Atoi(currPagePrm)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logger.Info("Edit USER GROUP PARAM",
|
||||
zap.Any("id", id),
|
||||
zap.Any("groupresultname", groupresultname),
|
||||
zap.Any("groupresultflagpertest", groupresultflagpertest),
|
||||
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
|
||||
zap.Any("groupresultresumemcu", groupresultresumemcu),
|
||||
zap.Any("tableid", tableID),
|
||||
zap.Any("search", search),
|
||||
zap.Any("currpage", currPage),
|
||||
)
|
||||
|
||||
// listItem
|
||||
dataResultMcu, err := lh.GroupResultService.GetGroupResultResumeMcu()
|
||||
fmt.Println(dataResultMcu)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR BREADCRUMB DEV",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
fmt.Println(dataResultMcu)
|
||||
return err
|
||||
}
|
||||
|
||||
// Component Dropdown MCU
|
||||
listItemResultMcuComponentInitial := groupresult.ItemDropdown(dataResultMcu, 0)
|
||||
|
||||
// check dropdown result mcu
|
||||
var idSelectedGroupResultResumeMcu int
|
||||
idSelectedGroupResultResumeMcu, err = strconv.Atoi(groupresultresumemcu)
|
||||
if err != nil {
|
||||
// Tangani kesalahan konversi
|
||||
fmt.Println("Error converting string to int:", err)
|
||||
// return
|
||||
test := groupresult.DialogNewBodyV1(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result name",
|
||||
Name: "groupresultid",
|
||||
Placeholder: "Group Result name",
|
||||
Type: "hidden",
|
||||
ID: "groupresultid",
|
||||
},
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result Name",
|
||||
Name: "groupresultname",
|
||||
Placeholder: "Group Result Name",
|
||||
Type: "text", ID: "groupresultname"},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagpertest",
|
||||
ID: "groupresultflagpertest",
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagnonlab",
|
||||
ID: "groupresultflagnonlab",
|
||||
},
|
||||
models.CustomDropdownv1Prm{
|
||||
Label: "Group Result Resume MCU",
|
||||
Name: "groupresultresumemcu",
|
||||
ID: "groupresultresumemcu",
|
||||
},
|
||||
listItemResultMcuComponentInitial,
|
||||
dialogEditBodyID, groupresult.HandleJSModalAddGR(""),
|
||||
)
|
||||
coba := utils.ViewMulti(c, []templ.Component{
|
||||
customtoastv2.CustomToastV2Show("Error", "Error converting string to int", "error"),
|
||||
test})
|
||||
return coba
|
||||
}
|
||||
|
||||
var groupresultresumemcuNew string
|
||||
for _, x := range dataResultMcu {
|
||||
if x.ID == idSelectedGroupResultResumeMcu {
|
||||
groupresultresumemcuNew = x.Text
|
||||
}
|
||||
}
|
||||
|
||||
// check group result flag per test
|
||||
if groupresultflagpertest == "on" {
|
||||
flagPerTest = "Y"
|
||||
}
|
||||
|
||||
// check group result flag non lab
|
||||
if groupresultflagnonlab == "on" {
|
||||
flagNonLab = "Y"
|
||||
}
|
||||
|
||||
if strings.TrimSpace(groupresultname) == "" {
|
||||
listItemResultMcuComponent := groupresult.ItemDropdown(dataResultMcu, idSelectedGroupResultResumeMcu)
|
||||
test := groupresult.DialogNewBodyV1(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result name",
|
||||
Name: "groupresultid",
|
||||
Placeholder: "Group Result name",
|
||||
Type: "hidden",
|
||||
ID: "groupresultid",
|
||||
Value: id,
|
||||
},
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result Name",
|
||||
Name: "groupresultname",
|
||||
Placeholder: "Group Result Name",
|
||||
Value: groupresultname,
|
||||
Type: "text", ID: "groupresultname"},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagpertest",
|
||||
ID: "groupresultflagpertest",
|
||||
Value: groupresultflagpertest,
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagnonlab",
|
||||
ID: "groupresultflagnonlab",
|
||||
Value: groupresultflagnonlab,
|
||||
},
|
||||
models.CustomDropdownv1Prm{
|
||||
Label: "Group Result Resume MCU",
|
||||
Name: "groupresultresumemcu",
|
||||
ID: "groupresultresumemcu",
|
||||
},
|
||||
listItemResultMcuComponent,
|
||||
dialogEditBodyID, groupresult.HandleJSModalAddGR(""))
|
||||
coba := utils.ViewMulti(c, []templ.Component{
|
||||
customtoastv2.CustomToastV2Show("Warning", "Code and name cannot empty", "warning"),
|
||||
test})
|
||||
return coba
|
||||
}
|
||||
|
||||
dataUserGroup, err := lh.GroupResultService.EditGroupResult(id, groupresultname, flagPerTest, flagNonLab, groupresultresumemcuNew)
|
||||
|
||||
if err != nil {
|
||||
listItemResultMcuComponent := groupresult.ItemDropdown(dataResultMcu, idSelectedGroupResultResumeMcu)
|
||||
logger.Info("Error",
|
||||
zap.Any("Error", err),
|
||||
zap.Any("groupresultname", groupresultname),
|
||||
zap.Any("groupresultflagpertest", groupresultflagpertest),
|
||||
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
|
||||
zap.Any("groupresultresumemcu", groupresultresumemcu),
|
||||
)
|
||||
|
||||
test := groupresult.DialogNewBodyV1(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result name",
|
||||
Name: "groupresultid",
|
||||
Placeholder: "Group Result name",
|
||||
Type: "hidden",
|
||||
ID: "groupresultid",
|
||||
Value: id,
|
||||
},
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result Name",
|
||||
Name: "groupresultname",
|
||||
Placeholder: "Group Result Name",
|
||||
Value: groupresultname,
|
||||
Type: "text", ID: "groupresultname"},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagpertest",
|
||||
ID: "groupresultflagpertest",
|
||||
Value: groupresultflagpertest,
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagnonlab",
|
||||
ID: "groupresultflagnonlab",
|
||||
Value: groupresultflagnonlab,
|
||||
},
|
||||
models.CustomDropdownv1Prm{
|
||||
Label: "Group Result Resume MCU",
|
||||
Name: "groupresultresumemcu",
|
||||
ID: "groupresultresumemcu",
|
||||
},
|
||||
listItemResultMcuComponent,
|
||||
dialogEditBodyID, groupresult.HandleJSModalAddGR(""))
|
||||
coba := utils.ViewMulti(c, []templ.Component{
|
||||
customtoastv2.CustomToastV2Show("Error", err.Error(), "danger"),
|
||||
test})
|
||||
return coba
|
||||
}
|
||||
logger.Info("ADD USER GROUP",
|
||||
zap.Any("return", dataUserGroup),
|
||||
zap.Any("groupresultname", groupresultname),
|
||||
zap.Any("groupresultflagpertest", groupresultflagpertest),
|
||||
zap.Any("groupresultflagnonlab", groupresultflagnonlab),
|
||||
zap.Any("groupresultresumemcu", groupresultresumemcu),
|
||||
)
|
||||
dataGroupList, totalpage, err := lh.GroupResultService.GetListGroupResult(search, currPage, 5)
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Info("ERROR GET GROUP RESULT",
|
||||
zap.Any("error", err),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
newForm := groupresult.DialogNewBodyV1(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result name",
|
||||
Name: "groupresultid",
|
||||
Placeholder: "Group Result name",
|
||||
Type: "hidden",
|
||||
ID: "groupresultid",
|
||||
},
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Group Result Name",
|
||||
Name: "groupresultname",
|
||||
Placeholder: "Group Result Name",
|
||||
Type: "text", ID: "groupresultname"},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Per Test (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagpertest",
|
||||
ID: "groupresultflagpertest",
|
||||
},
|
||||
models.CustomCheckboxv1Prm{
|
||||
Label: "Group Result Flag Non Lab (Dicentang Maka Ya)",
|
||||
Name: "groupresultflagnonlab",
|
||||
ID: "groupresultflagnonlab",
|
||||
},
|
||||
models.CustomDropdownv1Prm{
|
||||
Label: "Group Result Resume MCU",
|
||||
Name: "groupresultresumemcu",
|
||||
ID: "groupresultresumemcu",
|
||||
},
|
||||
listItemResultMcuComponentInitial,
|
||||
dialogEditBodyID, groupresult.HandleJSModalAddGR("#"+dialogEditID))
|
||||
|
||||
contentUserGroupComponent := groupresult.TableGroupResult(
|
||||
dataGroupList, tableID, "/dev/groupresultshoweditform",
|
||||
"#"+dialogEditBodyID,
|
||||
"outerHTML",
|
||||
"#dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
"/dev/usergroupshowdeleteform",
|
||||
"#"+dialogDeleteBodyID,
|
||||
"outerHTML",
|
||||
"#dialogDeleteBodyID, #dialogDeleteID, #dialogEditBodyID, #dialogEditID")
|
||||
|
||||
userGroupPaginationComponent := pagination.PaginationV2(totalpage,
|
||||
currPage,
|
||||
"/dev/groupresultv1pagination",
|
||||
paginationID,
|
||||
"#tableID, #searchID, #"+searchID+", #paginationID, #dialogEditBodyID, #dialogEditID, #dialogDeleteBodyID, #dialogDeleteID",
|
||||
"#"+paginationID, "outerHTML", "", "true")
|
||||
|
||||
toastSuccess := customtoastv2.CustomToastV2Show("Success", "Success edit Group Result Name : "+groupresultname, "success")
|
||||
retval := []templ.Component{toastSuccess, contentUserGroupComponent, userGroupPaginationComponent, newForm}
|
||||
// time.Sleep(20 * time.Second)
|
||||
return utils.ViewMulti(c, retval)
|
||||
}
|
||||
|
||||
@@ -239,7 +239,10 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
|
||||
dev.GET("/searchgroupresultv1", devGRhandlers.HandlerShowGroupResultSearchV1)
|
||||
dev.GET("/groupresultv1pagination", devGRhandlers.HandlerShowGroupResultPaginationV1)
|
||||
dev.POST("/groupresulthandlecloseform", devGRhandlers.HandleCloseForm)
|
||||
dev.POST("/groupresulthandlecloseformedit", devGRhandlers.HandleCloseFormEdit)
|
||||
dev.GET("/groupresultshoweditform", devGRhandlers.HandleEditForm)
|
||||
// form add
|
||||
dev.POST("/groupresult/add", devGRhandlers.AddUserGroup)
|
||||
dev.POST("/groupresult/add", devGRhandlers.AddGroupResult)
|
||||
dev.POST("/groupresult/edit", devGRhandlers.EditGroupResult)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user