Skip to content

Commit 10ca8d3

Browse files
authored
Dashboard filters (#282)
* Dashboard filters * clean up * fix lint issues * fix issues
1 parent 557c7bd commit 10ca8d3

21 files changed

+24848
-46
lines changed

package-lock.json

+23,973-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@
3434
"@ngx-translate/http-loader": "^6.0.0",
3535
"alertifyjs": "^1.13.1",
3636
"concurrently": "^5.3.0",
37+
"date-fns": "^2.27.0",
3738
"keycloak-angular": "^8.0.1",
3839
"keycloak-js": "^12.0.1",
3940
"leaflet": "^1.7.1",
4041
"lint-staged": "^10.5.3",
4142
"ng-table-virtual-scroll": "^1.3.5",
43+
"ngx-date-fns": "^8.3.0",
4244
"ngx-translate-extract": "^1.0.0",
4345
"rxjs": "~6.6.0",
4446
"tslib": "^2.0.0",

src/app/_constants/common.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CaseOrigin } from '../_models/caseOrigin';
22
import { FollowUpStatus } from '../_models/followUpStatus';
33
import { PointOfEntryType } from '../_models/pointOfEntryType';
4+
import { DateFilterOptions } from './enums';
45

56
export const VIRTUAL_SCROLL_DEFAULT_ROW_HEIGHT = 48;
67
export const VIRTUAL_SCROLL_DEFAULT_HEADER_HEIGHT = 56;
@@ -67,10 +68,12 @@ export const EDGE_PANEL_TYPE = {
6768
};
6869

6970
// date format
70-
export const DEFAULT_DATE_FORMAT = 'd/m/yyyy';
71+
export const DEFAULT_DATE_FORMAT = 'd/M/yyyy';
7172
export const DAY_DATE_FORMAT = 'dd';
7273
export const MONTH_DATE_TEXT_FORMAT = 'MMM';
7374
export const HOUR_MINUTE_TIME_FORMAT = 'h:mm';
75+
export const BRIEF_DATE_FORMAT = 'M/d';
76+
export const COMMON_DATE_FORMAT = 'M/d/yyyy';
7477

7578
export type ButtonType = 'STANDARD' | 'STROKED' | 'FLAT';
7679
export const BUTTON_TYPE = {
@@ -120,3 +123,8 @@ export const FOLLOW_UP_STATUS = {
120123
LOST: 'LOST' as FollowUpStatus,
121124
NO_FOLLOW_UP: 'NO_FOLLOW_UP' as FollowUpStatus,
122125
};
126+
127+
export const DATE_TYPE_OPTIONS = {
128+
DATE: 'DATE' as DateFilterOptions,
129+
EPI_WEEK: 'EPI_WEEK' as DateFilterOptions,
130+
};

src/app/app.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { BidiModule } from '@angular/cdk/bidi';
88

99
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
1010
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
11+
import { DateFnsModule } from 'ngx-date-fns';
1112
import { AppRoutingModule } from './app-routing.module';
1213
import { AppComponent } from './app.component';
1314
import { initializeAuth } from './shared/auth/init-auth';
@@ -41,6 +42,7 @@ export function HttpLoaderFactory(http: HttpClient): any {
4142
deps: [HttpClient],
4243
},
4344
}),
45+
DateFnsModule.forRoot(),
4446
],
4547
providers: [
4648
{ provide: ENV, useFactory: getEnv },

src/app/configuration/communities/community-list/community-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, OnDestroy, ViewChild} from '@angular/core';
1+
import { Component, OnDestroy, ViewChild } from '@angular/core';
22
import { MatDialog } from '@angular/material/dialog';
33
import { TranslateService } from '@ngx-translate/core';
44
import { Subscription } from 'rxjs';

src/app/configuration/continents/continent-list/continent-list.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, OnDestroy, ViewChild} from '@angular/core';
1+
import { Component, OnDestroy, ViewChild } from '@angular/core';
22
import { MatDialog } from '@angular/material/dialog';
33
import { TranslateService } from '@ngx-translate/core';
44
import { Subscription } from 'rxjs';

src/app/configuration/districts/district-list/district-list.component.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import { DistrictService } from '../../../_services/api/district.service';
77
import { actionsBulkEditDefs } from './districts-actions-data';
88
import { defaultColumnDefs } from './districts-table-data';
99
import { AddEditBaseModalComponent } from '../../../shared/modals/add-edit-base-modal/add-edit-base-modal.component';
10-
import { CONFIGURATION_DISTRICT_FILTERS_FORM_ID, CONFIGURATION_MODAL_WIDTH, TableAppearanceOptions } from '../../../app.constants';
10+
import {
11+
CONFIGURATION_DISTRICT_FILTERS_FORM_ID,
12+
CONFIGURATION_MODAL_WIDTH,
13+
TableAppearanceOptions,
14+
} from '../../../app.constants';
1115
import { DistrictAddEditComponent } from '../district-add-edit/district-add-edit.component';
1216
import { DistrictDto } from '../../../_models/districtDto';
1317
import { TableComponent } from '../../../shared/table/table.component';

src/app/configuration/facilities/facility-list/facility-list.component.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { FacilityDto } from '../../../_models/facilityDto';
99
import { defaultColumnDefs } from './facilities-table-data';
1010
import { actionsBulkEditDefs } from './facilities-actions-data';
1111
import { AddEditBaseModalComponent } from '../../../shared/modals/add-edit-base-modal/add-edit-base-modal.component';
12-
import { ADD_MODAL_MAX_WIDTH, CONFIGURATION_FACILITY_FILTERS_FORM_ID } from '../../../app.constants';
12+
import {
13+
ADD_MODAL_MAX_WIDTH,
14+
CONFIGURATION_FACILITY_FILTERS_FORM_ID,
15+
} from '../../../app.constants';
1316
import { FacilityAddEditComponent } from '../facility-add-edit/facility-add-edit.component';
1417
import { TableComponent } from '../../../shared/table/table.component';
1518

src/app/configuration/regions/region-list/region-list.component.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { RegionService } from '../../../_services/api/region.service';
99
import { actionsBulkEditDefs } from './regions-actions-data';
1010
import { defaultColumnDefs } from './regions-table-data';
1111
import { AddEditBaseModalComponent } from '../../../shared/modals/add-edit-base-modal/add-edit-base-modal.component';
12-
import { CONFIGURATION_MODAL_WIDTH, CONFIGURATION_REGION_FILTERS_FORM_ID } from '../../../app.constants';
12+
import {
13+
CONFIGURATION_MODAL_WIDTH,
14+
CONFIGURATION_REGION_FILTERS_FORM_ID,
15+
} from '../../../app.constants';
1316
import { RegionAddEditComponent } from '../region-add-edit/region-add-edit.component';
1417
import { TableComponent } from '../../../shared/table/table.component';
1518

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
export const PERIOD_DATA = [
2+
{
3+
key: 'CUSTOM',
4+
name: 'captions.dashboardCustom',
5+
previous: [
6+
{
7+
key: 'BEFORE',
8+
name: 'captions.dashboardPeriodBefore',
9+
},
10+
{
11+
key: 'LAST_YEAR',
12+
name: 'captions.dashboardSamePeriodLastYear',
13+
},
14+
],
15+
},
16+
{
17+
key: 'TODAY',
18+
name: 'captions.dashboardToday',
19+
previous: [
20+
{
21+
key: 'BEFORE',
22+
name: 'captions.dashboardDayBefore',
23+
},
24+
{
25+
key: 'LAST_YEAR',
26+
name: 'captions.dashboardSameDayLastYear',
27+
},
28+
],
29+
},
30+
{
31+
key: 'YESTERDAY',
32+
name: 'captions.dashboardYesterday',
33+
previous: [
34+
{
35+
key: 'BEFORE',
36+
name: 'captions.dashboardDayBefore',
37+
},
38+
{
39+
key: 'LAST_YEAR',
40+
name: 'captions.dashboardSameDayLastYear',
41+
},
42+
],
43+
},
44+
{
45+
key: 'THIS_EPI_WEEK',
46+
name: 'captions.dashboardThisWeek',
47+
previous: [
48+
{
49+
key: 'BEFORE',
50+
name: 'captions.dashboardWeekBefore',
51+
},
52+
{
53+
key: 'LAST_YEAR',
54+
name: 'captions.dashboardSameWeekLastYear',
55+
},
56+
],
57+
},
58+
{
59+
key: 'LAST_EPI_WEEK',
60+
name: 'captions.dashboardLastWeek',
61+
previous: [
62+
{
63+
key: 'BEFORE',
64+
name: 'captions.dashboardWeekBefore',
65+
},
66+
{
67+
key: 'LAST_YEAR',
68+
name: 'captions.dashboardSameWeekLastYear',
69+
},
70+
],
71+
},
72+
{
73+
key: 'THIS_YEAR',
74+
name: 'captions.dashboardThisYear',
75+
previous: [
76+
{
77+
key: 'LAST_YEAR',
78+
name: 'captions.dashboardSamePeriodLastYear',
79+
},
80+
],
81+
},
82+
];
83+
84+
export const PREVIOUS_PERIOD_DATA = {};

0 commit comments

Comments
 (0)