diff --git a/src/app/components/lancamentos-modal/lancamentos-modal.component.ts b/src/app/components/lancamentos-modal/lancamentos-modal.component.ts index cc3dbe2..bbb07f5 100644 --- a/src/app/components/lancamentos-modal/lancamentos-modal.component.ts +++ b/src/app/components/lancamentos-modal/lancamentos-modal.component.ts @@ -45,4 +45,4 @@ export class LancamentosModalComponent implements OnInit { } ngOnInit() {} -} \ No newline at end of file +} diff --git a/src/app/components/ultimos-lancamentos/ultimos-lancamentos.component.html b/src/app/components/ultimos-lancamentos/ultimos-lancamentos.component.html index 51671f8..c2d32e2 100644 --- a/src/app/components/ultimos-lancamentos/ultimos-lancamentos.component.html +++ b/src/app/components/ultimos-lancamentos/ultimos-lancamentos.component.html @@ -15,4 +15,4 @@ {{ valor }} - \ No newline at end of file + diff --git a/src/app/components/ultimos-lancamentos/ultimos-lancamentos.component.ts b/src/app/components/ultimos-lancamentos/ultimos-lancamentos.component.ts index 98af05d..a2e08b8 100644 --- a/src/app/components/ultimos-lancamentos/ultimos-lancamentos.component.ts +++ b/src/app/components/ultimos-lancamentos/ultimos-lancamentos.component.ts @@ -15,8 +15,9 @@ export class UltimosLancamentosComponent implements OnInit { @Input() tipoOperacao: string; - + ngOnInit() { + this.diaCompra = new Date(this.diaCompra).toLocaleDateString(); } corTexto() { @@ -47,8 +48,8 @@ export class UltimosLancamentosComponent implements OnInit { break; } - case 'investimentos': { - this.srcImg = "https://static.vecteezy.com/ti/vetor-gratis/p1/2519573-investimento-grafico-icone-design-ilustracao-vetor.jpg" + case 'investimentos': { + this.srcImg = "https://static.vecteezy.com/ti/vetor-gratis/p1/2519573-investimento-grafico-icone-design-ilustracao-vetor.jpg" break; } case 'alimentacao': { @@ -63,4 +64,4 @@ export class UltimosLancamentosComponent implements OnInit { } return this.srcImg; } -} \ No newline at end of file +} diff --git a/src/app/pages/home/home.page.html b/src/app/pages/home/home.page.html index 4f34a0c..77279f0 100644 --- a/src/app/pages/home/home.page.html +++ b/src/app/pages/home/home.page.html @@ -41,16 +41,16 @@

R$ {{ valorDinamico }}

Últimas transações
-
- \ No newline at end of file + diff --git a/src/app/pages/home/home.page.ts b/src/app/pages/home/home.page.ts index d765ee0..635d09f 100644 --- a/src/app/pages/home/home.page.ts +++ b/src/app/pages/home/home.page.ts @@ -85,12 +85,12 @@ export class HomePage implements OnInit { }; if (this.listaLancamentos) { this.listaLancamentos.forEach((el) => { - if (el.tipoTransacao == 'entrada') { + if (el.tipoOperacao == 'entrada') { entradas.valores.push(el.valor); - entradas.data.push(el.diaCompra); + entradas.data.push(new Date(el.diaCompra).toLocaleDateString()); entradas.total += el.valor; } else { - saidas.data.push(el.diaCompra); + saidas.data.push(new Date(el.diaCompra).toLocaleDateString()); saidas.valores.push(el.valor); saidas.total += el.valor; } @@ -120,9 +120,12 @@ export class HomePage implements OnInit { } async retornaTodosLancamentos() { let arr = await this.storage.retornaTodosLancamentos(); - console.log(arr) - this.listaLancamentos = arr; - this.listaLancamentosCard = arr.slice().sort((a: Lancamento, b: Lancamento) => - new Date(b.diaCompra).getTime() - new Date(a.diaCompra).getTime()) + if(arr) { + console.log(arr) + this.listaLancamentos = arr; + this.listaLancamentosCard = arr.slice().sort((a: Lancamento, b: Lancamento) => + new Date(b.diaCompra).getTime() - new Date(a.diaCompra).getTime()) + } + } }