trying to fix navbar
parent
e61e029252
commit
611d192e92
@ -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,82 @@
|
||||
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;
|
||||
afficheLogout: boolean;
|
||||
|
||||
|
||||
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
|
||||
private router: Router, private authService: AuthService) {
|
||||
this.updateNavBar();
|
||||
}
|
||||
|
||||
updateNavBar() {
|
||||
firebase.auth().onAuthStateChanged(function(user) {
|
||||
if (user) {
|
||||
this.afficheLogout = true;
|
||||
console.log('is signed in.');
|
||||
if (user.displayName === 'Parrain') {
|
||||
this.localUser = user;
|
||||
this.element1 = 'Profil Parrain';
|
||||
this.element2 = 'Logout Parrain';
|
||||
console.log('parrain fct: ' + this.navElement1);
|
||||
} else if (user.displayName === 'Commercant') {
|
||||
this.localUser = user;
|
||||
this.element1 = 'Profil Commercant';
|
||||
this.element2 = '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() {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,14 @@
|
||||
<div class="card">
|
||||
<div class="well">
|
||||
<p class="h5 text-center mb-4">Liste de vos operations commercials</p>
|
||||
<div class="container" style="padding-top:5%">
|
||||
|
||||
<div class="card">
|
||||
<div class="well">
|
||||
<p class="h5 text-center mb-4">Liste de vos operations commercials</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li *ngFor="let op of opCommData | async">Operation Commerciale: {{op.name}}</li>
|
||||
</ul>
|
||||
<button (click)="goToCreaOpCom()">Nouvelle opération Commercial</button>
|
||||
<button (click)="goToProfil()">Back</button>
|
||||
<ul>
|
||||
<li *ngFor="let op of opCommData | async">Operation Commerciale: {{op.name}}</li>
|
||||
</ul>
|
||||
<button (click)="goToCreaOpCom()">Nouvelle opération Commercial</button>
|
||||
<button (click)="goToProfil()">Profil</button>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue