diff --git a/app/WhereIsThePower/src/app/shared/components/signup/signup.component.html b/app/WhereIsThePower/src/app/shared/components/signup/signup.component.html
index fc9d921..d8add49 100644
--- a/app/WhereIsThePower/src/app/shared/components/signup/signup.component.html
+++ b/app/WhereIsThePower/src/app/shared/components/signup/signup.component.html
@@ -50,6 +50,15 @@
Where Is the Power?
Password must be at least 8 characters
+
+
+ Confirm Password
+
+
+
+ Passwords do not match
+
+
Signup
diff --git a/app/WhereIsThePower/src/app/shared/components/signup/signup.component.ts b/app/WhereIsThePower/src/app/shared/components/signup/signup.component.ts
index 4c2757f..53ec773 100644
--- a/app/WhereIsThePower/src/app/shared/components/signup/signup.component.ts
+++ b/app/WhereIsThePower/src/app/shared/components/signup/signup.component.ts
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { ToastController } from '@ionic/angular';
import { RegisterUser } from '../../models/register-user';
@@ -27,8 +27,10 @@ export class SignupComponent implements OnInit {
lastName: ['', [Validators.required]],
email: ['', [Validators.required, Validators.email]],
password: ['', [Validators.required, Validators.minLength(8)]],
+ confirmPassword: ['', Validators.required],
});
+
constructor(
private router: Router,
private formBuilder: FormBuilder,
@@ -36,7 +38,17 @@ export class SignupComponent implements OnInit {
private authService: AuthService,
public modalController: ModalController,
private loadingController: LoadingController
- ) { }
+ ) {
+ this.signupForm.addValidators(
+ this.comparePasswordValidator(
+ this.signupForm.controls['password'],
+ this.signupForm.controls['confirmPassword']
+ )
+ );
+ }
+
+
+
ngOnInit() { }
@@ -45,7 +57,24 @@ export class SignupComponent implements OnInit {
this.modalController.dismiss();
}
+
+ comparePasswordValidator(passwordOne: AbstractControl, passwordTwo: AbstractControl) {
+ return () => {
+ if (passwordOne.value !== passwordTwo.value) {
+ console.log("Passwords do not match")
+ return { match_error: 'matchingErr' };
+ }
+
+ return null;
+ };
+ }
+
signup() {
+ if(this.signupForm.value.password !== this.signupForm.value.confirmPassword) {
+ this.failToast('Passwords do not match');
+ return;
+ }
+
if (this.signupForm.valid) {
this.newUser.firstName = this.signupForm.value.firstName;
this.newUser.lastName = this.signupForm.value.lastName;
diff --git a/app/WhereIsThePower/src/app/tab-schedule/tab-schedule.page.html b/app/WhereIsThePower/src/app/tab-schedule/tab-schedule.page.html
index 995cfc7..2a5d465 100644
--- a/app/WhereIsThePower/src/app/tab-schedule/tab-schedule.page.html
+++ b/app/WhereIsThePower/src/app/tab-schedule/tab-schedule.page.html
@@ -32,9 +32,12 @@ {{ result.name }}
{{ suburbName }}
-
+ 0" [color]="chipColor">
Current Stage: {{ loadsheddingStage }}
+
+ No Loadshedding
+
diff --git a/app/WhereIsThePower/src/app/tab-statistics/tab-statistics.page.ts b/app/WhereIsThePower/src/app/tab-statistics/tab-statistics.page.ts
index 077bea9..7b421f6 100644
--- a/app/WhereIsThePower/src/app/tab-statistics/tab-statistics.page.ts
+++ b/app/WhereIsThePower/src/app/tab-statistics/tab-statistics.page.ts
@@ -83,15 +83,23 @@ export class TabStatisticsPage implements OnInit {
processDoughnutChart(data: any) {
// Get today's day name (e.g., "Mon", "Tue", etc.)
+
const today = new Date().toLocaleDateString('en-US', { weekday: 'short' });
+ //const today = "Wed";
+ //console.log("WEDNESDAY", data.result.perDayTimes["Wed"]);
// Get the on and off values for today's day from the data
- const todayOnValue = data.result.perDayTimes[today]?.on || 0;
- const todayOffValue = data.result.perDayTimes[today]?.off || 0;
+ let uptimeToday = 24;
+ let downtimeToday = 0;
+ if (data.result.perDayTimes[today] != undefined) {
+ const todayOnValue = data.result.perDayTimes[today]?.on || 0;
+ const todayOffValue = data.result.perDayTimes[today]?.off || 0;
+
+ // Convert total uptime and downtime to hours
+ uptimeToday = Math.floor(todayOnValue / 60);
+ downtimeToday = Math.floor(todayOffValue / 60);
+ }
- // Convert total uptime and downtime to hours
- const uptimeToday = Math.floor(todayOnValue / 60);
- const downtimeToday = Math.floor(todayOffValue / 60);
// Data for Doughnut Chart (Uptime/Downtime for Today)
const doughnutData = {