add templ medical analityc

This commit is contained in:
Hanan Askarim
2024-05-02 08:46:05 +07:00
parent c267c26260
commit f6eb31c242
9 changed files with 499 additions and 122 deletions

View File

@@ -139,18 +139,26 @@ License: You must have a valid license purchased only from themeforest(the above
height: 40px;
}
/* batas */
.items-content {
padding: 24px;
margin-bottom: 24px;
}
.container {
padding: 24px;
.content-page {
padding-top: 24px;
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
}
.item-foto {
width: 32px;
height: 32px;
}
.heading {
padding-top: 40px;
}
.card:hover {
background-color: rgba(197, 200, 211, 0.5);
}
</style>
</head>
<!--end::Head-->
@@ -184,7 +192,7 @@ License: You must have a valid license purchased only from themeforest(the above
<!-- Navbar End -->
<!--begin::Page Heading-->
<div class="d-flex justify-content-between">
<div class="heading d-flex justify-content-between">
<div class="align-items-center flex-wrap">
<!--begin::Page Title-->
<h5 class="text-dark font-weight-bold my-1 mr-5">
@@ -208,8 +216,8 @@ License: You must have a valid license purchased only from themeforest(the above
<div class="d-flex align-items-center">
<!--begin::Actions-->
<a href="#" class="btn btn-light-primary font-weight-bolder btn-sm">
Filter
<a href="#" class="btn btn-primary font-weight-bolder btn-lg">
<i class="fas fa-filter"></i> Filter
</a>
<!--end::Actions-->
</div>
@@ -219,48 +227,94 @@ License: You must have a valid license purchased only from themeforest(the above
<!-- content -->
<div class="align-items-center pt-15 flex-column">
<div class="bg-field rounded">
<div class="container">
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3>MCU Calon Karyawan</h3>
</div>
<div class="col-md col-lg text-right">
<span class="font-weight-bolde">Tanggal Pelaksanaan</span>
</div>
<div class="col-md col-lg text-right">
<span class="font-weight-bolde">01/04/2024 - 06/04/2024</span>
<div class="content-page">
<!-- card -->
<a href="">
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3 class="text-black">MCU Calon Karyawan</h3>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde"
>Tanggal Pelaksanaan</span
>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde"
>01/04/2024 - 06/04/2024</span
>
</div>
</div>
</div>
</div>
</a>
<!-- end card -->
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3>MCU Calon Karyawan</h3>
</div>
<div class="col-md col-lg text-right">
<span class="font-weight-bolde">Tanggal Pelaksanaan</span>
</div>
<div class="col-md col-lg text-right">
<span class="font-weight-bolde">01/04/2024 - 06/04/2024</span>
<!-- card -->
<a href="">
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3 class="text-black">MCU Karyawan</h3>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde"
>Tanggal Pelaksanaan</span
>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde"
>01/04/2024 - 06/04/2024</span
>
</div>
</div>
</div>
</div>
</a>
<!-- end card -->
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3>MCU Calon Karyawan</h3>
</div>
<div class="col-md col-lg text-right">
<span class="font-weight-bolde">Tanggal Pelaksanaan</span>
</div>
<div class="col-md col-lg text-right">
<span class="font-weight-bolde">01/04/2024 - 06/04/2024</span>
<!-- card -->
<a href="">
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3 class="text-black">MCU Eselon 1</h3>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde"
>Tanggal Pelaksanaan</span
>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde"
>01/04/2024 - 06/04/2024</span
>
</div>
</div>
</div>
</div>
</a>
<!-- end card -->
<!-- card -->
<a href="">
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3 class="text-black">MCU Eselon 2</h3>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde"
>Tanggal Pelaksanaan</span
>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde"
>01/04/2024 - 06/04/2024</span
>
</div>
</div>
</div>
</a>
<!-- end card -->
</div>
</div>
</div>

View File

@@ -62,6 +62,14 @@ func main() {
lphs := handlers.NewLandingPageHandler(lps)
handlers.SetupRoutesLandingPage(app, lphs)
eStore, err := db.NewEmployeeStore(dbName)
if err != nil {
app.Logger.Fatalf("failed to create store: %s", err)
}
el := services.NewServicesEmployee(services.Employee{}, eStore)
ehs := handlers.NewEmployeeHandler(el)
handlers.SetupRoutesEmployee(app, ehs)
app.Logger.Fatal(app.Start(":5000"))
}

View File

@@ -0,0 +1,42 @@
package handlers
import (
"fmt"
"github.com/a-h/templ"
"github.com/emarifer/go-templ-project-structure/services"
"github.com/emarifer/go-templ-project-structure/views/employee"
"github.com/labstack/echo/v4"
)
type EmployeeService interface {
GetEmployeeService() ([]services.EmployeeService, error)
}
func NewEmployeeHandler(us EmployeeService) *EmployeeHandler {
return &EmployeeHandler{
EmployeeService: us,
}
}
type EmployeeHandler struct {
EmployeeService EmployeeService
}
func (eh *EmployeeHandler) ShowEmployee(c echo.Context) error {
udata, err := eh.EmployeeService.GetEmployeeService()
if err != nil {
// fmt.Println(err)
return err
}
fmt.Printf("%+v\n", udata)
e := employee.ShowEmployee("Employee", employee.MainEmployee(employee.ListCardService(udata)), employee.CssEmployee(), employee.JsEmployee())
return eh.View(c, e)
}
func (eh *EmployeeHandler) View(c echo.Context, cmp templ.Component) error {
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
return cmp.Render(c.Request().Context(), c.Response().Writer)
}

View File

@@ -23,6 +23,10 @@ func SetupRoutesLandingPage(app *echo.Echo, h *LandingPageHandler) {
Lp := app.Group("/landing_page")
Lp.GET("/", h.ShowLandingPage)
}
func SetupRoutesEmployee(app *echo.Echo, e *EmployeeHandler) {
employee := app.Group("/employee")
employee.GET("/", e.ShowEmployee)
}
func SetupRoutesProject(app *echo.Echo) {
}

View File

@@ -0,0 +1,71 @@
package services
import (
"time"
"github.com/emarifer/go-templ-project-structure/db"
)
func NewServicesEmployee(u Employee, uStore db.EmployeeStore) *ServicesEmployee {
return &ServicesEmployee{
Employee: u,
EmployeeStore: uStore,
}
}
type Employee struct {
ID int `json:"id"`
Employeename string `json:"Employeename"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
type EmployeeService struct {
EmployeeID int `json:"EmployeeID"`
EmployeeTitle string `json:"EmployeeTitle"`
EmployeeDescription string `json:"EmployeeDescription"`
EmployeeStartDate string `json:"EmployeeStartDate"`
EmployeeEndDate string `json:"EmployeeEndDate"`
}
type ServicesEmployee struct {
Employee Employee
EmployeeStore db.EmployeeStore
}
func (se *ServicesEmployee) GetEmployeeService() ([]EmployeeService, error) {
data := []EmployeeService{
{
EmployeeID: 1,
EmployeeTitle: "MCU Calon Karyawan",
EmployeeDescription: "Tanggal Pelaksanaan",
EmployeeStartDate: "01/04/2024",
EmployeeEndDate: "06/04/2024",
},
{
EmployeeID: 2,
EmployeeTitle: "MCU Karyawan",
EmployeeDescription: "Tanggal Pelaksanaan",
EmployeeStartDate: "01/04/2024",
EmployeeEndDate: "06/04/2024",
},
{
EmployeeID: 1,
EmployeeTitle: "MCU Eselon 1",
EmployeeDescription: "Tanggal Pelaksanaan",
EmployeeStartDate: "01/04/2024",
EmployeeEndDate: "06/04/2024",
},
{
EmployeeID: 1,
EmployeeTitle: "MCU Eselon 2",
EmployeeDescription: "Tanggal Pelaksanaan",
EmployeeStartDate: "01/04/2024",
EmployeeEndDate: "06/04/2024",
},
}
return data, nil
}

View File

@@ -4,7 +4,7 @@ import (
"github.com/emarifer/go-templ-project-structure/views/layout"
)
templ MainEmployee() {
templ MainEmployee(cardServiceComponent templ.Component) {
<div class="wrapper-custom">
<!-- Navbar Start -->
<nav
@@ -12,7 +12,7 @@ templ MainEmployee() {
>
<a class="navbar-brand" href="#">
<img
src="../assets/asset-corporate-portal/media/landingpage/logo.png"
src="../../asset-corporate-portal/media/landingpage/logo.png"
width="126"
height="40"
class="d-inline-block align-top"
@@ -20,85 +20,22 @@ templ MainEmployee() {
/>
</a>
<img
src="../assets/asset-corporate-portal/media/logo/foto.png"
src="../../asset-corporate-portal/media/logo/foto.png"
alt="..."
class="item-foto rounded-circle"
/>
</nav>
<!-- Navbar End -->
<!--begin::Page Heading-->
<div class="d-flex justify-content-between">
<div class="align-items-center flex-wrap">
<!--begin::Page Title-->
<h5 class="text-dark font-weight-bold my-1 mr-5">
PT. Sadhana Abiyasa Sampoerna
</h5>
<!--end::Page Title-->
<!--begin::Breadcrumb-->
<ul
class="breadcrumb breadcrumb-transparent breadcrumb-dot font-weight-bold p-0 my-2 font-size-sm"
>
<li class="breadcrumb-item">
<a href="" class="text-muted">Dashboard</a>
</li>
<li class="breadcrumb-item">
<a href="" class="text-muted">Employee Health Medical Analytic</a>
</li>
</ul>
<!--end::Breadcrumb-->
</div>
<div class="d-flex align-items-center">
<!--begin::Actions-->
<a href="#" class="btn btn-light-primary font-weight-bolder btn-sm">
Filter
</a>
<!--end::Actions-->
</div>
</div>
@HeadingEmployee("PT. Sadhana Abiyasa Sampoerna")
<!--end::Page Heading-->
<!-- content -->
<div class="align-items-center pt-15 flex-column">
<div class="bg-field rounded">
<div class="container">
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3>MCU Calon Karyawan</h3>
</div>
<div class="col-md col-lg">
<span class="font-weight-bolde">Tanggal Pelaksanaan</span>
</div>
<div class="col-md col-lg">
<span class="font-weight-bolde">01/04/2024 - 06/04/2024</span>
</div>
</div>
</div>
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3>MCU Calon Karyawan</h3>
</div>
<div class="col-md col-lg">
<span class="font-weight-bolde">Tanggal Pelaksanaan</span>
</div>
<div class="col-md col-lg">
<span class="font-weight-bolde">01/04/2024 - 06/04/2024</span>
</div>
</div>
</div>
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3>MCU Calon Karyawan</h3>
</div>
<div class="col-md col-lg">
<span class="font-weight-bolde">Tanggal Pelaksanaan</span>
</div>
<div class="col-md col-lg">
<span class="font-weight-bolde">01/04/2024 - 06/04/2024</span>
</div>
</div>
</div>
<div class="content-page">
<!-- card -->
@cardServiceComponent
<!-- end card -->
</div>
</div>
</div>
@@ -145,21 +82,32 @@ templ CssEmployee() {
height: 40px;
}
/* batas */
.items-content {
padding: 24px;
margin-bottom: 24px;
}
.container {
padding: 24px;
.content-page {
padding-top: 24px;
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
}
.item-foto {
width: 32px;
height: 32px;
}
.heading {
padding-top: 40px;
}
.card:hover {
background-color: rgba(197, 200, 211, 0.5);
}
</style>
}
templ JsEmployee() {
}
templ ShowEmployee(title string, cmp templ.Component, css templ.Component, js templ.Component) {
@layout.PlaygroundLayout(title, css, js) {
@cmp

View File

@@ -14,7 +14,7 @@ import (
"github.com/emarifer/go-templ-project-structure/views/layout"
)
func MainEmployee() templ.Component {
func MainEmployee(cardServiceComponent 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 {
@@ -27,7 +27,23 @@ func MainEmployee() templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"wrapper-custom\"><!-- Navbar Start --><nav class=\"navbar navbar-expand-sm navbar-expand-lg navbar-lp justify-content-between\"><a class=\"navbar-brand\" href=\"#\"><img src=\"../assets/asset-corporate-portal/media/landingpage/logo.png\" width=\"126\" height=\"40\" class=\"d-inline-block align-top\" alt=\"Your Brand\"></a> <img src=\"../assets/asset-corporate-portal/media/logo/foto.png\" alt=\"...\" class=\"item-foto rounded-circle\"></nav><!-- Navbar End --><!--begin::Page Heading--><div class=\"d-flex justify-content-between\"><div class=\"align-items-center flex-wrap\"><!--begin::Page Title--><h5 class=\"text-dark font-weight-bold my-1 mr-5\">PT. Sadhana Abiyasa Sampoerna\r</h5><!--end::Page Title--><!--begin::Breadcrumb--><ul class=\"breadcrumb breadcrumb-transparent breadcrumb-dot font-weight-bold p-0 my-2 font-size-sm\"><li class=\"breadcrumb-item\"><a href=\"\" class=\"text-muted\">Dashboard</a></li><li class=\"breadcrumb-item\"><a href=\"\" class=\"text-muted\">Employee Health Medical Analytic</a></li></ul><!--end::Breadcrumb--></div><div class=\"d-flex align-items-center\"><!--begin::Actions--><a href=\"#\" class=\"btn btn-light-primary font-weight-bolder btn-sm\">Filter\r</a><!--end::Actions--></div></div><!--end::Page Heading--><!-- content --><div class=\"align-items-center pt-15 flex-column\"><div class=\"bg-field rounded\"><div class=\"container\"><div class=\"items-content card shadow\"><div class=\"row d-flex align-items-center\"><div class=\"col-7\"><h3>MCU Calon Karyawan</h3></div><div class=\"col-md col-lg\"><span class=\"font-weight-bolde\">Tanggal Pelaksanaan</span></div><div class=\"col-md col-lg\"><span class=\"font-weight-bolde\">01/04/2024 - 06/04/2024</span></div></div></div><div class=\"items-content card shadow\"><div class=\"row d-flex align-items-center\"><div class=\"col-7\"><h3>MCU Calon Karyawan</h3></div><div class=\"col-md col-lg\"><span class=\"font-weight-bolde\">Tanggal Pelaksanaan</span></div><div class=\"col-md col-lg\"><span class=\"font-weight-bolde\">01/04/2024 - 06/04/2024</span></div></div></div><div class=\"items-content card shadow\"><div class=\"row d-flex align-items-center\"><div class=\"col-7\"><h3>MCU Calon Karyawan</h3></div><div class=\"col-md col-lg\"><span class=\"font-weight-bolde\">Tanggal Pelaksanaan</span></div><div class=\"col-md col-lg\"><span class=\"font-weight-bolde\">01/04/2024 - 06/04/2024</span></div></div></div></div></div></div><!-- end content --></div>")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"wrapper-custom\"><!-- Navbar Start --><nav class=\"navbar navbar-expand-sm navbar-expand-lg navbar-lp justify-content-between\"><a class=\"navbar-brand\" href=\"#\"><img src=\"../../asset-corporate-portal/media/landingpage/logo.png\" width=\"126\" height=\"40\" class=\"d-inline-block align-top\" alt=\"Your Brand\"></a> <img src=\"../../asset-corporate-portal/media/logo/foto.png\" alt=\"...\" class=\"item-foto rounded-circle\"></nav><!-- Navbar End --><!--begin::Page Heading-->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = HeadingEmployee("PT. Sadhana Abiyasa Sampoerna").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!--end::Page Heading--><!-- content --><div class=\"align-items-center pt-15 flex-column\"><div class=\"bg-field rounded\"><div class=\"content-page\"><!-- card -->")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = cardServiceComponent.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- end card --></div></div></div><!-- end content --></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -51,7 +67,7 @@ func CssEmployee() templ.Component {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<style>\r\n body {\r\n background-color: white;\r\n /* padding-right: 100px;\r\n padding-left: 100px; */\r\n }\r\n\r\n .navbar-lp {\r\n padding-top: 40px;\r\n padding-bottom: 40px;\r\n }\r\n\r\n .title {\r\n /* color: #FFF; */\r\n font-family: Poppins;\r\n font-size: 15px;\r\n /* font-size: 1vw; */\r\n font-style: normal;\r\n font-weight: 700;\r\n }\r\n\r\n .custom-card-lp {\r\n border-radius: 24px;\r\n border: 1px solid #d9d9d9;\r\n margin-top: 40px;\r\n }\r\n\r\n .wrapper-custom {\r\n /* background: #1B1D1F; */\r\n padding-left: 10vw;\r\n padding-right: 10vw;\r\n }\r\n\r\n .media-left-icon {\r\n width: 40px;\r\n height: 40px;\r\n }\r\n\r\n /* batas */\r\n .items-content {\r\n padding: 24px;\r\n margin-bottom: 24px;\r\n }\r\n .container {\r\n padding: 24px;\r\n }\r\n .item-foto {\r\n width: 32px;\r\n height: 32px;\r\n }\r\n </style>")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<style>\r\n body {\r\n background-color: white;\r\n /* padding-right: 100px;\r\n padding-left: 100px; */\r\n }\r\n\r\n .navbar-lp {\r\n padding-top: 40px;\r\n padding-bottom: 40px;\r\n }\r\n\r\n .title {\r\n /* color: #FFF; */\r\n font-family: Poppins;\r\n font-size: 15px;\r\n /* font-size: 1vw; */\r\n font-style: normal;\r\n font-weight: 700;\r\n }\r\n\r\n .custom-card-lp {\r\n border-radius: 24px;\r\n border: 1px solid #d9d9d9;\r\n margin-top: 40px;\r\n }\r\n\r\n .wrapper-custom {\r\n /* background: #1B1D1F; */\r\n padding-left: 10vw;\r\n padding-right: 10vw;\r\n }\r\n\r\n .media-left-icon {\r\n width: 40px;\r\n height: 40px;\r\n }\r\n\r\n .items-content {\r\n padding: 24px;\r\n margin-bottom: 24px;\r\n }\r\n .content-page {\r\n padding-top: 24px;\r\n padding-left: 24px;\r\n padding-right: 24px;\r\n padding-bottom: 24px;\r\n }\r\n .item-foto {\r\n width: 32px;\r\n height: 32px;\r\n }\r\n .heading {\r\n padding-top: 40px;\r\n }\r\n .card:hover {\r\n background-color: rgba(197, 200, 211, 0.5);\r\n }\r\n </style>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -62,6 +78,26 @@ func CssEmployee() templ.Component {
})
}
func JsEmployee() 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 ShowEmployee(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)
@@ -70,12 +106,12 @@ func ShowEmployee(title string, cmp templ.Component, css templ.Component, js tem
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
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
if templ_7745c5c3_Var4 == nil {
templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var4 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
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()
@@ -90,7 +126,7 @@ func ShowEmployee(title string, cmp templ.Component, css templ.Component, js tem
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
templ_7745c5c3_Err = layout.PlaygroundLayout(title, css, js).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}

View File

@@ -0,0 +1,60 @@
package employee
import (
"github.com/emarifer/go-templ-project-structure/services"
)
templ CardService(title string, description string, startdate string, enddate string) {
<a href="">
<div class="items-content card shadow">
<div class="row d-flex align-items-center">
<div class="col-7">
<h3 class="text-black">{ title }</h3>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde">{ description }</span>
</div>
<div class="col-md col-lg text-right">
<span class="text-black font-weight-bolde">{ startdate } - { enddate }</span>
</div>
</div>
</div>
</a>
}
templ ListCardService(cardData []services.EmployeeService) {
for _, d := range cardData {
@CardService(d.EmployeeTitle, d.EmployeeDescription, d.EmployeeStartDate, d.EmployeeEndDate)
}
}
templ HeadingEmployee(title string) {
<div class="heading d-flex justify-content-between">
<div class="align-items-center flex-wrap">
<!--begin::Page Title-->
<h5 class="text-dark font-weight-bold my-1 mr-5">
{ title }
</h5>
<!--end::Page Title-->
<!--begin::Breadcrumb-->
<ul
class="breadcrumb breadcrumb-transparent font-weight-bold p-0 my-2 font-size-sm"
>
<li class="breadcrumb-item">
<a href="" class="text-muted">Dashboard</a>
</li>
<li class="breadcrumb-item">
<a href="" class="text-muted">Employee Health Medical Analytic</a>
</li>
</ul>
<!--end::Breadcrumb-->
</div>
<div class="d-flex align-items-center">
<!--begin::Actions-->
<a href="#" class="btn btn-primary font-weight-bolder btn-lg">
<i class="fas fa-filter"></i> Filter
</a>
<!--end::Actions-->
</div>
</div>
}

View File

@@ -0,0 +1,154 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.663
package employee
//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 (
"github.com/emarifer/go-templ-project-structure/services"
)
func CardService(title string, description string, startdate string, enddate 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("<a href=\"\"><div class=\"items-content card shadow\"><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_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\employee\employeecomponent.templ`, Line: 12, Col: 35}
}
_, 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("</h3></div><div class=\"col-md col-lg text-right\"><span class=\"text-black font-weight-bolde\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(description)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\employee\employeecomponent.templ`, Line: 15, Col: 61}
}
_, 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("</span></div><div class=\"col-md col-lg text-right\"><span class=\"text-black font-weight-bolde\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(startdate)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\employee\employeecomponent.templ`, Line: 18, Col: 59}
}
_, 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(" - ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(enddate)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\employee\employeecomponent.templ`, Line: 18, Col: 73}
}
_, 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("</span></div></div></div></a>")
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 ListCardService(cardData []services.EmployeeService) 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_Var6 := templ.GetChildren(ctx)
if templ_7745c5c3_Var6 == nil {
templ_7745c5c3_Var6 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
for _, d := range cardData {
templ_7745c5c3_Err = CardService(d.EmployeeTitle, d.EmployeeDescription, d.EmployeeStartDate, d.EmployeeEndDate).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 HeadingEmployee(title 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_Var7 := templ.GetChildren(ctx)
if templ_7745c5c3_Var7 == nil {
templ_7745c5c3_Var7 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"heading d-flex justify-content-between\"><div class=\"align-items-center flex-wrap\"><!--begin::Page Title--><h5 class=\"text-dark font-weight-bold my-1 mr-5\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\employee\employeecomponent.templ`, Line: 36, Col: 11}
}
_, 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("</h5><!--end::Page Title--><!--begin::Breadcrumb--><ul class=\"breadcrumb breadcrumb-transparent font-weight-bold p-0 my-2 font-size-sm\"><li class=\"breadcrumb-item\"><a href=\"\" class=\"text-muted\">Dashboard</a></li><li class=\"breadcrumb-item\"><a href=\"\" class=\"text-muted\">Employee Health Medical Analytic</a></li></ul><!--end::Breadcrumb--></div><div class=\"d-flex align-items-center\"><!--begin::Actions--><a href=\"#\" class=\"btn btn-primary font-weight-bolder btn-lg\"><i class=\"fas fa-filter\"></i> Filter\r</a><!--end::Actions--></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
})
}