From 6b90b7257efaadcce357ae740381ef5d32c45d60 Mon Sep 17 00:00:00 2001 From: sindhu Date: Mon, 20 May 2024 20:52:33 +0700 Subject: [PATCH] step 5 : swap oob modal dan set timeout loading --- assets/mcu/be_wording.php | 29 ++++ assets/mcu/kartukontrolv1.html | 40 +---- handlers/dev/kartukontrol.handlers.go | 21 ++- handlers/routes.go | 1 + views/dev/kartukontrol/kartukontrol.templ | 72 +++++++- views/dev/kartukontrol/kartukontrol_templ.go | 165 ++++++++++++++++--- 6 files changed, 270 insertions(+), 58 deletions(-) create mode 100644 assets/mcu/be_wording.php diff --git a/assets/mcu/be_wording.php b/assets/mcu/be_wording.php new file mode 100644 index 0000000..83d5364 --- /dev/null +++ b/assets/mcu/be_wording.php @@ -0,0 +1,29 @@ + + + \ No newline at end of file diff --git a/assets/mcu/kartukontrolv1.html b/assets/mcu/kartukontrolv1.html index ae00cd3..6503787 100644 --- a/assets/mcu/kartukontrolv1.html +++ b/assets/mcu/kartukontrolv1.html @@ -78,6 +78,7 @@ License: You must have a valid license purchased only from themeforest(the above + @@ -121,6 +122,10 @@ License: You must have a valid license purchased only from themeforest(the above .smallf { font-size: 10px; } + + .modalcover { + background-color: #00000073; + }
@@ -268,38 +273,9 @@ License: You must have a valid license purchased only from themeforest(the above
- +
+ +
diff --git a/handlers/dev/kartukontrol.handlers.go b/handlers/dev/kartukontrol.handlers.go index 6ed5ad6..db75a30 100644 --- a/handlers/dev/kartukontrol.handlers.go +++ b/handlers/dev/kartukontrol.handlers.go @@ -5,6 +5,7 @@ import ( "cpone/utils" kartukontrol "cpone/views/dev/kartukontrol" + "github.com/a-h/templ" "github.com/labstack/echo/v4" "go.uber.org/zap" ) @@ -44,7 +45,25 @@ func (lh *KartuKontrolHandler) HandlerShowKartuKontrol(c echo.Context) error { zap.Any("prm", id), ) - si := kartukontrol.ShowKartuKontrol("Kartu Kontrol", kartukontrol.MainContentKartuKontrolLayout(dataKartuKontrol), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol()) + var si templ.Component + var isShowSurveyMcu bool = true + + if isShowSurveyMcu { + si = kartukontrol.ShowKartuKontrol("Kartu Kontrol", kartukontrol.MainContentKartuKontrolLayout(dataKartuKontrol, "/dev/modalsurveykartukontrol", "load delay:3s", "modalWordingSurveyMcu"), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol()) + } else { + si = kartukontrol.ShowKartuKontrol("Kartu Kontrol", + kartukontrol.MainContentKartuKontrolLayout(dataKartuKontrol, "", "", "modalWordingSurveyMcu"), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol()) + } + + return utils.View(c, si) +} + +func (lh *KartuKontrolHandler) HandlerShowWordingModalSurveyMcu(c echo.Context) error { + + // var dataKartuKontrol []models.KartuKontrolModel + si := kartukontrol.ShowKartuKontrol( + "Kartu Kontrol", + kartukontrol.ModalMcuWordingShow("modalWordingSurveyMcu", "Silahkan isi questioner untuk membantu peningkatan layanan kami. Terima kasih."), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol()) return utils.View(c, si) } diff --git a/handlers/routes.go b/handlers/routes.go index 549d0d9..845482b 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -211,4 +211,5 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) { devKartuKontrolServices := dev_services.NewServicesKartuKontrol(appStore) devKartuKontrolhandlers := dev_handlers.NewKartuKontrolHandler(devKartuKontrolServices) dev.GET("/kartukontrol/:id", devKartuKontrolhandlers.HandlerShowKartuKontrol) + dev.GET("/modalsurveykartukontrol", devKartuKontrolhandlers.HandlerShowWordingModalSurveyMcu) } diff --git a/views/dev/kartukontrol/kartukontrol.templ b/views/dev/kartukontrol/kartukontrol.templ index bb4b28b..6c78019 100644 --- a/views/dev/kartukontrol/kartukontrol.templ +++ b/views/dev/kartukontrol/kartukontrol.templ @@ -5,7 +5,7 @@ import ( "cpone/layout" ) -templ MainContentKartuKontrolLayout(dataKartuKontrol []models.KartuKontrolModel) { +templ MainContentKartuKontrolLayout(dataKartuKontrol []models.KartuKontrolModel, hxGet string, hxTrigger string, idModal string) {
if len(dataKartuKontrol) > 0 { @@ -14,6 +14,7 @@ templ MainContentKartuKontrolLayout(dataKartuKontrol []models.KartuKontrolModel) }
+ @ModalMcuWordingProcessShow(hxTrigger, hxGet, idModal) } templ ContentDataPasienList(dataPasienList []models.DataPasien) { @@ -118,6 +119,72 @@ templ ContentPengambilanSampleList(dataPemeriksaanPengambilanSample []models.Dat
} +templ ModalMcuWordingProcessShow(hxTrigger string, hxGet string, idModal string) { +
+
+} + +templ ModalMcuWordingShow(idModal string, messageWording string) { + + + +} + templ CssKartuKontrol() { } diff --git a/views/dev/kartukontrol/kartukontrol_templ.go b/views/dev/kartukontrol/kartukontrol_templ.go index ac71b6e..0239b30 100644 --- a/views/dev/kartukontrol/kartukontrol_templ.go +++ b/views/dev/kartukontrol/kartukontrol_templ.go @@ -15,7 +15,7 @@ import ( "cpone/models" ) -func MainContentKartuKontrolLayout(dataKartuKontrol []models.KartuKontrolModel) templ.Component { +func MainContentKartuKontrolLayout(dataKartuKontrol []models.KartuKontrolModel, hxGet string, hxTrigger string, idModal 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 { @@ -50,6 +50,10 @@ func MainContentKartuKontrolLayout(dataKartuKontrol []models.KartuKontrolModel) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = ModalMcuWordingProcessShow(hxTrigger, hxGet, idModal).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) } @@ -77,7 +81,7 @@ func ContentDataPasienList(dataPasienList []models.DataPasien) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(dataPasienList[0].NomorRegistrasi) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 28, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 29, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -90,7 +94,7 @@ func ContentDataPasienList(dataPasienList []models.DataPasien) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(dataPasienList[0].NomorLab) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 32, Col: 35} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 33, Col: 35} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -103,7 +107,7 @@ func ContentDataPasienList(dataPasienList []models.DataPasien) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(dataPasienList[0].NamaPasien) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 36, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 37, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -116,7 +120,7 @@ func ContentDataPasienList(dataPasienList []models.DataPasien) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(dataPasienList[0].TanggalLahir) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 40, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 41, Col: 39} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -129,7 +133,7 @@ func ContentDataPasienList(dataPasienList []models.DataPasien) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(dataPasienList[0].Umur) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 40, Col: 68} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 41, Col: 68} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -142,7 +146,7 @@ func ContentDataPasienList(dataPasienList []models.DataPasien) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(dataPasienList[0].JenisKelamin) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 44, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 45, Col: 39} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -155,7 +159,7 @@ func ContentDataPasienList(dataPasienList []models.DataPasien) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(dataPasienList[0].NamaDivisi) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 48, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 49, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -168,7 +172,7 @@ func ContentDataPasienList(dataPasienList []models.DataPasien) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(dataPasienList[0].NamaCompany) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 52, Col: 38} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 53, Col: 38} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -251,7 +255,7 @@ func ContentPemeriksaanList(dataPemeriksaan []models.DataPemeriksaanList) templ. var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(v.NamaPemeriksaanList) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 71, Col: 36} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 72, Col: 36} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -309,7 +313,7 @@ func ContentPengambilanSampleList(dataPemeriksaanPengambilanSample []models.Data var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(v.NamaPemeriksaanPengambilanSample) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 88, Col: 46} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 89, Col: 46} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -332,7 +336,7 @@ func ContentPengambilanSampleList(dataPemeriksaanPengambilanSample []models.Data var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(k.SampleTypeName) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 95, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 96, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { @@ -350,7 +354,7 @@ func ContentPengambilanSampleList(dataPemeriksaanPengambilanSample []models.Data var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(k.SampleTypeDateTime) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 97, Col: 70} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 98, Col: 70} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { @@ -368,7 +372,7 @@ func ContentPengambilanSampleList(dataPemeriksaanPengambilanSample []models.Data var templ_7745c5c3_Var18 string templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(k.SampleTypeStatus) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 101, Col: 122} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 102, Col: 122} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) if templ_7745c5c3_Err != nil { @@ -411,7 +415,7 @@ func ContentPengambilanSampleList(dataPemeriksaanPengambilanSample []models.Data }) } -func CssKartuKontrol() templ.Component { +func ModalMcuWordingProcessShow(hxTrigger string, hxGet string, idModal 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 { @@ -424,7 +428,120 @@ func CssKartuKontrol() templ.Component { templ_7745c5c3_Var19 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 ModalMcuWordingShow(idModal string, messageWording 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_Var23 := templ.GetChildren(ctx) + if templ_7745c5c3_Var23 == nil { + templ_7745c5c3_Var23 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Perhatian

Loading...
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var25 string + templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(messageWording) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\kartukontrol\kartukontrol.templ`, Line: 151, Col: 22} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + 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 CssKartuKontrol() 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_Var26 := templ.GetChildren(ctx) + if templ_7745c5c3_Var26 == nil { + templ_7745c5c3_Var26 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -443,9 +560,9 @@ func JsKartuKontrol() templ.Component { defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var20 := templ.GetChildren(ctx) - if templ_7745c5c3_Var20 == nil { - templ_7745c5c3_Var20 = templ.NopComponent + templ_7745c5c3_Var27 := templ.GetChildren(ctx) + if templ_7745c5c3_Var27 == nil { + templ_7745c5c3_Var27 = templ.NopComponent } ctx = templ.ClearChildren(ctx) if !templ_7745c5c3_IsBuffer { @@ -463,12 +580,12 @@ func ShowKartuKontrol(title string, cmp templ.Component, css templ.Component, js defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var21 := templ.GetChildren(ctx) - if templ_7745c5c3_Var21 == nil { - templ_7745c5c3_Var21 = templ.NopComponent + templ_7745c5c3_Var28 := templ.GetChildren(ctx) + if templ_7745c5c3_Var28 == nil { + templ_7745c5c3_Var28 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var22 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var29 := 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() @@ -483,7 +600,7 @@ func ShowKartuKontrol(title string, cmp templ.Component, css templ.Component, js } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var22), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var29), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }