From d8278b68866300fcfd8db585faf460a7f81a0fe1 Mon Sep 17 00:00:00 2001 From: sindhu Date: Wed, 22 May 2024 16:39:41 +0700 Subject: [PATCH] add kartu kontrol and survey mcu into public --- .../asset-corporate-portal/css/sas.bundle.css | 19 + handlers/public/kartukontrol.handlers.go | 118 ++++ handlers/public/surveymcu.handlers.go | 194 ++++++ handlers/routes.go | 20 + models/kartukontrol.models.go | 33 + models/surveymcu.models.go | 24 + services/public/kartukontrol.services.go | 112 +++ services/public/surveymcu.services.go | 120 ++++ utils/surveymcu.utils.go | 35 + views/public/kartukontrol/kartukontrol.templ | 267 +++++++ .../public/kartukontrol/kartukontrol_templ.go | 651 ++++++++++++++++++ views/public/surveymcu/surveymcu.templ | 305 ++++++++ views/public/surveymcu/surveymcu_templ.go | 455 ++++++++++++ .../toast/toastpublickartukontrol.templ | 101 +++ .../toast/toastpublickartukontrol_templ.go | 242 +++++++ 15 files changed, 2696 insertions(+) create mode 100644 handlers/public/kartukontrol.handlers.go create mode 100644 handlers/public/surveymcu.handlers.go create mode 100644 models/kartukontrol.models.go create mode 100644 models/surveymcu.models.go create mode 100644 services/public/kartukontrol.services.go create mode 100644 services/public/surveymcu.services.go create mode 100644 utils/surveymcu.utils.go create mode 100644 views/public/kartukontrol/kartukontrol.templ create mode 100644 views/public/kartukontrol/kartukontrol_templ.go create mode 100644 views/public/surveymcu/surveymcu.templ create mode 100644 views/public/surveymcu/surveymcu_templ.go create mode 100644 views/public/toast/toastpublickartukontrol.templ create mode 100644 views/public/toast/toastpublickartukontrol_templ.go diff --git a/assets/asset-corporate-portal/css/sas.bundle.css b/assets/asset-corporate-portal/css/sas.bundle.css index 6896ce4..a7103ac 100644 --- a/assets/asset-corporate-portal/css/sas.bundle.css +++ b/assets/asset-corporate-portal/css/sas.bundle.css @@ -59,6 +59,8 @@ SEARCH GROUP CSS KEYWORD "###" --dangerbg: #f7c9c9; --toscabg: #c9f7f5; --fieldbg: #f5f8fa; + --labelkartukontrolSudahbg: #e8fff3; + --labelkartukontrolBelumbg: #fff8dd; /* END BACKGROUND */ /* TEXT COLOR */ --text-black: #0e1e28; @@ -67,6 +69,8 @@ SEARCH GROUP CSS KEYWORD "###" --text-header-table: #b5b5c3; --header-table-bg: #f3f6f9; --active-state: #637381; + --textcolorlabelkartukontrolSudah: #50cd89; + --textcolorlabelkartukontrolBelum: #f1bc00; /* END TEXT COLOR */ --light: #f3f6f9; --dark: #181c32; @@ -5205,6 +5209,21 @@ a.text-hover-tosca:hover .svg-icon svg:hover g [fill], font-size: 1.1rem; } +/* ### KARTU KONTROL CSS */ +.kartukontrol-sudah-label { + background-color: var(--labelkartukontrolSudahbg); /*figma*/ + color: var(--textcolorlabelkartukontrolSudah); /*figma*/ + padding: 0.15rem 0.75rem; + border-radius: 0.42rem; +} + +.kartukontrol-pending-label { + background-color: var(--labelkartukontrolBelumbg); /*figma*/ + color: var(--textcolorlabelkartukontrolBelum); /*figma*/ + padding: 0.15rem 0.75rem; + border-radius: 0.42rem; +} + /* ### OVERLAY */ .overlay-loading { position: relative !important; diff --git a/handlers/public/kartukontrol.handlers.go b/handlers/public/kartukontrol.handlers.go new file mode 100644 index 0000000..660f473 --- /dev/null +++ b/handlers/public/kartukontrol.handlers.go @@ -0,0 +1,118 @@ +package public_handlers + +import ( + "cpone/models" + "cpone/utils" + kartukontrol "cpone/views/public/kartukontrol" + public_toast "cpone/views/public/toast" + + "github.com/a-h/templ" + "github.com/labstack/echo/v4" + "go.uber.org/zap" +) + +type KartuKontrolService interface { + GetkartuKontrolById(nomorRegistrasi string) ([]models.KartuKontrolModel, error) +} + +func NewKartuKontrolHandler(us KartuKontrolService) *KartuKontrolHandler { + return &KartuKontrolHandler{ + KartuKontrolService: us, + } +} + +type KartuKontrolHandler struct { + KartuKontrolService KartuKontrolService +} + +func (lh *KartuKontrolHandler) HandlerHideToast(c echo.Context) error { + toastComponent := public_toast.PublicToastV1KartuKontrolHide() + + si := toastComponent + + return utils.View(c, si) +} + +func (lh *KartuKontrolHandler) HandlerShowKartuKontrol(c echo.Context) error { + + var flagxError bool = true + var msgx string = "" + + nomorRegistrasi := c.Param("nomorRegistrasi") + + urlSurveyMcu := "redirectsurveymcu" + + // urlSurveyMcu := "redirectsurveymcu" + + // nomorRegistrasi := "1" + logger, _ := zap.NewProduction() + defer logger.Sync() + + dataKartuKontrol, err := lh.KartuKontrolService.GetkartuKontrolById(nomorRegistrasi) + + if err != nil { + logger.Info("Error", + zap.Any("Error", err), + zap.Any("prm", nomorRegistrasi), + ) + // return err + if flagxError { + msgx = "Error Get Kartu Kontrol" + si := public_toast.PublicToastV1KartuKontrolShow("Error", msgx, "danger") + return utils.View(c, si) + } + } + logger.Info("SHOW DATA KARTU KONTROL handler", + zap.Any("return", dataKartuKontrol), + zap.Any("prm", nomorRegistrasi), + ) + + flagxError = false + var si templ.Component + var isShowSurveyMcu bool = true + + if isShowSurveyMcu { + si = kartukontrol.ShowKartuKontrol("Kartu Kontrol", kartukontrol.MainContentKartuKontrolLayout(dataKartuKontrol, "/modalsurveykartukontrol", "load delay:3s", "modalWordingSurveyMcu", urlSurveyMcu, nomorRegistrasi), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol()) + } else { + si = kartukontrol.ShowKartuKontrol("Kartu Kontrol", + kartukontrol.MainContentKartuKontrolLayout(dataKartuKontrol, "", "", "modalWordingSurveyMcu", urlSurveyMcu, nomorRegistrasi), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol()) + } + + return utils.View(c, si) +} + +func (lh *KartuKontrolHandler) HandlerShowWordingModalSurveyMcu(c echo.Context) error { + + stringUrlToSurveyMcu := c.QueryParam("urlSurveyMcu") + + // var dataKartuKontrol []models.KartuKontrolModel + si := kartukontrol.ShowKartuKontrol( + "Kartu Kontrol", + kartukontrol.ModalMcuWordingShow("modalWordingSurveyMcu", "Silahkan isi questioner untuk membantu peningkatan layanan kami. Terima kasih.", stringUrlToSurveyMcu), kartukontrol.CssKartuKontrol(), kartukontrol.JsKartuKontrol()) + + return utils.View(c, si) +} + +func (lh *KartuKontrolHandler) HandlerRedirectToSurveyMcu(c echo.Context) error { + + nomorRegistrasi := c.QueryParam("nomorRegistrasi") + stringUrlToSurveyMcu := "/surveymcu/" + nomorRegistrasi + + logger, _ := zap.NewProduction() + defer logger.Sync() + + if len(stringUrlToSurveyMcu) > 0 { + // redirect ke kartu kontrol + logger.Info("redirect SURVEY MCU", + zap.Any("redirect SURVEY MCU", stringUrlToSurveyMcu), + ) + c.Response().Header().Set("HX-Redirect", stringUrlToSurveyMcu) + // return c.NoContent(http.StatusOK) + } + + 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/public/surveymcu.handlers.go b/handlers/public/surveymcu.handlers.go new file mode 100644 index 0000000..c0befd3 --- /dev/null +++ b/handlers/public/surveymcu.handlers.go @@ -0,0 +1,194 @@ +package public_handlers + +import ( + "cpone/models" + "cpone/utils" + surveymcu "cpone/views/public/surveymcu" + public_toast "cpone/views/public/toast" + + "github.com/a-h/templ" + "github.com/labstack/echo/v4" + "go.uber.org/zap" +) + +type SurveyMcuService interface { + GetSurveyMcuByNoreg(nomorRegistrasi string) ([]models.SurveyMcu, error) +} + +func NewSurveyMcuHandler(us SurveyMcuService) *SurveyMcuHandler { + return &SurveyMcuHandler{ + SurveyMcuService: us, + } +} + +type SurveyMcuHandler struct { + SurveyMcuService SurveyMcuService +} + +func (lh *SurveyMcuHandler) HandlerShowSurveyMcu(c echo.Context) error { + + var flagxError bool = true + var msgx string = "" + + nomorRegistrasi := c.Param("nomorRegistrasi") + // nomorRegistrasi := "1" + logger, _ := zap.NewProduction() + defer logger.Sync() + + dataSurveyMcu, err := lh.SurveyMcuService.GetSurveyMcuByNoreg(nomorRegistrasi) + + if err != nil { + logger.Info("Error", + zap.Any("Error", err), + zap.Any("prm", nomorRegistrasi), + ) + // return err + if flagxError { + msgx = "Error Get Survey MCU By No Reg" + si := public_toast.PublicToastV1KartuKontrolShow("Error", msgx, "danger") + return utils.View(c, si) + } + } + + flagxError = false + logger.Info("SHOW DATA SURVEY MCU handler", + zap.Any("return", dataSurveyMcu), + zap.Any("prm", nomorRegistrasi), + ) + + stringUrl := "surveymcuproses/" + nomorRegistrasi + var hxInclude string = "" + var idClearMsg []models.IdClearErrorMessage + + if len(dataSurveyMcu) > 0 { + hxInclude = utils.ConcatHxIncludeSurveyMcu(dataSurveyMcu) + } + + si := surveymcu.ShowSurveyMcu("Survey Mcu", + surveymcu.MainContentSurveyMcuLayout(dataSurveyMcu, stringUrl, surveymcu.ErrorMessageSurveyMcu("", "", idClearMsg, "alertSaranMcu", public_toast.PublicToastV1KartuKontrolHide()), hxInclude), surveymcu.CssSurveyMcu(), surveymcu.JsSurveyMcu()) + + return utils.View(c, si) +} + +func (lh *SurveyMcuHandler) HandlerProcessSurveyMcu(c echo.Context) error { + + var flagxError bool = true + var msgx string = "" + + nomorRegistrasi := c.Param("nomorRegistrasi") + stringUrlBackToKartuKontrol := "/kartukontrol/" + nomorRegistrasi + // nomorRegistrasi := "1" + logger, _ := zap.NewProduction() + defer logger.Sync() + + dataSurveyMcu, err := lh.SurveyMcuService.GetSurveyMcuByNoreg(nomorRegistrasi) + + if err != nil { + logger.Info("Error", + zap.Any("Error", err), + zap.Any("prm", nomorRegistrasi), + ) + // return err + if flagxError { + msgx = "Error Get Survey MCU By No Reg" + si := public_toast.PublicToastV1KartuKontrolShow("Error", msgx, "danger") + return utils.View(c, si) + } + } + + logger.Info("SHOW DATA SURVEY MCU handler", + zap.Any("return", dataSurveyMcu), + zap.Any("prm", nomorRegistrasi), + ) + + // form := c.Request().PostForm + + // stringUrl := "surveymcuproses/" + nomorRegistrasi + + logger.Info("CEK POST handler", + zap.Any("c.FormValue Saran", c.FormValue("saranmcu-11")), + ) + + // proses validasi + + var si templ.Component + var idFormKosong string = "" + var stringMessage string = "" + var isFormEmpty bool = false + var idClearMsg []models.IdClearErrorMessage + 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 { + + if len(c.FormValue("radio-"+x.IDItemSurvey)) > 0 { + idClearMsg = append(idClearMsg, models.IdClearErrorMessage{IdItem: x.IDItemSurvey}) + } + + 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) + isFormEmpty = true + hasError = true + flagxError = true + break + } + } + } + + if hasError { + break + } + } + } + + // 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 "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 { + // if flagxError { + // msgx = "Error Get Survey MCU By No Reg" + // si := public_toast.PublicToastV1KartuKontrolShow("Error", msgx, "danger") + // return utils.View(c, si) + // } + si = surveymcu.ErrorMessageSurveyMcu(stringMessage, idFormKosong, idClearMsg, idSaranMcuAlert, public_toast.PublicToastV1KartuKontrolShow("Warning", stringMessage, "warning")) + } else { + flagxError = false + si = surveymcu.ErrorMessageSurveyMcu("", "", idClearMsg, "", public_toast.PublicToastV1KartuKontrolHide()) + logger.Info("redirect", + zap.Any("redirect", stringUrlBackToKartuKontrol), + ) + + // redirect ke kartu kontrol + c.Response().Header().Set("HX-Redirect", stringUrlBackToKartuKontrol) + } + + return utils.View(c, si) +} diff --git a/handlers/routes.go b/handlers/routes.go index 7e23bcd..21ab444 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -68,6 +68,26 @@ func SetupRoutesPublic(app *echo.Echo, appStore db.AppStore) { public.GET("landingpage", lh.ShowLandingPage) loginHdr := public_handlers.NewLoginHandler(l) public.GET("login", loginHdr.HandlerShowLogin) + + // kartu kontrol + publicKartuKontrolServices := public_services.NewServicesKartuKontrol(appStore) + publicKartuKontrolhandlers := public_handlers.NewKartuKontrolHandler(publicKartuKontrolServices) + public.GET("kartukontrol/:nomorRegistrasi", publicKartuKontrolhandlers.HandlerShowKartuKontrol) + public.GET("modalsurveykartukontrol", publicKartuKontrolhandlers.HandlerShowWordingModalSurveyMcu) + + // survey mcu page (pertanyaan dan jawaban) + publicSurveyMcuServices := public_services.NewServicesSurveyMcu(appStore) + publicSurveyMcuhandlers := public_handlers.NewSurveyMcuHandler(publicSurveyMcuServices) + public.GET("surveymcu/:nomorRegistrasi", publicSurveyMcuhandlers.HandlerShowSurveyMcu) + + // hide toast + public.GET("hidetoastkartukontrol", publicKartuKontrolhandlers.HandlerHideToast) + + // surveymcuproses + public.POST("surveymcuproses/:nomorRegistrasi", publicSurveyMcuhandlers.HandlerProcessSurveyMcu) + + // redirect to survey mcu page + public.GET("redirectsurveymcu", publicKartuKontrolhandlers.HandlerRedirectToSurveyMcu) } func SetupRoutesCorporate(app *echo.Echo, appStore db.AppStore) { public := app.Group("/corp") diff --git a/models/kartukontrol.models.go b/models/kartukontrol.models.go new file mode 100644 index 0000000..749e831 --- /dev/null +++ b/models/kartukontrol.models.go @@ -0,0 +1,33 @@ +package models + +type KartuKontrolModel struct { + KartuKontrolDataPasienList []DataPasien `json:"kartuKontrolDataPasien"` + KartuKontrolDataPemeriksaanList []DataPemeriksaanList `json:"kartuKontrolDataPemeriksaanList"` + KartuKontrolDataPemeriksaanPengambilanSample []DataPemeriksaanPengambilanSample `json:"kartuKontrolDataPemeriksaanPengambilanSample"` +} + +type DataPasien struct { + NomorRegistrasi string `json:"nomorRegistrasi"` + NomorLab string `json:"nomorLab"` + NamaPasien string `json:"namaPasien"` + TanggalLahir string `json:"tanggalLahir"` + Umur string `json:"umur"` + JenisKelamin string `json:"jenisKelamin"` + NamaDivisi string `json:"namaDivisi"` + NamaCompany string `json:"namaCompany"` +} + +type DataPemeriksaanList struct { + NamaPemeriksaanList string `json:"namaPemeriksaanList"` +} + +type SampleTypeList struct { + SampleTypeName string `json:"sampleTypeName"` + SampleTypeDateTime string `json:"sampleTypeDateTime"` + SampleTypeStatus string `json:"sampleTypeStatus"` +} + +type DataPemeriksaanPengambilanSample struct { + NamaPemeriksaanPengambilanSample string `json:"namaPemeriksaanPengambilanSample"` + SampleTypeListData []SampleTypeList `json:"sampleTypeListData"` +} diff --git a/models/surveymcu.models.go b/models/surveymcu.models.go new file mode 100644 index 0000000..8aef60d --- /dev/null +++ b/models/surveymcu.models.go @@ -0,0 +1,24 @@ +package models + +type SurveyMcu struct { + DataListItemSurveyMcu []ItemSurveyMcu `json:"dataListItemSurveyMcu"` + DataListItemSurveyMcuSaran []ItemSurveyMcuSaran `json:"datalistitemsurveymcusaran"` +} + +type ItemSurveyMcu struct { + IDItemSurvey string `json:"iditemsurvey"` + Nomor string `json:"nomor"` + Pertanyaan string `json:"pertanyaan"` + NameRadioButton string `json:"nameradiobutton"` + ErrorMessage string `json:"errorMessage"` +} + +type ItemSurveyMcuSaran struct { + IDItemSurveyMcuSaran string `json:"iditemsurveymcusaran"` + NameSurveyMcuSaran string `json:"namesurveymcusaran"` + ErrorMessageSurveyMcuSaran string `json:"errormessagesurveymcusaran"` +} + +type IdClearErrorMessage struct { + IdItem string `json:"iditem"` +} diff --git a/services/public/kartukontrol.services.go b/services/public/kartukontrol.services.go new file mode 100644 index 0000000..2116280 --- /dev/null +++ b/services/public/kartukontrol.services.go @@ -0,0 +1,112 @@ +package public_services + +import ( + "cpone/db" + "cpone/models" + + "go.uber.org/zap" +) + +func NewServicesKartuKontrol(uStore db.AppStore) *ServicesKartuKontrol { + + return &ServicesKartuKontrol{ + KartuKontrolStore: uStore, + } +} + +type ServicesKartuKontrol struct { + KartuKontrolStore db.AppStore +} + +func (su *ServicesKartuKontrol) GetkartuKontrolById(nomorRegistrasi string) ([]models.KartuKontrolModel, error) { + + logger, _ := zap.NewProduction() + defer logger.Sync() + logger.Info("QUERY SEARCH GET KARTU KONTROL", + zap.String("query search", ""), + ) + + dataPasien := []models.DataPasien{ + { + NomorRegistrasi: "00234", + NomorLab: "LA90002", + NamaPasien: "Hendra Setiawan", + TanggalLahir: "2000-01-01", + Umur: "24 tahun", + JenisKelamin: "Laki-laki", + NamaDivisi: "Development", + NamaCompany: "PT. Sadhana Abiyasa Sampoerna", + }, + } + + dataPemeriksaanList := []models.DataPemeriksaanList{ + {NamaPemeriksaanList: "Hematologi Lengkap"}, + {NamaPemeriksaanList: "Urine Lengkap"}, + {NamaPemeriksaanList: "ACG"}, + {NamaPemeriksaanList: "Treadmill"}, + {NamaPemeriksaanList: "Pemeriksaan Fisik"}, + {NamaPemeriksaanList: "Hematologi Lengkap"}, + {NamaPemeriksaanList: "Urine Lengkap"}, + {NamaPemeriksaanList: "ACG"}, + {NamaPemeriksaanList: "Treadmill"}, + {NamaPemeriksaanList: "Pemeriksaan Fisik"}, + {NamaPemeriksaanList: "Hematologi Lengkap"}, + {NamaPemeriksaanList: "Urine Lengkap"}, + {NamaPemeriksaanList: "ACG"}, + {NamaPemeriksaanList: "Treadmill"}, + {NamaPemeriksaanList: "Pemeriksaan Fisik"}, + {NamaPemeriksaanList: "Hematologi Lengkap"}, + {NamaPemeriksaanList: "Urine Lengkap"}, + {NamaPemeriksaanList: "ACG"}, + {NamaPemeriksaanList: "Treadmill"}, + {NamaPemeriksaanList: "Pemeriksaan Fisik"}, + } + + dataPemeriksaanPengambilanSample := []models.DataPemeriksaanPengambilanSample{ + { + NamaPemeriksaanPengambilanSample: "Laboratorium", + SampleTypeListData: []models.SampleTypeList{ + { + SampleTypeName: "Darah", + SampleTypeDateTime: "15-05-2024 10:00", + SampleTypeStatus: "Sudah", + }, + { + SampleTypeName: "Urine", + SampleTypeDateTime: "15-05-2024 10:00", + SampleTypeStatus: "Sudah", + }, + }, + }, + { + NamaPemeriksaanPengambilanSample: "Rontgen", + SampleTypeListData: []models.SampleTypeList{ + { + SampleTypeName: "Thorax AP (PCR)", + SampleTypeDateTime: "", + SampleTypeStatus: "Sudah", + }, + }, + }, + { + NamaPemeriksaanPengambilanSample: "Elektromedis", + SampleTypeListData: []models.SampleTypeList{ + { + SampleTypeName: "ECG", + SampleTypeStatus: "Belum", + SampleTypeDateTime: "", + }, + }, + }, + } + + kartuKontrol := []models.KartuKontrolModel{ + { + KartuKontrolDataPasienList: dataPasien, + KartuKontrolDataPemeriksaanList: dataPemeriksaanList, + KartuKontrolDataPemeriksaanPengambilanSample: dataPemeriksaanPengambilanSample, + }, + } + + return kartuKontrol, nil +} diff --git a/services/public/surveymcu.services.go b/services/public/surveymcu.services.go new file mode 100644 index 0000000..4078dde --- /dev/null +++ b/services/public/surveymcu.services.go @@ -0,0 +1,120 @@ +package public_services + +import ( + "cpone/db" + "cpone/models" + + "go.uber.org/zap" +) + +func NewServicesSurveyMcu(uStore db.AppStore) *SurveyMcuService { + + return &SurveyMcuService{ + SurveyMcuStore: uStore, + } +} + +type SurveyMcuService struct { + SurveyMcuStore db.AppStore +} + +func (su *SurveyMcuService) GetSurveyMcuByNoreg(nomorRegistrasi string) ([]models.SurveyMcu, error) { + + logger, _ := zap.NewProduction() + defer logger.Sync() + logger.Info("QUERY SEARCH GET SURVEY MCU BY NOMOR REGISTRASI", + zap.String("query search", ""), + ) + + // radio button + dataItemSurveyMcu := []models.ItemSurveyMcu{ + { + IDItemSurvey: "1", + Nomor: "1", + Pertanyaan: "Bagaimana Penilaian Sikap & Keramahan Petugas?", + ErrorMessage: "", + NameRadioButton: "radio-1", + }, + { + IDItemSurvey: "2", + Nomor: "2", + Pertanyaan: "Bagaimana Penilaian Penampilan Petugas?", + ErrorMessage: "", + NameRadioButton: "radio-2", + }, + { + IDItemSurvey: "3", + Nomor: "3", + Pertanyaan: "Bagaimana Penilaian Ketrampilan Petugas?", + ErrorMessage: "", + NameRadioButton: "radio-3", + }, + { + IDItemSurvey: "4", + Nomor: "4", + Pertanyaan: "Bagaimana Penilaian Pemberian Informasi Petugas?", + ErrorMessage: "", + NameRadioButton: "radio-4", + }, + { + IDItemSurvey: "5", + Nomor: "5", + Pertanyaan: "Bagaimana Penilaian Kelengkapan Alat?", + ErrorMessage: "", + NameRadioButton: "radio-5", + }, + { + IDItemSurvey: "6", + Nomor: "6", + Pertanyaan: "Bagaimana Penilaian Kelayakan Alat?", + ErrorMessage: "", + NameRadioButton: "radio-6", + }, + { + IDItemSurvey: "7", + Nomor: "7", + Pertanyaan: "Bagaimana Penilaian Kebersihan Ruangan?", + ErrorMessage: "", + NameRadioButton: "radio-7", + }, + { + IDItemSurvey: "8", + Nomor: "8", + Pertanyaan: "Bagaimana Penilaian Kebersihan Ruangan?", + ErrorMessage: "", + NameRadioButton: "radio-8", + }, + { + IDItemSurvey: "9", + Nomor: "9", + Pertanyaan: "Bagaimana Penilaian Alur Pelayanan?", + ErrorMessage: "", + NameRadioButton: "radio-9", + }, + { + IDItemSurvey: "10", + Nomor: "10", + Pertanyaan: "Bagaimana Penilaian Ketepatan Waktu?", + ErrorMessage: "", + NameRadioButton: "radio-10", + }, + } + + // saran + dataItemSurveyMcuSaran := []models.ItemSurveyMcuSaran{ + { + IDItemSurveyMcuSaran: "11", + NameSurveyMcuSaran: "saranmcu-11", + ErrorMessageSurveyMcuSaran: "", + }, + } + + surveymcu := []models.SurveyMcu{ + { + DataListItemSurveyMcu: dataItemSurveyMcu, + DataListItemSurveyMcuSaran: dataItemSurveyMcuSaran, + }, + } + + return surveymcu, nil +} diff --git a/utils/surveymcu.utils.go b/utils/surveymcu.utils.go new file mode 100644 index 0000000..cf4c46d --- /dev/null +++ b/utils/surveymcu.utils.go @@ -0,0 +1,35 @@ +package utils + +import ( + "cpone/models" + "strings" +) + +func GetIdSurveyMcu(id string) string { + return id +} + +func ConcatHxIncludeSurveyMcu(dataSurveyMcu []models.SurveyMcu) string { + var elements []string + + if len(dataSurveyMcu) > 0 { + for _, x := range dataSurveyMcu { + // radio button + if len(x.DataListItemSurveyMcu) > 0 { + for _, v := range x.DataListItemSurveyMcu { + elements = append(elements, "[name='radio-"+v.IDItemSurvey+"']", "[name='default-radio-"+v.IDItemSurvey+"']", "[name='id-radio']") + } + } + + // saran + if len(x.DataListItemSurveyMcuSaran) > 0 { + for _, v := range x.DataListItemSurveyMcuSaran { + elements = append(elements, "[name='saranmcu-"+v.IDItemSurveyMcuSaran+"']", "[name='default-saranmcu-"+v.IDItemSurveyMcuSaran+"']", "[name='id-saran']") + } + } + } + } + + // Gabungkan semua elemen dengan koma + return strings.Join(elements, ", ") +} diff --git a/views/public/kartukontrol/kartukontrol.templ b/views/public/kartukontrol/kartukontrol.templ new file mode 100644 index 0000000..06f7ec8 --- /dev/null +++ b/views/public/kartukontrol/kartukontrol.templ @@ -0,0 +1,267 @@ +package public_kartukontrol + +import ( + "cpone/models" + "cpone/layout" +) + +templ MainContentKartuKontrolLayout(dataKartuKontrol []models.KartuKontrolModel, hxGet string, hxTrigger string, idModal string, urlSurveyMcu string, nomorRegistrasi string) { + // toast +
+ + +
+ // end toast +
+
+ if len(dataKartuKontrol) > 0 { + @ContentDataPasienList(dataKartuKontrol[0].KartuKontrolDataPasienList) + @ContentPemeriksaanLayout(dataKartuKontrol[0].KartuKontrolDataPemeriksaanList, dataKartuKontrol[0].KartuKontrolDataPemeriksaanPengambilanSample) + } +
+
+ @ModalMcuWordingProcessShow(hxTrigger, hxGet, idModal, urlSurveyMcu, nomorRegistrasi) +} + +templ ContentDataPasienList(dataPasienList []models.DataPasien) { + +
+
+
+

Data Pasien

+
+
+
No Registrasi
+
{ dataPasienList[0].NomorRegistrasi }
+
+
+
Nomor Lab
+
{ dataPasienList[0].NomorLab }
+
+
+
Nama Pasien
+
{ dataPasienList[0].NamaPasien }
+
+
+
Tanggal Lahir / Umur
+
{ dataPasienList[0].TanggalLahir } / { dataPasienList[0].Umur }
+
+
+
Jenis Kelamin
+
{ dataPasienList[0].JenisKelamin }
+
+
+
Divisi
+
{ dataPasienList[0].NamaDivisi }
+
+
+
Company
+
{ dataPasienList[0].NamaCompany }
+
+
+ +} + +templ ContentPemeriksaanLayout(dataPemeriksaanList []models.DataPemeriksaanList, dataPemeriksaanPengambilanSample []models.DataPemeriksaanPengambilanSample) { +
+ @ContentPemeriksaanList(dataPemeriksaanList) +
+ @ContentPengambilanSampleList(dataPemeriksaanPengambilanSample) +} + +templ ContentPemeriksaanList(dataPemeriksaan []models.DataPemeriksaanList) { +
+
Daftar Pemeriksaan
+ if len(dataPemeriksaan) > 0 { + + } else { +
Belum Ada Daftar Pemeriksaan
+ } +
+} + +templ ContentPengambilanSampleList(dataPemeriksaanPengambilanSample []models.DataPemeriksaanPengambilanSample) { +
+
+ +
Pemeriksaan / Pengambilan Sample
+ if len(dataPemeriksaanPengambilanSample) > 0 { + for _, v := range dataPemeriksaanPengambilanSample { +
+
{ v.NamaPemeriksaanPengambilanSample }
+ if len(v.SampleTypeListData) > 0 { +
    + for _, k := range v.SampleTypeListData { +
  • +
    +
    +
    { k.SampleTypeName }
    + if len(k.SampleTypeDateTime) > 0 { + { k.SampleTypeDateTime } + } +
    +
    + { k.SampleTypeStatus } +
    +
    +
  • + } +
+ } else { +
Belum Ada Data Pengambilan Sample
+ } +
+ } + } else { +
Belum Ada Data Pemeriksaan & Pengambilan Sample
+ } + +
+
+
+} + +templ ModalMcuWordingProcessShow(hxTrigger string, hxGet string, idModal string, urlSurveyMcu string, nomorRegistrasi string) { + + +
+
+} + +templ ModalMcuWordingShow(idModal string, messageWording string, urlSurvey string) { + + + +} + +templ CssKartuKontrol() { + + + + +} + +templ JsKartuKontrol() { +} + +templ ShowKartuKontrol(title string, cmp templ.Component, css templ.Component, js templ.Component) { + @layout.PlaygroundLayout(title, css, js) { + @cmp + } +} diff --git a/views/public/kartukontrol/kartukontrol_templ.go b/views/public/kartukontrol/kartukontrol_templ.go new file mode 100644 index 0000000..90ea82b --- /dev/null +++ b/views/public/kartukontrol/kartukontrol_templ.go @@ -0,0 +1,651 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package public_kartukontrol + +//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/layout" + "cpone/models" +) + +func MainContentKartuKontrolLayout(dataKartuKontrol []models.KartuKontrolModel, hxGet string, hxTrigger string, idModal string, urlSurveyMcu string, nomorRegistrasi 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("
Success just now
This is a success toast.\r
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(dataKartuKontrol) > 0 { + templ_7745c5c3_Err = ContentDataPasienList(dataKartuKontrol[0].KartuKontrolDataPasienList).Render(ctx, templ_7745c5c3_Buffer) + 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 + } + templ_7745c5c3_Err = ContentPemeriksaanLayout(dataKartuKontrol[0].KartuKontrolDataPemeriksaanList, dataKartuKontrol[0].KartuKontrolDataPemeriksaanPengambilanSample).Render(ctx, templ_7745c5c3_Buffer) + 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 + } + templ_7745c5c3_Err = ModalMcuWordingProcessShow(hxTrigger, hxGet, idModal, urlSurveyMcu, nomorRegistrasi).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 ContentDataPasienList(dataPasienList []models.DataPasien) 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("

Data Pasien

No Registrasi
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 53, Col: 42} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Nomor Lab
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 57, Col: 35} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Nama Pasien
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 61, Col: 37} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Tanggal Lahir / Umur
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 65, Col: 39} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + 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 + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 65, Col: 68} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Jenis Kelamin
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 69, Col: 39} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Divisi
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 73, Col: 37} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Company
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 77, Col: 38} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) + 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 ContentPemeriksaanLayout(dataPemeriksaanList []models.DataPemeriksaanList, dataPemeriksaanPengambilanSample []models.DataPemeriksaanPengambilanSample) 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_Var11 := templ.GetChildren(ctx) + if templ_7745c5c3_Var11 == nil { + templ_7745c5c3_Var11 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = ContentPemeriksaanList(dataPemeriksaanList).Render(ctx, templ_7745c5c3_Buffer) + 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 + } + templ_7745c5c3_Err = ContentPengambilanSampleList(dataPemeriksaanPengambilanSample).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 ContentPemeriksaanList(dataPemeriksaan []models.DataPemeriksaanList) 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_Var12 := templ.GetChildren(ctx) + if templ_7745c5c3_Var12 == nil { + templ_7745c5c3_Var12 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Daftar Pemeriksaan
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(dataPemeriksaan) > 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Belum Ada Daftar Pemeriksaan
") + 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 ContentPengambilanSampleList(dataPemeriksaanPengambilanSample []models.DataPemeriksaanPengambilanSample) 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_Var14 := templ.GetChildren(ctx) + if templ_7745c5c3_Var14 == nil { + templ_7745c5c3_Var14 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Pemeriksaan / Pengambilan Sample
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(dataPemeriksaanPengambilanSample) > 0 { + for _, v := range dataPemeriksaanPengambilanSample { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 113, Col: 46} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) + 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 len(v.SampleTypeListData) > 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, k := range v.SampleTypeListData { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
  • ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 120, Col: 34} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) + 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 len(k.SampleTypeDateTime) > 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 122, Col: 70} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) + 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 + } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
    ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + 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\public\kartukontrol\kartukontrol.templ`, Line: 126, Col: 122} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) + 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 + } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Belum Ada Data Pengambilan Sample
") + 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 + } + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Belum Ada Data Pemeriksaan & Pengambilan Sample
") + 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 ModalMcuWordingProcessShow(hxTrigger string, hxGet string, idModal string, urlSurveyMcu string, nomorRegistrasi 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_Var19 := templ.GetChildren(ctx) + if templ_7745c5c3_Var19 == nil { + templ_7745c5c3_Var19 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, 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, urlSurvey 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_Var25 := templ.GetChildren(ctx) + if templ_7745c5c3_Var25 == nil { + templ_7745c5c3_Var25 = 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_Var27 string + templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(messageWording) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\kartukontrol\kartukontrol.templ`, Line: 177, Col: 22} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) + 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_Var29 := templ.GetChildren(ctx) + if templ_7745c5c3_Var29 == nil { + templ_7745c5c3_Var29 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, 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 JsKartuKontrol() 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_Var30 := templ.GetChildren(ctx) + if templ_7745c5c3_Var30 == nil { + templ_7745c5c3_Var30 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func ShowKartuKontrol(title string, cmp templ.Component, css templ.Component, js templ.Component) 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_Var31 := templ.GetChildren(ctx) + if templ_7745c5c3_Var31 == nil { + templ_7745c5c3_Var31 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var32 := 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) + } + templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var32), 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 + }) +} diff --git a/views/public/surveymcu/surveymcu.templ b/views/public/surveymcu/surveymcu.templ new file mode 100644 index 0000000..48a67f6 --- /dev/null +++ b/views/public/surveymcu/surveymcu.templ @@ -0,0 +1,305 @@ +package public_surveymcu + +import ( + "cpone/models" + "cpone/layout" +) + +func concatIdErrorMessage(idPertanyaan string) string { + return "errorMessage-" + idPertanyaan +} + +func concatNameDefault(NameRadioButton string) string { + return "default-" + NameRadioButton +} + +func isIDInClearList(IDItemSurvey string, idclear []models.IdClearErrorMessage) bool { + for _, item := range idclear { + if item.IdItem == IDItemSurvey { + return true + } + } + return false +} + +templ MainContentSurveyMcuLayout(dataSurveyMcu []models.SurveyMcu, urlPost string, errorComp templ.Component, hxInclude string) { + // toast +
+ + +
+ // end toast +
+ +
+

Survey MCU

+
+ +
+ //
+
+ if len(dataSurveyMcu) > 0 { + for _, v := range dataSurveyMcu { + // radio button + if len(v.DataListItemSurveyMcu) > 0 { + for _, k := range v.DataListItemSurveyMcu { + +
+
+ +
+
+ { k.Nomor }.  +
+
+ { k.Pertanyaan } +
+
+ +
+
+
+
+ + +
+ + +
+
+
+
+
+ + +
+
+ + } + } + // text area + if len(v.DataListItemSurveyMcuSaran) > 0 { + for _, q := range v.DataListItemSurveyMcuSaran { + + + + + + + } + } + } + } + + + + +
+
+ //
+
+} + +templ ErrorMessageSurveyMcu(ErrorMessage string, IDItemSurvey string, idclear []models.IdClearErrorMessage, idSaranMcuAlert string, toast templ.Component) { + if len(idclear) > 0 { + for _, v := range idclear { + + + + } + } + +
+
+ { ErrorMessage } +
+
+ @toast +} + +templ CssSurveyMcu() { + + + + +} + +templ JsSurveyMcu() { +} + +templ ShowSurveyMcu(title string, cmp templ.Component, css templ.Component, js templ.Component) { + @layout.PlaygroundLayout(title, css, js) { + @cmp + } +} diff --git a/views/public/surveymcu/surveymcu_templ.go b/views/public/surveymcu/surveymcu_templ.go new file mode 100644 index 0000000..4949e3b --- /dev/null +++ b/views/public/surveymcu/surveymcu_templ.go @@ -0,0 +1,455 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package public_surveymcu + +//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/layout" + "cpone/models" +) + +func concatIdErrorMessage(idPertanyaan string) string { + return "errorMessage-" + idPertanyaan +} + +func concatNameDefault(NameRadioButton string) string { + return "default-" + NameRadioButton +} + +func isIDInClearList(IDItemSurvey string, idclear []models.IdClearErrorMessage) bool { + for _, item := range idclear { + if item.IdItem == IDItemSurvey { + return true + } + } + return false +} + +func MainContentSurveyMcuLayout(dataSurveyMcu []models.SurveyMcu, urlPost string, errorComp templ.Component, hxInclude 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("
Success just now
This is a success toast.\r

Survey MCU

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(dataSurveyMcu) > 0 { + for _, v := range dataSurveyMcu { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if len(v.DataListItemSurveyMcu) > 0 { + for _, k := range v.DataListItemSurveyMcu { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(k.Nomor) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\surveymcu\surveymcu.templ`, Line: 72, Col: 20} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(". \r
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(k.Pertanyaan) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\surveymcu\surveymcu.templ`, Line: 77, Col: 25} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
hello\r
") + 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 len(v.DataListItemSurveyMcuSaran) > 0 { + for _, q := range v.DataListItemSurveyMcuSaran { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
hello\r
") + 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 ErrorMessageSurveyMcu(ErrorMessage string, IDItemSurvey string, idclear []models.IdClearErrorMessage, idSaranMcuAlert string, toast templ.Component) 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_Var17 := templ.GetChildren(ctx) + if templ_7745c5c3_Var17 == nil { + templ_7745c5c3_Var17 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if len(idclear) > 0 { + for _, v := range idclear { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var19 string + templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(ErrorMessage) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\surveymcu\surveymcu.templ`, Line: 174, Col: 19} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) + 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 + } + } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var21 string + templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(ErrorMessage) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\surveymcu\surveymcu.templ`, Line: 187, Col: 17} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) + 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 + } + templ_7745c5c3_Err = toast.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 CssSurveyMcu() 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_Var22 := templ.GetChildren(ctx) + if templ_7745c5c3_Var22 == nil { + templ_7745c5c3_Var22 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, 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 JsSurveyMcu() 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) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func ShowSurveyMcu(title string, cmp templ.Component, css templ.Component, js templ.Component) 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_Var24 := templ.GetChildren(ctx) + if templ_7745c5c3_Var24 == nil { + templ_7745c5c3_Var24 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var25 := 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) + } + templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var25), 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 + }) +} diff --git a/views/public/toast/toastpublickartukontrol.templ b/views/public/toast/toastpublickartukontrol.templ new file mode 100644 index 0000000..66c2aaa --- /dev/null +++ b/views/public/toast/toastpublickartukontrol.templ @@ -0,0 +1,101 @@ +package public_toast + +import ( + "cpone/layout" +) + +// kalau eror => bg nya danger +// kalau sukses => bgnya success +// kalau warning => bgnya warning + +func toastBackgroundKartuKontrol(typeToast string) string { + return "bg-" + typeToast +} + +func toastBodyKartuKontrol(typeToastBody string) string { + return "bg-" + typeToastBody + "-transparent" +} + +func toastIconKartuKontrol(typeToast string) string { + var stringx string + if typeToast == "success" { + stringx = "solar:check-circle-broken" + } else { + if typeToast == "danger" { + stringx = "solar:close-circle-broken" + } else { + if typeToast == "warning" { + stringx = "solar:shield-warning-bold" + } else { + if typeToast == "information" { + stringx = "solar:info-square-broken" + } + } + } + } + + return stringx +} + +templ PublicToastV1KartuKontrolShow(title string, message string, typeToast string) { + +} + +templ PublicToastV1KartuKontrolHide() { + +} + +templ EmptyDiv() { +
+} + +templ ShowToastKartuKontrol(title string, cmp templ.Component, css templ.Component, js templ.Component) { + @layout.CorporateLayout(title, css, js, EmptyDiv(), EmptyDiv(), EmptyDiv()) { + @cmp + } +} diff --git a/views/public/toast/toastpublickartukontrol_templ.go b/views/public/toast/toastpublickartukontrol_templ.go new file mode 100644 index 0000000..0e4c267 --- /dev/null +++ b/views/public/toast/toastpublickartukontrol_templ.go @@ -0,0 +1,242 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package public_toast + +//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/layout" +) + +// kalau eror => bg nya danger +// kalau sukses => bgnya success +// kalau warning => bgnya warning + +func toastBackgroundKartuKontrol(typeToast string) string { + return "bg-" + typeToast +} + +func toastBodyKartuKontrol(typeToastBody string) string { + return "bg-" + typeToastBody + "-transparent" +} + +func toastIconKartuKontrol(typeToast string) string { + var stringx string + if typeToast == "success" { + stringx = "solar:check-circle-broken" + } else { + if typeToast == "danger" { + stringx = "solar:close-circle-broken" + } else { + if typeToast == "warning" { + stringx = "solar:shield-warning-bold" + } else { + if typeToast == "information" { + stringx = "solar:info-square-broken" + } + } + } + } + + return stringx +} + +func PublicToastV1KartuKontrolShow(title string, message string, typeToast 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("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 = []any{"toast-header", toastBackgroundKartuKontrol(typeToast), "text-white"} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) + 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 + } + var templ_7745c5c3_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\toast\toastpublickartukontrol.templ`, Line: 58, Col: 34} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + 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 + } + var templ_7745c5c3_Var6 = []any{"toast-body", toastBodyKartuKontrol(typeToast)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var6...) + 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 + } + var templ_7745c5c3_Var8 string + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(message) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\toast\toastpublickartukontrol.templ`, Line: 64, Col: 12} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) + 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 PublicToastV1KartuKontrolHide() 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_Var9 := templ.GetChildren(ctx) + if templ_7745c5c3_Var9 == nil { + templ_7745c5c3_Var9 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Success just now
This is a success toast.\r
") + 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 EmptyDiv() 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_Var10 := templ.GetChildren(ctx) + if templ_7745c5c3_Var10 == nil { + templ_7745c5c3_Var10 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, 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 ShowToastKartuKontrol(title string, cmp templ.Component, css templ.Component, js templ.Component) 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_Var11 := templ.GetChildren(ctx) + if templ_7745c5c3_Var11 == nil { + templ_7745c5c3_Var11 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var12 := 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) + } + templ_7745c5c3_Err = cmp.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer) + } + return templ_7745c5c3_Err + }) + templ_7745c5c3_Err = layout.CorporateLayout(title, css, js, EmptyDiv(), EmptyDiv(), EmptyDiv()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var12), 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 + }) +}