dialog add
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"cpone/views/dev/masterkelainan"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/labstack/echo/v4"
|
||||
@@ -21,6 +22,8 @@ import (
|
||||
type MasterKelainanService interface {
|
||||
GetListBreadCrumb(title string) (models.BreadCrumbV1, error)
|
||||
GetListMasterKelainan(search string, currentPage int, rowPerPage int) ([]models.Kelainan, int, error)
|
||||
GetKelainanByID(id string) (models.Kelainan, error)
|
||||
AddKelainan(name string) (models.Kelainan, error)
|
||||
}
|
||||
|
||||
func NewMasterKelainanHandler(us MasterKelainanService) *MasterKelainanHandler {
|
||||
@@ -221,3 +224,46 @@ func (lh *MasterKelainanHandler) HandlerShowMasterKelainanPagination(c echo.Cont
|
||||
|
||||
return utils.View(c, si)
|
||||
}
|
||||
|
||||
func (lh *MasterKelainanHandler) AddKelainan(c echo.Context) error {
|
||||
logger, _ := zap.NewProduction()
|
||||
defer logger.Sync()
|
||||
|
||||
name := c.FormValue("kelainanname")
|
||||
// if strings.TrimSpace(name) == "" {
|
||||
// test := masterkelainan.KelainanSwapOOB(name, "Name cannot empty")
|
||||
// return lh.View(c, test)
|
||||
// }
|
||||
if strings.TrimSpace(name) == "" {
|
||||
test := masterkelainan.DialogNewBody(name, "", "Name cannot empty")
|
||||
return lh.View(c, test)
|
||||
}
|
||||
|
||||
dataKelainan, err := lh.MasterKelainanService.AddKelainan(name)
|
||||
|
||||
if err != nil {
|
||||
logger.Info("Error",
|
||||
zap.Any("Error", err),
|
||||
zap.Any("name", name),
|
||||
)
|
||||
|
||||
// test := masterkelainan.KelainanSwapOOB(name, err.Error())
|
||||
// return lh.View(c, test)
|
||||
}
|
||||
logger.Info("ADD KELAINAN",
|
||||
zap.Any("reutn", dataKelainan),
|
||||
zap.Any("name", name),
|
||||
)
|
||||
dataKelainanGet, err := lh.MasterKelainanService.GetKelainanByID("1")
|
||||
fmt.Println(dataKelainan)
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
fmt.Println(dataKelainan)
|
||||
return err
|
||||
}
|
||||
|
||||
v := masterkelainan.DialogEditForm(dataKelainanGet.Mcu_KelainanGroupName)
|
||||
|
||||
return lh.View(c, v)
|
||||
|
||||
}
|
||||
|
||||
@@ -218,4 +218,5 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) {
|
||||
dev.GET("/kelainan", devKLhandlers.HandlerShowMasterKelainan)
|
||||
dev.GET("/searchkelainan", devKLhandlers.HandlerShowMasterKelainanSearch)
|
||||
dev.GET("/kelainanpagination", devKLhandlers.HandlerShowMasterKelainanPagination)
|
||||
dev.POST("/kelainan/add", devKLhandlers.AddKelainan)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func NewServicesMasterKelainan(uStore db.AppStore) *ServicesMasterKelainan {
|
||||
@@ -114,3 +116,70 @@ func (su *ServicesMasterKelainan) GetListMasterKelainan(search string, currentPa
|
||||
|
||||
return kelainanList, totalPage, nil
|
||||
}
|
||||
|
||||
func (su *ServicesMasterKelainan) GetKelainanByID(id string) (models.Kelainan, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
|
||||
var data models.Kelainan
|
||||
err := dbx.Handlex.Get(&data, `SELECT * FROM mcu_kelainangroup
|
||||
WHERE Mcu_KelainanGroupIsActive = 'Y' AND Mcu_KelainanGroupID = ?`, id)
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error get data by id",
|
||||
zap.String("ID", id),
|
||||
)
|
||||
return data, fmt.Errorf("QUERY_FAILED")
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func (su *ServicesMasterKelainan) AddKelainan(name string) (models.Kelainan, error) {
|
||||
logger, _ := zap.NewProduction()
|
||||
var data models.Kelainan
|
||||
var datacek []models.Kelainan
|
||||
|
||||
qryCek := `SELECT Mcu_KelainanGroupName FROM mcu_kelainangroup WHERE Mcu_KelainanGroupName = ?
|
||||
AND Mcu_KelainanGroupID = 'Y'`
|
||||
err := dbx.Handlex.Select(&datacek, qryCek, name)
|
||||
|
||||
if err != nil {
|
||||
defer logger.Sync()
|
||||
logger.Error("Error cek data by name",
|
||||
zap.String("name", name),
|
||||
zap.Any("datacek", datacek),
|
||||
)
|
||||
return data, fmt.Errorf("QUERY_FAILED")
|
||||
}
|
||||
if len(datacek) > 0 {
|
||||
defer logger.Sync()
|
||||
logger.Error("Name already taken by another data",
|
||||
zap.String("name", name),
|
||||
)
|
||||
return data, fmt.Errorf("name sudah dipakai")
|
||||
}
|
||||
|
||||
fmt.Println("cek data name", name)
|
||||
|
||||
// qry := `INSERT INTO mcu_kelainangroup(
|
||||
// Mcu_KelainanGroupName) VALUES(?)`
|
||||
// rst := dbx.Handlex.MustExec(qry, name)
|
||||
// insertedID, err := rst.LastInsertId()
|
||||
// if err != nil {
|
||||
// defer logger.Sync()
|
||||
// logger.Error("Error Insert kelainan",
|
||||
// zap.String("name", name),
|
||||
// )
|
||||
// return data, fmt.Errorf("QUERY_FAILED")
|
||||
// }
|
||||
// s := strconv.Itoa(int(insertedID))
|
||||
// data, err = su.GetKelainanByID(s)
|
||||
// if err != nil {
|
||||
// defer logger.Sync()
|
||||
// logger.Error("Error get kelainan by id",
|
||||
// zap.String("name", name),
|
||||
// )
|
||||
// return data, fmt.Errorf("QUERY_FAILED")
|
||||
// }
|
||||
return data, nil
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package masterkelainan
|
||||
import (
|
||||
"cpone/layout"
|
||||
"cpone/models"
|
||||
"cpone/component/modal"
|
||||
"cpone/component/customtextfield"
|
||||
"strconv"
|
||||
"cpone/component/table"
|
||||
@@ -57,6 +58,18 @@ templ ContentMasterKelainan(
|
||||
<span class="sr-only"></span>
|
||||
</div>
|
||||
</div>
|
||||
<form
|
||||
hx-post="/dev/kelainan/add"
|
||||
class="form"
|
||||
hx-target="#dialogNew"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
@modalcomponent.Modal("dialogNew",
|
||||
"New - Grup Kelainan",
|
||||
DialogNewBody("", "New", ""),
|
||||
DialogNewAction(),
|
||||
BtnCloseNew())
|
||||
</form>
|
||||
@JSku()
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import "bytes"
|
||||
|
||||
import (
|
||||
"cpone/component/customtextfield"
|
||||
"cpone/component/modal"
|
||||
"cpone/component/table"
|
||||
"cpone/layout"
|
||||
"cpone/models"
|
||||
@@ -88,7 +89,19 @@ func ContentMasterKelainan(
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"d-flex justify-content-center text-primary\"><div class=\"htmx-indicator spinner-border\" role=\"status\" id=\"indicator\"><span class=\"sr-only\"></span></div></div>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"d-flex justify-content-center text-primary\"><div class=\"htmx-indicator spinner-border\" role=\"status\" id=\"indicator\"><span class=\"sr-only\"></span></div></div><form hx-post=\"/dev/kelainan/add\" class=\"form\" hx-target=\"#dialogNew\" hx-swap=\"innerHTML\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = modalcomponent.Modal("dialogNew",
|
||||
"New - Grup Kelainan",
|
||||
DialogNewBody("", "New", ""),
|
||||
DialogNewAction(),
|
||||
BtnCloseNew()).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</form>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -134,7 +147,7 @@ func TableRowV1(data []models.Kelainan) templ.Component {
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(v.Nomor)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 72, Col: 16}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 85, Col: 16}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -147,7 +160,7 @@ func TableRowV1(data []models.Kelainan) templ.Component {
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(v.Mcu_KelainanGroupName)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 73, Col: 32}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 86, Col: 32}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -160,7 +173,7 @@ func TableRowV1(data []models.Kelainan) templ.Component {
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs("#dialogEdit" + strconv.Itoa(v.Mcu_KelainanGroupID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 81, Col: 71}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 94, Col: 71}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -173,7 +186,7 @@ func TableRowV1(data []models.Kelainan) templ.Component {
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs("#dialogDelete" + strconv.Itoa(v.Mcu_KelainanGroupID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 90, Col: 73}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 103, Col: 73}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -305,7 +318,7 @@ func TableKelainan(data []models.Kelainan, tableID string) templ.Component {
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(tableID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 178, Col: 18}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 191, Col: 18}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@@ -318,7 +331,7 @@ func TableKelainan(data []models.Kelainan, tableID string) templ.Component {
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs("#" + tableID)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 178, Col: 48}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\masterkelainan\masterkelainan.templ`, Line: 191, Col: 48}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
|
||||
67
views/dev/masterkelainan/modaladdkelainan.templ
Normal file
67
views/dev/masterkelainan/modaladdkelainan.templ
Normal file
@@ -0,0 +1,67 @@
|
||||
package masterkelainan
|
||||
|
||||
import (
|
||||
"cpone/models"
|
||||
"cpone/component/customtextfield"
|
||||
)
|
||||
|
||||
templ DialogNewBody(name string, id string, nameErrorMsg string) {
|
||||
<div id="modalbdy">
|
||||
@customtextfield.CustomTextFieldv2(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Nama Grup Kelainan",
|
||||
Name: "kelainanname",
|
||||
Placeholder: "Nama Grup Kelainan",
|
||||
Type: "text",
|
||||
Value: name,
|
||||
ErrorMsg: nameErrorMsg,
|
||||
})
|
||||
</div>
|
||||
}
|
||||
|
||||
templ DialogErrorBody(name string) {
|
||||
<div id="testttt" class="p-6" hx-swap-oob="#testttt">
|
||||
@customtextfield.CustomTextFieldv2(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Nama Grup Kelainan",
|
||||
Name: "kelainanname",
|
||||
Placeholder: "Nama Grup Kelainan",
|
||||
Type: "text",
|
||||
Value: name,
|
||||
})
|
||||
</div>
|
||||
}
|
||||
|
||||
templ DialogNewAction() {
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4"
|
||||
data-dismiss="modal"
|
||||
>
|
||||
Batal
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary btn-shadow font-weight-bold rounded-lg"
|
||||
>
|
||||
Save changes
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ BtnCloseNew() {
|
||||
<button
|
||||
type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<i aria-hidden="true" class="ki ki-close"></i>
|
||||
</button>
|
||||
}
|
||||
|
||||
// templ KelainanSwapOOB(name string, errorName string) {
|
||||
// @DialogNewBody(name, errorName)
|
||||
// @DialogErrorBody(name)
|
||||
// }
|
||||
148
views/dev/masterkelainan/modaladdkelainan_templ.go
Normal file
148
views/dev/masterkelainan/modaladdkelainan_templ.go
Normal file
@@ -0,0 +1,148 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package masterkelainan
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
import (
|
||||
"cpone/component/customtextfield"
|
||||
"cpone/models"
|
||||
)
|
||||
|
||||
func DialogNewBody(name string, id string, nameErrorMsg string) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"modalbdy\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Nama Grup Kelainan",
|
||||
Name: "kelainanname",
|
||||
Placeholder: "Nama Grup Kelainan",
|
||||
Type: "text",
|
||||
Value: name,
|
||||
ErrorMsg: nameErrorMsg,
|
||||
}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func DialogErrorBody(name string) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var2 == nil {
|
||||
templ_7745c5c3_Var2 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"testttt\" class=\"p-6\" hx-swap-oob=\"#testttt\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Nama Grup Kelainan",
|
||||
Name: "kelainanname",
|
||||
Placeholder: "Nama Grup Kelainan",
|
||||
Type: "text",
|
||||
Value: name,
|
||||
}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func DialogNewAction() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var3 == nil {
|
||||
templ_7745c5c3_Var3 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><button type=\"button\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4\" data-dismiss=\"modal\">Batal\r</button> <button type=\"button\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg\">Save changes\r</button></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func BtnCloseNew() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var4 == nil {
|
||||
templ_7745c5c3_Var4 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><i aria-hidden=\"true\" class=\"ki ki-close\"></i></button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
// templ KelainanSwapOOB(name string, errorName string) {
|
||||
// @DialogNewBody(name, errorName)
|
||||
// @DialogErrorBody(name)
|
||||
// }
|
||||
66
views/dev/masterkelainan/modaleditkelainan.templ
Normal file
66
views/dev/masterkelainan/modaleditkelainan.templ
Normal file
@@ -0,0 +1,66 @@
|
||||
package masterkelainan
|
||||
|
||||
import (
|
||||
"cpone/models"
|
||||
"cpone/component/customtextfield"
|
||||
)
|
||||
|
||||
templ DialogEditForm(name string) {
|
||||
@customtextfield.CustomTextFieldv2(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Nama Grup Kelainan",
|
||||
Name: "kelainanname",
|
||||
Placeholder: "Nama Grup Kelainan",
|
||||
Type: "text",
|
||||
Value: name,
|
||||
})
|
||||
}
|
||||
|
||||
templ DialogEditBody(name string) {
|
||||
<div id="modalbdyEdit">
|
||||
@DialogEditForm(name)
|
||||
</div>
|
||||
}
|
||||
|
||||
templ LoadingSpinner() {
|
||||
<div id="modalbdyEdit">
|
||||
<div class="text-center text-primary">
|
||||
<div class="spinner-border" role="status"></div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ DialogEditAction() {
|
||||
<div>
|
||||
<button
|
||||
id="btledit"
|
||||
type="button"
|
||||
hx-swap="delete"
|
||||
hx-target="#modalbdyEdit"
|
||||
onclick="htmx.trigger('.btneditusgp', 'htmx:abort')"
|
||||
class="btn btn-outline-secondary font-weight-bolder rounded-lg mr-4"
|
||||
data-dismiss="modal"
|
||||
>
|
||||
Batal
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary btn-shadow font-weight-bold rounded-lg"
|
||||
>
|
||||
Save changes
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ BtnCloseEdit() {
|
||||
<button
|
||||
type="button"
|
||||
class="close"
|
||||
data-dismiss="modal"
|
||||
aria-label="Close"
|
||||
hx-target="#modalbdyEdit"
|
||||
onclick="htmx.trigger('.btneditusgp', 'htmx:abort')"
|
||||
>
|
||||
<i aria-hidden="true" class="ki ki-close"></i>
|
||||
</button>
|
||||
}
|
||||
151
views/dev/masterkelainan/modaleditkelainan_templ.go
Normal file
151
views/dev/masterkelainan/modaleditkelainan_templ.go
Normal file
@@ -0,0 +1,151 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.663
|
||||
package masterkelainan
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import "context"
|
||||
import "io"
|
||||
import "bytes"
|
||||
|
||||
import (
|
||||
"cpone/component/customtextfield"
|
||||
"cpone/models"
|
||||
)
|
||||
|
||||
func DialogEditForm(name string) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(
|
||||
models.CustomTextFieldv2Prm{
|
||||
Label: "Nama Grup Kelainan",
|
||||
Name: "kelainanname",
|
||||
Placeholder: "Nama Grup Kelainan",
|
||||
Type: "text",
|
||||
Value: name,
|
||||
}).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func DialogEditBody(name string) templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var2 == nil {
|
||||
templ_7745c5c3_Var2 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"modalbdyEdit\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = DialogEditForm(name).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func LoadingSpinner() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var3 == nil {
|
||||
templ_7745c5c3_Var3 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"modalbdyEdit\"><div class=\"text-center text-primary\"><div class=\"spinner-border\" role=\"status\"></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func DialogEditAction() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var4 == nil {
|
||||
templ_7745c5c3_Var4 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><button id=\"btledit\" type=\"button\" hx-swap=\"delete\" hx-target=\"#modalbdyEdit\" onclick=\"htmx.trigger('.btneditusgp', 'htmx:abort')\" class=\"btn btn-outline-secondary font-weight-bolder rounded-lg mr-4\" data-dismiss=\"modal\">Batal\r</button> <button type=\"button\" class=\"btn btn-primary btn-shadow font-weight-bold rounded-lg\">Save changes\r</button></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func BtnCloseEdit() templ.Component {
|
||||
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
templ_7745c5c3_Buffer = templ.GetBuffer()
|
||||
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var5 == nil {
|
||||
templ_7745c5c3_Var5 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\" hx-target=\"#modalbdyEdit\" onclick=\"htmx.trigger('.btneditusgp', 'htmx:abort')\"><i aria-hidden=\"true\" class=\"ki ki-close\"></i></button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user