version stable avec envoyer carte
parent
cbe2548344
commit
4054dfd332
@ -1,10 +1,38 @@
|
||||
<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>
|
||||
|
||||
<h4 class="h5 text-center mb-4">Liste de vos cartes de parrainage</h4>
|
||||
<div class="btn-group">
|
||||
<button (click)="goToProfil()">Profil</button>
|
||||
|
||||
</div>
|
||||
<button (click)="goToProfil()">Profil</button>
|
||||
<div class="list-group">
|
||||
<div class="card mainCard" *ngFor="let crt of carteParrData | async">
|
||||
<div class="row">
|
||||
<div class="col-md-6 card-image mb-1 subCard1" [ngStyle]="{ 'background-image': 'url(' + crt.carteTemplate.downloadURL + ')'}">
|
||||
<div class="view mask-light pattern-1">
|
||||
<div class="row firstRow">
|
||||
<div *ngIf="commercant !== undefined" >
|
||||
<div class="col-md-6 flex-center card-block cardPart1">{{commercant.commercialName}}</div>
|
||||
<div class="col-md-6 flex-center card-block card-image mb-1 cardPart2" [ngStyle]="{ 'background-image': 'url(' + commercant.image.downloadURL + ')'}">
|
||||
<p>test2</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row secondRow">
|
||||
<div class="col-md-6 flex-center cardPart3"><p></p></div>
|
||||
<div class="col-md-6 flex-center cardPart4"><p>{{crt.uid}}</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 card subCard2">
|
||||
<label>date Debut: {{crt.dateDebut}}</label>
|
||||
<label>date Fin: {{crt.dateFin}}</label>
|
||||
<label>avantage Cumule: {{crt.avantageCumule}}</label>
|
||||
<label>avantage Recuperer: {{crt.avantageRecuperer}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -0,0 +1,46 @@
|
||||
.mainCard {
|
||||
margin-top: 5%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.view {
|
||||
height:102%;
|
||||
width: 103%;
|
||||
}
|
||||
|
||||
|
||||
.subCard1 {
|
||||
height: 15rem;
|
||||
background-repeat: no-repeat;
|
||||
background-size:20% auto;
|
||||
background-position : center;
|
||||
}
|
||||
|
||||
.firstRow {
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.secondRow {
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
|
||||
.cardPart1 {
|
||||
//background-color: red;
|
||||
}
|
||||
|
||||
.cardPart2 {
|
||||
//background-color: orange;
|
||||
background-repeat: no-repeat;
|
||||
background-size:50% auto;
|
||||
background-position : center;
|
||||
}
|
||||
|
||||
|
||||
.cardPart3 {
|
||||
//background-color: green;
|
||||
}
|
||||
|
||||
.cardPart4 {
|
||||
//background-color: yellow;
|
||||
}
|
@ -1,18 +1,96 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { OperationCommerciale } from '../../../../models/OperationCommerciale';
|
||||
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database';
|
||||
|
||||
import * as firebase from 'firebase/app';
|
||||
import { AngularFireAuth } from 'angularfire2/auth';
|
||||
import { AuthService } from '../../../services/auth/auth.service';
|
||||
import { OpCommercialService } from '../../../services/opCommercial/op-commercial.service';
|
||||
import { Parrain } from '../../../../models/Parrain';
|
||||
import { Commercant } from '../../../../models/Commercant';
|
||||
import { Image } from '../../../../models/Image';
|
||||
import { CarteParrainage } from '../../../../models/CarteParrainage';
|
||||
|
||||
@Component({
|
||||
selector: 'app-carte-parrainage',
|
||||
templateUrl: './carte-parrainage.component.html',
|
||||
styleUrls: ['./carte-parrainage.component.scss']
|
||||
styleUrls: ['./carte-parrainage.component.scss'],
|
||||
providers: [AuthService, OpCommercialService]
|
||||
})
|
||||
export class CarteParrainageComponent implements OnInit {
|
||||
export class CarteParrainageComponent implements OnInit, OnDestroy {
|
||||
|
||||
user: Observable<firebase.User>;
|
||||
parrain: Parrain;
|
||||
commercant: Commercant;
|
||||
carteParr: CarteParrainage;
|
||||
carteParrData: FirebaseListObservable<any[]>;
|
||||
profileData: FirebaseListObservable<any[]>;
|
||||
commList: FirebaseListObservable<any[]>;
|
||||
|
||||
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase, private router: Router) {
|
||||
this.carteParr = new CarteParrainage();
|
||||
|
||||
this.user = afAuth.authState;
|
||||
|
||||
constructor(private router: Router) { }
|
||||
this.parrain = new Parrain();
|
||||
this.user.subscribe(
|
||||
(auth) => {
|
||||
console.log('be' + auth.uid);
|
||||
if (auth) {
|
||||
this.carteParrData = this.afDb.list('/CarteParrainage/', {
|
||||
query: {
|
||||
orderByChild: 'parrainID',
|
||||
equalTo: auth.uid.toString()
|
||||
}
|
||||
}
|
||||
);
|
||||
this.carteParrData.forEach(car => {
|
||||
car.forEach(elementCar => {
|
||||
this.commList = this.afDb.list('/Commercant/', {
|
||||
query: {
|
||||
orderByChild: 'uid',
|
||||
equalTo: elementCar.commercantID
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
this.commList.forEach(commerc => {
|
||||
commerc.forEach(elementCommerc => {
|
||||
this.commercant = elementCommerc;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
this.profileData = this.afDb.list('/' + auth.displayName + '/', {
|
||||
query: {
|
||||
orderByChild: 'uid',
|
||||
equalTo: auth.uid.toString()
|
||||
}
|
||||
}
|
||||
);
|
||||
this.profileData.forEach(utilisateur => {
|
||||
utilisateur.forEach(element => {
|
||||
this.parrain = element;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
goToProfil(){
|
||||
this.router.navigate(['/profil']);
|
||||
}
|
||||
ngOnDestroy() {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue