mirror of
https://github.com/Nezumi-2711/foodify-frontend.git
synced 2026-09-22 20:01:17 +00:00
61 lines
1.8 KiB
TypeScript
61 lines
1.8 KiB
TypeScript
import { Component, OnInit, QueryList, ViewChildren } from '@angular/core';
|
|
import * as chartData from '../../shared/data/chart';
|
|
import { ReportDB, REPORTDB } from 'src/app/shared/tables/report';
|
|
import { Observable } from 'rxjs';
|
|
import { TableService } from 'src/app/shared/service/table.service';
|
|
import { NgbdSortableHeader, SortEvent } from 'src/app/shared/directives/NgbdSortableHeader';
|
|
import { DecimalPipe } from '@angular/common';
|
|
|
|
@Component({
|
|
selector: 'app-reports',
|
|
templateUrl: './reports.component.html',
|
|
styleUrls: ['./reports.component.scss'],
|
|
providers: [TableService, DecimalPipe]
|
|
})
|
|
export class ReportsComponent implements OnInit {
|
|
|
|
// lineChart
|
|
public salesChartData = chartData.salesChartData;
|
|
public salesChartLabels = chartData.salesChartLabels;
|
|
public salesChartOptions = chartData.salesChartOptions;
|
|
public salesChartColors = chartData.salesChartColors;
|
|
public salesChartLegend = chartData.salesChartLegend;
|
|
public salesChartType = chartData.salesChartType;
|
|
|
|
public areaChart1 = chartData.areaChart1;
|
|
public columnChart1 = chartData.columnChart1;
|
|
public lineChart = chartData.lineChart;
|
|
|
|
public chart5 = chartData.chart6
|
|
|
|
public tableItem$: Observable<ReportDB[]>;
|
|
public searchText;
|
|
total$: Observable<number>;
|
|
|
|
constructor(public service: TableService) {
|
|
this.tableItem$ = service.tableItem$;
|
|
this.total$ = service.total$;
|
|
this.service.setUserData(REPORTDB)
|
|
}
|
|
|
|
@ViewChildren(NgbdSortableHeader) headers: QueryList<NgbdSortableHeader>;
|
|
|
|
onSort({ column, direction }: SortEvent) {
|
|
// resetting other headers
|
|
this.headers.forEach((header) => {
|
|
if (header.sortable !== column) {
|
|
header.direction = '';
|
|
}
|
|
});
|
|
|
|
this.service.sortColumn = column;
|
|
this.service.sortDirection = direction;
|
|
|
|
}
|
|
|
|
|
|
ngOnInit() {
|
|
}
|
|
|
|
}
|