admin opcom en cour

thierry
Tmadkaud 7 years ago
parent 430ccbaf66
commit b1f13cedb0

@ -1,15 +1,67 @@
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 { Commercant } from '../../../../models/Commercant';
@Component({
selector: 'app-demande-op-commercial',
templateUrl: './demande-op-commercial.component.html',
styleUrls: ['./demande-op-commercial.component.scss']
styleUrls: ['./demande-op-commercial.component.scss'],
providers: [AuthService, OpCommercialService]
})
export class DemandeOpCommercialComponent implements OnInit {
export class DemandeOpCommercialComponent implements OnInit, OnDestroy {
opComm: OperationCommerciale;
user: Observable<firebase.User>;
opCommData: FirebaseListObservable<any[]>;
profileData: FirebaseListObservable<any[]>;
commercant: Commercant;
constructor() { }
constructor(public afAuth: AngularFireAuth, public afDb: AngularFireDatabase,
private router: Router, private authService: AuthService, private opComService: OpCommercialService) {
this.opComm = new OperationCommerciale();
this.user = afAuth.authState;
this.commercant = new Commercant();
this.user.subscribe(
(auth) => {
// console.log("afAuth.authState : " + auth.toJSON());
if (auth) {
this.opCommData = this.afDb.list('/OperationCommercial/',{
query: {
orderByChild: 'validationXJC',
equalTo: 'En Cours'
}
}).map((array) => array.reverse()) as FirebaseListObservable<any[]>;
}
console.log(auth.uid);
}
);
}
ngOnInit() {
try {
this.user.subscribe(
(auth) => {
if (auth) {
console.log(auth.uid);
} else {
// this.router.navigate(['/']);
}
});
} catch (e) {
// No content response..
console.log(e);
// this.router.navigate(['/']);
}
}
ngOnDestroy() {}
}

@ -52,10 +52,10 @@
</div>
</div>
<div class="col-md-2" id="subCard2Part2">
<button class="btn btn-outline-primary btn-rounded" (click)="goToEnCart(op.uid)">Tarif</button>
<button class="btn btn-outline-default btn-rounded" (click)="goToScanCart(op.uid)">Bloquer</button>
<button class="btn btn-outline-info btn-rounded" (click)="goToDebiterCart(op.uid)">Cartes Envoyé</button>
<button class="btn btn-outline-info btn-rounded" (click)="goToDebiterCart(op.uid)">Scans Effecté</button>
<button class="btn btn-outline-primary btn-rounded" (click)="">Tarif</button>
<button class="btn btn-outline-default btn-rounded" (click)="">Bloquer</button>
<button class="btn btn-outline-info btn-rounded" (click)="">CrtEnv</button>
<button class="btn btn-outline-info btn-rounded" (click)="">Scans</button>
</div>
</div>
<div class="card-block col-md-12" id="subCard2Part3">

@ -67,6 +67,7 @@ export class CreationOpComComponent implements OnInit, OnDestroy {
this.opComm.nbScan = '';
this.opComm.nbEnvoie = '';
this.opComm.nbDebiter = '';
this.opComm.validationXJC = 'En Cours';
console.log('element.uid: ' + element.uid);
this.opComService.saveOpComm(element, this.opComm);
});

Loading…
Cancel
Save