debiter carte cree mais pas encore fonctionnel
parent
64b83bed40
commit
42290c14f1
@ -0,0 +1,52 @@
|
||||
<p>
|
||||
debiter-carte works!
|
||||
</p>
|
||||
<!--
|
||||
|
||||
<ul>
|
||||
<li *ngFor="let fil of filleulExistList | async">
|
||||
Filleuls: {{fil.firstname}} {{fil.familyname}}
|
||||
</li>
|
||||
</ul>-->
|
||||
|
||||
|
||||
<div class="container" style="padding-top:10%">
|
||||
<div class="card">
|
||||
<div class="well">
|
||||
<p class="h5 text-center mb-4">Débiter Carte</p>
|
||||
<!-- Si cest un filleul existant -->
|
||||
<div class="md-form">
|
||||
<i class="fa fa-user prefix grey-text"></i>
|
||||
<input type="text" id="orangeForm-Familyname" placeholder="ID carte" ><!--[(ngModel)]="filleul.idCard"-->
|
||||
</div>
|
||||
|
||||
<p>{{parSelect}}</p>
|
||||
<input
|
||||
#query
|
||||
(keyup)="filter(query.value)"
|
||||
type="text" class="form-control" placeholder="Cherchez Parrain Existants...">
|
||||
<div *ngFor="let parrain of filteredParrainsTest">
|
||||
<a (click)="getIdParrain(parrain.uid)">{{parrain.firstname}} {{parrain.familyname}}</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="md-form">
|
||||
<i class="fa fa-user prefix grey-text"></i>
|
||||
<input type="text" id="orangeForm-Familyname" placeholder="Code confidentiel du parrain" ><!--[(ngModel)]="filleul.idCard"-->
|
||||
</div>
|
||||
|
||||
<label>
|
||||
En cliquant sur Créer un compte, vous acceptez nos Conditions
|
||||
et indiquez que vous aves lu notre Politique d'utilisation des
|
||||
données, y compris notre Utilisation des cookies.
|
||||
</label>
|
||||
<div class="text-center" style="margin-top:5%">
|
||||
<button class="btn btn-light-green waves-light" (click)="debiterCarte()">Débiter Carte</button>
|
||||
<button class="btn btn-cyan" (click)="goToOpComm()">Back</button>
|
||||
</div>
|
||||
|
||||
<!-- Fin Si cest un filleul existant -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DebiterCarteComponent } from './debiter-carte.component';
|
||||
|
||||
describe('DebiterCarteComponent', () => {
|
||||
let component: DebiterCarteComponent;
|
||||
let fixture: ComponentFixture<DebiterCarteComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DebiterCarteComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DebiterCarteComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,134 @@
|
||||
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 { ActivatedRoute } from '@angular/router';
|
||||
import { User } from '../../../../models/User';
|
||||
import { Parrain } from '../../../../models/Parrain';
|
||||
import { Commercant } from '../../../../models/Commercant';
|
||||
import { Image } from '../../../../models/Image';
|
||||
import { OperationCommerciale } from '../../../../models/OperationCommerciale';
|
||||
import { CarteParrainage } from '../../../../models/CarteParrainage';
|
||||
|
||||
import { OpCommercialService } from '../../../services/opCommercial/op-commercial.service';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { AuthService } from '../../../services/auth/auth.service';
|
||||
import { Filleul } from '../../../../models/Filleul';
|
||||
import { Scan } from '../../../../models/Scan';
|
||||
|
||||
@Component({
|
||||
selector: 'app-debiter-carte',
|
||||
templateUrl: './debiter-carte.component.html',
|
||||
styleUrls: ['./debiter-carte.component.scss'],
|
||||
providers: [AuthService, OpCommercialService]
|
||||
})
|
||||
export class DebiterCarteComponent implements OnInit, OnDestroy {
|
||||
radioParrain: string;
|
||||
|
||||
user: Observable<firebase.User>;
|
||||
localUser: any;
|
||||
parrain: Parrain;
|
||||
commercant: Commercant;
|
||||
opComm: OperationCommerciale;
|
||||
cartePar: CarteParrainage;
|
||||
|
||||
commList: FirebaseListObservable<any[]>;
|
||||
opCommList: FirebaseListObservable<any[]>;
|
||||
parrainExistList: FirebaseListObservable<any[]>;
|
||||
parrainAffList: FirebaseListObservable<any[]>;
|
||||
carteParList: FirebaseListObservable<any[]>;
|
||||
parSelect: string;
|
||||
selectPar: boolean;
|
||||
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) {
|
||||
this.radioParrain = '';
|
||||
|
||||
this.localUser = new User();
|
||||
this.parrain = new Parrain();
|
||||
this.commercant = new Commercant();
|
||||
this.cartePar = new CarteParrainage();
|
||||
this.parrainAffList = null;
|
||||
this.user = afAuth.authState;
|
||||
this.databaseRef = firebase.database().ref();
|
||||
}
|
||||
debiterCarte(){}
|
||||
|
||||
getIdParrain(parUid) {
|
||||
this.parrainExistList.forEach(parEx => {
|
||||
parEx.forEach(elementparEx => {
|
||||
if (elementparEx.uid === parUid){
|
||||
this.parSelect = 'Vous avez selectionner le parrain : '
|
||||
+ elementparEx.familyname + ' '
|
||||
+ elementparEx.firstname;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
filter(query: string) {
|
||||
this.filteredParrainsTest = (query) ?
|
||||
this.parrainsTest.filter(p => (p.firstname.toLowerCase() + p.familyname.toLowerCase()).includes(query.toLowerCase())) :
|
||||
[];
|
||||
}
|
||||
//////
|
||||
ngOnInit() {
|
||||
this.subscription = this.opComService.getParrains()
|
||||
.subscribe(parrains => this.parrainsTest = parrains);
|
||||
}
|
||||
//////
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscription.unsubscribe();
|
||||
this.cartePar = {
|
||||
uid: '',
|
||||
parrainID: '',
|
||||
commercantID: '',
|
||||
operationCommercialID: '',
|
||||
dateDebut: new Date(),
|
||||
dateFin: new Date(),
|
||||
avantageCumule: '',
|
||||
avantageRecuperer: '',
|
||||
carteTemplate: new Image(),
|
||||
status: ''
|
||||
};
|
||||
this.localUser = {
|
||||
uid: '',
|
||||
image: new Image(),
|
||||
email: '',
|
||||
emailVerified: false,
|
||||
password: '',
|
||||
status: ''
|
||||
};
|
||||
this.parrain = {
|
||||
uid: '',
|
||||
image: new Image(),
|
||||
email: '',
|
||||
emailVerified: false,
|
||||
password: '',
|
||||
familyname: '',
|
||||
firstname: '',
|
||||
sex: '',
|
||||
birthday: new Date(),
|
||||
telephone: '',
|
||||
idCard: '',
|
||||
secretCode: '',
|
||||
status: ''
|
||||
};
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue