diff --git a/src/app/features/noah-playground/components/risk-assessment-modal/risk-assessment-modal.component.html b/src/app/features/noah-playground/components/risk-assessment-modal/risk-assessment-modal.component.html
index 47bab192..b64f4abd 100644
--- a/src/app/features/noah-playground/components/risk-assessment-modal/risk-assessment-modal.component.html
+++ b/src/app/features/noah-playground/components/risk-assessment-modal/risk-assessment-modal.component.html
@@ -61,9 +61,64 @@
X
-
+
+
@@ -79,6 +134,8 @@
>
Province |
+
Total Population |
Total Affected Population |
Exposed to Med-High |
@@ -89,7 +146,9 @@
{{ data.province }}
+
{{ data.total_population }}
|
diff --git a/src/app/features/noah-playground/components/risk-assessment-modal/risk-assessment-modal.component.ts b/src/app/features/noah-playground/components/risk-assessment-modal/risk-assessment-modal.component.ts
index 7da0cecc..3eff943c 100644
--- a/src/app/features/noah-playground/components/risk-assessment-modal/risk-assessment-modal.component.ts
+++ b/src/app/features/noah-playground/components/risk-assessment-modal/risk-assessment-modal.component.ts
@@ -1,5 +1,8 @@
import { Component, OnInit } from '@angular/core';
-import { RiskAssessmentService } from '@features/noah-playground/services/risk-assessment.service';
+import {
+ AffectedData,
+ RiskAssessmentService,
+} from '@features/noah-playground/services/risk-assessment.service';
import { ModalService } from '@features/noah-playground/services/modal.service';
@Component({
@@ -8,8 +11,9 @@ import { ModalService } from '@features/noah-playground/services/modal.service';
styleUrls: ['./risk-assessment-modal.component.scss'],
})
export class RiskAssessmentModalComponent implements OnInit {
- affectedData: Array = [];
+ affectedData: AffectedData[] = [];
riskModal = false;
+ searchValue: string;
constructor(
private riskAssessment: RiskAssessmentService,
diff --git a/src/app/features/noah-playground/services/risk-assessment.service.ts b/src/app/features/noah-playground/services/risk-assessment.service.ts
index 774ca401..c4b84422 100644
--- a/src/app/features/noah-playground/services/risk-assessment.service.ts
+++ b/src/app/features/noah-playground/services/risk-assessment.service.ts
@@ -2,13 +2,15 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
-// export type AffectedData = {
-// province: string;
-// total_population: string;
-// total_affected: string;
-// med_high: string;
-// percentage_med_high: string;
-// };
+export type AffectedData = {
+ province: string;
+ Municipality: string;
+ Barangay: string;
+ total_population: string;
+ total_affected_population: string;
+ medium_high: string;
+ percentage_of_affected_medium_high: string;
+};
@Injectable({
providedIn: 'root',
})
diff --git a/src/app/shared/pipes/search-risk-affected.pipe.spec.ts b/src/app/shared/pipes/search-risk-affected.pipe.spec.ts
new file mode 100644
index 00000000..710cf4d6
--- /dev/null
+++ b/src/app/shared/pipes/search-risk-affected.pipe.spec.ts
@@ -0,0 +1,8 @@
+import { SearchRiskAffectedPipe } from './search-risk-affected.pipe';
+
+describe('SearchRiskAffectedPipe', () => {
+ it('create an instance', () => {
+ const pipe = new SearchRiskAffectedPipe();
+ expect(pipe).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/pipes/search-risk-affected.pipe.ts b/src/app/shared/pipes/search-risk-affected.pipe.ts
new file mode 100644
index 00000000..97c4bfc0
--- /dev/null
+++ b/src/app/shared/pipes/search-risk-affected.pipe.ts
@@ -0,0 +1,24 @@
+import { Pipe, PipeTransform } from '@angular/core';
+import { AffectedData } from '@features/noah-playground/services/risk-assessment.service';
+
+@Pipe({
+ name: 'searchRiskAffected',
+})
+export class SearchRiskAffectedPipe implements PipeTransform {
+ transform(summaryData: AffectedData[], searchValue: string): AffectedData[] {
+ if (!summaryData || !searchValue) {
+ return summaryData;
+ }
+ return summaryData.filter((data) =>
+ // data.province
+ // .toLocaleLowerCase()
+ // .includes(searchValue.toLocaleLowerCase()) ||
+ // data.Municipality
+ // .toLocaleLowerCase()
+ // .includes(searchValue.toLocaleLowerCase()) ||
+ data.province
+ .toLocaleLowerCase()
+ .includes(searchValue.toLocaleLowerCase())
+ );
+ }
+}
diff --git a/src/app/shared/pipes/sort-risk-affected.pipe.spec.ts b/src/app/shared/pipes/sort-risk-affected.pipe.spec.ts
new file mode 100644
index 00000000..7948560e
--- /dev/null
+++ b/src/app/shared/pipes/sort-risk-affected.pipe.spec.ts
@@ -0,0 +1,8 @@
+import { SortRiskAffectedPipe } from './sort-risk-affected.pipe';
+
+describe('SortRiskAffectedPipe', () => {
+ it('create an instance', () => {
+ const pipe = new SortRiskAffectedPipe();
+ expect(pipe).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/pipes/sort-risk-affected.pipe.ts b/src/app/shared/pipes/sort-risk-affected.pipe.ts
new file mode 100644
index 00000000..94a147a5
--- /dev/null
+++ b/src/app/shared/pipes/sort-risk-affected.pipe.ts
@@ -0,0 +1,18 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+ name: 'sortRiskAffected',
+ pure: true,
+})
+export class SortRiskAffectedPipe implements PipeTransform {
+ transform(list: any[], column: string, direction: string): any[] {
+ if (!list) {
+ return [];
+ }
+ if (direction === 'ascending') {
+ return list.sort((a, b) => (a[column] > b[column] ? -1 : 1));
+ } else {
+ return list.sort((a, b) => (a[column] < b[column] ? -1 : 1));
+ }
+ }
+}
diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts
index 63ce61c2..b7a8a97a 100644
--- a/src/app/shared/shared.module.ts
+++ b/src/app/shared/shared.module.ts
@@ -14,6 +14,8 @@ import { SearchfilterPipe } from './pipes/searchfilter.pipe';
import { PaginationComponent } from './components/pagination/pagination.component';
import { AlertComponent } from './components/alert/alert.component';
import { QcLoginComponent } from './components/qc-login/qc-login.component';
+import { SearchRiskAffectedPipe } from './pipes/search-risk-affected.pipe';
+import { SortRiskAffectedPipe } from './pipes/sort-risk-affected.pipe';
const modules = [CommonModule, FormsModule, ReactiveFormsModule];
const components = [
@@ -28,7 +30,13 @@ const components = [
AlertComponent,
];
const directives = [];
-const pipes = [ReplacePipe, SortPipe, SearchfilterPipe];
+const pipes = [
+ ReplacePipe,
+ SortPipe,
+ SearchfilterPipe,
+ SearchRiskAffectedPipe,
+ SortRiskAffectedPipe,
+];
@NgModule({
declarations: [...components, ...directives, ...pipes],
imports: [...modules],