diff --git a/src/web/domain/presentation/dashboard/atendente/consultar-atendentes/consultar-atendentes.component.html b/src/web/domain/presentation/dashboard/atendente/consultar-atendentes/consultar-atendentes.component.html index e8db2a43..414b3a28 100644 --- a/src/web/domain/presentation/dashboard/atendente/consultar-atendentes/consultar-atendentes.component.html +++ b/src/web/domain/presentation/dashboard/atendente/consultar-atendentes/consultar-atendentes.component.html @@ -14,10 +14,9 @@
-

{{atendente.nome}}

-

{{atendente.email}}

-

{{atendente?.endereco?.cidade?.nome}} - - {{atendente?.endereco?.cidade?.estado?.uf}}

+

{{atendente?.payload?.val()?.nome}}

+

{{atendente?.payload?.val()?.email}}

+

{{atendente?.payload?.val()?.unidade?.endereco}}

diff --git a/src/web/domain/presentation/dashboard/atendente/consultar-atendentes/consultar-atendentes.component.ts b/src/web/domain/presentation/dashboard/atendente/consultar-atendentes/consultar-atendentes.component.ts index 0c6de048..5dafa4a4 100644 --- a/src/web/domain/presentation/dashboard/atendente/consultar-atendentes/consultar-atendentes.component.ts +++ b/src/web/domain/presentation/dashboard/atendente/consultar-atendentes/consultar-atendentes.component.ts @@ -14,7 +14,7 @@ export class ConsultarAtendentesComponent implements OnInit { /** * */ - public atendentes: Atendente[]; + public atendentes: any; /** * @@ -37,7 +37,14 @@ export class ConsultarAtendentesComponent implements OnInit { * */ public listUsuariosByFilters() { - this.atendenteService.find().subscribe(atendentes => this.atendentes = atendentes) + this.atendenteService.find().snapshotChanges().subscribe(atendentes => { + this.atendentes = atendentes; + this.atendentes.forEach( atendente => { + console.log('aqui'); + atendente.payload.val().unidade.endereco = 'asdfas'; + // atendente.payload.val + }) + }) } /** diff --git a/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.html b/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.html index 700f40ed..ce276637 100644 --- a/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.html +++ b/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.html @@ -7,7 +7,7 @@ - +
diff --git a/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.ts b/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.ts index d13ee0ce..d174d920 100644 --- a/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.ts +++ b/src/web/domain/presentation/dashboard/atendente/visualizar-atendente/visualizar-atendente.component.ts @@ -23,7 +23,7 @@ export class VisualizarAtendenteComponent implements OnInit { * * @type {Atendente} */ - atendente: Atendente = new Atendente(); + atendente: any; /** * @@ -47,7 +47,7 @@ export class VisualizarAtendenteComponent implements OnInit { * @param {string} atendenteKey */ public find(atendenteKey: string) { - this.atendenteService.findOne(atendenteKey).subscribe(atendente => this.atendente = atendente) + this.atendenteService.findOne(atendenteKey).snapshotChanges().subscribe(atendente => this.atendente = atendente) } /** diff --git a/src/web/domain/presentation/dashboard/unidade/consultar-unidades/consultar-unidades.component.ts b/src/web/domain/presentation/dashboard/unidade/consultar-unidades/consultar-unidades.component.ts index df180f14..618d8006 100644 --- a/src/web/domain/presentation/dashboard/unidade/consultar-unidades/consultar-unidades.component.ts +++ b/src/web/domain/presentation/dashboard/unidade/consultar-unidades/consultar-unidades.component.ts @@ -40,8 +40,8 @@ export class ConsultarUnidadesComponent implements OnInit { * */ public listUnidadesByFilters() { - this.unidadeService.find().snapshotChanges().subscribe(asdf=> { - this.unidades = asdf; + this.unidadeService.find().snapshotChanges().subscribe(result => { + this.unidades = result; }); } diff --git a/src/web/domain/service/atendente.service.ts b/src/web/domain/service/atendente.service.ts index 8b5e500f..99056482 100644 --- a/src/web/domain/service/atendente.service.ts +++ b/src/web/domain/service/atendente.service.ts @@ -1,18 +1,13 @@ import {Injectable} from '@angular/core'; import {HttpClient} from "@angular/common/http"; import {AbstractService} from "./abstract.service"; -import {AngularFireDatabase} from "angularfire2/database"; +import {AngularFireDatabase, AngularFireList, AngularFireObject} from "angularfire2/database"; import {Observable} from "rxjs/Observable"; import {Atendente} from "../entity/atendente/atendente.model"; @Injectable() export class AtendenteService extends AbstractService { - /** - * TODO mudar para o model - */ - atendentes: any[]; - constructor(private af: AngularFireDatabase, private httpClient: HttpClient) { super(); } @@ -21,12 +16,12 @@ export class AtendenteService extends AbstractService { return this.httpClient.post(this.baseUrl + 'atendentes', atendente).toPromise(); } - public find(): Observable { - return this.af.list('atendentes').valueChanges(); + public find(): AngularFireList { + return this.af.list('atendentes'); } - public findOne(key: string): Observable { - return this.af.object('atendentes/' + key).valueChanges(); + public findOne(key: string): AngularFireObject { + return this.af.object('atendentes/' + key); } public update(atendente: Atendente): Promise { diff --git a/src/web/domain/service/unidade.service.ts b/src/web/domain/service/unidade.service.ts index cbb5bedf..d5c852d7 100644 --- a/src/web/domain/service/unidade.service.ts +++ b/src/web/domain/service/unidade.service.ts @@ -10,11 +10,6 @@ import {FirebaseListObservable} from "angularfire2/database-deprecated"; @Injectable() export class UnidadeService extends AbstractService { - /** - * TODO mudar para o model - */ - unidades: any[]; - constructor(private af: AngularFireDatabase, private httpClient: HttpClient) { super(); } @@ -24,8 +19,6 @@ export class UnidadeService extends AbstractService { } public find(): AngularFireList { - - // this.unidadeService.find().snapshotChanges().subscribe( return this.af.list('unidades'); }