MAJ image profil et opcomm
commit
53b7c50c8c
@ -1 +1,2 @@
|
||||
<navigationBar></navigationBar>
|
||||
<router-outlet></router-outlet>
|
||||
|
@ -1,6 +1,10 @@
|
||||
<div class="card">
|
||||
<div class="well">
|
||||
<p class="h5 text-center mb-4">Liste de vos cartes de parrainage</p>
|
||||
<div class="container" style="padding-top:5%">
|
||||
<div class="card">
|
||||
<div class="well">
|
||||
<p class="h5 text-center mb-4">Liste de vos cartes de parrainage</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<button (click)="goToProfil()">Profil</button>
|
||||
</div>
|
||||
<button (click)="goToProfil()">Back</button>
|
||||
|
||||
|
@ -1,12 +1,88 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Router } from '@angular/router';
|
||||
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database';
|
||||
import * as firebase from 'firebase/app';
|
||||
import { AngularFireAuth } from 'angularfire2/auth';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ProfilService } from '../../services/profil/profil.service';
|
||||
import { User } from '../../../models/User';
|
||||
import { Parrain } from '../../../models/Parrain';
|
||||
import { Commercant } from '../../../models/Commercant';
|
||||
import { AuthService } from '../../services/auth/auth.service';
|
||||
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
selector: 'navigationBar',
|
||||
templateUrl: './navigationBar.component.html',
|
||||
styleUrls: ['./navigationBar.component.scss']
|
||||
styleUrls: ['./navigationBar.component.scss'],
|
||||
providers: [AuthService]
|
||||
})
|
||||
|
||||
export class NavigationBarComponent { }
|
||||
export class NavigationBarComponent implements OnInit, OnDestroy{
|
||||
user: Observable<firebase.User>;
|
||||
localUser: any;
|
||||
parrain: Parrain;
|
||||
commercant: Commercant;
|
||||
profileData: FirebaseListObservable<any[]>;
|
||||
navElement1: string;
|
||||
navElement2: string;
|
||||
navElement3: string;
|
||||
element1: string;
|
||||
element2: string;
|
||||
afficheLogout: boolean;
|
||||
|
||||
|
||||
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
|
||||
private router: Router, private authService: AuthService) {
|
||||
this.updateNavBar();
|
||||
}
|
||||
|
||||
|
||||
|
||||
updateNavBar() {
|
||||
this.navElement1 = 'Register';
|
||||
this.navElement2 = 'Login';
|
||||
firebase.auth().onAuthStateChanged(function(user) {
|
||||
if (user) {
|
||||
this.afficheLogout = true;
|
||||
console.log('is signed in.');
|
||||
if (user.displayName === 'Parrain') {
|
||||
this.localUser = user;
|
||||
this.navElement1 = 'Profil Parrain';
|
||||
this.navElement2 = 'Logout Parrain';
|
||||
console.log('parrain fct: ' + this.navElement1);
|
||||
} else if (user.displayName === 'Commercant') {
|
||||
this.localUser = user;
|
||||
this.navElement1 = 'Profil Commercant';
|
||||
this.navElement2 = 'Logout Commercant';
|
||||
}
|
||||
} else {
|
||||
this.afficheLogout = false;
|
||||
console.log('No user is signed in.');
|
||||
// No user is signed in.
|
||||
this.element1 = 'Register';
|
||||
this.element2 = 'login';
|
||||
console.log('fct dans home: ' + this.navElement1);
|
||||
}
|
||||
this.navElement1 = this.element1;
|
||||
this.navElement2 = this.element2;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.authService.logout();
|
||||
this.updateNavBar();
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
.mainCard {
|
||||
margin-top: 5%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.subCard1 {
|
||||
height: 15rem;
|
||||
}
|
||||
|
||||
.firstRow {
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.secondRow {
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
|
||||
.cardPart1 {
|
||||
//background-color: red;
|
||||
}
|
||||
|
||||
.cardPart2 {
|
||||
//background-color: orange;
|
||||
}
|
||||
|
||||
.cardPart3 {
|
||||
//background-color: green;
|
||||
}
|
||||
|
||||
.cardPart4 {
|
||||
//background-color: yellow;
|
||||
}
|
Loading…
Reference in New Issue