From ae807c16152baa75e4bee69c3b46477f5c6eb789 Mon Sep 17 00:00:00 2001 From: adibwp Date: Sat, 8 Jun 2024 09:48:39 +0700 Subject: [PATCH] listing card data --- handlers/dev/employeeanalytic.handlers.go | 82 +++++++ handlers/routes.go | 5 + layout/layout_employee_analytic.templ | 174 ++++++++++++++ layout/layout_employee_analytic_templ.go | 94 ++++++++ layout/playground_layout.templ | 12 - layout/playground_layout_templ.go | 4 +- models/employeeanalytic.models.go | 15 ++ services/dev/employeeanalytic.services.go | 81 +++++++ .../employeeanalytic/employeeanalytic.templ | 137 +++++++++++ .../employeeanalytic_templ.go | 227 ++++++++++++++++++ .../listingemployeeanalytic.templ | 37 +++ .../listingemployeeanalytic_templ.go | 146 +++++++++++ .../dev/mdsamplestation/mdsamplestation.templ | 2 +- .../mdsamplestation/mdsamplestation_templ.go | 2 +- 14 files changed, 1002 insertions(+), 16 deletions(-) create mode 100644 handlers/dev/employeeanalytic.handlers.go create mode 100644 layout/layout_employee_analytic.templ create mode 100644 layout/layout_employee_analytic_templ.go create mode 100644 models/employeeanalytic.models.go create mode 100644 services/dev/employeeanalytic.services.go create mode 100644 views/dev/employeeanalytic/employeeanalytic.templ create mode 100644 views/dev/employeeanalytic/employeeanalytic_templ.go create mode 100644 views/dev/employeeanalytic/listingemployeeanalytic.templ create mode 100644 views/dev/employeeanalytic/listingemployeeanalytic_templ.go diff --git a/handlers/dev/employeeanalytic.handlers.go b/handlers/dev/employeeanalytic.handlers.go new file mode 100644 index 0000000..11cc848 --- /dev/null +++ b/handlers/dev/employeeanalytic.handlers.go @@ -0,0 +1,82 @@ +package dev_handlers + +import ( + breadcrumadmin "cpone/component/breadcrumbadmin" + navbarmenu "cpone/component/navbar" + sidebaruserprofile "cpone/component/sidebar_user_profile" + "cpone/models" + "cpone/services" + "cpone/utils" + dev_employeeanalytic "cpone/views/dev/employeeanalytic" + + "github.com/labstack/echo/v4" + "go.uber.org/zap" +) + +type EmployeeAnalyticServices interface { + GetEmployeeAnalyticBreadcrumb(title string) (models.BreadCrumbV1, error) + DummyDataTest() ([]models.EmployeeAnalytic, error) +} + +type EmployeeAnalyticHandler struct { + EmployeeAnalyticServices EmployeeAnalyticServices +} + +func NewEmployeeAnalyticHandler(ea EmployeeAnalyticServices) *EmployeeAnalyticHandler { + return &EmployeeAnalyticHandler{ + EmployeeAnalyticServices: ea, + } +} + +func (ea *EmployeeAnalyticHandler) HandleShowEmployeeAnalyticScreen(c echo.Context) error { + logger, _ := zap.NewProduction() + title := "PT. Sadhana Abiyasa Sampoerna" + + listID := utils.GenerateRandomID("listid") + paginationID := utils.GenerateRandomID("paginationid") + searchID := utils.GenerateRandomID("searchid") + startdateID := utils.GenerateRandomID("startdateid") + enddateID := utils.GenerateRandomID("enddateid") + + user, err := services.GetUserLogin() + if err != nil { + defer logger.Sync() + logger.Info("Error get user dev", zap.Any("error", err)) + return err + } + + dataBreadcrumb, err := ea.EmployeeAnalyticServices.GetEmployeeAnalyticBreadcrumb(title) + if err != nil { + defer logger.Sync() + logger.Info("Error breadcrumb dev", zap.Any("error", err)) + return err + } + defer logger.Sync() + + navbaruser := navbarmenu.Navbar(user) + sidbaruser := sidebaruserprofile.Navbaruserprofile(user) + breadcrumb := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadcrumb) + + listingData, err := ea.EmployeeAnalyticServices.DummyDataTest() + if err != nil { + defer logger.Sync() + logger.Info("Error get listing data", zap.Any("error", err)) + return err + } + listingcomponent := dev_employeeanalytic.ListingData(listingData) + + content := dev_employeeanalytic.EmployeeAnalyticScreen( + listID, + paginationID, + searchID, + startdateID, + enddateID, + breadcrumb, + listingcomponent, + ) + css := dev_employeeanalytic.CSSEmployeeAnalytic() + js := dev_employeeanalytic.JSEmployeeAnalytic() + + view := dev_employeeanalytic.ShowEmployeeAnalytic(title, content, css, js, navbaruser, sidbaruser) + return utils.View(c, view) +} diff --git a/handlers/routes.go b/handlers/routes.go index 964667a..62710ff 100644 --- a/handlers/routes.go +++ b/handlers/routes.go @@ -233,6 +233,11 @@ func SetupRoutesDev(app *echo.Echo, appStore db.AppStore) { // clientgroup.GET("/usergroup/edit", mastermenuusergroupHandler.ChangeFormEdit) // clientgroup.GET("/usergroup/pagination", mastermenuusergroupHandler.HandleChangePage) + // employee analytic + devEmplAnaServices := dev_services.NewEmployeeAnalyticServices(appStore) + devEmplAnaHandler := dev_handlers.NewEmployeeAnalyticHandler(devEmplAnaServices) + dev.GET("/employeeanalytic", devEmplAnaHandler.HandleShowEmployeeAnalyticScreen) + // group result devGRServices := dev_services.NewServicesGroupResult(appStore) devGRhandlers := dev_handlers.NewGroupResultHandler(devGRServices) diff --git a/layout/layout_employee_analytic.templ b/layout/layout_employee_analytic.templ new file mode 100644 index 0000000..4f80985 --- /dev/null +++ b/layout/layout_employee_analytic.templ @@ -0,0 +1,174 @@ +package layout + +templ EmployeeAnalyticLayout( + title string, + css templ.Component, + js templ.Component, + navbaruser templ.Component, + sidebaruser templ.Component, +) { + + + + + + + Company Portal | { title } + + + + + + + + + + + + + + + + + + + + + + + + + + + + @css + + + + + + +
+ + + Logo + + + +
+ + + +
+ +
+ + +
+
+ @navbaruser +
+
+ { children... } +
+
+ + @sidebaruser + + + + + + + + + + // bootstrap datepicker + + @js + + + +} \ No newline at end of file diff --git a/layout/layout_employee_analytic_templ.go b/layout/layout_employee_analytic_templ.go new file mode 100644 index 0000000..6760275 --- /dev/null +++ b/layout/layout_employee_analytic_templ.go @@ -0,0 +1,94 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package layout + +//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 EmployeeAnalyticLayout( + title string, + css templ.Component, + js templ.Component, + navbaruser templ.Component, + sidebaruser 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("Company Portal | ") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 string + templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `layout\layout_employee_analytic.templ`, Line: 16, Col: 34} + } + _, 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("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = css.Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
\"Logo\"
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = navbaruser.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_Var1.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 = sidebaruser.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 = js.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 + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/layout/playground_layout.templ b/layout/playground_layout.templ index 891d448..9d45c7f 100644 --- a/layout/playground_layout.templ +++ b/layout/playground_layout.templ @@ -3,18 +3,6 @@ package layout // LAYOUT PLAYGROUND templ PlaygroundLayout(title string, css templ.Component, js templ.Component) { - diff --git a/layout/playground_layout_templ.go b/layout/playground_layout_templ.go index 43b92d9..d118439 100644 --- a/layout/playground_layout_templ.go +++ b/layout/playground_layout_templ.go @@ -24,14 +24,14 @@ func PlaygroundLayout(title string, css templ.Component, js templ.Component) tem templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Company Portal | ") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"en\"><!--begin::Head--><head><base href=\"/\"><meta charset=\"utf-8\"><title>Company Portal | ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `layout\playground_layout.templ`, Line: 23, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `layout\playground_layout.templ`, Line: 11, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { diff --git a/models/employeeanalytic.models.go b/models/employeeanalytic.models.go new file mode 100644 index 0000000..15ad113 --- /dev/null +++ b/models/employeeanalytic.models.go @@ -0,0 +1,15 @@ +package models + +type EmployeeAnalytic struct { + Mgm_McuID int `db:"Mgm_McuID"` + Mgm_McuLabel string `db:"Mgm_McuLabel"` + Mgm_McuFlagRelasiBayarSendiri string `db:"Mgm_McuFlagRelasiBayarSendiri"` + Mgm_McuBisaTambahPemeriksaan string `db:"Mgm_McuBisaTambahPemeriksaan"` + Mgm_McuCorporateID int `db:"Mgm_McuCorporateID"` + Mgm_McuNumber string `db:"Mgm_McuNumber"` + Mgm_McuNumberNational string `db:"Mgm_McuNumberNational"` + Mgm_McuNote string `db:"Mgm_McuNote"` + Mgm_McuStartDate string `db:"Mgm_McuStartDate"` + Mgm_McuEndDate string `db:"Mgm_McuEndDate"` + Mgm_McuIsActive string `db:"Mgm_McuIsActive"` +} diff --git a/services/dev/employeeanalytic.services.go b/services/dev/employeeanalytic.services.go new file mode 100644 index 0000000..c37d4a0 --- /dev/null +++ b/services/dev/employeeanalytic.services.go @@ -0,0 +1,81 @@ +package dev_services + +import ( + "cpone/db" + "cpone/models" +) + +type EmployeeAnalyticServices struct { + EmployeeAnalyticStore db.AppStore +} + +func NewEmployeeAnalyticServices(uStore db.AppStore) *EmployeeAnalyticServices { + return &EmployeeAnalyticServices{ + EmployeeAnalyticStore: uStore, + } +} + +func (ea *EmployeeAnalyticServices) GetEmployeeAnalyticBreadcrumb(title string) (models.BreadCrumbV1, error) { + breadcrumb := models.BreadCrumbV1{ + Title: title, + Item: []models.ItemBreadCrumbV1{ + { + Item: "Dashboard", + Url: "/dev/dashboard", + }, + { + Item: "Employee Health Medical Analytic", + Url: "", + }, + }, + } + + return breadcrumb, nil +} + +func (ea *EmployeeAnalyticServices) DummyDataTest() ([]models.EmployeeAnalytic, error) { + employees := []models.EmployeeAnalytic{ + { + Mgm_McuID: 1, + Mgm_McuLabel: "Employee 1", + Mgm_McuFlagRelasiBayarSendiri: "Yes", + Mgm_McuBisaTambahPemeriksaan: "No", + Mgm_McuCorporateID: 101, + Mgm_McuNumber: "EMP001", + Mgm_McuNumberNational: "NAT001", + Mgm_McuNote: "Lorem ipsum dolor sit amet.", + Mgm_McuStartDate: "2024-01-01", + Mgm_McuEndDate: "2024-12-31", + Mgm_McuIsActive: "Y", + }, + { + Mgm_McuID: 2, + Mgm_McuLabel: "Employee 2", + Mgm_McuFlagRelasiBayarSendiri: "No", + Mgm_McuBisaTambahPemeriksaan: "Yes", + Mgm_McuCorporateID: 102, + Mgm_McuNumber: "EMP002", + Mgm_McuNumberNational: "NAT002", + Mgm_McuNote: "Lorem ipsum dolor sit amet consectetur.", + Mgm_McuStartDate: "2024-02-15", + Mgm_McuEndDate: "2024-11-30", + Mgm_McuIsActive: "Y", + }, + } + + return employees, nil +} + +// func (ea *EmployeeAnalyticServices) ListingEmployeeAnalytic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.EmployeeAnalytic, error) { +// logger, _ := zap.NewProduction() +// var ret []models.EmployeeAnalytic + +// prmLabel := "%" + search + "%" + +// q := ` +// SELECT +// FROM mgm_mcu +// WHERE Mgm_McuIsActive = 'Y' +// AND Mgm_McuLabel LIKE ? +// ` +// } diff --git a/views/dev/employeeanalytic/employeeanalytic.templ b/views/dev/employeeanalytic/employeeanalytic.templ new file mode 100644 index 0000000..08c4589 --- /dev/null +++ b/views/dev/employeeanalytic/employeeanalytic.templ @@ -0,0 +1,137 @@ +package dev_employeeanalytic + +import "cpone/layout" +import "cpone/component/customtextfield" +import "cpone/models" + +templ EmployeeAnalyticScreen( + listID string, + paginationID string, + searchID string, + startdateID string, + enddateID string, + breadcrumb templ.Component, + // filtercomponent templ.Component, + listingcomponent templ.Component, +) { + <div class="container-fluid"> + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "listID", + Name: "listID", + Type: "hidden", + Value: listID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "paginationID", + Name: "paginationID", + Type: "hidden", + Value: paginationID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID", + Name: "searchID", + Type: "hidden", + Value: searchID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "startdateID", + Name: "startdateID", + Type: "hidden", + Value: startdateID}) + @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "enddateID", + Name: "enddateID", + Type: "hidden", + Value: enddateID}) + <div class="row align-item-center mb-10"> + <div class="col-md-10 col-sm-12 p-0"> + @breadcrumb + </div> + <div class="col-md-2 d-none d-lg-block d-xl-block d-md=block d-sm-none"> + <div class="d-flex justify-content-end"> + <button + type="button" + class="btn btn-primary btn-block" + >Filter</button> + </div> + </div> + <div class="col-md-2 d-block d-lg-none d-xl-none d-md-none d-sm-block justify-content-center px-5"> + <button + type="button" + class="btn btn-primary btn-block" + >Filter</button> + </div> + </div> + // @filtercomponent + <div id="loading-parent" class="rounded"> + @listingcomponent + <div id="loading-child" class="rounded bg-transparent"> + <div id="loading-spinner" class="spinner-border text-primary d-none" style="width: 3rem; height: 3rem;" role="status"> + <span class="sr-only">Loading...</span> + </div> + </div> + </div> + <div id="loadingcontent"></div> + </div> +} + +templ CSSEmployeeAnalytic() { + <link + rel="stylesheet" + href="assets/css/googlefont/poppins.css" + /> + <link + rel="stylesheet" + href="assets/css/googlefont/publicsans.css" + /> + <link + rel="stylesheet" + href="assets/css/googlefont/roboto.css" + /> + <style> + body { + background-color: white; + } + #div-chart { + margin: 40px 10vw 40px 10vw; + } + .title { + font-size: 20px; + font-weight: bold; + } + #title { + font-weight: 600; + } + </style> +} + +templ JSEmployeeAnalytic() { + +} + +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 ShowEmployeeAnalytic( + 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/dev/employeeanalytic/employeeanalytic_templ.go b/views/dev/employeeanalytic/employeeanalytic_templ.go new file mode 100644 index 0000000..69fa08d --- /dev/null +++ b/views/dev/employeeanalytic/employeeanalytic_templ.go @@ -0,0 +1,227 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package dev_employeeanalytic + +//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 EmployeeAnalyticScreen( + listID string, + paginationID string, + searchID string, + startdateID string, + enddateID string, + breadcrumb templ.Component, + // filtercomponent templ.Component, + listingcomponent 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("<div class=\"container-fluid\">") + 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 = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "searchID", + Name: "searchID", + Type: "hidden", + Value: searchID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "startdateID", + Name: "startdateID", + Type: "hidden", + Value: startdateID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "enddateID", + Name: "enddateID", + Type: "hidden", + Value: enddateID}).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"row align-item-center mb-10\"><div class=\"col-md-10 col-sm-12 p-0\">") + 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("</div><div class=\"col-md-2 d-none d-lg-block d-xl-block d-md=block d-sm-none\"><div class=\"d-flex justify-content-end\"><button type=\"button\" class=\"btn btn-primary btn-block\">Filter</button></div></div><div class=\"col-md-2 d-block d-lg-none d-xl-none d-md-none d-sm-block justify-content-center px-5\"><button type=\"button\" class=\"btn btn-primary btn-block\">Filter</button></div></div><div id=\"loading-parent\" class=\"rounded\">") + 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 = templ_7745c5c3_Buffer.WriteString("<div id=\"loading-child\" class=\"rounded bg-transparent\"><div id=\"loading-spinner\" class=\"spinner-border text-primary d-none\" style=\"width: 3rem; height: 3rem;\" role=\"status\"><span class=\"sr-only\">Loading...</span></div></div></div><div id=\"loadingcontent\"></div></div>") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func CSSEmployeeAnalytic() 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("<link rel=\"stylesheet\" href=\"assets/css/googlefont/poppins.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/publicsans.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/roboto.css\"><style>\r\n body {\r\n background-color: white;\r\n }\r\n #div-chart {\r\n margin: 40px 10vw 40px 10vw;\r\n }\r\n .title {\r\n font-size: 20px;\r\n font-weight: bold;\r\n }\r\n #title {\r\n font-weight: 600;\r\n }\r\n </style>") + 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 JSEmployeeAnalytic() 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) + 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_848c`, + Function: `function __templ_AfterRequestContent_848c(){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_848c`), + CallInline: templ.SafeScriptInline(`__templ_AfterRequestContent_848c`), + } +} + +func ShowEmployeeAnalytic( + 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/dev/employeeanalytic/listingemployeeanalytic.templ b/views/dev/employeeanalytic/listingemployeeanalytic.templ new file mode 100644 index 0000000..bfe9575 --- /dev/null +++ b/views/dev/employeeanalytic/listingemployeeanalytic.templ @@ -0,0 +1,37 @@ +package dev_employeeanalytic + +import "cpone/models" + +templ ListingData(data []models.EmployeeAnalytic) { + <div class="align-items-center pt-16 flex-column"> + <div class="bg-field rounded"> + <div class="p-8"> + for i, d := range data { + if i == (len(data) - 1) { + <div class="card shadow p-8"> + @ItemCard(d) + </div> + } else { + <div class="card shadow p-8 mb-8"> + @ItemCard(d) + </div> + } + } + </div> + </div> + </div> +} + +templ ItemCard(data models.EmployeeAnalytic) { + <div class="row d-flex align-items-center"> + <div class="col-7"> + <h3 class="text-black">{ data.Mgm_McuLabel }</h3> + </div> + <div class="col-md col-lg text-right"> + <span class="text-black font-weight-bolder">{ data.Mgm_McuNote }</span> + </div> + <div class="col-md col-lg text-right"> + <span class="text-black font-weight-bolder">{ data.Mgm_McuStartDate } - { data.Mgm_McuEndDate }</span> + </div> + </div> +} \ No newline at end of file diff --git a/views/dev/employeeanalytic/listingemployeeanalytic_templ.go b/views/dev/employeeanalytic/listingemployeeanalytic_templ.go new file mode 100644 index 0000000..c652b6d --- /dev/null +++ b/views/dev/employeeanalytic/listingemployeeanalytic_templ.go @@ -0,0 +1,146 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.663 +package dev_employeeanalytic + +//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" + +func ListingData(data []models.EmployeeAnalytic) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"align-items-center pt-16 flex-column\"><div class=\"bg-field rounded\"><div class=\"p-8\">") + 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("<div class=\"card shadow p-8\">") + 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("</div>") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"card shadow p-8 mb-8\">") + 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("</div>") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div>") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} + +func ItemCard(data models.EmployeeAnalytic) templ.Component { + return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) + if !templ_7745c5c3_IsBuffer { + templ_7745c5c3_Buffer = templ.GetBuffer() + defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"row d-flex align-items-center\"><div class=\"col-7\"><h3 class=\"text-black\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var3 string + templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuLabel) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\employeeanalytic\listingemployeeanalytic.templ`, Line: 28, Col: 54} + } + _, 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("</h3></div><div class=\"col-md col-lg text-right\"><span class=\"text-black font-weight-bolder\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var4 string + templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuNote) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\employeeanalytic\listingemployeeanalytic.templ`, Line: 31, Col: 74} + } + _, 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("</span></div><div class=\"col-md col-lg text-right\"><span class=\"text-black font-weight-bolder\">") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var5 string + templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuStartDate) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\employeeanalytic\listingemployeeanalytic.templ`, Line: 34, Col: 79} + } + _, 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 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuEndDate) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\dev\employeeanalytic\listingemployeeanalytic.templ`, Line: 34, Col: 105} + } + _, 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("</span></div></div>") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + if !templ_7745c5c3_IsBuffer { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) + } + return templ_7745c5c3_Err + }) +} diff --git a/views/dev/mdsamplestation/mdsamplestation.templ b/views/dev/mdsamplestation/mdsamplestation.templ index a7cdd9a..6cd0b5a 100644 --- a/views/dev/mdsamplestation/mdsamplestation.templ +++ b/views/dev/mdsamplestation/mdsamplestation.templ @@ -100,7 +100,7 @@ templ ContentMDSampleStation( } templ CSSMDSampleStation() { - <linl + <link rel="stylesheet" href="assets/css/googlefont/poppins.css" /> diff --git a/views/dev/mdsamplestation/mdsamplestation_templ.go b/views/dev/mdsamplestation/mdsamplestation_templ.go index 4fcbdbb..dcd5d10 100644 --- a/views/dev/mdsamplestation/mdsamplestation_templ.go +++ b/views/dev/mdsamplestation/mdsamplestation_templ.go @@ -203,7 +203,7 @@ func CSSMDSampleStation() templ.Component { templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<linl rel=\"stylesheet\" href=\"assets/css/googlefont/poppins.css\"></linl><link rel=\"stylesheet\" href=\"assets/css/googlefont/publicsans.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/roboto.css\"><style>\r\n body {\r\n background-color: white;\r\n }\r\n #div-chart {\r\n margin: 40px 10vw 40px 10vw;\r\n }\r\n .title {\r\n font-size: 20px;\r\n font-weight: bold;\r\n }\r\n #title {\r\n font-weight: 600;\r\n }\r\n </style>") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<link rel=\"stylesheet\" href=\"assets/css/googlefont/poppins.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/publicsans.css\"><link rel=\"stylesheet\" href=\"assets/css/googlefont/roboto.css\"><style>\r\n body {\r\n background-color: white;\r\n }\r\n #div-chart {\r\n margin: 40px 10vw 40px 10vw;\r\n }\r\n .title {\r\n font-size: 20px;\r\n font-weight: bold;\r\n }\r\n #title {\r\n font-weight: 600;\r\n }\r\n </style>") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }