From a2fc4639902d0350b5c7eb9e5a6933155a81e577 Mon Sep 17 00:00:00 2001 From: adibwp Date: Wed, 12 Jun 2024 15:56:20 +0700 Subject: [PATCH] add public dashboard_pic --- handlers/dev/employeeanalytic.handlers.go | 4 +- handlers/public/dashboardpic.handlers.go | 44 +-- handlers/public/landingpage.handlers.go | 7 + handlers/public/login.handlers.go | 6 +- handlers/routes.go | 1 + models/employeeanalytic.models.go | 2 +- services/dev/employeeanalytic.services.go | 8 +- services/public/dashboardpic.services.go | 8 +- .../listingemployeeanalytic.templ | 4 +- .../listingemployeeanalytic_templ.go | 4 +- views/public/dashboardpic/dashboardpic.templ | 110 ++++++ .../public/dashboardpic/dashboardpic_templ.go | 216 ++++++++++++ .../dashboardpic/filterdashboardpic.templ | 68 ++++ .../dashboardpic/filterdashboardpic_templ.go | 316 ++++++++++++++++++ .../dashboardpic/listingdashboardpic.templ | 42 +++ .../dashboardpic/listingdashboardpic_templ.go | 189 +++++++++++ views/public/landingpage/landingpage.templ | 7 +- views/public/landingpage/landingpage_templ.go | 2 +- views/public/login/login.templ | 6 +- views/public/login/login_templ.go | 6 +- views/public/login/logincomponent.templ | 10 +- views/public/login/logincomponent_templ.go | 46 +-- 22 files changed, 1009 insertions(+), 97 deletions(-) create mode 100644 views/public/dashboardpic/dashboardpic.templ create mode 100644 views/public/dashboardpic/dashboardpic_templ.go create mode 100644 views/public/dashboardpic/filterdashboardpic.templ create mode 100644 views/public/dashboardpic/filterdashboardpic_templ.go create mode 100644 views/public/dashboardpic/listingdashboardpic.templ create mode 100644 views/public/dashboardpic/listingdashboardpic_templ.go diff --git a/handlers/dev/employeeanalytic.handlers.go b/handlers/dev/employeeanalytic.handlers.go index 4666901..5fb2f3b 100644 --- a/handlers/dev/employeeanalytic.handlers.go +++ b/handlers/dev/employeeanalytic.handlers.go @@ -18,8 +18,8 @@ import ( type EmployeeAnalyticServices interface { GetEmployeeAnalyticBreadcrumb(title string) (models.BreadCrumbV1, error) - DummyDataTest() ([]models.EmployeeAnalytic, error) - ListingEmployeeAnalytic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.EmployeeAnalytic, int, error) + DummyDataTest() ([]models.DashboardPic, error) + ListingEmployeeAnalytic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.DashboardPic, int, error) } type EmployeeAnalyticHandler struct { diff --git a/handlers/public/dashboardpic.handlers.go b/handlers/public/dashboardpic.handlers.go index 9505bdf..73e65d7 100644 --- a/handlers/public/dashboardpic.handlers.go +++ b/handlers/public/dashboardpic.handlers.go @@ -8,7 +8,7 @@ import ( "cpone/models" "cpone/services" "cpone/utils" - dev_employeeanalytic "cpone/views/dev/employeeanalytic" + public_dashboardpic "cpone/views/public/dashboardpic" "strconv" "github.com/a-h/templ" @@ -18,8 +18,8 @@ import ( type DashboardPicServices interface { GetEmployeeAnalyticBreadcrumb(title string) (models.BreadCrumbV1, error) - DummyDataTest() ([]models.EmployeeAnalytic, error) - ListingEmployeeAnalytic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.EmployeeAnalytic, int, error) + DummyDataTest() ([]models.DashboardPic, error) + ListingDashboardPic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.DashboardPic, int, error) } type DashboardPicHandler struct { @@ -58,13 +58,13 @@ func (ea *DashboardPicHandler) HandleShowEmployeeAnalyticScreen(c echo.Context) sidbaruser := sidebaruserprofile.Navbaruserprofile(user) breadcrumb := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadcrumb) - listingData, totalPage, err := ea.DashboardPicServices.ListingEmployeeAnalytic("", "", "", 1, 5) + listingData, totalPage, err := ea.DashboardPicServices.ListingDashboardPic("", "", "", 1, 5) if err != nil { defer logger.Sync() logger.Info("Error get listing data", zap.Any("error", err), zap.Any("total", totalPage)) return err } - listingcomponent := dev_employeeanalytic.ListingData(listingData, listID) + listingcomponent := public_dashboardpic.ListingData(listingData, listID) paginationcomponent := pagination.PaginationV3( totalPage, @@ -74,21 +74,21 @@ func (ea *DashboardPicHandler) HandleShowEmployeeAnalyticScreen(c echo.Context) "#listID, #paginationID, #searchID, #startdateID, #enddateID", "#"+paginationID, "outerHTML", "", "", - dev_employeeanalytic.BeforeRequestContent(), - dev_employeeanalytic.AfterRequestContent(), + public_dashboardpic.BeforeRequestContent(), + public_dashboardpic.AfterRequestContent(), ) - filtercomponent := dev_employeeanalytic.FilterListing( + filtercomponent := public_dashboardpic.FilterListing( "/dev/dashboard_pic/filter", "input changed delay:500ms", "#searchID, #startdateID, #enddateID, #listID, #paginationID", "outerHTML", "#"+paginationID, - dev_employeeanalytic.BeforeRequestContent(), - dev_employeeanalytic.AfterRequestContent(), + public_dashboardpic.BeforeRequestContent(), + public_dashboardpic.AfterRequestContent(), ) - content := dev_employeeanalytic.EmployeeAnalyticScreen( + content := public_dashboardpic.DashboardPic( listID, paginationID, breadcrumb, @@ -96,10 +96,10 @@ func (ea *DashboardPicHandler) HandleShowEmployeeAnalyticScreen(c echo.Context) listingcomponent, paginationcomponent, ) - css := dev_employeeanalytic.CSSEmployeeAnalytic() - js := dev_employeeanalytic.JSEmployeeAnalytic() + css := public_dashboardpic.CSSDashboardPIC() + js := public_dashboardpic.JSDashboardPIC() - view := dev_employeeanalytic.ShowEmployeeAnalytic(title, content, css, js, navbaruser, sidbaruser) + view := public_dashboardpic.ShowDashboardPic(title, content, css, js, navbaruser, sidbaruser) return utils.View(c, view) } @@ -121,13 +121,13 @@ func (ea *DashboardPicHandler) HandlePagination(c echo.Context) error { return err } - listdata, totalPage, err := ea.DashboardPicServices.ListingEmployeeAnalytic(search, startdate, enddate, page, 5) + listdata, totalPage, err := ea.DashboardPicServices.ListingDashboardPic(search, startdate, enddate, page, 5) if err != nil { defer logger.Sync() logger.Info("Error convert page param") return err } - listcomponent := dev_employeeanalytic.ListingData(listdata, listID) + listcomponent := public_dashboardpic.ListingData(listdata, listID) paginationcomponent := pagination.PaginationV3( totalPage, @@ -137,8 +137,8 @@ func (ea *DashboardPicHandler) HandlePagination(c echo.Context) error { "#listID, #paginationID, #searchID, #startdateID, #enddateID", "#"+paginationID, "outerHTML", "", "", - dev_employeeanalytic.BeforeRequestContent(), - dev_employeeanalytic.AfterRequestContent(), + public_dashboardpic.BeforeRequestContent(), + public_dashboardpic.AfterRequestContent(), ) retVal = append(retVal, listcomponent) @@ -155,22 +155,22 @@ func (ea *DashboardPicHandler) HandleFilter(c echo.Context) error { listID := c.QueryParam("listID") paginationID := c.QueryParam("paginationID") - dataList, totalPage, err := ea.DashboardPicServices.ListingEmployeeAnalytic(search, startdate, enddate, 1, 5) + dataList, totalPage, err := ea.DashboardPicServices.ListingDashboardPic(search, startdate, enddate, 1, 5) if err != nil { defer logger.Sync() logger.Info("Error Get Listing Data", zap.Any("error", err)) return err } - listcomponent := dev_employeeanalytic.ListingData(dataList, listID) + listcomponent := public_dashboardpic.ListingData(dataList, listID) paginationcomponent := pagination.PaginationV3( totalPage, 1, "/dev/dashboard_pic/changepage", paginationID, "#listID, #paginationID, #searchID, #startdateID, #enddateID", "#"+paginationID, "outerHTML", "", "", - dev_employeeanalytic.BeforeRequestContent(), - dev_employeeanalytic.AfterRequestContent(), + public_dashboardpic.BeforeRequestContent(), + public_dashboardpic.AfterRequestContent(), ) var retval []templ.Component diff --git a/handlers/public/landingpage.handlers.go b/handlers/public/landingpage.handlers.go index f6688cc..53e1da0 100644 --- a/handlers/public/landingpage.handlers.go +++ b/handlers/public/landingpage.handlers.go @@ -3,6 +3,7 @@ package public_handlers import ( public_services "cpone/services/public" public_landingpage "cpone/views/public/landingpage" + "net/http" "github.com/a-h/templ" "go.uber.org/zap" @@ -65,6 +66,12 @@ func (uh *LandingPageHandler) ShowLandingPage(c echo.Context) error { return uh.View(c, helo) } +func (uh *LandingPageHandler) HandleBtnLogin(c echo.Context) error { + c.Response().Header().Set("HX-Redirect", "/login") + + return c.String(http.StatusOK, "/login") +} + func (uh *LandingPageHandler) View(c echo.Context, cmp templ.Component) error { c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML) diff --git a/handlers/public/login.handlers.go b/handlers/public/login.handlers.go index 388909d..c40cbca 100644 --- a/handlers/public/login.handlers.go +++ b/handlers/public/login.handlers.go @@ -27,7 +27,7 @@ type LoginHandler struct { func (lh *LoginHandler) HandlerShowLogin(c echo.Context) error { - si := public_login.ShowLogin("Login ", public_login.MainLogin(""), public_login.CssLogin(), public_login.JsLogin()) + si := public_login.ShowLogin("Login ", public_login.MainLogin(), public_login.CssLogin(), public_login.JsLogin()) return utils.View(c, si) } @@ -46,7 +46,7 @@ func (lh *LoginHandler) HandlerSignIn(c echo.Context) error { defer logger.Sync() logger.Info("Error", zap.Error(err)) - si := public_login.ShowLogin("Login ", public_login.MainLogin(""), public_login.CssLogin(), public_login.JsLogin()) + si := public_login.ShowLogin("Login ", public_login.MainLogin(), public_login.CssLogin(), public_login.JsLogin()) return utils.View(c, si) } defer logger.Sync() @@ -62,7 +62,7 @@ func (lh *LoginHandler) HandlerSignIn(c echo.Context) error { defer logger.Sync() logger.Info("Error", zap.Error(err)) - si := public_login.ShowLogin("Login ", public_login.MainLogin(""), public_login.CssLogin(), public_login.JsLogin()) + si := public_login.ShowLogin("Login ", public_login.MainLogin(), public_login.CssLogin(), public_login.JsLogin()) return utils.View(c, si) } diff --git a/handlers/routes.go b/handlers/routes.go index 55ab2a7..dd4af98 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -67,6 +67,7 @@ func SetupRoutesPublic(app *echo.Echo, appStore db.AppStore) { lh := public_handlers.NewLandingPageHandler(l) public.GET("landingpage", lh.ShowLandingPage) public.GET("home", lh.ShowLandingPage) + public.GET("home/login", lh.HandleBtnLogin) // loginHdr := public_handlers.NewLoginHandler(l) // public.GET("login", loginHdr.HandlerShowLogin) diff --git a/models/employeeanalytic.models.go b/models/employeeanalytic.models.go index 15ad113..29d7244 100644 --- a/models/employeeanalytic.models.go +++ b/models/employeeanalytic.models.go @@ -1,6 +1,6 @@ package models -type EmployeeAnalytic struct { +type DashboardPic struct { Mgm_McuID int `db:"Mgm_McuID"` Mgm_McuLabel string `db:"Mgm_McuLabel"` Mgm_McuFlagRelasiBayarSendiri string `db:"Mgm_McuFlagRelasiBayarSendiri"` diff --git a/services/dev/employeeanalytic.services.go b/services/dev/employeeanalytic.services.go index 569ae1a..5e16eba 100644 --- a/services/dev/employeeanalytic.services.go +++ b/services/dev/employeeanalytic.services.go @@ -38,8 +38,8 @@ func (ea *EmployeeAnalyticServices) GetEmployeeAnalyticBreadcrumb(title string) return breadcrumb, nil } -func (ea *EmployeeAnalyticServices) DummyDataTest() ([]models.EmployeeAnalytic, error) { - employees := []models.EmployeeAnalytic{ +func (ea *EmployeeAnalyticServices) DummyDataTest() ([]models.DashboardPic, error) { + employees := []models.DashboardPic{ { Mgm_McuID: 1, Mgm_McuLabel: "Employee 1", @@ -71,9 +71,9 @@ func (ea *EmployeeAnalyticServices) DummyDataTest() ([]models.EmployeeAnalytic, return employees, nil } -func (ea *EmployeeAnalyticServices) ListingEmployeeAnalytic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.EmployeeAnalytic, int, error) { +func (ea *EmployeeAnalyticServices) ListingEmployeeAnalytic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.DashboardPic, int, error) { logger, _ := zap.NewProduction() - var ret []models.EmployeeAnalytic + var ret []models.DashboardPic var totalData int if len(startdate) == 0 { diff --git a/services/public/dashboardpic.services.go b/services/public/dashboardpic.services.go index 8033ac5..409e35f 100644 --- a/services/public/dashboardpic.services.go +++ b/services/public/dashboardpic.services.go @@ -38,8 +38,8 @@ func (ea *DashboardPicServices) GetEmployeeAnalyticBreadcrumb(title string) (mod return breadcrumb, nil } -func (ea *DashboardPicServices) DummyDataTest() ([]models.EmployeeAnalytic, error) { - employees := []models.EmployeeAnalytic{ +func (ea *DashboardPicServices) DummyDataTest() ([]models.DashboardPic, error) { + employees := []models.DashboardPic{ { Mgm_McuID: 1, Mgm_McuLabel: "Employee 1", @@ -71,9 +71,9 @@ func (ea *DashboardPicServices) DummyDataTest() ([]models.EmployeeAnalytic, erro return employees, nil } -func (ea *DashboardPicServices) ListingEmployeeAnalytic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.EmployeeAnalytic, int, error) { +func (ea *DashboardPicServices) ListingDashboardPic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.DashboardPic, int, error) { logger, _ := zap.NewProduction() - var ret []models.EmployeeAnalytic + var ret []models.DashboardPic var totalData int if len(startdate) == 0 { diff --git a/views/dev/employeeanalytic/listingemployeeanalytic.templ b/views/dev/employeeanalytic/listingemployeeanalytic.templ index e679a94..9579beb 100644 --- a/views/dev/employeeanalytic/listingemployeeanalytic.templ +++ b/views/dev/employeeanalytic/listingemployeeanalytic.templ @@ -4,7 +4,7 @@ import "cpone/models" import "strconv" templ ListingData( - data []models.EmployeeAnalytic, + data []models.DashboardPic, listID string, ) {
@@ -26,7 +26,7 @@ templ ListingData(
} -templ ItemCard(data models.EmployeeAnalytic) { +templ ItemCard(data models.DashboardPic) {

{ data.Mgm_McuLabel }

diff --git a/views/dev/employeeanalytic/listingemployeeanalytic_templ.go b/views/dev/employeeanalytic/listingemployeeanalytic_templ.go index 629a297..19ed2f8 100644 --- a/views/dev/employeeanalytic/listingemployeeanalytic_templ.go +++ b/views/dev/employeeanalytic/listingemployeeanalytic_templ.go @@ -14,7 +14,7 @@ import "cpone/models" import "strconv" func ListingData( - data []models.EmployeeAnalytic, + data []models.DashboardPic, listID string, ) templ.Component { return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { @@ -138,7 +138,7 @@ func ListingData( }) } -func ItemCard(data models.EmployeeAnalytic) templ.Component { +func ItemCard(data models.DashboardPic) 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 { diff --git a/views/public/dashboardpic/dashboardpic.templ b/views/public/dashboardpic/dashboardpic.templ new file mode 100644 index 0000000..32d03ed --- /dev/null +++ b/views/public/dashboardpic/dashboardpic.templ @@ -0,0 +1,110 @@ +package public_dashboardpic + +import "cpone/layout" +import "cpone/component/customtextfield" +import "cpone/models" + +templ DashboardPic( + listID string, + paginationID string, + breadcrumb templ.Component, + filtercomponent templ.Component, + listingcomponent templ.Component, + paginationcomponent templ.Component, +) { +
+ @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "listID", + Name: "listID", + Type: "hidden", + Value: listID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID", + Name: "paginationID", + Type: "hidden", + Value: paginationID}) +
+
+ @breadcrumb +
+
+ @filtercomponent +
+ @listingcomponent + @paginationcomponent +
+
+ Loading... +
+
+
+
+
+} + +templ JSDashboardPIC() { + +} + +templ CSSDashboardPIC() { + + + + +} + +script BeforeRequestContent() { + const loadingParent = document.getElementById("loading-parent"); + const loadingChild = document.getElementById("loading-child"); + const loadingSpinner = document.getElementById("loading-spinner"); + + loadingParent.classList.add("overlay"); + loadingParent.classList.add("overlay-block"); + loadingChild.classList.add("overlay-layer"); + loadingSpinner.classList.remove("d-none"); +} + +script AfterRequestContent() { + const loadingParent = document.getElementById("loading-parent"); + const loadingChild = document.getElementById("loading-child"); + const loadingSpinner = document.getElementById("loading-spinner"); + + loadingParent.classList.remove("overlay"); + loadingParent.classList.remove("overlay-block"); + loadingChild.classList.remove("overlay-layer"); + loadingSpinner.classList.add("d-none"); +} + +templ ShowDashboardPic( + title string, + cmp templ.Component, + css templ.Component, + js templ.Component, + navbaruser templ.Component, + userprofile templ.Component, +) { + @layout.EmployeeAnalyticLayout(title, css, js, navbaruser, userprofile) { + @cmp + } +} \ No newline at end of file diff --git a/views/public/dashboardpic/dashboardpic_templ.go b/views/public/dashboardpic/dashboardpic_templ.go new file mode 100644 index 0000000..ceca62c --- /dev/null +++ b/views/public/dashboardpic/dashboardpic_templ.go @@ -0,0 +1,216 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package public_dashboardpic + +//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" +import "cpone/component/customtextfield" +import "cpone/models" + +func DashboardPic( + listID string, + paginationID string, + breadcrumb templ.Component, + filtercomponent templ.Component, + listingcomponent templ.Component, + paginationcomponent 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_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 + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "listID", + Name: "listID", + Type: "hidden", + Value: listID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID", + Name: "paginationID", + Type: "hidden", + Value: paginationID}).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 = breadcrumb.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 = filtercomponent.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 = listingcomponent.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = paginationcomponent.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Loading...
") + 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 JSDashboardPIC() 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) + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func CSSDashboardPIC() 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("") + 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 BeforeRequestContent() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_BeforeRequestContent_5717`, + Function: `function __templ_BeforeRequestContent_5717(){const loadingParent = document.getElementById("loading-parent"); + const loadingChild = document.getElementById("loading-child"); + const loadingSpinner = document.getElementById("loading-spinner"); + + loadingParent.classList.add("overlay"); + loadingParent.classList.add("overlay-block"); + loadingChild.classList.add("overlay-layer"); + loadingSpinner.classList.remove("d-none"); +}`, + Call: templ.SafeScript(`__templ_BeforeRequestContent_5717`), + CallInline: templ.SafeScriptInline(`__templ_BeforeRequestContent_5717`), + } +} + +func AfterRequestContent() templ.ComponentScript { + return templ.ComponentScript{ + Name: `__templ_AfterRequestContent_077f`, + Function: `function __templ_AfterRequestContent_077f(){const loadingParent = document.getElementById("loading-parent"); + const loadingChild = document.getElementById("loading-child"); + const loadingSpinner = document.getElementById("loading-spinner"); + + loadingParent.classList.remove("overlay"); + loadingParent.classList.remove("overlay-block"); + loadingChild.classList.remove("overlay-layer"); + loadingSpinner.classList.add("d-none"); +}`, + Call: templ.SafeScript(`__templ_AfterRequestContent_077f`), + CallInline: templ.SafeScriptInline(`__templ_AfterRequestContent_077f`), + } +} + +func ShowDashboardPic( + title string, + cmp templ.Component, + css templ.Component, + js templ.Component, + navbaruser templ.Component, + userprofile 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_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + templ_7745c5c3_Var5 := 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.EmployeeAnalyticLayout(title, css, js, navbaruser, userprofile).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), 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/dashboardpic/filterdashboardpic.templ b/views/public/dashboardpic/filterdashboardpic.templ new file mode 100644 index 0000000..c1e2bdf --- /dev/null +++ b/views/public/dashboardpic/filterdashboardpic.templ @@ -0,0 +1,68 @@ +package public_dashboardpic + +templ FilterListing( + hxGet string, + hxTrigger string, + hxInclude string, + hxSwap string, + hxTarget string, + hxBeforeRequest templ.ComponentScript, + hxAfterRequest templ.ComponentScript, +) { +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+} diff --git a/views/public/dashboardpic/filterdashboardpic_templ.go b/views/public/dashboardpic/filterdashboardpic_templ.go new file mode 100644 index 0000000..fc0cf65 --- /dev/null +++ b/views/public/dashboardpic/filterdashboardpic_templ.go @@ -0,0 +1,316 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package public_dashboardpic + +//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" + +func FilterListing( + hxGet string, + hxTrigger string, + hxInclude string, + hxSwap string, + hxTarget string, + hxBeforeRequest templ.ComponentScript, + hxAfterRequest templ.ComponentScript, +) 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 + } + templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxBeforeRequest, hxAfterRequest) + 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.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxBeforeRequest, hxAfterRequest) + 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.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxBeforeRequest, hxAfterRequest) + 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 + }) +} diff --git a/views/public/dashboardpic/listingdashboardpic.templ b/views/public/dashboardpic/listingdashboardpic.templ new file mode 100644 index 0000000..dc390cc --- /dev/null +++ b/views/public/dashboardpic/listingdashboardpic.templ @@ -0,0 +1,42 @@ +package public_dashboardpic + +import "cpone/models" +import "strconv" + +templ ListingData( + data []models.DashboardPic, + listID string, +) { +
+
+
+ for i, d := range data { + if i == (len(data) - 1) { +
+ @ItemCard(d) +
+ } else { +
+ @ItemCard(d) +
+ } + } +
+
+
+} + +templ ItemCard(data models.DashboardPic) { +
+
+

{ data.Mgm_McuLabel }

+
+
+ { data.Mgm_McuNote } +
+
+ { data.Mgm_McuStartDate } - { data.Mgm_McuEndDate } +
+
+} + diff --git a/views/public/dashboardpic/listingdashboardpic_templ.go b/views/public/dashboardpic/listingdashboardpic_templ.go new file mode 100644 index 0000000..2a89d33 --- /dev/null +++ b/views/public/dashboardpic/listingdashboardpic_templ.go @@ -0,0 +1,189 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package public_dashboardpic + +//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/models" +import "strconv" + +func ListingData( + data []models.DashboardPic, + listID 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 + } + for i, d := range data { + if i == (len(data) - 1) { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = ItemCard(d).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 + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = ItemCard(d).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 = 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 ItemCard(data models.DashboardPic) 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("

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var6 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuLabel) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\dashboardpic\listingdashboardpic.templ`, Line: 32, Col: 54} + } + _, 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(data.Mgm_McuNote) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\dashboardpic\listingdashboardpic.templ`, Line: 35, Col: 74} + } + _, 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("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var8 string + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuStartDate) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\dashboardpic\listingdashboardpic.templ`, Line: 38, Col: 79} + } + _, 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 + } + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuEndDate) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\public\dashboardpic\listingdashboardpic.templ`, Line: 38, Col: 105} + } + _, 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("
") + 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/landingpage/landingpage.templ b/views/public/landingpage/landingpage.templ index a2c0dab..5dfac0b 100644 --- a/views/public/landingpage/landingpage.templ +++ b/views/public/landingpage/landingpage.templ @@ -19,7 +19,12 @@ templ MainLandingPage(medicalServiceComponent templ.Component, listAdvantageComp alt="Your Brand" /> - diff --git a/views/public/landingpage/landingpage_templ.go b/views/public/landingpage/landingpage_templ.go index 12d4944..9faf147 100644 --- a/views/public/landingpage/landingpage_templ.go +++ b/views/public/landingpage/landingpage_templ.go @@ -27,7 +27,7 @@ func MainLandingPage(medicalServiceComponent templ.Component, listAdvantageCompo templ_7745c5c3_Var1 = 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 } diff --git a/views/public/login/login.templ b/views/public/login/login.templ index 2820085..79a9572 100644 --- a/views/public/login/login.templ +++ b/views/public/login/login.templ @@ -4,9 +4,7 @@ import ( "cpone/layout" ) -templ MainLogin( - responseBody string, -) { +templ MainLogin() {
} -templ FormSignin( - responseBody string, -) { +templ FormSignin() {
-} - -script StoreLocalStorage(responseBody string) { - console.log("here"); - console.log(responseBody); } \ No newline at end of file diff --git a/views/public/login/logincomponent_templ.go b/views/public/login/logincomponent_templ.go index 4051bee..9678eec 100644 --- a/views/public/login/logincomponent_templ.go +++ b/views/public/login/logincomponent_templ.go @@ -34,9 +34,7 @@ func AsideLeft() templ.Component { }) } -func FormSignin( - responseBody string, -) templ.Component { +func FormSignin() 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 { @@ -49,24 +47,7 @@ func FormSignin( templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"\"

Welcome to Corporate Portal\r

Sign in to access your account\r

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, StoreLocalStorage(responseBody)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"\"

Welcome to Corporate Portal\r

Sign in to access your account\r

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -85,9 +66,9 @@ func FormSignup() templ.Component { 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 + 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("

Sign Up\r

Enter your details to create your account\r

") @@ -109,9 +90,9 @@ func ForgotPassword() templ.Component { 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 + 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("
\"\"

Forgotten Password ?\r

Enter your email to reset your password\r

") @@ -124,14 +105,3 @@ func ForgotPassword() templ.Component { return templ_7745c5c3_Err }) } - -func StoreLocalStorage(responseBody string) templ.ComponentScript { - return templ.ComponentScript{ - Name: `__templ_StoreLocalStorage_ef0d`, - Function: `function __templ_StoreLocalStorage_ef0d(responseBody){console.log("here"); - console.log(responseBody); -}`, - Call: templ.SafeScript(`__templ_StoreLocalStorage_ef0d`, responseBody), - CallInline: templ.SafeScriptInline(`__templ_StoreLocalStorage_ef0d`, responseBody), - } -}