diff --git a/src/app/content/hemat-app/cost-management/cost-management.component.ts b/src/app/content/hemat-app/cost-management/cost-management.component.ts index 9d36b8a..66d42cd 100644 --- a/src/app/content/hemat-app/cost-management/cost-management.component.ts +++ b/src/app/content/hemat-app/cost-management/cost-management.component.ts @@ -426,7 +426,7 @@ export class CostManagementComponent implements OnInit { ); } - export(){ + export() { this.spinnerExportActive = true; setTimeout(() => { const columnsToExport = [ diff --git a/src/app/content/hemat-app/cost-management/modal-export/modal-export.component.html b/src/app/content/hemat-app/cost-management/modal-export/modal-export.component.html index 99ed18c..47f4096 100644 --- a/src/app/content/hemat-app/cost-management/modal-export/modal-export.component.html +++ b/src/app/content/hemat-app/cost-management/modal-export/modal-export.component.html @@ -2,6 +2,8 @@

Comparison of Water and Electricity Costs > {{ dataRow.building }}

+

Room : {{ dataRow?.roomName }}

+

Category : {{ dataRow?.categoryName }}

update-password works!

+
+
+
+
+
+
+

Update Password

+
+
+
+
+
+
+
+ + + +
+ Current Password is required +
+
+ +
+
+ + + +
+ New Password is required +
+
+ New Password must be at least 8 characters long +
+
+ New Password must contain at least one uppercase + letter, one lowercase letter, and one number +
+
+ +
+
+ + + +
+ Confirm Password is required +
+
+ Confirm Password must match the New Password +
+
+ +
+
+
+
+
+ + +
+
+
+
+
+
+
+
diff --git a/src/app/content/hemat-app/user-profile/update-password/update-password.component.ts b/src/app/content/hemat-app/user-profile/update-password/update-password.component.ts index 582c57e..bf83ab4 100644 --- a/src/app/content/hemat-app/user-profile/update-password/update-password.component.ts +++ b/src/app/content/hemat-app/user-profile/update-password/update-password.component.ts @@ -1,10 +1,98 @@ -import { Component } from '@angular/core'; +import { Component, ViewChild } from "@angular/core"; +import { FormBuilder, FormGroup, NgForm, Validators, AbstractControl, ValidatorFn } from "@angular/forms"; +import { ActivatedRoute, Router } from "@angular/router"; @Component({ - selector: 'app-update-password', - templateUrl: './update-password.component.html', - styleUrls: ['./update-password.component.css'] + selector: "app-update-password", + templateUrl: "./update-password.component.html", + styleUrls: ["./update-password.component.css"], }) export class UpdatePasswordComponent { + @ViewChild("f", { read: true }) userProfileForm: NgForm; + public breadcrumb: any; + profilInfo: FormGroup; + activeTab: string = "profile-info2"; + submitted = false; + showCurrentPass: boolean = false; + showNewPass: boolean = false; + showConfirmPass: boolean = false; + constructor( + private formBuilder: FormBuilder, + private router: Router, + private route: ActivatedRoute + ) {} + + ngOnInit(): void { + this.profilInfo = this.formBuilder.group({ + currentPass: ["", Validators.required], + newPass: ["", [Validators.required, Validators.minLength(8), Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/)]], + confirmPass: ["", [Validators.required, this.matchPassword('newPass')]], + }); + + this.profilInfo.get('newPass').valueChanges.subscribe(() => { + this.profilInfo.get('confirmPass').updateValueAndValidity(); + }); + } + + selectTab(tabName: string) { + this.activeTab = tabName; + } + + get f() { + return this.profilInfo.controls; + } + + matchPassword(passwordControlName: string): ValidatorFn { + return (control: AbstractControl): { [key: string]: boolean } | null => { + if (!control.parent || !control) { + return null; + } + + const passwordControl = control.parent.get(passwordControlName); + if (!passwordControl) { + return null; + } + + if (passwordControl.value !== control.value) { + return { matchPassword: true }; + } + + return null; + }; + } + + onProjectInfoSubmit() { + this.submitted = true; + + if (this.profilInfo.invalid) { + return; + } + + // Handle form submission + } + + cancel() { + // Handle cancel action + } + + saveEdit() { + // Handle save action + console.log(this.profilInfo); + console.log(this.profilInfo.invalid); + console.log(this.profilInfo.valid); + + } + + toggleCurrentPassVisibility() { + this.showCurrentPass = !this.showCurrentPass; + } + + toggleNewPassVisibility() { + this.showNewPass = !this.showNewPass; + } + + toggleConfirmPassVisibility() { + this.showConfirmPass = !this.showConfirmPass; + } } diff --git a/src/app/content/hemat-app/user-profile/user-profile.component.css b/src/app/content/hemat-app/user-profile/user-profile.component.css index fddb888..9c9d077 100644 --- a/src/app/content/hemat-app/user-profile/user-profile.component.css +++ b/src/app/content/hemat-app/user-profile/user-profile.component.css @@ -1,21 +1,25 @@ .tabs { display: flex; - border-bottom: 1px solid #ccc; + margin-bottom: 20px; + /* border-bottom: 1px solid #ccc; */ } .tab-link { background-color: #333; - color: #fff; + border-radius: 8px; + color: #C3F164; padding: 10px 20px; cursor: pointer; border: none; outline: none; transition: background-color 0.3s ease; + margin-right: 10px; } .tab-link:hover, .tab-link.active { - background-color: #555; + background-color: #C3F164; + color: black !important; } .tab-content { diff --git a/src/app/content/hemat-app/user-profile/user-profile.component.html b/src/app/content/hemat-app/user-profile/user-profile.component.html index 3d21d0b..d632aac 100644 --- a/src/app/content/hemat-app/user-profile/user-profile.component.html +++ b/src/app/content/hemat-app/user-profile/user-profile.component.html @@ -9,7 +9,6 @@ -