| @@ -1,6 +1,6 @@ | |||||
| <div class="subpage"> | <div class="subpage"> | ||||
| <header class="main-header"> | <header class="main-header"> | ||||
| <h2> All Partners </h2> | |||||
| <h2> All Partners <ng-container *ngIf="userData">({{ userData.length }})</ng-container> </h2> | |||||
| </header> | </header> | ||||
| <div class="card"> | <div class="card"> | ||||
| @@ -12,6 +12,14 @@ | |||||
| <input type="text" placeholder="Partner name, location, PRA user, contact..."> | <input type="text" placeholder="Partner name, location, PRA user, contact..."> | ||||
| <label> Search </label> | <label> Search </label> | ||||
| </div> | </div> | ||||
| <button class="button" (click)="shouldHaveImplementationData = !shouldHaveImplementationData; allData()"> | |||||
| <ng-container *ngIf="!shouldHaveImplementationData"> | |||||
| Partners with implmentation data | |||||
| </ng-container> | |||||
| <ng-container *ngIf="shouldHaveImplementationData"> | |||||
| Show all Partners | |||||
| </ng-container> | |||||
| </button> | |||||
| <button class="button" (click)="showExportOptions = true"> <img src="assets/export.svg" alt=""> Export </button> | <button class="button" (click)="showExportOptions = true"> <img src="assets/export.svg" alt=""> Export </button> | ||||
| <button class="button"> <img src="assets/filter.svg" alt=""> Filter </button> | <button class="button"> <img src="assets/filter.svg" alt=""> Filter </button> | ||||
| </div> | </div> | ||||
| @@ -20,8 +28,8 @@ | |||||
| <div class="export-options"> | <div class="export-options"> | ||||
| <header> | <header> | ||||
| <h5> Export as </h5> | <h5> Export as </h5> | ||||
| </header> | |||||
| <div class="options"> | |||||
| </header> | |||||
| <div class="options"> | |||||
| <button class="button"> CSV </button> | <button class="button"> CSV </button> | ||||
| <button class="button"> Excel </button> | <button class="button"> Excel </button> | ||||
| </div> | </div> | ||||
| @@ -10,6 +10,7 @@ import { Router } from '@angular/router'; | |||||
| export class TableComponent implements OnInit { | export class TableComponent implements OnInit { | ||||
| userData: Array<any> = []; | userData: Array<any> = []; | ||||
| showExportOptions: boolean = false; | showExportOptions: boolean = false; | ||||
| shouldHaveImplementationData: boolean = false; | |||||
| constructor( | constructor( | ||||
| private partnerProfileService: PartnerProfileService, | private partnerProfileService: PartnerProfileService, | ||||
| @@ -17,9 +18,23 @@ export class TableComponent implements OnInit { | |||||
| ) { } | ) { } | ||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| this.allData(); | |||||
| } | |||||
| allData() { | |||||
| this.partnerProfileService.getPartnersData().then((data: any) => { | this.partnerProfileService.getPartnersData().then((data: any) => { | ||||
| this.userData = data; | |||||
| console.log(data); | |||||
| this.userData = data; | |||||
| if (this.shouldHaveImplementationData) { | |||||
| this.userData = this.userData.filter(user => { | |||||
| return (user.surveyCtoData.hiiData && user.surveyCtoData.hiiData.length > 0) || | |||||
| (user.surveyCtoData.spData && user.surveyCtoData.spData.length > 0) || | |||||
| (user.surveyCtoData.spSchemeData && user.surveyCtoData.spSchemeData.length > 0) | |||||
| }); | |||||
| } | |||||
| console.log(this.userData); | |||||
| }, (e) => console.log(e)); | }, (e) => console.log(e)); | ||||
| } | } | ||||