diff --git a/component/sidebar_user_profile/modal_sidebar_user.templ b/component/sidebar_user_profile/modal_sidebar_user.templ
new file mode 100644
index 0000000..1665ff8
--- /dev/null
+++ b/component/sidebar_user_profile/modal_sidebar_user.templ
@@ -0,0 +1,157 @@
+package sidebaruserprofile
+
+import (
+ "cpone/component/customtextfield"
+ "cpone/models"
+ "cpone/component/modal"
+)
+
+templ SidebarForm() {
+
+
+
+}
+
+templ ModalGantiPassword() {
+
+ @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "oldPassID",
+ Name: "oldpassid",
+ Type: "password",
+ Placeholder: "Masukan password lama",
+ Label: "Password Lama",
+ })
+ @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "newPassID",
+ Name: "newpassid",
+ Type: "password",
+ Placeholder: "Masukan password baru",
+ Label: "Password Baru",
+ })
+ @customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "reNewPassID",
+ Name: "renewpassid",
+ Type: "password",
+ Placeholder: "Masukan ulang password baru",
+ Label: "Ulangi Password Baru",
+ })
+
+
+}
+
+
+templ RetModalGantiPassword(
+ oldPass models.CustomTextFieldv2Prm,
+ newPass models.CustomTextFieldv2Prm,
+ renewPass models.CustomTextFieldv2Prm,
+ hxOnLoad templ.ComponentScript,
+) {
+
+ @customtextfield.CustomTextFieldv2(oldPass)
+ @customtextfield.CustomTextFieldv2(newPass)
+ @customtextfield.CustomTextFieldv2(renewPass)
+
+
+}
+
+templ ActionFormGantiPassword() {
+
+
+
+
+}
+
+templ CloseFormGantiPassword() {
+
+}
+
+script JSHideModal(modalID string) {
+ $(modalID).modal('hide')
+}
+
+script JSShowModal(modalID string) {
+ $(modalID).modal('show')
+ const btnActCancel = document.querySelectorAll('.btnactcancel');
+ const btnActSaveData = document.querySelectorAll('.btnactsavedata');
+
+ for (let i = 0; i < btnActCancel.length; i++) {
+ btnActCancel[i].removeAttribute('disabled');
+ }
+ for (let i = 0; i < btnActSaveData.length; i++) {
+ btnActSaveData[i].removeAttribute('disabled');
+ }
+}
+
+script HandleFormBeforeRequest() {
+ const btnActCancel = document.querySelectorAll('.btnactcancel');
+ const btnActSaveData = document.querySelectorAll('.btnactsavedata');
+
+ for (let i = 0; i < btnActCancel.length; i++) {
+ btnActCancel[i].setAttribute('disabled', 'true');
+ }
+ for (let i = 0; i < btnActSaveData.length; i++) {
+ btnActSaveData[i].setAttribute('disabled', 'true');
+ }
+}
+
+script HandleFormAfterGantiPass() {
+ const btnActCancel = document.querySelectorAll('.btnactcancel');
+ const btnActSaveData = document.querySelectorAll('.btnactsavedata');
+
+ for (let i = 0; i < btnActCancel.length; i++) {
+ btnActCancel[i].removeAttribute('disabled');
+ }
+ for (let i = 0; i < btnActSaveData.length; i++) {
+ btnActSaveData[i].removeAttribute('disabled');
+ }
+}
\ No newline at end of file
diff --git a/component/sidebar_user_profile/modal_sidebar_user_templ.go b/component/sidebar_user_profile/modal_sidebar_user_templ.go
new file mode 100644
index 0000000..b696b8f
--- /dev/null
+++ b/component/sidebar_user_profile/modal_sidebar_user_templ.go
@@ -0,0 +1,336 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.2.663
+package sidebaruserprofile
+
+//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/component/customtextfield"
+ "cpone/component/modal"
+ "cpone/models"
+)
+
+func SidebarForm() 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("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, HandleFormBeforeRequest(), HandleFormAfterGantiPass())
+ 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 ModalGantiPassword() 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_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "oldPassID",
+ Name: "oldpassid",
+ Type: "password",
+ Placeholder: "Masukan password lama",
+ Label: "Password Lama",
+ }).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "newPassID",
+ Name: "newpassid",
+ Type: "password",
+ Placeholder: "Masukan password baru",
+ Label: "Password Baru",
+ }).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(models.CustomTextFieldv2Prm{ID: "reNewPassID",
+ Name: "renewpassid",
+ Type: "password",
+ Placeholder: "Masukan ulang password baru",
+ Label: "Ulangi Password Baru",
+ }).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 RetModalGantiPassword(
+ oldPass models.CustomTextFieldv2Prm,
+ newPass models.CustomTextFieldv2Prm,
+ renewPass models.CustomTextFieldv2Prm,
+ hxOnLoad templ.ComponentScript,
+) 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_Var5 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var5 == nil {
+ templ_7745c5c3_Var5 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hxOnLoad)
+ 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 = customtextfield.CustomTextFieldv2(oldPass).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(newPass).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = customtextfield.CustomTextFieldv2(renewPass).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 ActionFormGantiPassword() 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("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JSHideModal("#modal-ganti-pass"))
+ 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 CloseFormGantiPassword() 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_Var9 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var9 == nil {
+ templ_7745c5c3_Var9 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, JSHideModal("#modal-ganti-pass"))
+ 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 JSHideModal(modalID string) templ.ComponentScript {
+ return templ.ComponentScript{
+ Name: `__templ_JSHideModal_4530`,
+ Function: `function __templ_JSHideModal_4530(modalID){$(modalID).modal('hide')
+}`,
+ Call: templ.SafeScript(`__templ_JSHideModal_4530`, modalID),
+ CallInline: templ.SafeScriptInline(`__templ_JSHideModal_4530`, modalID),
+ }
+}
+
+func JSShowModal(modalID string) templ.ComponentScript {
+ return templ.ComponentScript{
+ Name: `__templ_JSShowModal_658d`,
+ Function: `function __templ_JSShowModal_658d(modalID){$(modalID).modal('show')
+ const btnActCancel = document.querySelectorAll('.btnactcancel');
+ const btnActSaveData = document.querySelectorAll('.btnactsavedata');
+
+ for (let i = 0; i < btnActCancel.length; i++) {
+ btnActCancel[i].removeAttribute('disabled');
+ }
+ for (let i = 0; i < btnActSaveData.length; i++) {
+ btnActSaveData[i].removeAttribute('disabled');
+ }
+}`,
+ Call: templ.SafeScript(`__templ_JSShowModal_658d`, modalID),
+ CallInline: templ.SafeScriptInline(`__templ_JSShowModal_658d`, modalID),
+ }
+}
+
+func HandleFormBeforeRequest() templ.ComponentScript {
+ return templ.ComponentScript{
+ Name: `__templ_HandleFormBeforeRequest_7bdf`,
+ Function: `function __templ_HandleFormBeforeRequest_7bdf(){const btnActCancel = document.querySelectorAll('.btnactcancel');
+ const btnActSaveData = document.querySelectorAll('.btnactsavedata');
+
+ for (let i = 0; i < btnActCancel.length; i++) {
+ btnActCancel[i].setAttribute('disabled', 'true');
+ }
+ for (let i = 0; i < btnActSaveData.length; i++) {
+ btnActSaveData[i].setAttribute('disabled', 'true');
+ }
+}`,
+ Call: templ.SafeScript(`__templ_HandleFormBeforeRequest_7bdf`),
+ CallInline: templ.SafeScriptInline(`__templ_HandleFormBeforeRequest_7bdf`),
+ }
+}
+
+func HandleFormAfterGantiPass() templ.ComponentScript {
+ return templ.ComponentScript{
+ Name: `__templ_HandleFormAfterGantiPass_cc6f`,
+ Function: `function __templ_HandleFormAfterGantiPass_cc6f(){const btnActCancel = document.querySelectorAll('.btnactcancel');
+ const btnActSaveData = document.querySelectorAll('.btnactsavedata');
+
+ for (let i = 0; i < btnActCancel.length; i++) {
+ btnActCancel[i].removeAttribute('disabled');
+ }
+ for (let i = 0; i < btnActSaveData.length; i++) {
+ btnActSaveData[i].removeAttribute('disabled');
+ }
+}`,
+ Call: templ.SafeScript(`__templ_HandleFormAfterGantiPass_cc6f`),
+ CallInline: templ.SafeScriptInline(`__templ_HandleFormAfterGantiPass_cc6f`),
+ }
+}
diff --git a/component/sidebar_user_profile/sidebar_user_profile.templ b/component/sidebar_user_profile/sidebar_user_profile.templ
index a78df87..53fee87 100644
--- a/component/sidebar_user_profile/sidebar_user_profile.templ
+++ b/component/sidebar_user_profile/sidebar_user_profile.templ
@@ -22,26 +22,33 @@ templ Navbaruserprofile(dataUser models.User) {
-
-
- //
- //
- //
- // Recent Notifications
- //
- //
- //
- // @NotificationCard()
- //
- //
-
+
+
+ @SidebarForm()
}
templ ProfileHeader(dataUser models.User) {
-
+
//
//
@@ -54,14 +61,6 @@ templ ProfileHeader(dataUser models.User) {
{ dataUser.UserPosition }
-
}
diff --git a/component/sidebar_user_profile/sidebar_user_profile_templ.go b/component/sidebar_user_profile/sidebar_user_profile_templ.go
index e9bcc9e..53ea029 100644
--- a/component/sidebar_user_profile/sidebar_user_profile_templ.go
+++ b/component/sidebar_user_profile/sidebar_user_profile_templ.go
@@ -33,7 +33,11 @@ func Navbaruserprofile(dataUser models.User) templ.Component {
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
+ }
+ templ_7745c5c3_Err = SidebarForm().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -57,14 +61,14 @@ func ProfileHeader(dataUser models.User) templ.Component {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
diff --git a/component/toastbootstrap/customtoastv2.templ b/component/toastbootstrap/customtoastv2.templ
index 035da1f..57922c7 100644
--- a/component/toastbootstrap/customtoastv2.templ
+++ b/component/toastbootstrap/customtoastv2.templ
@@ -41,7 +41,7 @@ templ CustomToastV2Show(title string, message string, typeToast string) {
aria-atomic="true"
id="notification-001"
hx-swap-oob="true"
- hx-get="/dev/hidetoast"
+ hx-get="/home/hidetoast"
hx-trigger="load delay:3s"
hx-target="this"
style="border-radius: 8px 8px 8px 8px;"
diff --git a/component/toastbootstrap/customtoastv2_templ.go b/component/toastbootstrap/customtoastv2_templ.go
index 47e7367..6da06d4 100644
--- a/component/toastbootstrap/customtoastv2_templ.go
+++ b/component/toastbootstrap/customtoastv2_templ.go
@@ -56,7 +56,7 @@ func CustomToastV2Show(title string, message string, typeToast string) templ.Com
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
diff --git a/handlers/corporate/account.handlers.go b/handlers/corporate/account.handlers.go
index 95259e6..4e9ce6a 100644
--- a/handlers/corporate/account.handlers.go
+++ b/handlers/corporate/account.handlers.go
@@ -1,16 +1,21 @@
package corporate_handlers
import (
+ sidebaruserprofile "cpone/component/sidebar_user_profile"
+ customtoastv2 "cpone/component/toastbootstrap"
"cpone/models"
+ "cpone/utils"
"net/http"
+ "strings"
"time"
+ "github.com/a-h/templ"
"github.com/golang-jwt/jwt/v5"
"github.com/labstack/echo/v4"
)
type AccountService interface {
- ChangePasswordPIC(token string, currPassword string, newPassword string) (models.ResponseStatus, error)
+ ChangePasswordPIC(host string, token string, currPassword string, newPassword string) (models.ResponseStatus, error)
ChangePasswordPAT(token string, currPassword string, newPassword string) (models.ResponseStatus, error)
}
@@ -30,14 +35,74 @@ func (as *AccountHandler) HandleChangePassword(c echo.Context) error {
token := userToken.Raw
claims := userToken.Claims.(jwt.MapClaims)
userGroup := claims["M_UserGroupDashboard"].(string)
+ h := c.Request().Host
- old_pass := c.FormValue("oldpassword")
- new_pass := c.FormValue("newpassword")
+ old_pass := c.FormValue("oldpassid")
+ new_pass := c.FormValue("newpassid")
+ re_new_pass := c.FormValue("renewpassid")
+ // logger.Info("params", zap.Any("old", old_pass), zap.Any("new", new_pass), zap.Any("re-new", re_new_pass))
+
+ old_validation := ""
+ new_validation := ""
+ renew_validation := ""
+ errorPop := ""
+
+ if strings.TrimSpace(old_pass) == "" {
+ old_validation = "Tidak boleh kosong"
+ errorPop = "Tidak boleh kosong"
+ }
+ if strings.TrimSpace(new_pass) == "" {
+ new_validation = "Tidak boleh kosong"
+ errorPop = "Tidak boleh kosong"
+ }
+ if strings.TrimSpace(re_new_pass) == "" {
+ renew_validation = "Tidak boleh kosong"
+ errorPop = "Tidak boleh kosong"
+ }
+ if strings.TrimSpace(new_pass) != strings.TrimSpace(re_new_pass) {
+ new_validation = "Password tidak sama"
+ renew_validation = "Password tidak sama"
+ errorPop = "Password tidak sama"
+ }
+
+ if old_validation != "" || new_validation != "" || renew_validation != "" {
+ newBody := sidebaruserprofile.RetModalGantiPassword(
+ models.CustomTextFieldv2Prm{
+ ID: "oldPassID",
+ Name: "oldpassid",
+ Type: "password",
+ Placeholder: "Masukan password lama",
+ Label: "Password Lama",
+ ErrorMsg: old_validation,
+ },
+ models.CustomTextFieldv2Prm{
+ ID: "newPassID",
+ Name: "newpassid",
+ Type: "password",
+ Placeholder: "Masukan password baru",
+ Label: "Password Baru",
+ ErrorMsg: new_validation,
+ },
+ models.CustomTextFieldv2Prm{
+ ID: "reNewPassID",
+ Name: "renewpassid",
+ Type: "password",
+ Placeholder: "Masukan ulang password baru",
+ Label: "Ulangi Password Baru",
+ ErrorMsg: renew_validation,
+ },
+ sidebaruserprofile.JSHideModal(""),
+ )
+ toast := customtoastv2.CustomToastV2Show("Warning", errorPop, "warning")
+ return utils.ViewMulti(c, []templ.Component{toast, newBody})
+ }
if userGroup == "pic" {
- resp, err := as.AccountService.ChangePasswordPIC(token, old_pass, new_pass)
+ resp, err := as.AccountService.ChangePasswordPIC(h, token, old_pass, new_pass)
if err != nil {
- return err
+ newBody := sidebaruserprofile.ModalGantiPassword()
+ toast := customtoastv2.CustomToastV2Show("Warning", err.Error(), "warning")
+ return utils.ViewMulti(c, []templ.Component{toast, newBody})
}
response = resp
}
@@ -45,13 +110,17 @@ func (as *AccountHandler) HandleChangePassword(c echo.Context) error {
if userGroup == "patient" {
resp, err := as.AccountService.ChangePasswordPAT(token, old_pass, new_pass)
if err != nil {
- return err
+ newBody := sidebaruserprofile.ModalGantiPassword()
+ toast := customtoastv2.CustomToastV2Show("Warning", "Error ganti password pat", "warning")
+ return utils.ViewMulti(c, []templ.Component{toast, newBody})
}
response = resp
}
if response.Status == "ERR" {
- return nil
+ newBody := sidebaruserprofile.ModalGantiPassword()
+ toast := customtoastv2.CustomToastV2Show("Warning", response.Message, "warning")
+ return utils.ViewMulti(c, []templ.Component{toast, newBody})
}
expire := time.Now().Add(-7 * 24 * time.Hour)
@@ -65,6 +134,7 @@ func (as *AccountHandler) HandleChangePassword(c echo.Context) error {
ret := `