From b22e0c912d3528d2a600a6d8677cb31326aa2c42 Mon Sep 17 00:00:00 2001
From: Anuraag Rijal
Date: Mon, 16 Apr 2018 21:27:46 -0400
Subject: [PATCH] Notification and Booked cuisines from database
---
src/app/cuisines/cuisines.service.ts | 4 +++
src/app/dashboard/dashboard.component.html | 37 ++++++++++++++++++++--
src/app/dashboard/dashboard.component.ts | 17 ++++++++--
src/app/material.module.ts | 6 ++++
4 files changed, 60 insertions(+), 4 deletions(-)
diff --git a/src/app/cuisines/cuisines.service.ts b/src/app/cuisines/cuisines.service.ts
index fd003c2e..d9410c02 100644
--- a/src/app/cuisines/cuisines.service.ts
+++ b/src/app/cuisines/cuisines.service.ts
@@ -13,10 +13,14 @@ export class CuisinesService {
cuisines : Observable;
usercuisines: Observable;
+ notification: Observable;
+ bookedCuisines: Observable;
constructor(db: AngularFireDatabase, as: AuthService){
this.cuisines = db.list('cuisines').valueChanges();
this.usercuisines = db.list('user-cuisines/'+as.auth.currentUser.uid).valueChanges();
+ this.notification = db.list('users/'+as.auth.currentUser.uid+ '/notification').valueChanges();
+ this.bookedCuisines = db.list('users/'+as.auth.currentUser.uid+ '/bokedcuisines').valueChanges();
}
}
diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html
index c77a943c..1456b642 100644
--- a/src/app/dashboard/dashboard.component.html
+++ b/src/app/dashboard/dashboard.component.html
@@ -9,6 +9,39 @@
- Content 2
- Content 2
+
+
+
+
+ {{ book.cuisineName }}
+
+
+
+
+ Date: {{ book.date }}
+ Time: {{ book.startTime }}
+ Dorm: {{ book.dormName }}
+ Address1: {{ book.streetAddress1 }}
+ Address2: {{ book.streetAddress2 }}
+
+
+
+
+
+
+
+ {{ notifi.notification }}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts
index b91f2b5a..570880a5 100644
--- a/src/app/dashboard/dashboard.component.ts
+++ b/src/app/dashboard/dashboard.component.ts
@@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { AuthService } from '../auth.service';
import { Router } from '@angular/router';
+import { CuisinesService } from '../cuisines/cuisines.service';
+import { Observable } from 'rxjs/Observable';
@Component({
selector: 'app-dashboard',
@@ -9,13 +11,24 @@ import { Router } from '@angular/router';
})
export class DashboardComponent implements OnInit {
userName: String;
-
+ notifications : Observable;
+ booked: Observable;
constructor(private authService: AuthService,
- private router: Router) {
+ private router: Router,
+ private cuisinesService: CuisinesService) {
this.userName = this.authService.auth.currentUser.displayName;
+ console.log(this.notifications);
}
ngOnInit() {
+ this.notifications = this.cuisinesService.notification;
+ this.booked = this.cuisinesService.bookedCuisines;
+ // this.cuisinesService.notification
+ // .subscribe(
+ // (message : any) => {
+ // console.log(message);
+ // }
+ // );
}
}
diff --git a/src/app/material.module.ts b/src/app/material.module.ts
index e3077579..47fea108 100644
--- a/src/app/material.module.ts
+++ b/src/app/material.module.ts
@@ -10,6 +10,8 @@ import {MatIconModule} from '@angular/material/icon';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatTabsModule} from '@angular/material/tabs';
import {MatExpansionModule} from '@angular/material/expansion';
+import {MatDividerModule} from '@angular/material/divider';
+import {MatListModule} from '@angular/material/list';
@NgModule({
imports: [MatInputModule,
@@ -22,6 +24,8 @@ import {MatExpansionModule} from '@angular/material/expansion';
MatIconModule,
MatTabsModule,
MatExpansionModule,
+ MatDividerModule,
+ MatListModule,
MatFormFieldModule],
exports: [MatInputModule,
MatStepperModule,
@@ -33,6 +37,8 @@ import {MatExpansionModule} from '@angular/material/expansion';
MatIconModule,
MatTabsModule,
MatExpansionModule,
+ MatDividerModule,
+ MatListModule,
MatFormFieldModule],
})
export class Material { }
\ No newline at end of file