diff --git a/angular.json b/angular.json
index 00cf627..2f72481 100644
--- a/angular.json
+++ b/angular.json
@@ -89,7 +89,9 @@
],
"styles": [
"@angular/material/prebuilt-themes/indigo-pink.css",
- "src/styles.css"
+ "src/styles.css",
+ "node_modules/primeng/resources/themes/lara-light-blue/theme.css",
+ "node_modules/primeng/resources/primeng.min.css"
],
"scripts": []
}
diff --git a/package-lock.json b/package-lock.json
index 3fa8c76..f6394cb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20,6 +20,7 @@
"@angular/platform-browser-dynamic": "^16.1.0",
"@angular/router": "^16.1.0",
"fs": "^0.0.1-security",
+ "ng-angular-popup": "^0.4.7",
"rxjs": "~7.8.0",
"ts-node": "^10.9.1",
"tslib": "^2.3.0",
@@ -10685,6 +10686,19 @@
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true
},
+ "node_modules/ng-angular-popup": {
+ "version": "0.4.7",
+ "resolved": "https://registry.npmjs.org/ng-angular-popup/-/ng-angular-popup-0.4.7.tgz",
+ "integrity": "sha512-Pyq6AZucwnB/LCawwwuBkShaLVSwPBasYjQnJhm80/RpDh5MOljq9pBvYHE+/mr3oM6M5NMX39RU0AtFwg4fZg==",
+ "dependencies": {
+ "tslib": "^2.3.0"
+ },
+ "peerDependencies": {
+ "@angular/common": ">=16.0.0-0",
+ "@angular/core": ">=16.0.0-0",
+ "@angular/platform-browser": ">=16.0.0-0"
+ }
+ },
"node_modules/nice-napi": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/nice-napi/-/nice-napi-1.0.2.tgz",
diff --git a/package.json b/package.json
index c157f2d..ae81af3 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"@angular/platform-browser-dynamic": "^16.1.0",
"@angular/router": "^16.1.0",
"fs": "^0.0.1-security",
+ "ng-angular-popup": "^0.4.7",
"rxjs": "~7.8.0",
"ts-node": "^10.9.1",
"tslib": "^2.3.0",
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 90c6b64..e5b7950 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1 +1,3 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index e9e2ecc..c41f9aa 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -30,7 +30,7 @@ import { PasswordInputDialogComponent } from './password-input-dialog/password-i
import {MatDialogModule} from '@angular/material/dialog';
import { PasswordInputComponent } from './password-input/password-input.component';
import { getAuth, provideAuth } from '@angular/fire/auth';
-
+import { NgToastModule } from 'ng-angular-popup';
@NgModule({
declarations: [
AppComponent,
@@ -43,6 +43,7 @@ import { getAuth, provideAuth } from '@angular/fire/auth';
],
imports: [
BrowserModule,
+ NgToastModule,
AppRoutingModule,
MatFormFieldModule,
FormsModule,
diff --git a/src/app/navigation/navigation.component.ts b/src/app/navigation/navigation.component.ts
index 338f35b..98319f0 100644
--- a/src/app/navigation/navigation.component.ts
+++ b/src/app/navigation/navigation.component.ts
@@ -14,6 +14,7 @@ import {
} from 'firebase/database';
import { query, update } from '@angular/fire/database';
import { UnlockService } from '../UnlockService/unlock.service';
+import { NgToastService } from 'ng-angular-popup';
@Component({
selector: 'app-navigation',
templateUrl: './navigation.component.html',
@@ -30,7 +31,8 @@ export class NavigationComponent {
private router: Router,
private route: ActivatedRoute,
private dialog: MatDialog,
- private passwordService: UnlockService
+ private passwordService: UnlockService,
+ private toast : NgToastService
) {
this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
@@ -60,27 +62,30 @@ export class NavigationComponent {
unlock(){
// Get the route ID
const routeID = this.routeId;
-
+
// Check if the route ID exists
if (routeID) {
// Create a reference to the Firebase Realtime Database
const db = getDatabase();
-
+
// Define the data object to update the password
const dataToUpdate = {
password: '',
locked : false
};
-
+
// Update the password in the database
update(ref(db, routeID), dataToUpdate)
- .then(() => {
- console.log('Password updated successfully');
+ .then(() => {
+ this.toast.success({detail : 'Page unlocked successfully'});
+ console.log('Password updated successfully');
})
.catch((error) => {
+ this.toast.error({detail : 'Error unlocking page'});
console.error('Error updating password:', error);
});
} else {
+ this.toast.error({detail : 'Error unlocking page'});
console.error('Route ID is null or undefined');
}
}
@@ -135,9 +140,11 @@ export class NavigationComponent {
// Update the password in the database
update(ref(db, routeID), dataToUpdate)
.then(() => {
+ this.toast.success({detail : 'Password updated successfully'});
console.log('Password updated successfully');
})
.catch((error) => {
+ this.toast.error({detail : 'Error updating password'});
console.error('Error updating password:', error);
});
} else {
diff --git a/src/index.html b/src/index.html
index 36b0c30..b32c544 100644
--- a/src/index.html
+++ b/src/index.html
@@ -9,6 +9,7 @@
+