Skip to content

Commit

Permalink
Merge pull request #3443 from cisagov/Add-New-fields-to-the-Key-Form-…
Browse files Browse the repository at this point in the history
…page

TSA-501 Anonymous Key Report
  • Loading branch information
jekuipers authored Aug 2, 2023
2 parents 41f4dab + 9a61d99 commit 0fc687f
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 203 deletions.
2 changes: 1 addition & 1 deletion CSETWebNg/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ const appRoutes: Routes = [
{ path: 'hydroReport', component: HydroReportComponent },
{ path: 'hydroActionItemsReport', component: HydroActionItemsReportComponent },
{ path: 'sd-answer-summary', component: SdAnswerSummaryReportComponent },
{ path: 'key-report/:numberOfContacts', component: KeyReportComponent },
{ path: 'key-report', component: KeyReportComponent },
]
},
{ path: '**', redirectTo: 'home' }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<a class="link" (click)="generatePdf()">Anonymous Key Report</a>

<div class="container mt-5 pt-5" id="pdfTable" #pdfTable style="margin-top: 3rem; padding-top: 3rem;">
<!-- <div class="row">
<div class="col-12 text-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,14 @@
.label {
min-width: 160px !important;
display: inline-block !important
}
}
.link {
color: #1a53ff;;
text-decoration: none;
cursor: pointer;
}

.link:hover {
color: #0056b3;
text-decoration:underline;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { DemographicService } from '../../../../services/demographic.service';
import { Console } from 'console';
import { ActivatedRoute } from '@angular/router';


@Component({
selector: 'app-key-report',
templateUrl: './key-report.component.html',
Expand All @@ -34,30 +35,28 @@ export class KeyReportComponent {
) { }

ngOnInit(): void {
this.contactCount = +this.route.snapshot.paramMap.get('numberOfContacts');
console.log(this.contactCount)
if (this.assessSvc.id()) {
this.assessSvc.loadAssessment(this.assessSvc.id())
this.assessment = this.assessSvc.assessment;
console.log( this.assessment)
this.demoSvc.getDemographic().subscribe(
(data: Demographic) => {
this.demographicData = data;
console.log( this.demographicData )
})
}

this.generatePdf()
}
ngAfterViewInit(): void {
this.generatePdf(); // Now it should not throw error
// this.contactCount = +this.route.snapshot.paramMap.get('numberOfContacts');
// if (this.assessSvc.id()) {
// this.assessSvc.loadAssessment(this.assessSvc.id())
// this.assessment = this.assessSvc.assessment;
// this.demoSvc.getDemographic().subscribe(
// (data: Demographic) => {
// this.demographicData = data;
// })
// }
// this.assessSvc.setKeyReportComponent(this);
this.contactCount=1
// this.generatePdf()
}
// ngAfterViewInit(): void {
// this.generatePdf(); // Now it should not throw error
// }

generatePdf() {
let pdfMake = require('pdfmake/build/pdfmake.js');
let pdfFonts = require('pdfmake/build/vfs_fonts.js');
pdfMake.vfs = pdfFonts.pdfMake.vfs;
const authKey = this.auth.accessKey(); // Update this line as per your need
const authKey = this.auth.accessKey();

const isConfigChainEqual = this.arraysEqual(this.configSvc.config.currentConfigChain, ["TSA","TSAonline"]);
// Get the 'Assessment Name', 'Assessment Date' and 'Facility Name' based on the 'currentConfigChain'
Expand Down Expand Up @@ -335,35 +334,6 @@ text: [
}
]
},
// {
// style: 'tableExample',
// table: {
// widths: ['*', '*', '*', '*', '*'],
// body: [
// ['First Name', 'Last Name', 'Title', 'Organization', 'Cell Phone'],
// [' ', ' ', ' ', ' ', ' '],
// [' ', ' ', ' ', ' ', ' '],
// [' ', ' ', ' ', ' ', ' '],
// [' ', ' ', ' ', ' ', ' ']
// ]
// },
// layout: {
// hLineWidth: function(i, node) {
// return (i === 0 || i === node.table.body.length) ? 1 : 1;
// },
// vLineWidth: function(i, node) {
// return (i === 0 || i === node.table.widths.length) ? 1 : 1;
// },
// hLineColor: function(i, node) {
// return (i === 0 || i === node.table.body.length) ? 'black' : 'black';
// },
// vLineColor: function(i, node) {
// return (i === 0 || i === node.table.widths.length) ? 'black' : 'black';
// }
// },
// margin: [0, 20, 0, 0] ,

// },
{ text: '', pageBreak: i !== this.contactCount - 1 ? 'after' : undefined }
]
content = content.concat(pageContent);
Expand Down Expand Up @@ -430,90 +400,7 @@ text: [
]
},
{ text: `Assessment Owner :`, style: 'label', margin: [0, 10, 10, 10] },
// {
// columns: [
// {
// width: '20%',
// text: `First Name :`,
// style: 'labelKey',
// margin: [0, 10, 10, 5]
// },
// {
// width: '30%',
// text: `_________________________`,
// style: 'label',
// margin: [0, 10, 10, 0]
// },
// {
// width: '20%',
// text: `Last Name :`,
// style: 'labelKey',
// margin: [0, 10, 10, 5]
// },
// {
// width: '30%',
// text: `_________________________`,
// style: 'label',
// margin: [0, 10, 10, 0]
// }
// ]
// },
// {
// columns: [
// {
// width: '18%',
// text: `Title/Role :`,
// style: 'labelKey',
// margin: [0, 10, 10, 5]
// },
// {
// width: '30%',
// text: `_________________________`,
// style: 'label',
// margin: [0, 10, 10, 0]
// },
// {
// width: '18%',
// text: `Email :`,
// style: 'labelKey',
// margin: [0, 10, 10, 5]
// },
// {
// width: '30%',
// text: `_________________________`,
// style: 'label',
// margin: [0, 10, 10, 0]
// }
// ]
// },
// {
// columns: [
// {
// width: '18%',
// text: `Cell Phone :`,
// style: 'labelKey',
// margin: [0, 10, 10, 5]
// },
// {
// width: '30%',
// text: `_________________________`,
// style: 'label',
// margin: [0,10, 10, 0]
// },
// {
// width: '18%',
// text: `Office Phone :`,
// style: 'labelKey',
// margin: [0, 10, 10, 5]
// },
// {
// width: '30%',
// text: `_________________________`,
// style: 'label',
// margin: [0, 10, 10, 0]
// }
// ]
// },

{
columns: [
{
Expand Down Expand Up @@ -542,64 +429,7 @@ text: [
}
]
},
// {
// columns: [
// {
// width: '24%',
// text: `Organization Name :`,
// style: 'labelKey',
// margin: [0, 10, 10, 0]
// },
// {
// width: '30%',
// text: `__________________`,
// style: 'label',
// margin: [10, 10, 10, 10]
// },
// {
// width: '22%',
// text: `Facility Name :`,
// style: 'labelKey',
// margin: [0, 10, 10, 0]
// },
// {
// width: '30%',
// text: `_____________________`,
// style: 'label',
// margin: [0, 10, 10, 0]
// }
// ]
// },
// {
// columns: [
// {
// width: '22%',
// text: `City or Site Name :`,
// style: 'labelKey',
// margin: [0, 10, 10, 0]
// },
// {
// width: '30%',
// text: `__________________`,
// style: 'label',
// margin: [0,10, 10, 0]
// },
// {
// width: '28%',
// text: `State/Province/Region :`,
// style: 'labelKey',
// margin: [0, 10, 10, 0]
// },
// {
// width: '32%',
// text: `___________________`,
// style: 'label',
// margin: [0, 10, 10, 0]
// }
// ]
// },

// { text: `Organization Type : _________________________`, style: 'label', margin: [0, 10, 10, 10] },

{ text: `Roles :`, style: 'label', margin: [0, 20, 0, 0] },
{
columns: [
Expand Down Expand Up @@ -673,8 +503,8 @@ text: [
pageSize: 'A4',
pageOrientation: 'landscape',
};
let url = '/index.html?returnPath=report/key-report' ;
localStorage.setItem('REPORT-KEY-REPORT' , print.toString());
// let url = '/index.html?returnPath=report/key-report' ;
// localStorage.setItem('REPORT-KEY-REPORT' , print.toString());
pdfMake.createPdf(documentDefinition).open();
}
// Helper function to check if two arrays are equal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,16 +478,21 @@ <h4>
</div>

</div>
<div>
<div *ngIf="isConfigChainEqual">
<!-- <select [(ngModel)]="numberOfContacts">
<option *ngFor="let number of [1, 2, 3, 4, 5]" [value]="number">{{number}}</option>
</select>
-->
<a [routerLink]="['/report/key-report', 1]">Anonymous Key Report</a>
<div>
<div class="ml-2" *ngIf="isConfigChainEqual">
<app-key-report></app-key-report>
</div>




<div class="mt-5">
<button *ngIf="this.configSvc.behaviors.showExportOnReports" tabindex="0"
class="icon-button-dark btn btn-secondary d-flex justify-content-center align-items-center flex-00a"
(click)="clickExport()"
matTooltip="Export a copy of this assessment to another location ({{ exportExtension }}).">
<span class="cset-icons-export-up fs-base-2 mr-2"></span>
<span>Export</span>
</button>
</div>
<div class="mt-5">
<button *ngIf="this.configSvc.behaviors.showExportOnReports" tabindex="0"
class="icon-button-dark btn btn-secondary d-flex justify-content-center align-items-center flex-00a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ export class ReportsComponent implements OnInit, AfterViewInit {
if (reportType === 'crrreport') {
localStorage.setItem('crrReportConfidentiality', this.securitySelected);
}

window.open(url, "_blank");
}

Expand Down

0 comments on commit 0fc687f

Please sign in to comment.