|
|
|
@ -16,7 +16,8 @@ import { OperationCommerciale } from '../../../../models/OperationCommerciale';
|
|
|
|
|
import { CarteParrainage } from '../../../../models/CarteParrainage';
|
|
|
|
|
|
|
|
|
|
import { OpCommercialService } from '../../../services/opCommercial/op-commercial.service';
|
|
|
|
|
|
|
|
|
|
import { Subject } from 'rxjs/Subject';
|
|
|
|
|
import { Subscription } from 'rxjs/Subscription';
|
|
|
|
|
import {forEach} from '@angular/router/src/utils/collection';
|
|
|
|
|
import { AuthService } from '../../../services/auth/auth.service';
|
|
|
|
|
|
|
|
|
@ -47,6 +48,14 @@ export class EnvoyerCarteComponent implements OnInit, OnDestroy {
|
|
|
|
|
parrainAffListTemp = [];
|
|
|
|
|
databaseRef: any;
|
|
|
|
|
|
|
|
|
|
/////
|
|
|
|
|
parrainsTest: Parrain[];
|
|
|
|
|
filteredParrainsTest: any[];
|
|
|
|
|
subscription: Subscription;
|
|
|
|
|
//startAt = new Subject();
|
|
|
|
|
//endAt = new Subject();
|
|
|
|
|
/////
|
|
|
|
|
|
|
|
|
|
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
|
|
|
|
|
private router: Router, private authService: AuthService,
|
|
|
|
|
private opComService: OpCommercialService, private route: ActivatedRoute) {
|
|
|
|
@ -148,6 +157,16 @@ export class EnvoyerCarteComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//////
|
|
|
|
|
filter(query: string) {
|
|
|
|
|
this.filteredParrainsTest = (query) ?
|
|
|
|
|
this.parrainsTest.filter(p => (p.firstname.toLowerCase() + p.familyname.toLowerCase()).includes(query.toLowerCase())) :
|
|
|
|
|
[];
|
|
|
|
|
}
|
|
|
|
|
//////
|
|
|
|
|
|
|
|
|
|
registerNewParrain() {
|
|
|
|
|
|
|
|
|
|
this.parrain.status = 'Parrain';
|
|
|
|
@ -221,11 +240,15 @@ export class EnvoyerCarteComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.opComService.creerCartePar(this.cartePar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//////
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.subscription = this.opComService.getParrains()
|
|
|
|
|
.subscribe(parrains => this.parrainsTest = parrains);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//////
|
|
|
|
|
|
|
|
|
|
ngOnDestroy() {
|
|
|
|
|
this.subscription.unsubscribe();
|
|
|
|
|
this.radioParrain = '';
|
|
|
|
|
this.cartePar = {
|
|
|
|
|
uid: '',
|
|
|
|
|