|
|
|
@ -61,11 +61,12 @@ export class ScannerCarteComponent implements OnInit, OnDestroy {
|
|
|
|
|
filleulListTemp = [];
|
|
|
|
|
subscription: Subscription;
|
|
|
|
|
subscriptionCarte: Subscription;
|
|
|
|
|
isFilleulAnonyme: boolean;
|
|
|
|
|
/////
|
|
|
|
|
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
|
|
|
|
|
private router: Router, private authService: AuthService,
|
|
|
|
|
private opComService: OpCommercialService, private route: ActivatedRoute) {
|
|
|
|
|
|
|
|
|
|
this.isFilleulAnonyme = false;
|
|
|
|
|
this.radioFilleul = '';
|
|
|
|
|
this.filleulSelect = '';
|
|
|
|
|
this.ParrainCarteSelect = '';
|
|
|
|
@ -187,6 +188,13 @@ export class ScannerCarteComponent implements OnInit, OnDestroy {
|
|
|
|
|
this.updateCarte();
|
|
|
|
|
this.goToOpComm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filleulAnonymous() {
|
|
|
|
|
this.isFilleulAnonyme = true;
|
|
|
|
|
this.filleulSelect = 'Filleul anonyme';
|
|
|
|
|
this.filleul = new Filleul();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateCarte() {
|
|
|
|
|
console.log(+this.cartePar.avantageCumule);
|
|
|
|
|
|
|
|
|
@ -232,8 +240,10 @@ export class ScannerCarteComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
var elementCarteHist = 'Le ' + (this.scan.dateCreation).getDate() + '/' + (this.scan.dateCreation).getMonth()
|
|
|
|
|
+ '/' + (this.scan.dateCreation).getFullYear() + ' à ' + (this.scan.dateCreation).getHours() + ':'
|
|
|
|
|
+ (this.scan.dateCreation).getMinutes() + ', ' + ' la visite de '+ this.filleul.familyname.toUpperCase()
|
|
|
|
|
+ ' ' + this.filleul.firstname.toUpperCase() + ' a credité cette carte de ' + this.opComm.avantageParrain
|
|
|
|
|
+ (this.scan.dateCreation).getMinutes() + ', ' + ' la visite de '
|
|
|
|
|
+ (this.filleul.familyname === '' ? 'Filleul' : this.filleul.familyname.toUpperCase())
|
|
|
|
|
+ ' ' + (this.filleul.firstname === '' ? 'anonyme' : this.filleul.firstname.toUpperCase())
|
|
|
|
|
+ ' a credité cette carte de ' + this.opComm.avantageParrain
|
|
|
|
|
+ '€ supplémentaires, à valoir lors d un prochain achat.';
|
|
|
|
|
console.log(elementCarteHist);
|
|
|
|
|
// this.cartePar.historique = [];
|
|
|
|
@ -264,10 +274,11 @@ export class ScannerCarteComponent implements OnInit, OnDestroy {
|
|
|
|
|
+ elementparC.firstname;
|
|
|
|
|
this.parrain = elementparC;
|
|
|
|
|
for(let i = 0; i < this.filteredCartesTest.length; i++){
|
|
|
|
|
console.log(this.filteredCartesTest);
|
|
|
|
|
console.log('this.filteredCartesTest[i].parrainCarte.uid'+this.filteredCartesTest[i].parrainCarte.uid);
|
|
|
|
|
console.log('this.parrain.uid'+this.parrain.uid);
|
|
|
|
|
console.log('elementparC.uid'+ elementparC.uid);
|
|
|
|
|
//console.log(query);
|
|
|
|
|
if (this.filteredCartesTest[i].parrainCarte.uid === this.parrain.uid) {
|
|
|
|
|
if (this.filteredCartesTest[i].parrainCarte.uid === elementparC.uid) {
|
|
|
|
|
// this.carteParSelected = this.filteredCartesTest[i];
|
|
|
|
|
console.log('succes id carte est: ' + this.filteredCartesTest[i].uid);
|
|
|
|
|
console.log('succes le parrain de la carte est: ' + this.filteredCartesTest[i].parrainCarte.firstname);
|
|
|
|
|