@@ -8,8 +8,9 @@ | |||||
<div class="segments"> | <div class="segments"> | ||||
<button class="button" [ngClass]="{'active' : selectedSegment === 1}" (click)="selectedSegment = 1"> Profile </button> | <button class="button" [ngClass]="{'active' : selectedSegment === 1}" (click)="selectedSegment = 1"> Profile </button> | ||||
<button class="button" [ngClass]="{'active' : selectedSegment === 2}" (click)="selectedSegment = 2"> Implementation Data </button> | |||||
<button class="button" [ngClass]="{'active' : selectedSegment === 3}" (click)="selectedSegment = 3"> Training Data </button> | |||||
<button class="button" [ngClass]="{'active' : selectedSegment === 2}" (click)="selectedSegment = 2" | |||||
*ngIf="partnerDetails.surveyCtoData.hiiData.length > 0 || partnerDetails.surveyCtoData.spData.length > 0 || partnerDetails.surveyCtoData.spSchemeData.length > 0" | |||||
> Implementation Data </button> | |||||
</div> | </div> | ||||
<ng-container *ngIf="selectedSegment === 1"> | <ng-container *ngIf="selectedSegment === 1"> | ||||
@@ -301,7 +302,7 @@ | |||||
</div> | </div> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col"> | <div class="col"> | ||||
No. of Males | |||||
No. of Transgenders | |||||
</div> | </div> | ||||
<div class="col"> | <div class="col"> | ||||
{{ package.noOfTransgender }} | {{ package.noOfTransgender }} | ||||
@@ -336,7 +337,7 @@ | |||||
Relevant Documents | Relevant Documents | ||||
</div> | </div> | ||||
<div class="col"> | <div class="col"> | ||||
{{ package.relevantDocuments }} | |||||
<a href="{{ package.relevantDocuments }}" target="_blank"> Link </a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</section> | </section> | ||||
@@ -384,7 +385,7 @@ | |||||
Relevant Documents | Relevant Documents | ||||
</div> | </div> | ||||
<div class="col"> | <div class="col"> | ||||
{{ package.relevantDocuments }} | |||||
<a href="{{ package.relevantDocuments }}" target="_blank"> Link </a> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</section> | </section> | ||||
@@ -431,12 +432,31 @@ | |||||
<ng-container *ngIf="showExportOptions"> | <ng-container *ngIf="showExportOptions"> | ||||
<div class="export-options"> | <div class="export-options"> | ||||
<div class="sub-options"> | |||||
<header> | |||||
<h5>Select Data Type</h5> | |||||
</header> | |||||
<div> | |||||
<span>Profile Data</span> | |||||
<div class="radioButton" [ngClass]="{'active' : isProfileData}" (click) = "isProfileData = true; isImplementationData=false; isBothData=false" ></div> | |||||
</div> | |||||
<div> | |||||
<span>Implementation Data</span> | |||||
<div class="radioButton" [ngClass]="{'active' : isImplementationData}" (click) = "isImplementationData= true; isProfileData=false; isBothData=false" ></div> | |||||
</div> | |||||
<div> | |||||
<span>Both</span> | |||||
<div class="radioButton" [ngClass]="{'active' : isBothData}" (click)="isBothData = true; isProfileData = false; isImplementationData=false"></div> | |||||
</div> | |||||
</div> | |||||
<header> | <header> | ||||
<h5> Export as </h5> | <h5> Export as </h5> | ||||
</header> | </header> | ||||
<div class="options"> | <div class="options"> | ||||
<button class="button" (click)="exportProfileData(0)"> CSV </button> | |||||
<button class="button" (click)="exportProfileData(1)"> Excel </button> | |||||
<button class="button" (click)="exportProfileData('CSV')"> CSV </button> | |||||
<button class="button" (click)="exportProfileData('XLSX')"> Excel </button> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</ng-container> | </ng-container> | ||||
@@ -162,6 +162,51 @@ | |||||
color: var(--secondary-text); | color: var(--secondary-text); | ||||
font-weight: 500; | font-weight: 500; | ||||
} | } | ||||
.sub-options { | |||||
div{ | |||||
margin: 3px 0; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
text-align: left; | |||||
font-size: 14px; | |||||
color: var(--input-border); | |||||
span{ | |||||
width: 85%; | |||||
} | |||||
} | |||||
.radioButton{ | |||||
border: 2px solid var(--input-border); | |||||
width: 15px; | |||||
height: 15px; | |||||
border-radius: 50%; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
&::before { | |||||
content: ''; | |||||
display: block; | |||||
width: 7px; | |||||
height: 7px; | |||||
border-radius: inherit; | |||||
background-color: white; | |||||
} | |||||
&.active { | |||||
border-color: var(--input-border); | |||||
&::before { | |||||
background-color: var(--input-border); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
.shadow { | .shadow { | ||||
@@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router'; | |||||
import * as Papa from 'papaparse'; | import * as Papa from 'papaparse'; | ||||
import * as XLSX from 'xlsx' | import * as XLSX from 'xlsx' | ||||
type exportType = "CSV" | "XLSX"; | |||||
@Component({ | @Component({ | ||||
selector: 'app-partner-details', | selector: 'app-partner-details', | ||||
@@ -15,6 +16,12 @@ export class PartnerDetailsComponent implements OnInit { | |||||
selectedSegment: 1 | 2 | 3 = 1; | selectedSegment: 1 | 2 | 3 = 1; | ||||
showExportOptions: boolean = false; | showExportOptions: boolean = false; | ||||
exportData: Array<any> = []; | |||||
exportSurveyCtoData: Array<any> = []; | |||||
isProfileData: boolean = true; | |||||
isImplementationData: boolean = false; | |||||
isBothData: boolean = false; | |||||
constructor( | constructor( | ||||
private activateRouter: ActivatedRoute | private activateRouter: ActivatedRoute | ||||
@@ -29,27 +36,34 @@ export class PartnerDetailsComponent implements OnInit { | |||||
loadExportData(partnerData: any) { | loadExportData(partnerData: any) { | ||||
let exportData: Array<any> = []; | |||||
let exportHiiData: Array<any> = []; | |||||
let exportSpData: Array<any> = []; | |||||
let exportSPSchemaData: Array<any> = []; | |||||
let surveyCtoData: Array<any> = []; | |||||
let csvArray = [{ | |||||
exportData = [{ | |||||
"PortalID": partnerData.portalId ? partnerData.portalId : '-', | "PortalID": partnerData.portalId ? partnerData.portalId : '-', | ||||
// Primary Contact | // Primary Contact | ||||
"Primary Name": partnerData.primaryContact.contactNumber, | |||||
"Primary Name": partnerData.primaryContact.name, | |||||
"Primary Contact Number": partnerData.primaryContact.contactNumber, | "Primary Contact Number": partnerData.primaryContact.contactNumber, | ||||
"Primary Email": partnerData.primaryContact.contactNumber, | |||||
"Primary Designation": partnerData.primaryContact.contactNumber, | |||||
"Primary Email": partnerData.primaryContact.email, | |||||
"Primary Designation": partnerData.primaryContact.designation, | |||||
// Basic Info | // Basic Info | ||||
"areasOfWork": partnerData.organizationBasicInfo.areasOfWork ? partnerData.organizationBasicInfo.areasOfWork.toString() : '', | |||||
"name": partnerData.organizationBasicInfo.name, | |||||
"reasonForBecomingMember": partnerData.organizationBasicInfo.reasonForBecomingMember, | |||||
"referralName": partnerData.organizationBasicInfo.referralName, | |||||
"source": partnerData.organizationBasicInfo.source, | |||||
"type": partnerData.organizationBasicInfo.type, | |||||
"website": partnerData.organizationBasicInfo.website, | |||||
"wouldLikeUpdates": partnerData.organizationBasicInfo.wouldLikeUpdates, | |||||
"Areas Of Work": partnerData.organizationBasicInfo.areasOfWork ? partnerData.organizationBasicInfo.areasOfWork.toString() : '', | |||||
"Name": partnerData.organizationBasicInfo.name, | |||||
"Reason For Becoming Member": partnerData.organizationBasicInfo.reasonForBecomingMember, | |||||
"Referral Name": partnerData.organizationBasicInfo.referralName, | |||||
"Source": partnerData.organizationBasicInfo.source, | |||||
"Type": partnerData.organizationBasicInfo.type, | |||||
"Website": partnerData.organizationBasicInfo.website, | |||||
"Would Like Updates": partnerData.organizationBasicInfo.wouldLikeUpdates, | |||||
// Alternative Contact | // Alternative Contact | ||||
@@ -86,28 +100,107 @@ export class PartnerDetailsComponent implements OnInit { | |||||
"Primary Areas Of Support Required Description": partnerData.strengthAndCapability.primaryAreasOfSupportRequired, | "Primary Areas Of Support Required Description": partnerData.strengthAndCapability.primaryAreasOfSupportRequired, | ||||
"Primary Areas Of Support Required Other": partnerData.strengthAndCapability.primaryAreasOfSupportRequiredOther, | "Primary Areas Of Support Required Other": partnerData.strengthAndCapability.primaryAreasOfSupportRequiredOther, | ||||
}] | }] | ||||
return csvArray; | |||||
let surveyCtoHIIData = []; | |||||
for (const hiidata of partnerData.surveyCtoData.hiiData) { | |||||
let partnerHiiDetails = { | |||||
"HII Id": hiidata.id, | |||||
"HII Name": hiidata.name, | |||||
"HII Packages Health": hiidata.packagesHealth, | |||||
"HII Implementation Status": hiidata.implementationStatus, | |||||
"HII Disaggregation Note": hiidata.disaggregationNote, | |||||
"HII No Of Males": hiidata.id, | |||||
"HII No Of Females": hiidata.noOfMales, | |||||
"HII No Of Transgender": hiidata.noOfTransgender, | |||||
"HII Health Remarks": hiidata.healthRemarks, | |||||
"HII Relevant Documents": hiidata.relevantDocuments, | |||||
} | |||||
surveyCtoHIIData.push(partnerHiiDetails) | |||||
} | |||||
surveyCtoHIIData.forEach(data => { | |||||
exportHiiData.push(data) | |||||
}) | |||||
let surveyCtoSpData = [] | |||||
for (const spData of partnerData.surveyCtoData.spData) { | |||||
let partnerSpDetails = { | |||||
"SP Id": spData.id, | |||||
"SP Name": spData.name, | |||||
"SP Status": spData.status, | |||||
"SP TotalAggregation": spData.totalAggregation, | |||||
"SP OtherRemarks": spData.otherRemarks, | |||||
"SP RelevantDocuments": spData.relevantDocuments, | |||||
} | |||||
surveyCtoSpData.push(partnerSpDetails) | |||||
} | |||||
surveyCtoSpData.forEach(data => { | |||||
exportSpData.push(data) | |||||
}) | |||||
let surveyCtoSpSchemaData = [] | |||||
for (const spSchema of partnerData.surveyCtoData.spSchemeData) { | |||||
let partnerSpSchemaDetails = { | |||||
"SPSchema SchemeId": spSchema.schemeId, | |||||
"SPSchema Count": spSchema.count, | |||||
} | |||||
surveyCtoSpSchemaData.push(partnerSpSchemaDetails) | |||||
} | |||||
surveyCtoSpSchemaData.forEach(data => { | |||||
exportSPSchemaData.push(data) | |||||
}) | |||||
surveyCtoData.push(exportHiiData) | |||||
surveyCtoData.push(exportSpData) | |||||
surveyCtoData.push(exportSPSchemaData) | |||||
this.exportData = exportData; | |||||
this.exportSurveyCtoData = surveyCtoData | |||||
} | } | ||||
exportProfileData(index: number) { | |||||
let fileTypeXLS = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'; | |||||
let fileTypeCSV = 'text/csv;charset=utf-8;'; | |||||
let fileExtension = index === 0 ? '.csv' : '.xlsx'; | |||||
let element = document.createElement('a'); | |||||
exportProfileData(exportType: exportType) { | |||||
const fileTypeXLS = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8', | |||||
fileTypeCSV = 'text/csv;charset=utf-8;', | |||||
fileExtension = exportType === 'CSV' ? '.csv' : '.xlsx', | |||||
element = document.createElement('a'); | |||||
let blob; | let blob; | ||||
if (index === 0) { | |||||
let csvData = Papa.unparse(this.loadExportData(this.partnerDetails)); | |||||
this.loadExportData(this.partnerDetails) | |||||
const partnerData = XLSX.utils.json_to_sheet(this.exportData); | |||||
const hiiData = XLSX.utils.json_to_sheet(this.exportSurveyCtoData[0]); | |||||
const spData = XLSX.utils.json_to_sheet(this.exportSurveyCtoData[1]); | |||||
const spSchema = XLSX.utils.json_to_sheet(this.exportSurveyCtoData[2]); | |||||
const wb = XLSX.utils.book_new(); | |||||
if (exportType === 'CSV') { | |||||
let csvData = Papa.unparse(this.exportData); | |||||
blob = new Blob([csvData], { type: fileTypeCSV }); | blob = new Blob([csvData], { type: fileTypeCSV }); | ||||
let url = URL.createObjectURL(blob); | |||||
element.href = url; | |||||
element.setAttribute('download', 'PartnerProfile' + fileExtension); | |||||
element.click(); | |||||
} else if (this.isImplementationData) { | |||||
XLSX.utils.book_append_sheet(wb, hiiData, "Hii Data"); | |||||
XLSX.utils.book_append_sheet(wb, spData, "Sp DATA"); | |||||
XLSX.utils.book_append_sheet(wb, spSchema, "SP Schema Data"); | |||||
XLSX.writeFile(wb, 'PartnerProfile' + fileExtension); | |||||
} else if (this.isBothData) { | |||||
XLSX.utils.book_append_sheet(wb, partnerData, "Partner Profile"); | |||||
XLSX.utils.book_append_sheet(wb, hiiData, "Hii Data"); | |||||
XLSX.utils.book_append_sheet(wb, spData, "Sp DATA"); | |||||
XLSX.utils.book_append_sheet(wb, spSchema, "SP Schema Data"); | |||||
XLSX.writeFile(wb, 'PartnerProfile' + fileExtension); | |||||
} else { | } else { | ||||
let ws = XLSX.utils.json_to_sheet(this.loadExportData(this.partnerDetails)); | |||||
let wb = { Sheets: { 'data': ws }, SheetNames: ['data'] }; | |||||
let excelBuffer = XLSX.write(wb, { bookType: 'xlsx', type: 'array' }); | |||||
blob = new Blob([excelBuffer], { type: fileTypeXLS }); | |||||
XLSX.utils.book_append_sheet(wb, partnerData, "Partner Profile"); | |||||
XLSX.writeFile(wb, 'PartnerProfile' + fileExtension); | |||||
} | } | ||||
let url = URL.createObjectURL(blob); | |||||
element.href = url; | |||||
element.setAttribute('download', 'PartnerProfile' + fileExtension); | |||||
element.click(); | |||||
} | } | ||||
} | } |
@@ -25,19 +25,40 @@ | |||||
<ng-container *ngIf="showExportOptions"> | <ng-container *ngIf="showExportOptions"> | ||||
<div class="export-options"> | <div class="export-options"> | ||||
<div class="sub-options" *ngIf="shouldHaveImplementationData"> | |||||
<header> | |||||
<h5>Select Data Type</h5> | |||||
</header> | |||||
<div> | |||||
<span>Profile Data</span> | |||||
<div class="radioButton" [ngClass]="{'active' : isProfileData}" (click) = "isProfileData = true; isImplementationData=false; isBothData=false" ></div> | |||||
</div> | |||||
<div> | |||||
<span>Implementation Data</span> | |||||
<div class="radioButton" [ngClass]="{'active' : isImplementationData}" (click) = "isImplementationData= true; isProfileData=false; isBothData=false" ></div> | |||||
</div> | |||||
<div> | |||||
<span>Both</span> | |||||
<div class="radioButton" [ngClass]="{'active' : isBothData}" (click)="isBothData = true; isProfileData = false; isImplementationData=false"></div> | |||||
</div> | |||||
</div> | |||||
<header> | <header> | ||||
<h5> Export as </h5> | <h5> Export as </h5> | ||||
</header> | </header> | ||||
<div class="options"> | <div class="options"> | ||||
<button (click) ="exportProfileData(0)" class="button"> CSV </button> | |||||
<button (click) ="exportProfileData(1)" class="button"> Excel </button> | |||||
<button (click) ="exportProfileData('CSV')" class="button"> CSV </button> | |||||
<button (click) ="exportProfileData('XLSX')" class="button"> Excel </button> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</ng-container> | </ng-container> | ||||
<section class="table"> | <section class="table"> | ||||
<header> | <header> | ||||
<div class="col"> <input type="checkbox" [checked]="checkedAllInput()" (change)="selectAllPartner()"> Select </div> | |||||
<div class="col"> <input type="checkbox" [checked]="isAllInputChecked()" (change)="selectAllPartner()"> Select </div> | |||||
<div class="col"> Name </div> | <div class="col"> Name </div> | ||||
<div class="col"> Primary Disctrict & State </div> | <div class="col"> Primary Disctrict & State </div> | ||||
<div class="col"> Type </div> | <div class="col"> Type </div> | ||||
@@ -47,7 +68,7 @@ | |||||
</header> | </header> | ||||
<section class="data"> | <section class="data"> | ||||
<div class="row" *ngFor="let partner of tempUserData"> | <div class="row" *ngFor="let partner of tempUserData"> | ||||
<div class="col"> <input type="checkbox" [checked]="checkedInput(partner)" (change)="selectPartner(partner)"> </div> | |||||
<div class="col"> <input type="checkbox" [checked]="isInputChecked(partner)" (change)="selectPartner(partner)"> </div> | |||||
<div class="col" (click)="showPartnerDetails(partner)"> | <div class="col" (click)="showPartnerDetails(partner)"> | ||||
{{ partner.organizationBasicInfo.name }} | {{ partner.organizationBasicInfo.name }} | ||||
</div> | </div> | ||||
@@ -44,7 +44,7 @@ | |||||
} | } | ||||
.export-options { | .export-options { | ||||
width: 190px; | |||||
width: 210px; | |||||
position: absolute; | position: absolute; | ||||
top: 70px; | top: 70px; | ||||
right: 120px; | right: 120px; | ||||
@@ -69,6 +69,53 @@ | |||||
justify-content: space-between; | justify-content: space-between; | ||||
} | } | ||||
.sub-options { | |||||
div{ | |||||
margin: 3px 0; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: space-between; | |||||
text-align: left; | |||||
font-size: 14px; | |||||
color: var(--input-border); | |||||
span{ | |||||
width: 85%; | |||||
} | |||||
} | |||||
.radioButton{ | |||||
border: 2px solid var(--input-border); | |||||
width: 15px; | |||||
height: 15px; | |||||
border-radius: 50%; | |||||
display: flex; | |||||
align-items: center; | |||||
justify-content: center; | |||||
&::before { | |||||
content: ''; | |||||
display: block; | |||||
width: 7px; | |||||
height: 7px; | |||||
border-radius: inherit; | |||||
background-color: white; | |||||
} | |||||
&.active { | |||||
border-color: var(--input-border); | |||||
&::before { | |||||
background-color: var(--input-border); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
button { | button { | ||||
border: 2px solid var(--input-border); | border: 2px solid var(--input-border); | ||||
padding: 7px 20px; | padding: 7px 20px; | ||||
@@ -78,6 +125,8 @@ | |||||
color: var(--secondary-text); | color: var(--secondary-text); | ||||
font-weight: 500; | font-weight: 500; | ||||
} | } | ||||
} | } | ||||
.table { | .table { | ||||
@@ -4,6 +4,8 @@ import { Router } from '@angular/router'; | |||||
import * as Papa from 'papaparse'; | import * as Papa from 'papaparse'; | ||||
import * as XLSX from 'xlsx' | import * as XLSX from 'xlsx' | ||||
type exportType = "CSV" | "XLSX"; | |||||
@Component({ | @Component({ | ||||
selector: 'app-table', | selector: 'app-table', | ||||
templateUrl: './table.component.html', | templateUrl: './table.component.html', | ||||
@@ -17,6 +19,12 @@ export class TableComponent implements OnInit { | |||||
shouldHaveImplementationData: boolean = false; | shouldHaveImplementationData: boolean = false; | ||||
searchText: string = ''; | searchText: string = ''; | ||||
selectedPartnerList: Array<any> = []; | selectedPartnerList: Array<any> = []; | ||||
isProfileData: boolean = true; | |||||
isImplementationData: boolean = false; | |||||
isBothData: boolean = false; | |||||
exportData: Array<any> = []; | |||||
exportSurveyCtoData: Array<any> = []; | |||||
constructor( | constructor( | ||||
private partnerProfileService: PartnerProfileService, | private partnerProfileService: PartnerProfileService, | ||||
@@ -45,7 +53,7 @@ export class TableComponent implements OnInit { | |||||
}) | }) | ||||
} | } | ||||
this.partialLoad(this.userData.slice(0, 10)) | |||||
this.partialLoad(this.userData.slice(0, 100)) | |||||
console.log(this.userData); | console.log(this.userData); | ||||
}, (e) => console.log(e)); | }, (e) => console.log(e)); | ||||
@@ -66,7 +74,6 @@ export class TableComponent implements OnInit { | |||||
selectPartner(partner: any) { | selectPartner(partner: any) { | ||||
if (this.selectedPartnerList) { | if (this.selectedPartnerList) { | ||||
console.log(!this.checkedInput(partner)) | |||||
if (this.selectedPartnerList.some(x => JSON.stringify(x) === JSON.stringify(partner))) { | if (this.selectedPartnerList.some(x => JSON.stringify(x) === JSON.stringify(partner))) { | ||||
this.selectedPartnerList = this.selectedPartnerList.filter(x => JSON.stringify(x) !== JSON.stringify(partner)) | this.selectedPartnerList = this.selectedPartnerList.filter(x => JSON.stringify(x) !== JSON.stringify(partner)) | ||||
} else this.selectedPartnerList.push(partner) | } else this.selectedPartnerList.push(partner) | ||||
@@ -74,28 +81,34 @@ export class TableComponent implements OnInit { | |||||
} | } | ||||
loadExportData() { | loadExportData() { | ||||
let tempArray = []; | |||||
let exportData: Array<any> = []; | |||||
let exportHiiData: Array<any> = []; | |||||
let exportSpData: Array<any> = []; | |||||
let exportSPSchemaData: Array<any> = []; | |||||
let surveyCtoData: Array<any> = []; | |||||
for (const partner of this.selectedPartnerList) { | for (const partner of this.selectedPartnerList) { | ||||
let csvArray = [{ | |||||
let partnerDetails = { | |||||
"PortalID": partner.portalId ? partner.portalId : '-', | "PortalID": partner.portalId ? partner.portalId : '-', | ||||
// Primary Contact | // Primary Contact | ||||
"Primary Name": partner.primaryContact.contactNumber, | |||||
"Primary Name": partner.primaryContact.name, | |||||
"Primary Contact Number": partner.primaryContact.contactNumber, | "Primary Contact Number": partner.primaryContact.contactNumber, | ||||
"Primary Email": partner.primaryContact.contactNumber, | |||||
"Primary Designation": partner.primaryContact.contactNumber, | |||||
"Primary Email": partner.primaryContact.email, | |||||
"Primary Designation": partner.primaryContact.designation, | |||||
// Basic Info | // Basic Info | ||||
"areasOfWork": partner.organizationBasicInfo.areasOfWork ? partner.organizationBasicInfo.areasOfWork.toString() : '', | |||||
"name": partner.organizationBasicInfo.name, | |||||
"reasonForBecomingMember": partner.organizationBasicInfo.reasonForBecomingMember, | |||||
"referralName": partner.organizationBasicInfo.referralName, | |||||
"source": partner.organizationBasicInfo.source, | |||||
"type": partner.organizationBasicInfo.type, | |||||
"website": partner.organizationBasicInfo.website, | |||||
"wouldLikeUpdates": partner.organizationBasicInfo.wouldLikeUpdates, | |||||
"Areas Of Work": partner.organizationBasicInfo.areasOfWork ? partner.organizationBasicInfo.areasOfWork.toString() : '', | |||||
"Name": partner.organizationBasicInfo.name, | |||||
"Reason For Becoming Member": partner.organizationBasicInfo.reasonForBecomingMember, | |||||
"Referral Name": partner.organizationBasicInfo.referralName, | |||||
"Source": partner.organizationBasicInfo.source, | |||||
"Type": partner.organizationBasicInfo.type, | |||||
"Website": partner.organizationBasicInfo.website, | |||||
"Would Like Updates": partner.organizationBasicInfo.wouldLikeUpdates, | |||||
// Alternative Contact | // Alternative Contact | ||||
@@ -114,7 +127,7 @@ export class TableComponent implements OnInit { | |||||
"Files": partner.detailedProfile.files, | "Files": partner.detailedProfile.files, | ||||
"Have Branches In Other Districts": partner.detailedProfile.haveBranchesInOtherDistricts, | "Have Branches In Other Districts": partner.detailedProfile.haveBranchesInOtherDistricts, | ||||
"Logo": partner.detailedProfile.logo, | "Logo": partner.detailedProfile.logo, | ||||
"Partner Location": partner.detailedProfile.partnerLocation, | |||||
"partner Location": partner.detailedProfile.partnerLocation, | |||||
"Preferred Languages": partner.detailedProfile.preferredLanguages ? partner.detailedProfile.preferredLanguages.toString() : '', | "Preferred Languages": partner.detailedProfile.preferredLanguages ? partner.detailedProfile.preferredLanguages.toString() : '', | ||||
"Preferred Mode Of Communications": partner.detailedProfile.preferredModeOfCommunications ? partner.detailedProfile.preferredModeOfCommunications.toString() : '', | "Preferred Mode Of Communications": partner.detailedProfile.preferredModeOfCommunications ? partner.detailedProfile.preferredModeOfCommunications.toString() : '', | ||||
"State": partner.detailedProfile.state, | "State": partner.detailedProfile.state, | ||||
@@ -131,48 +144,121 @@ export class TableComponent implements OnInit { | |||||
"Primary Areas Of Support Required": partner.strengthAndCapability.primaryAreasOfSupportOfferedOther ? partner.strengthAndCapability.primaryAreasOfSupportOfferedOther.toString() : '', | "Primary Areas Of Support Required": partner.strengthAndCapability.primaryAreasOfSupportOfferedOther ? partner.strengthAndCapability.primaryAreasOfSupportOfferedOther.toString() : '', | ||||
"Primary Areas Of Support Required Description": partner.strengthAndCapability.primaryAreasOfSupportRequired, | "Primary Areas Of Support Required Description": partner.strengthAndCapability.primaryAreasOfSupportRequired, | ||||
"Primary Areas Of Support Required Other": partner.strengthAndCapability.primaryAreasOfSupportRequiredOther, | "Primary Areas Of Support Required Other": partner.strengthAndCapability.primaryAreasOfSupportRequiredOther, | ||||
}] | |||||
} | |||||
exportData.push(partnerDetails); | |||||
let surveyCtoHIIData = []; | |||||
for (const hiidata of partner.surveyCtoData.hiiData) { | |||||
let partnerHiiDetails = { | |||||
"HII Id": hiidata.id, | |||||
"HII Name": hiidata.name, | |||||
"HII Packages Health": hiidata.packagesHealth, | |||||
"HII Implementation Status": hiidata.implementationStatus, | |||||
"HII Disaggregation Note": hiidata.disaggregationNote, | |||||
"HII No Of Males": hiidata.id, | |||||
"HII No Of Females": hiidata.noOfMales, | |||||
"HII No Of Transgender": hiidata.noOfTransgender, | |||||
"HII Health Remarks": hiidata.healthRemarks, | |||||
"HII Relevant Documents": hiidata.relevantDocuments, | |||||
} | |||||
surveyCtoHIIData.push(partnerHiiDetails) | |||||
} | |||||
surveyCtoHIIData.forEach(data => { | |||||
exportHiiData.push(data) | |||||
}) | |||||
let surveyCtoSpData = [] | |||||
for (const spData of partner.surveyCtoData.spData) { | |||||
let partnerSpDetails = { | |||||
"SP Id": spData.id, | |||||
"SP Name": spData.name, | |||||
"SP Status": spData.status, | |||||
"SP TotalAggregation": spData.totalAggregation, | |||||
"SP OtherRemarks": spData.otherRemarks, | |||||
"SP RelevantDocuments": spData.relevantDocuments, | |||||
} | |||||
surveyCtoSpData.push(partnerSpDetails) | |||||
} | |||||
surveyCtoSpData.forEach(data => { | |||||
exportSpData.push(data) | |||||
}) | |||||
let surveyCtoSpSchemaData = [] | |||||
for (const spSchema of partner.surveyCtoData.spSchemeData) { | |||||
let partnerSpSchemaDetails = { | |||||
"SPSchema SchemeId": spSchema.schemeId, | |||||
"SPSchema Count": spSchema.count, | |||||
} | |||||
tempArray.push(csvArray[0]) | |||||
surveyCtoSpSchemaData.push(partnerSpSchemaDetails) | |||||
} | |||||
surveyCtoSpSchemaData.forEach(data => { | |||||
exportSPSchemaData.push(data) | |||||
}) | |||||
} | } | ||||
return tempArray; | |||||
surveyCtoData.push(exportHiiData) | |||||
surveyCtoData.push(exportSpData) | |||||
surveyCtoData.push(exportSPSchemaData) | |||||
this.exportData = exportData; | |||||
this.exportSurveyCtoData = surveyCtoData | |||||
} | } | ||||
checkedInput(partner: any) { | |||||
return this.selectedPartnerList.some(x => JSON.stringify(x) === JSON.stringify(partner)) | |||||
isInputChecked(partner: any) { | |||||
return this.selectedPartnerList.some(x => JSON.stringify(x) === JSON.stringify(partner)); | |||||
} | } | ||||
checkedAllInput() { | |||||
return JSON.stringify(this.selectedPartnerList) === JSON.stringify(this.tempUserData) | |||||
isAllInputChecked() { | |||||
return JSON.stringify(this.selectedPartnerList) === JSON.stringify(this.tempUserData); | |||||
} | } | ||||
selectAllPartner() { | selectAllPartner() { | ||||
if (JSON.stringify(this.selectedPartnerList) === JSON.stringify(this.tempUserData)) { | |||||
this.selectedPartnerList = [] | |||||
} else this.selectedPartnerList = this.tempUserData | |||||
JSON.stringify(this.selectedPartnerList) === JSON.stringify(this.tempUserData) ? this.selectedPartnerList = [] : this.selectedPartnerList = this.tempUserData; | |||||
} | } | ||||
exportProfileData(index: number) { | |||||
let fileTypeXLS = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8'; | |||||
let fileTypeCSV = 'text/csv;charset=utf-8;'; | |||||
let fileExtension = index === 0 ? '.csv' : '.xlsx'; | |||||
let element = document.createElement('a'); | |||||
exportProfileData(exportType: exportType) { | |||||
const fileTypeXLS = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8', | |||||
fileTypeCSV = 'text/csv;charset=utf-8;', | |||||
fileExtension = exportType === 'CSV' ? '.csv' : '.xlsx', | |||||
element = document.createElement('a'); | |||||
let blob; | let blob; | ||||
if (index === 0) { | |||||
let csvData = Papa.unparse(this.loadExportData()); | |||||
this.loadExportData(); | |||||
const partnerData = XLSX.utils.json_to_sheet(this.exportData); | |||||
const hiiData = XLSX.utils.json_to_sheet(this.exportSurveyCtoData[0]); | |||||
const spData = XLSX.utils.json_to_sheet(this.exportSurveyCtoData[1]); | |||||
const spSchema = XLSX.utils.json_to_sheet(this.exportSurveyCtoData[2]); | |||||
const wb = XLSX.utils.book_new(); | |||||
if (exportType === 'CSV') { | |||||
let csvData = Papa.unparse(this.exportData); | |||||
blob = new Blob([csvData], { type: fileTypeCSV }); | blob = new Blob([csvData], { type: fileTypeCSV }); | ||||
let url = URL.createObjectURL(blob); | |||||
element.href = url; | |||||
element.setAttribute('download', 'PartnerProfile' + fileExtension); | |||||
element.click(); | |||||
} else if (this.isImplementationData && this.shouldHaveImplementationData) { | |||||
XLSX.utils.book_append_sheet(wb, hiiData, "Hii Data"); | |||||
XLSX.utils.book_append_sheet(wb, spData, "Sp DATA"); | |||||
XLSX.utils.book_append_sheet(wb, spSchema, "SP Schema Data"); | |||||
XLSX.writeFile(wb, 'PartnerProfile' + fileExtension); | |||||
} else if (this.isBothData && this.shouldHaveImplementationData) { | |||||
XLSX.utils.book_append_sheet(wb, partnerData, "Partner Profile"); | |||||
XLSX.utils.book_append_sheet(wb, hiiData, "Hii Data"); | |||||
XLSX.utils.book_append_sheet(wb, spData, "Sp DATA"); | |||||
XLSX.utils.book_append_sheet(wb, spSchema, "SP Schema Data"); | |||||
XLSX.writeFile(wb, 'PartnerProfile' + fileExtension); | |||||
} else { | } else { | ||||
let ws = XLSX.utils.json_to_sheet(this.loadExportData()); | |||||
let wb = { Sheets: { 'data': ws }, SheetNames: ['data'] }; | |||||
let excelBuffer = XLSX.write(wb, { bookType: 'xlsx', type: 'array' }); | |||||
blob = new Blob([excelBuffer], { type: fileTypeXLS }); | |||||
XLSX.utils.book_append_sheet(wb, partnerData, "Partner Profile"); | |||||
XLSX.writeFile(wb, 'PartnerProfile' + fileExtension); | |||||
} | } | ||||
let url = URL.createObjectURL(blob); | |||||
element.href = url; | |||||
element.setAttribute('download', 'PartnerProfile' + fileExtension); | |||||
element.click(); | |||||
} | } | ||||
} | } |