Skip to content

Commit

Permalink
pequenas mudanças
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielVictorF committed Sep 27, 2019
1 parent 508359a commit 6f2e82b
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 76 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@
"config": {
"ionic_generate_source_map": "true"
}
}
}
1 change: 1 addition & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class MyApp {
if (localStorage.userToken) {
this.api.validaToken().subscribe(res => {
if (res) {
console.log(localStorage.userToken)
this.rootPage = TabsPage;
} else {
this.logout();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ion-icon name='menu'></ion-icon>
</button>
</ion-buttons>
<ion-title text-center><span class="titulo">Home Glique</span></ion-title>
<ion-title text-center><span class="titulo">Tela inicial</span></ion-title>
</ion-navbar>
</ion-header>

Expand Down
5 changes: 4 additions & 1 deletion src/pages/perfil/perfil.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@


<ion-content padding>
<ion-item>
<input type="file" ion-input>
</ion-item>
<ion-item>
<strong>Ùltimo login: </strong>{{ dadosUser?.lastLogin | data}}
</ion-item>
Expand All @@ -30,6 +33,6 @@
<strong>Nome do usuário: </strong>{{ dadosUser?.name }}
</ion-item>
<ion-item>
<strong>Ùltima modificação: </strong>{{ dadosUser?.updated }}
<strong>Ùltima modificação: </strong>{{ dadosUser?.updated | data}}
</ion-item>
</ion-content>
82 changes: 45 additions & 37 deletions src/pages/relatorio-resultado/relatorio-resultado.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@
</ion-navbar>
</ion-header>

<ion-content *ngIf="data.length == 0">
<p>aaaaaaaaaaa</p>
</ion-content>

<ion-content>
<div *ngIf="data.length == 0; else temRegistro">
<ion-refresher (ionRefresh)="ionViewWillEnter()">
<ion-refresher-content pullingText="Puxe para gerar novamente o relatório..." refreshingText="Gerando relatório...">
</ion-refresher-content>
</ion-refresher>

<div *ngIf="!getConcluido">

</div>

<div *ngIf="data.length == 0 && getConcluido">
<ion-item text-center color="danger">Sem registros</ion-item>
</div>

<ng-template #temRegistro>
<div *ngIf="data.length > 0 && getConcluido">
<ion-item>
<ion-icon name="arrow-up"></ion-icon>
Maior quantidade de insulina injetada: <b>{{relatorio.maior}}</b> mg/dl
Expand All @@ -31,6 +36,38 @@
</div>
</ion-item>

<ion-item>
<ion-icon name="arrow-up"></ion-icon>
Maior nível de açúcar: <b>{{relatorio.maiorAcucar}}</b> mg/dl
<p>
<div text-center>
<button ion-button icon-end (click)="detalhe(2)" *ngIf="relatorio.maiorAcucar != -1">
Ver Detalhe
<ion-icon name="more"></ion-icon>
</button>
</div>
</ion-item>

<ion-item>
<ion-icon name="arrow-down"></ion-icon>
Menor nível de açúcar: <b>{{relatorio.menorAcucar}}</b> mg/dl
<p>
<div text-center>
<button ion-button icon-end (click)="detalhe(3)" *ngIf="relatorio.menorAcucar != 10000000">
Ver Detalhe
<ion-icon name="more"></ion-icon>
</button>
</div>
</ion-item>

<ion-item>
<ion-icon name="grid"></ion-icon>
Relatório de medição por turno
<button ion-button small (click)="openModal()">
<ion-icon name="arrow-round-forward"></ion-icon>
Ir
</button>
</ion-item>

<ion-item>
<ion-icon name="calculator"></ion-icon>
Expand Down Expand Up @@ -69,38 +106,9 @@
<ion-icon name="cloud-download"></ion-icon>
Menos registros no turno: <b>{{relatorio.menorTurno | turno}}</b>
</ion-item>
<ion-item>
<ion-icon name="arrow-up"></ion-icon>
Maior nível de açúcar: <b>{{relatorio.maiorAcucar}}</b> mg/dl
<p>
<div text-center>
<button ion-button icon-end (click)="detalhe(2)" *ngIf="relatorio.maiorAcucar != -1">
Ver Detalhe
<ion-icon name="more"></ion-icon>
</button>
</div>
</ion-item>
<ion-item>
<ion-icon name="arrow-down"></ion-icon>
Menor nível de açúcar: <b>{{relatorio.menorAcucar}}</b> mg/dl
<p>
<div text-center>
<button ion-button icon-end (click)="detalhe(3)" *ngIf="relatorio.menorAcucar != 10000000">
Ver Detalhe
<ion-icon name="more"></ion-icon>
</button>
</div>
</ion-item>
<ion-item>
<ion-icon name="grid"></ion-icon>
Relatório de medição por turno
<button ion-button small (click)="openModal()">
<ion-icon name="arrow-round-forward"></ion-icon>
Ir
</button>
</ion-item>

<ion-item>
<strong>Quantidade de resultados: </strong>{{ data.length }}
</ion-item>
</ng-template>
</div>
</ion-content>
84 changes: 48 additions & 36 deletions src/pages/relatorio-resultado/relatorio-resultado.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,54 +32,30 @@ export class RelatorioResultadoPage {
constructor(public api: ApiProvider, public navCtrl: NavController, public navParams: NavParams,
public loadingCtrl: LoadingController, public alertCtrl: AlertController, public functions: FunctionsProvider,
public modal: ModalController) {
this.resetaRelatorio();
this.resetaRelatorio();
}

ionViewWillEnter() {
this.funcao = this.navParams.get("funcao");
this.offset = -100;
this.response = [];
this.api.getQtdObjetos().subscribe(res => {
this.qtdObj = res;
this.filtraFuncao();
console.log(this.qtdObj);
});
this.api.getQtdObjetos().subscribe(res => {
this.qtdObj = res;
this.filtraFuncao();
console.log(this.qtdObj);
});
}

filtraFuncao() {
switch (this.funcao) {
case 1: //Relatorio do mes
case 1: // Relatorio do mes
this.getSomenteMes();
break;
case 2:
case 2: // Relatório do ano
this.getSomenteAno();
break;
case 3:
var hoje = new Date();
var formatado = {
dia: hoje.getDate(),
mes: hoje.getMonth(),
ano: hoje.getFullYear()
}
let intervalo = {
i1: new Date(),
i2: new Date()
};
var newHoje: number = hoje.getDay();
intervalo.i1 = new Date(formatado.ano, formatado.mes, formatado.dia - newHoje, 0, 0, 0);
intervalo.i1 = this.functions.toEpoch(intervalo.i1);
intervalo.i2 = new Date(formatado.ano, formatado.mes, (formatado.dia + (6 - newHoje)), 0, 0, 0)
intervalo.i2 = this.functions.toEpoch(intervalo.i2)

this.api.getSemana(intervalo.i1, intervalo.i2).subscribe(res => {
if (res.length > 0) {
this.data = res;
this.maiorMenor();
} else {
this.getConcluido = true;
}
});

case 3: // Relatório da semana
this.getSomenteSemana();
}
}

Expand Down Expand Up @@ -141,7 +117,7 @@ export class RelatorioResultadoPage {
ultimoDia = this.functions.toEpoch(ultimoDia);
this.api.getMesEspecifico(primeiroDia, ultimoDia).subscribe(res => {
load.dismiss();
this.data = res;
this.data = res;
this.maiorMenor();
});
}
Expand All @@ -160,16 +136,52 @@ export class RelatorioResultadoPage {
}
}); */

let load = this.loadingCtrl.create({
content: 'Obtendo dados'
}); load.present();
let hoje = new Date();
let esteAno = new Date(hoje.getFullYear(), 0, 0);
esteAno = this.functions.toEpoch(esteAno);
this.api.getAnoEspecifico(esteAno).subscribe(res => {
load.dismiss();
this.data = res;
this.maiorMenor();
this.media();
});
}

getSomenteSemana() {
let load = this.loadingCtrl.create({
content: 'Obtendo dados'
}); load.present();

let hoje = new Date();
let formatado = {
dia: hoje.getDate(),
mes: hoje.getMonth(),
ano: hoje.getFullYear()
}
let intervalo = {
i1: new Date(),
i2: new Date()
};
let newHoje: number = hoje.getDay();
intervalo.i1 = new Date(formatado.ano, formatado.mes, formatado.dia - newHoje, 0, 0, 0);
intervalo.i1 = this.functions.toEpoch(intervalo.i1);
intervalo.i2 = new Date(formatado.ano, formatado.mes, (formatado.dia + (6 - newHoje)), 0, 0, 0)
intervalo.i2 = this.functions.toEpoch(intervalo.i2)

this.api.getSemana(intervalo.i1, intervalo.i2).subscribe(res => {
load.dismiss();
this.getConcluido = true;
if (res.length > 0) {
this.data = res;
this.maiorMenor();
}
this.getConcluido = true;
});
}

resetaRelatorio() {
this.relatorio = {
maior: -1, // Maior qtd de insulina injetada
Expand Down Expand Up @@ -248,7 +260,7 @@ export class RelatorioResultadoPage {
}

openModal() {
let modal = this.modal.create(ModalRelatorioPage, {"data": this.relatorio.turno});
let modal = this.modal.create(ModalRelatorioPage, { "data": this.relatorio.turno });
modal.present();
}
}

0 comments on commit 6f2e82b

Please sign in to comment.