Merge branch 'thierry' of ssh://git.marbelium.com:10023/Viiciouss/XJC into anis

thierry
Viiciouss 7 years ago
commit 85cdbce8e4

@ -31,8 +31,8 @@ export const AppRoutes = [
{path: 'debiterCarte/:idOp', component: DebiterCarteComponent, canActivate: [AuthGuard]},
{path: 'editProfil', component: EditProfilComponent, canActivate: [AuthGuard]},
{path: 'historiqueCarte', component: CarteEnvoyerComponent, canActivate: [AuthGuard]},
{path: 'listOpCommercialAdmin', component: ListeOpCommercialComponent, canActivate: [AuthGuard]},
{path: 'demandeOpCommercialAdmin', component: DemandeOpCommercialComponent, canActivate: [AuthGuard]},
{path: 'ListCarteEnvoyerAdmin/:idOp', component: ListCarteEnvoyerComponent, canActivate: [AuthGuard]},
{path: 'ListScanEffecterAdmin/:idOp', component: ListScanEffecterComponent, canActivate: [AuthGuard]}
{path: 'listOpCommercialAdmin', component: ListeOpCommercialComponent},
{path: 'demandeOpCommercialAdmin', component: DemandeOpCommercialComponent},
{path: 'ListCarteEnvoyerAdmin/:idOp', component: ListCarteEnvoyerComponent},
{path: 'ListScanEffecterAdmin/:idOp', component: ListScanEffecterComponent}
];

@ -29,7 +29,8 @@ export class DemandeOpCommercialComponent implements OnInit, OnDestroy {
tarifXJCParr: number;
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
private router: Router, private authService: AuthService, private opComService: OpCommercialService, private toastrService: ToastrService) {
private router: Router, private authService: AuthService,
private opComService: OpCommercialService, private toastrService: ToastrService) {
this.opComm = new OperationCommerciale();
this.databaseRef = firebase.database().ref();
this.user = afAuth.authState;
@ -39,7 +40,7 @@ export class DemandeOpCommercialComponent implements OnInit, OnDestroy {
(auth) => {
// console.log("afAuth.authState : " + auth.toJSON());
if (auth) {
this.opComService.updateCarteEtOpCom();
this.opCommDataEnCours = this.afDb.list('/OperationCommercial/',{
query: {
orderByChild: 'validationXJC',
@ -79,6 +80,7 @@ export class DemandeOpCommercialComponent implements OnInit, OnDestroy {
opTarifFRef.set(this.tarifXJCParr.toString());
const opEnvRef = this.databaseRef.child('OperationCommercial').child(opValider.uid).child('validationXJC');
opEnvRef.set('Validé');
this.tarifXJCParr = 0;
this.toastrService.success("L'opération commerciale : " + opValider.name + ' a été validée ' );

@ -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';
}

@ -37,7 +37,7 @@ export class CarteEnvoyerComponent implements OnInit {
this.commercant = new Commercant();
this.user.subscribe(
(auth) => {
this.opComService.updateCarteEtOpCom();
// console.log("afAuth.authState : " + auth.toJSON());
if (auth) {
this.carteParData = this.afDb.list('/CarteParrainage/', {
@ -51,7 +51,7 @@ export class CarteEnvoyerComponent implements OnInit {
this.carteParData.forEach(crt => {
crt.forEach(crtElement => {
// this.commercant = crtElement;
this.updateCarteStatus(crtElement);
//this.updateCarteStatus(crtElement);
});
});

@ -44,7 +44,7 @@ export class CarteParrainageComponent implements OnInit, OnDestroy {
this.user.subscribe(
(auth) => {
if (auth) {
this.opComService.updateCarteEtOpCom();
this.carteParrData = this.afDb.list('/CarteParrainage/', {
query: {
orderByChild: 'parrainCarte/uid',
@ -54,7 +54,7 @@ export class CarteParrainageComponent implements OnInit, OnDestroy {
).map((array) => array.reverse()) as FirebaseListObservable<any[]>;;
this.carteParrData.forEach(car => {
car.forEach(elementCar => {
this.updateCarteStatus(elementCar);
//this.updateCarteStatus(elementCar);
this.commList = this.afDb.list('/Commercant/', {
query: {
orderByChild: 'uid',

@ -87,7 +87,7 @@ export class CreationOpComComponent implements OnInit, OnDestroy {
utilisateur.forEach(element => {
console.log('element.uid: ' + element.raisonSociale);
this.opComm.commercantOpCom = element;
this.opComm.status = 'Non active';
this.opComm.status = 'Inactive';
// let file = this.selectedFiles.item(0);
// this.opComm.carteTemplate = file;
// this.upload();

@ -38,7 +38,7 @@ export class OpCommercialComponent implements OnInit, OnDestroy {
(auth) => {
// console.log("afAuth.authState : " + auth.toJSON());
if (auth) {
this.opComService.updateCarteEtOpCom();
this.opCommData = this.afDb.list('/OperationCommercial/', {
query: {
orderByChild: 'commercantOpCom/uid',

@ -48,6 +48,7 @@ export class OpCommercialService {
}
getOpComs(): FirebaseListObservable<any> {
console.log('oooooooooooo');
return this.afDb.list('/OperationCommercial/', {
query: {
orderByChild: 'uid'
@ -92,6 +93,7 @@ export class OpCommercialService {
}
updateOpCommStatus(){
/*
const opComAll = this.getOpComs();
opComAll.forEach(utilisateur => {
@ -109,9 +111,11 @@ export class OpCommercialService {
carteStatusRef.set(monOpCom.status);
});
});
*/
}
updateCarteEtOpCom(){
this.updateOpCommStatus();
// this.updateOpCommStatus();
this.updateCarteStatus();
}
updateCarteStatus(){

Loading…
Cancel
Save