|
|
|
@ -29,7 +29,7 @@ export class ListeOpCommercialComponent implements OnInit, OnDestroy {
|
|
|
|
|
databaseRef: any;
|
|
|
|
|
opCommercials: any;
|
|
|
|
|
filteredOpCommercials: any;
|
|
|
|
|
|
|
|
|
|
test: any;
|
|
|
|
|
filters = {};
|
|
|
|
|
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
|
|
|
|
|
private router: Router, private authService: AuthService, private opComService: OpCommercialService) {
|
|
|
|
@ -42,7 +42,7 @@ export class ListeOpCommercialComponent implements OnInit, OnDestroy {
|
|
|
|
|
(auth) => {
|
|
|
|
|
// console.log("afAuth.authState : " + auth.toJSON());
|
|
|
|
|
if (auth) {
|
|
|
|
|
this.opComService.updateCarteEtOpCom();
|
|
|
|
|
|
|
|
|
|
/*this.opCommData = this.afDb.list('/OperationCommercial/',{
|
|
|
|
|
query: {
|
|
|
|
|
orderByChild: 'validationXJC',
|
|
|
|
@ -50,20 +50,46 @@ export class ListeOpCommercialComponent implements OnInit, OnDestroy {
|
|
|
|
|
}
|
|
|
|
|
}).map((array) => array.filter(opCoVal => opCoVal.status !== 'bloqué')) as FirebaseListObservable<any[]>;
|
|
|
|
|
*/
|
|
|
|
|
this.afDb.list('/OperationCommercial/')
|
|
|
|
|
console.log('yyyyyyyyyy');
|
|
|
|
|
this.opCommDataBloquer = this.afDb.list('/OperationCommercial/',{
|
|
|
|
|
query: {
|
|
|
|
|
orderByChild: 'status',
|
|
|
|
|
equalTo: 'Bloqué'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.test = this.afDb.list('/OperationCommercial/',{
|
|
|
|
|
query: {
|
|
|
|
|
orderByChild: 'validationXJC',
|
|
|
|
|
equalTo: 'Validé'
|
|
|
|
|
}
|
|
|
|
|
}).subscribe(opComs => {
|
|
|
|
|
this.opCommercials = opComs;
|
|
|
|
|
this.applyFilters(this.filteredOpCommercials, this.opCommercials);
|
|
|
|
|
this.filterDifferentDe('status', 'Bloqué');
|
|
|
|
|
console.log(opComs);
|
|
|
|
|
console.log(this.opCommercials);
|
|
|
|
|
console.log(this.filteredOpCommercials);
|
|
|
|
|
console.log('ttttttttttttt');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
this.test = this.afDb.list('/OperationCommercial/')
|
|
|
|
|
.subscribe(opComs => {
|
|
|
|
|
this.opCommercials = opComs;
|
|
|
|
|
this.applyFilters(this.filteredOpCommercials, this.opCommercials);
|
|
|
|
|
this.filterEgual('validationXJC', 'validé');
|
|
|
|
|
this.filterEgual('validationXJC', 'Validé');
|
|
|
|
|
this.applyFilters(this.filteredOpCommercials, this.opCommercials);
|
|
|
|
|
this.filterDifferentDe('status', 'bloqué');
|
|
|
|
|
//this.filterDifferentDe('status', 'Bloqué');
|
|
|
|
|
|
|
|
|
|
this.applyFilters(this.filteredOpCommercials, this.opCommercials);
|
|
|
|
|
//this.applyFilters(this.filteredOpCommercials, this.opCommercials);
|
|
|
|
|
console.log(opComs);
|
|
|
|
|
console.log(this.opCommercials);
|
|
|
|
|
console.log(this.filteredOpCommercials);
|
|
|
|
|
console.log('ttttttttttttt');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
/*_jobs => _jobs.filter(job => job.price > price)
|
|
|
|
|
|
|
|
|
|
this.opCommData.forEach(opval => {
|
|
|
|
@ -77,12 +103,7 @@ export class ListeOpCommercialComponent implements OnInit, OnDestroy {
|
|
|
|
|
});
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
|
this.opCommDataBloquer = this.afDb.list('/OperationCommercial/',{
|
|
|
|
|
query: {
|
|
|
|
|
orderByChild: 'status',
|
|
|
|
|
equalTo: 'bloqué'
|
|
|
|
|
}
|
|
|
|
|
}).map((array) => array.reverse()) as FirebaseListObservable<any[]>;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
console.log(auth.uid);
|
|
|
|
|
}
|
|
|
|
@ -109,10 +130,11 @@ export class ListeOpCommercialComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
bloquer(uidRejeter: string){
|
|
|
|
|
const opEnvRef = this.databaseRef.child('OperationCommercial').child(uidRejeter).child('status');
|
|
|
|
|
opEnvRef.set('bloqué');
|
|
|
|
|
opEnvRef.set('Bloqué');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
debloquer(opDebloquer: OperationCommerciale){
|
|
|
|
|
|
|
|
|
|
var todayTemp = new Date(Date.now());
|
|
|
|
|
var debutTemp = new Date(opDebloquer.dateDebut);
|
|
|
|
|
var finTemp = new Date(opDebloquer.dateFin);
|
|
|
|
@ -123,7 +145,7 @@ export class ListeOpCommercialComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
if (todayTemp.getTime() >= debutTemp.getTime() && todayTemp.getTime() <= finTemp.getTime()) {
|
|
|
|
|
opDebloquer.status = 'Active';
|
|
|
|
|
opDebloquer.validationXJC = 'validé';
|
|
|
|
|
opDebloquer.validationXJC = 'Validé';
|
|
|
|
|
} else {
|
|
|
|
|
opDebloquer.status = 'Inactive';
|
|
|
|
|
}
|
|
|
|
|