diff --git a/src/components/report-popover/report-popover.html b/src/components/report-popover/report-popover.html
index ffc48ba..0260ad4 100644
--- a/src/components/report-popover/report-popover.html
+++ b/src/components/report-popover/report-popover.html
@@ -1,16 +1,25 @@
-
- Período
+
+
+ Período
+
+
De
+
Até
+
+
+ Opções
+
+
-
+
diff --git a/src/pages/reports/detail/reports-detail.ts b/src/pages/reports/detail/reports-detail.ts
index 793c316..f095753 100644
--- a/src/pages/reports/detail/reports-detail.ts
+++ b/src/pages/reports/detail/reports-detail.ts
@@ -48,6 +48,10 @@ export class ReportsDetailPage {
categoryName = 'produto';
this.listTitle = 'Lista de pedidos';
break;
+ case 'customers':
+ categoryName = 'cliente';
+ this.listTitle = 'Lista de pedidos';
+ break;
default:
this.listTitle = 'Listagem';
}
@@ -63,7 +67,7 @@ export class ReportsDetailPage {
*/
presentPopover(myEvent) {
let popover = this.popoverCtrl.create(ReportPopoverComponent, {period: this.period});
- popover.present();
+ popover.present({ev: myEvent});
popover.onDidDismiss(data => {
if (data) {
this.updatePeriod([data.from, data.to]);
@@ -76,11 +80,15 @@ export class ReportsDetailPage {
*/
updatePeriod(period) {
if (period && period[0] && period[1]) {
- this.period = [period[0], period[1]];
+ this.period = period = [
+ this.toIso(period[0]),
+ this.toIso(period[1])
+ ];
+
this.periodTitle = moment(period[0]).format('DD/MM/YYYY') + ' - ' + moment(period[1]).format('DD/MM/YYYY');
- this.apiProvider.builder('reports/' + this.category + '/' + this.id + '/' + period[0] + '/' + period[1]).loader().get()
- .subscribe((res) => this.updateListDate(res));
+ this.apiProvider.builder('reports/' + this.category + '/' + this.id + '/' + moment(period[0]).format('YYYY-MM-DD') + '/' + moment(period[1]).format('YYYY-MM-DD'))
+ .loader().get().subscribe((res) => this.updateListDate(res));
} else {
this.period = [];
this.periodTitle = 'Sempre';
@@ -105,4 +113,12 @@ export class ReportsDetailPage {
this.report = res;
}
+
+ /**
+ * @param date
+ * @returns {string}
+ */
+ toIso(date) {
+ return new Date(date).toISOString();
+ }
}
diff --git a/src/pages/reports/index/reports.html b/src/pages/reports/index/reports.html
index 44e09f3..96003cc 100644
--- a/src/pages/reports/index/reports.html
+++ b/src/pages/reports/index/reports.html
@@ -11,6 +11,11 @@
+
+