add executive summary

This commit is contained in:
2024-06-20 16:57:14 +07:00
parent 7094dadbdf
commit 664c041acf
17 changed files with 142 additions and 41 deletions

View File

@@ -35,11 +35,16 @@ func NewDashboardPicHandler(ea DashboardPicServices) *DashboardPicHandler {
func (ea *DashboardPicHandler) HandleShowEmployeeAnalyticScreen(c echo.Context) error {
logger, _ := zap.NewProduction()
title := "PT. Sadhana Abiyasa Sampoerna"
title := "PT. ABC"
listID := utils.GenerateRandomID("listid")
paginationID := utils.GenerateRandomID("paginationid")
// usertoken := c.Get("user").(*jwt.Token)
// claims := usertoken.Claims.(jwt.MapClaims)
// name := claims["M_UserEmail"].(string)
// logger.Info("fromtoken", zap.Any("name", name))
user, err := services.GetUserLogin()
if err != nil {
defer logger.Sync()
@@ -59,7 +64,7 @@ func (ea *DashboardPicHandler) HandleShowEmployeeAnalyticScreen(c echo.Context)
sidbaruser := sidebaruserprofile.Navbaruserprofile(user)
breadcrumb := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadcrumb)
listingData, totalPage, err := ea.DashboardPicServices.ListingDashboardPic("", "", "", 1, 5)
listingData, totalPage, err := ea.DashboardPicServices.ListingDashboardPic("", "", "", 1, 10)
if err != nil {
defer logger.Sync()
logger.Info("Error get listing data", zap.Any("error", err), zap.Any("total", totalPage))
@@ -122,7 +127,7 @@ func (ea *DashboardPicHandler) HandlePagination(c echo.Context) error {
return err
}
listdata, totalPage, err := ea.DashboardPicServices.ListingDashboardPic(search, startdate, enddate, page, 5)
listdata, totalPage, err := ea.DashboardPicServices.ListingDashboardPic(search, startdate, enddate, page, 10)
if err != nil {
defer logger.Sync()
logger.Info("Error convert page param")

View File

@@ -15,7 +15,7 @@ import (
)
type McuDetailServices interface {
GetBreadcrumb(title string) (models.BreadCrumbV1, error)
GetBreadcrumb(id string) (models.BreadCrumbV1, error)
}
type McuDetailHandler struct {
@@ -30,7 +30,7 @@ func NewMcuDetailHandler(mcud McuDetailServices) *McuDetailHandler {
func (mcud *McuDetailHandler) HandlerShowMcuDetailScreen(c echo.Context) error {
logger, _ := zap.NewProduction()
title := "PT. Sadhana Abiyasa Sampoerna"
title := "PT. ABC"
id := c.Param("id")
logger.Info("params", zap.Any("id", id))
@@ -42,7 +42,7 @@ func (mcud *McuDetailHandler) HandlerShowMcuDetailScreen(c echo.Context) error {
return err
}
dataBreadcrumb, err := mcud.McuDetailServices.GetBreadcrumb(title)
dataBreadcrumb, err := mcud.McuDetailServices.GetBreadcrumb(id)
if err != nil {
defer logger.Sync()
logger.Info("Error breadcrumb corp", zap.Any("error", err))

View File

@@ -37,7 +37,7 @@ func (tdp *TabDaftarPesertaHandlers) HandleShowTabDaftarPeserta(c echo.Context)
id := c.Param("id")
logger.Info("Params", zap.Any("id", id))
dataTable, totalPage, err := tdp.TabDaftarPesertaServices.GetListMcuDaftarPeserta(id, 1, 5)
dataTable, totalPage, err := tdp.TabDaftarPesertaServices.GetListMcuDaftarPeserta(id, 1, 10)
if err != nil {
return err
}
@@ -133,7 +133,7 @@ func (tdp *TabDaftarPesertaHandlers) HandlePagination(c echo.Context) error {
return err
}
tableData, totalPage, err := tdp.TabDaftarPesertaServices.GetListMcuDaftarPeserta(id, page, 5)
tableData, totalPage, err := tdp.TabDaftarPesertaServices.GetListMcuDaftarPeserta(id, page, 10)
if err != nil {
return err
}

View File

@@ -58,7 +58,7 @@ func (ph *PatientHandler) LoadLocalData(c echo.Context) error {
defer logger.Sync()
breadcrumb := breadcrumadmin.MainBreadcrumbAdminV1(dataBreadcrumb)
listingdata, totalPage, err := ph.PatientService.GetListtingData(userEmail, 1, 5)
listingdata, totalPage, err := ph.PatientService.GetListtingData(userEmail, 1, 10)
if err != nil {
defer logger.Sync()
logger.Info("error get listing data", zap.Any("error", err), zap.Any("total", totalPage))
@@ -174,7 +174,7 @@ func (ph *PatientHandler) HandleChangePage(c echo.Context) error {
return err
}
listData, totalPage, err := ph.PatientService.GetListtingData(userEmail, page, 5)
listData, totalPage, err := ph.PatientService.GetListtingData(userEmail, page, 10)
if err != nil {
defer logger.Sync()
logger.Info("error get data listing")

View File

@@ -87,12 +87,45 @@ func (lh *LoginHandler) HandleSignIn(c echo.Context) error {
const user = JSON.stringify(` + userString + `);
localStorage.setItem("token", token);
localStorage.setItem("user", user);
htmx.on("htmx:configRequest", (e)=> {
e.detail.headers["Authentication"] = "Bearer ` + resp.Data.Token + `"
})
setTimeout(() => {
window.location.href = "` + url + `";
}, 100);
htmx.ajax('GET', '/login/redirect?url=` + url + `')
}, 500)
// document.body.addEventListener('htmx:configRequest', function(evt) {
// evt.detail.headers['Authentication'] = "Bearer: " + getJWT();
// console.log("running");
// });
// setTimeout(() => {
// window.location.href = "` + url + `";
// }, 100);
// document.body.addEventListener('htmx:configRequest', function(evt) {
// const token = localStorage.getItem("token");
// if (token) {
// evt.detail.headers['Authorization'] = "Bearer " + token;
// }
// });
// document.body.hxTrigger({ "hx-redirect": "` + url + `" });
</script>
`
c.Response().Header().Set("HX-Trigger", "script")
return c.String(http.StatusOK, store)
}
func (lh *LoginHandler) HandleRedirect(c echo.Context) error {
logger, _ := zap.NewProduction()
url := c.QueryParam("url")
token := c.Request().Header.Get("Authentication")
logger.Info("params", zap.Any("url", url), zap.Any("token", token))
c.Response().Header().Set("Authentication", token)
c.Response().Header().Set("HX-Redirect", url)
return c.String(http.StatusOK, url)
}

View File

@@ -77,6 +77,7 @@ func SetupRoutesPublic(app *echo.Echo, appStore db.AppStore) {
loginHadlr := public_handlers.NewLoginHandler(loginServ)
public.GET("login", loginHadlr.HandlerShowLogin)
public.POST("login/signin", loginHadlr.HandleSignIn)
public.GET("login/redirect", loginHadlr.HandleRedirect)
// kartu kontrol
publicKartuKontrolServices := public_services.NewServicesKartuKontrol(appStore)