From dbad97d0f2d7ebaef2a760895032da2bd815b7bc Mon Sep 17 00:00:00 2001 From: adibwp Date: Tue, 25 Jun 2024 16:49:21 +0700 Subject: [PATCH] add formating ribuan keuangan + alert salah login --- .../mcudetail/tabkeuangan.handlers.go | 15 ++-- handlers/public/login.handlers.go | 19 +++-- models/keuangan.models.go | 22 ++--- .../mcudetail/tabkeuangan.services.go | 6 +- utils/formatRibuan.utils.go | 12 +++ .../corporate/mcu/mcutab/tablekeuangan.templ | 19 +++-- .../mcu/mcutab/tablekeuangan_templ.go | 85 ++++++++++--------- views/public/login/login.templ | 7 +- views/public/login/login_templ.go | 6 +- views/public/login/logincomponent.templ | 46 +++++++--- views/public/login/logincomponent_templ.go | 59 +++++++++++-- 11 files changed, 199 insertions(+), 97 deletions(-) create mode 100644 utils/formatRibuan.utils.go diff --git a/handlers/corporate/mcudetail/tabkeuangan.handlers.go b/handlers/corporate/mcudetail/tabkeuangan.handlers.go index f419f93..aa1a898 100644 --- a/handlers/corporate/mcudetail/tabkeuangan.handlers.go +++ b/handlers/corporate/mcudetail/tabkeuangan.handlers.go @@ -12,7 +12,7 @@ import ( ) type TabKeuanganServices interface { - GetTotalOrderKeuangan(mcuID string) (float64, error) + GetTotalOrderKeuangan(mcuID string) (int, error) GetTotalCardData(mcuID string) (models.TotalBillCard, error) GetListingDataKeuangan(mcuID string, currentpage int, rowperpage int) ([]models.KeuanganModel, int, error) } @@ -71,14 +71,19 @@ func (tk *TabKeuanganHandler) HandleShowTabKeuangan(c echo.Context) error { return err } + totalOrderF := utils.FormatRibuan(int(totalOrder)) + totalTagihan := utils.FormatRibuan(int(totalBill.TotalTagihan)) + totalPelunasan := utils.FormatRibuan(int(totalBill.TotalPelunasan)) + totalHutang := utils.FormatRibuan(int(totalBill.TotalHutang)) + content := corporate_mcudetail.TabKeuanganScreen( tableID, paginationID, corporate_mcudetail.KeuanganCard( - strconv.FormatFloat(totalOrder, 'f', 0, 64), - strconv.FormatFloat(totalBill.TotalTagihan, 'f', 0, 64), - strconv.FormatFloat(totalBill.TotalPelunasan, 'f', 0, 64), - strconv.FormatFloat(totalBill.TotalHutang, 'f', 0, 64), + totalOrderF, + totalTagihan, + totalPelunasan, + totalHutang, ), corporate_mcudetail.TableAndPagination( tablecompo, diff --git a/handlers/public/login.handlers.go b/handlers/public/login.handlers.go index f78fb3c..3bc733c 100644 --- a/handlers/public/login.handlers.go +++ b/handlers/public/login.handlers.go @@ -29,7 +29,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(true), public_login.CssLogin(), public_login.JsLogin()) return utils.View(c, si) } @@ -45,18 +45,24 @@ func (lh *LoginHandler) HandleSignIn(c echo.Context) error { resp, err := lh.LoginService.MultiSignIn(username, password) if err != nil { defer logger.Sync() - logger.Info("Error", zap.Error(err)) + logger.Info("Error", zap.Any("error multi signin", err)) - si := public_login.ShowLogin("Login ", public_login.MainLogin(), public_login.CssLogin(), public_login.JsLogin()) + si := public_login.ShowLogin("Login ", public_login.MainLogin(false), public_login.CssLogin(), public_login.JsLogin()) return utils.View(c, si) + + // loginform := public_login.FormSignin(false) + // return utils.View(c, loginform) } if resp.Status == "ERR" { defer logger.Sync() logger.Info("Error", zap.Any("ERR", resp.Status)) - si := public_login.ShowLogin("Login ", public_login.MainLogin(), public_login.CssLogin(), public_login.JsLogin()) + si := public_login.ShowLogin("Login ", public_login.MainLogin(false), public_login.CssLogin(), public_login.JsLogin()) return utils.View(c, si) + // loginform := public_login.FormSignin(false) + // return utils.View(c, loginform) } + defer logger.Sync() logger.Info("valid", zap.Any("value", resp)) @@ -77,8 +83,11 @@ func (lh *LoginHandler) HandleSignIn(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(false), public_login.CssLogin(), public_login.JsLogin()) return utils.View(c, si) + + // loginform := public_login.FormSignin(false) + // return utils.View(c, loginform) } cookie := new(http.Cookie) diff --git a/models/keuangan.models.go b/models/keuangan.models.go index c61ac67..3dd0767 100644 --- a/models/keuangan.models.go +++ b/models/keuangan.models.go @@ -1,15 +1,15 @@ package models type KeuanganModel struct { - F_BillID int `db:"F_BillID"` - F_BillNo string `db:"F_BillNo"` - F_BillCorporateID int `db:"F_BillCorporateID"` - F_BillDueDate string `db:"F_BillDueDate"` - F_BillTotal float64 `db:"F_BillTotal"` - F_BillUnpaid float64 `db:"F_BillUnpaid"` - F_BillCreated string `db:"F_BillCreated"` + F_BillID int `db:"F_BillID"` + F_BillNo string `db:"F_BillNo"` + F_BillCorporateID int `db:"F_BillCorporateID"` + F_BillDueDate string `db:"F_BillDueDate"` + F_BillTotal int `db:"F_BillTotal"` + F_BillUnpaid int `db:"F_BillUnpaid"` + F_BillCreated string `db:"F_BillCreated"` BillPayment []BillPaymentModel - TotalBillPayment float64 + TotalBillPayment int } type BillPaymentModel struct { @@ -28,7 +28,7 @@ type TotalOrderHeader struct { } type TotalBillCard struct { - TotalTagihan float64 - TotalPelunasan float64 - TotalHutang float64 + TotalTagihan int + TotalPelunasan int + TotalHutang int } diff --git a/services/corporate/mcudetail/tabkeuangan.services.go b/services/corporate/mcudetail/tabkeuangan.services.go index bc4e2aa..5eae89c 100644 --- a/services/corporate/mcudetail/tabkeuangan.services.go +++ b/services/corporate/mcudetail/tabkeuangan.services.go @@ -20,10 +20,10 @@ func NewTabKeuanganServices(uStore db.AppStore) *TabKeuanganServices { } } -func (tks *TabKeuanganServices) GetTotalOrderKeuangan(mcuID string) (float64, error) { +func (tks *TabKeuanganServices) GetTotalOrderKeuangan(mcuID string) (int, error) { logger, _ := zap.NewProduction() var mcu models.DashboardPic - ret := 0.00 + ret := 0 var data []models.TotalOrderHeader q := ` @@ -59,7 +59,7 @@ func (tks *TabKeuanganServices) GetTotalOrderKeuangan(mcuID string) (float64, er } for _, d := range data { - ret = ret + d.T_OrderHeaderTotal + ret = ret + int(d.T_OrderHeaderTotal) } return ret, nil diff --git a/utils/formatRibuan.utils.go b/utils/formatRibuan.utils.go new file mode 100644 index 0000000..b739e1a --- /dev/null +++ b/utils/formatRibuan.utils.go @@ -0,0 +1,12 @@ +package utils + +import ( + "golang.org/x/text/language" + "golang.org/x/text/message" +) + +func FormatRibuan(amount int) string { + p := message.NewPrinter(language.Indonesian) + formated := p.Sprintf("%v", amount) + return formated +} diff --git a/views/corporate/mcu/mcutab/tablekeuangan.templ b/views/corporate/mcu/mcutab/tablekeuangan.templ index 5430917..6b2f459 100644 --- a/views/corporate/mcu/mcutab/tablekeuangan.templ +++ b/views/corporate/mcu/mcutab/tablekeuangan.templ @@ -2,6 +2,7 @@ package corporate_mcudetail import "cpone/models" import "strconv" +import "cpone/utils" templ TableAndPagination( tablecomponent templ.Component, @@ -60,10 +61,10 @@ templ RowKeuangan(
{ v.F_BillCreated }
{ v.F_BillDueDate } - { strconv.FormatFloat(v.F_BillTotal, 'f', 0, 64) } + { utils.FormatRibuan(v.F_BillTotal) } - - - { strconv.FormatFloat(v.F_BillUnpaid, 'f', 0, 64) } + { utils.FormatRibuan(v.F_BillUnpaid) } } else if len(v.BillPayment) == 1 { @@ -72,13 +73,13 @@ templ RowKeuangan(
{ v.F_BillCreated }
{ v.F_BillDueDate } - { strconv.FormatFloat(v.F_BillTotal, 'f', 0, 64) } + { utils.FormatRibuan(v.F_BillTotal) }
{ v.BillPayment[0].F_BillPaymentNumber }
{ v.BillPayment[0].F_BillPaymentDate }
- { strconv.FormatFloat(v.BillPayment[0].F_BillPaymentAmount, 'f', 0, 64) } - { strconv.FormatFloat(v.F_BillUnpaid, 'f', 0, 64) } + { utils.FormatRibuan(int(v.BillPayment[0].F_BillPaymentAmount)) } + { utils.FormatRibuan(v.F_BillUnpaid) } } else { @@ -87,13 +88,13 @@ templ RowKeuangan(
{ v.F_BillCreated }
{ v.F_BillDueDate } - { strconv.FormatFloat(v.F_BillTotal, 'f', 0, 64) } + { utils.FormatRibuan(v.F_BillTotal) }
{ v.BillPayment[0].F_BillPaymentNumber }
{ v.BillPayment[0].F_BillPaymentDate }
- { strconv.FormatFloat(v.BillPayment[0].F_BillPaymentAmount, 'f', 0, 64) } - { strconv.FormatFloat(v.F_BillUnpaid, 'f', 0, 64) } + { utils.FormatRibuan(int(v.BillPayment[0].F_BillPaymentAmount)) } + { utils.FormatRibuan(v.F_BillUnpaid) } for i := 1; i < len(v.BillPayment); i++ { @@ -101,7 +102,7 @@ templ RowKeuangan(
{ v.BillPayment[i].F_BillPaymentNumber }
{ v.BillPayment[i].F_BillPaymentDate }
- { strconv.FormatFloat(v.BillPayment[i].F_BillPaymentAmount, 'f', 0, 64) } + { utils.FormatRibuan(int(v.BillPayment[i].F_BillPaymentAmount)) } } } diff --git a/views/corporate/mcu/mcutab/tablekeuangan_templ.go b/views/corporate/mcu/mcutab/tablekeuangan_templ.go index a8b42ca..f4fa0f8 100644 --- a/views/corporate/mcu/mcutab/tablekeuangan_templ.go +++ b/views/corporate/mcu/mcutab/tablekeuangan_templ.go @@ -12,6 +12,7 @@ import "bytes" import "cpone/models" import "strconv" +import "cpone/utils" func TableAndPagination( tablecomponent templ.Component, @@ -88,7 +89,7 @@ func TableKeuangan( var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(tableID) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 20, Col: 20} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 21, Col: 20} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -146,7 +147,7 @@ func RowKeuangan( var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillNo) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 59, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 60, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -159,7 +160,7 @@ func RowKeuangan( var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillCreated) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 60, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 61, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -172,7 +173,7 @@ func RowKeuangan( var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillDueDate) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 62, Col: 57} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 63, Col: 57} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -183,9 +184,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var9 string - templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.F_BillTotal, 'f', 0, 64)) + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(v.F_BillTotal)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 63, Col: 88} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 64, Col: 75} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -196,9 +197,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var10 string - templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.F_BillUnpaid, 'f', 0, 64)) + templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(v.F_BillUnpaid)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 66, Col: 89} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 67, Col: 76} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -216,7 +217,7 @@ func RowKeuangan( var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(v.BillPayment))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 70, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 71, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -229,7 +230,7 @@ func RowKeuangan( var templ_7745c5c3_Var12 string templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillNo) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 71, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 72, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) if templ_7745c5c3_Err != nil { @@ -242,7 +243,7 @@ func RowKeuangan( var templ_7745c5c3_Var13 string templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillCreated) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 72, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 73, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) if templ_7745c5c3_Err != nil { @@ -255,7 +256,7 @@ func RowKeuangan( var templ_7745c5c3_Var14 string templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(v.BillPayment))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 74, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 75, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) if templ_7745c5c3_Err != nil { @@ -268,7 +269,7 @@ func RowKeuangan( var templ_7745c5c3_Var15 string templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillDueDate) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 74, Col: 102} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 75, Col: 102} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) if templ_7745c5c3_Err != nil { @@ -281,7 +282,7 @@ func RowKeuangan( var templ_7745c5c3_Var16 string templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(v.BillPayment))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 75, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 76, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) if templ_7745c5c3_Err != nil { @@ -292,9 +293,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var17 string - templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.F_BillTotal, 'f', 0, 64)) + templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(v.F_BillTotal)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 75, Col: 133} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 76, Col: 120} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { @@ -307,7 +308,7 @@ func RowKeuangan( var templ_7745c5c3_Var18 string templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(v.BillPayment[0].F_BillPaymentNumber) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 77, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 78, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) if templ_7745c5c3_Err != nil { @@ -320,7 +321,7 @@ func RowKeuangan( var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(v.BillPayment[0].F_BillPaymentDate) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 78, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 79, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) if templ_7745c5c3_Err != nil { @@ -331,9 +332,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var20 string - templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.BillPayment[0].F_BillPaymentAmount, 'f', 0, 64)) + templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(int(v.BillPayment[0].F_BillPaymentAmount))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 80, Col: 111} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 81, Col: 103} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) if templ_7745c5c3_Err != nil { @@ -346,7 +347,7 @@ func RowKeuangan( var templ_7745c5c3_Var21 string templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(v.BillPayment))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 81, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 82, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) if templ_7745c5c3_Err != nil { @@ -357,9 +358,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var22 string - templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.F_BillUnpaid, 'f', 0, 64)) + templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(v.F_BillUnpaid)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 81, Col: 134} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 82, Col: 121} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { @@ -377,7 +378,7 @@ func RowKeuangan( var templ_7745c5c3_Var23 string templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(v.BillPayment))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 85, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 86, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -390,7 +391,7 @@ func RowKeuangan( var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillNo) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 86, Col: 37} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 87, Col: 37} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { @@ -403,7 +404,7 @@ func RowKeuangan( var templ_7745c5c3_Var25 string templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillCreated) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 87, Col: 42} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 88, Col: 42} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) if templ_7745c5c3_Err != nil { @@ -416,7 +417,7 @@ func RowKeuangan( var templ_7745c5c3_Var26 string templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(v.BillPayment))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 89, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 90, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) if templ_7745c5c3_Err != nil { @@ -429,7 +430,7 @@ func RowKeuangan( var templ_7745c5c3_Var27 string templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(v.F_BillDueDate) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 89, Col: 102} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 90, Col: 102} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) if templ_7745c5c3_Err != nil { @@ -442,7 +443,7 @@ func RowKeuangan( var templ_7745c5c3_Var28 string templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(v.BillPayment))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 90, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 91, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) if templ_7745c5c3_Err != nil { @@ -453,9 +454,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var29 string - templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.F_BillTotal, 'f', 0, 64)) + templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(v.F_BillTotal)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 90, Col: 133} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 91, Col: 120} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) if templ_7745c5c3_Err != nil { @@ -468,7 +469,7 @@ func RowKeuangan( var templ_7745c5c3_Var30 string templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(v.BillPayment[0].F_BillPaymentNumber) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 92, Col: 63} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 93, Col: 63} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) if templ_7745c5c3_Err != nil { @@ -481,7 +482,7 @@ func RowKeuangan( var templ_7745c5c3_Var31 string templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(v.BillPayment[0].F_BillPaymentDate) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 93, Col: 61} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 94, Col: 61} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) if templ_7745c5c3_Err != nil { @@ -492,9 +493,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var32 string - templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.BillPayment[0].F_BillPaymentAmount, 'f', 0, 64)) + templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(int(v.BillPayment[0].F_BillPaymentAmount))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 95, Col: 111} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 96, Col: 103} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) if templ_7745c5c3_Err != nil { @@ -507,7 +508,7 @@ func RowKeuangan( var templ_7745c5c3_Var33 string templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(v.BillPayment))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 96, Col: 82} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 97, Col: 82} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) if templ_7745c5c3_Err != nil { @@ -518,9 +519,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var34 string - templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.F_BillUnpaid, 'f', 0, 64)) + templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(v.F_BillUnpaid)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 96, Col: 134} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 97, Col: 121} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34)) if templ_7745c5c3_Err != nil { @@ -538,7 +539,7 @@ func RowKeuangan( var templ_7745c5c3_Var35 string templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(v.BillPayment[i].F_BillPaymentNumber) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 101, Col: 67} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 102, Col: 67} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35)) if templ_7745c5c3_Err != nil { @@ -551,7 +552,7 @@ func RowKeuangan( var templ_7745c5c3_Var36 string templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(v.BillPayment[i].F_BillPaymentDate) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 102, Col: 65} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 103, Col: 65} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) if templ_7745c5c3_Err != nil { @@ -562,9 +563,9 @@ func RowKeuangan( return templ_7745c5c3_Err } var templ_7745c5c3_Var37 string - templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(v.BillPayment[i].F_BillPaymentAmount, 'f', 0, 64)) + templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(utils.FormatRibuan(int(v.BillPayment[i].F_BillPaymentAmount))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 104, Col: 115} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `views\corporate\mcu\mcutab\tablekeuangan.templ`, Line: 105, Col: 107} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) if templ_7745c5c3_Err != nil { diff --git a/views/public/login/login.templ b/views/public/login/login.templ index 79a9572..3f3b4f7 100644 --- a/views/public/login/login.templ +++ b/views/public/login/login.templ @@ -4,7 +4,9 @@ import ( "cpone/layout" ) -templ MainLogin() { +templ MainLogin( + alerthidden bool, +) {
} -templ FormSignin() { +templ FormSignin( + alerthidden bool, +) {
-
- - Forgot Password ? - -
+ @AlertInvalidAccount(alerthidden)
+
+ + } else { + + } +} + templ FormSignup() {
\"\"

Welcome to Corporate Portal\r

Sign in to access your account\r

Forgot Password ?\r
") + _, 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 = AlertInvalidAccount(alerthidden).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 + }) +} + +func AlertInvalidAccount( + hidden bool, +) 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 hidden { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } else { + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Akun tidak ditemukan
Email atau Password salah
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } if !templ_7745c5c3_IsBuffer { _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) } @@ -66,9 +109,9 @@ func FormSignup() templ.Component { 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_Err = templ_7745c5c3_Buffer.WriteString("

Sign Up\r

Enter your details to create your account\r

") @@ -90,9 +133,9 @@ func ForgotPassword() 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_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("
\"\"

Forgotten Password ?\r

Enter your email to reset your password\r

")