diff --git a/handlers/corporate/dashboardpic.handlers.go b/handlers/corporate/dashboardpic.handlers.go index 9f69c4e..5a3f6dd 100644 --- a/handlers/corporate/dashboardpic.handlers.go +++ b/handlers/corporate/dashboardpic.handlers.go @@ -19,6 +19,7 @@ import ( type DashboardPicServices interface { GetEmployeeAnalyticBreadcrumb(title string) (models.BreadCrumbV1, error) + GetCorporateName(userID string) (string, error) DummyDataTest() ([]models.DashboardPic, error) ListingDashboardPic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.DashboardPic, int, error) } @@ -35,19 +36,28 @@ func NewDashboardPicHandler(ea DashboardPicServices) *DashboardPicHandler { func (ea *DashboardPicHandler) HandleShowEmployeeAnalyticScreen(c echo.Context) error { logger, _ := zap.NewProduction() - title := "PT. ABC" listID := utils.GenerateRandomID("listid") paginationID := utils.GenerateRandomID("paginationid") userCok := c.Get("user").(*jwt.Token) claims := userCok.Claims.(jwt.MapClaims) + userID := claims["M_UserID"].(string) name := claims["M_StaffName"].(string) position := claims["M_UserGroupDashboard"].(string) logger.Info("jwt", zap.Any("name", name)) + title, err := ea.DashboardPicServices.GetCorporateName(userID) + if err != nil { + defer logger.Sync() + logger.Info("error get corporate name", zap.Any("error", err)) + return err + } + + convr, _ := strconv.Atoi(userID) + user := models.User{ - UserID: 1, + UserID: convr, Username: name, UserFullName: name, UserPosition: position, diff --git a/services/corporate/dashboardpic.services.go b/services/corporate/dashboardpic.services.go index e879a58..d979993 100644 --- a/services/corporate/dashboardpic.services.go +++ b/services/corporate/dashboardpic.services.go @@ -71,6 +71,25 @@ func (ea *DashboardPicServices) DummyDataTest() ([]models.DashboardPic, error) { return employees, nil } +func (ea *DashboardPicServices) GetCorporateName(userID string) (string, error) { + var corpName string + + q := ` + SELECT + c.CorporateName + FROM mgm_mcu mm + JOIN corporate c ON c.CorporateID = mm.Mgm_McuCorporateID + AND CorporateIsActive = 'Y' + WHERE mm.Mgm_McuID = ? + AND mm.Mgm_McuIsActive = 'Y' + ` + if err := dbx.Handlex.Get(&corpName, q, userID); err != nil { + return "PT. ABC", err + } + + return corpName, nil +} + func (ea *DashboardPicServices) ListingDashboardPic(search string, startdate string, enddate string, currentpage int, rowperpage int) ([]models.DashboardPic, int, error) { logger, _ := zap.NewProduction() var ret []models.DashboardPic diff --git a/services/corporate/mcudetail/tabdaftarpeserta.services.go b/services/corporate/mcudetail/tabdaftarpeserta.services.go index 120399d..344c5c2 100644 --- a/services/corporate/mcudetail/tabdaftarpeserta.services.go +++ b/services/corporate/mcudetail/tabdaftarpeserta.services.go @@ -56,7 +56,7 @@ func (tdps *TabDaftarPesertaServices) GetListMcuDaftarPeserta(id string, current JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y' WHERE T_OrderHeaderIsActive = 'Y' AND T_OrderHeaderMgm_McuID = ? - ORDER BY M_PatientName ASC + ORDER BY T_OrderHeaderLabNumber ASC LIMIT ? OFFSET ?` if err := dbx.Handlex.Select(&listDaftarPeserta, query, id, rowperpage, offset); err != nil { diff --git a/views/corporate/dashboardpic/listingdashboardpic.templ b/views/corporate/dashboardpic/listingdashboardpic.templ index a99fa64..6c9551c 100644 --- a/views/corporate/dashboardpic/listingdashboardpic.templ +++ b/views/corporate/dashboardpic/listingdashboardpic.templ @@ -8,21 +8,27 @@ templ ListingData( listID string, ) {
-
-
- for i, d := range data { - if i == (len(data) - 1) { -
- @ItemCard(d) -
- } else { -
- @ItemCard(d) -
- } - } + if len(data) == 0 { +
+

Data Tidak Ditemukan

-
+ } else { +
+
+ for i, d := range data { + if i == (len(data) - 1) { +
+ @ItemCard(d) +
+ } else { +
+ @ItemCard(d) +
+ } + } +
+
+ }
} diff --git a/views/corporate/dashboardpic/listingdashboardpic_templ.go b/views/corporate/dashboardpic/listingdashboardpic_templ.go index a03a7a1..b2ad6c5 100644 --- a/views/corporate/dashboardpic/listingdashboardpic_templ.go +++ b/views/corporate/dashboardpic/listingdashboardpic_templ.go @@ -42,92 +42,107 @@ func ListingData( if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"align-items-center py-8 flex-column\" hx-swap-oob=\"true\">
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"align-items-center py-8 flex-column\" hx-swap-oob=\"true\">") 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 + if len(data) == 0 { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Data Tidak Ditemukan

") + 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 + } + 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 + } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -158,7 +173,7 @@ func ItemCard(data models.DashboardPic) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuLabel) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\dashboardpic\listingdashboardpic.templ`, Line: 32, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\dashboardpic\listingdashboardpic.templ`, Line: 38, Col: 54} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -171,7 +186,7 @@ func ItemCard(data models.DashboardPic) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuNote) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\dashboardpic\listingdashboardpic.templ`, Line: 35, Col: 74} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\dashboardpic\listingdashboardpic.templ`, Line: 41, Col: 74} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -184,7 +199,7 @@ func ItemCard(data models.DashboardPic) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuStartDate) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\dashboardpic\listingdashboardpic.templ`, Line: 38, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\dashboardpic\listingdashboardpic.templ`, Line: 44, Col: 79} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -197,7 +212,7 @@ func ItemCard(data models.DashboardPic) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(data.Mgm_McuEndDate) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\dashboardpic\listingdashboardpic.templ`, Line: 38, Col: 105} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\dashboardpic\listingdashboardpic.templ`, Line: 44, Col: 105} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { diff --git a/views/corporate/mcu/mcutab/tabledaftarpeserta.templ b/views/corporate/mcu/mcutab/tabledaftarpeserta.templ index f4b5f2d..0df1b63 100644 --- a/views/corporate/mcu/mcutab/tabledaftarpeserta.templ +++ b/views/corporate/mcu/mcutab/tabledaftarpeserta.templ @@ -50,7 +50,7 @@ templ ItemRow( { v.T_OrderHeaderLabNumber } { v.M_PatientName } - { v.M_PatientGender } + { v.JenisKelamin } { v.Age } //
diff --git a/views/corporate/mcu/mcutab/tabledaftarpeserta_templ.go b/views/corporate/mcu/mcutab/tabledaftarpeserta_templ.go index a7f0c69..d68832d 100644 --- a/views/corporate/mcu/mcutab/tabledaftarpeserta_templ.go +++ b/views/corporate/mcu/mcutab/tabledaftarpeserta_templ.go @@ -181,9 +181,9 @@ func ItemRow( return templ_7745c5c3_Err } var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(v.M_PatientGender) + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(v.JenisKelamin) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tabledaftarpeserta.templ`, Line: 53, Col: 35} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tabledaftarpeserta.templ`, Line: 53, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil {