diff --git a/src/app/api/models/unit.ts b/src/app/api/models/unit.ts index 452bbceb98..0415a8bda2 100644 --- a/src/app/api/models/unit.ts +++ b/src/app/api/models/unit.ts @@ -723,6 +723,17 @@ export class Unit extends Entity { ); } + public get staffNotesCsvDownloadUrl(): string { + return `${AppInjector.get(DoubtfireConstants).API_URL}/csv/units/${this.id}/staff_notes`; + } + + public downloadStaffNotesCsv(): void { + AppInjector.get(FileDownloaderService).downloadFile( + `${AppInjector.get(DoubtfireConstants).API_URL}/csv/units/${this.id}/staff_notes`, + `${this.name}-StaffNotes.csv`, + ); + } + public get taskDefinitionsPrerequisitesUrl(): string { return `${AppInjector.get(DoubtfireConstants).API_URL}/units/${this.id}/task_prerequisites`; } diff --git a/src/app/doubtfire-angular.module.ts b/src/app/doubtfire-angular.module.ts index 33c8db369b..16e6c15557 100644 --- a/src/app/doubtfire-angular.module.ts +++ b/src/app/doubtfire-angular.module.ts @@ -305,6 +305,7 @@ import {DiscussionPromptService} from './api/services/discussion-prompt.service' import {DiscussionPromptsComponent} from './projects/states/discussion-prompts/discussion-prompts.component'; import {TaskDefinitionDiscussionPromptsComponent} from './units/states/edit/directives/unit-tasks-editor/task-definition-editor/task-definition-discussion-prompts/task-definition-discussion-prompts.component'; import {DiscussionPromptsViewComponent} from './projects/states/dashboard/directives/task-dashboard/directives/discussion-prompts-view/discussion-prompts-view.component'; +import {DownloadStaffNotesComponent} from './units/states/portfolios/download-staff-notes/download-staff-notes.component'; import {TaskPlannerComponent} from './projects/states/plan/task-planner/task-planner.component'; import {TaskPlannerPrerequisitesModalComponent} from './projects/states/plan/task-planner/task-planner-prerequisites-modal/task-planner-prerequisites-modal.component'; import {TaskPlannerPrerequisitesModalService} from './projects/states/plan/task-planner/task-planner-prerequisites-modal/task-planner-prerequisites-modal.service'; @@ -497,6 +498,7 @@ const GANTT_CHART_CONFIG = { TaskDefinitionDiscussionPromptsComponent, DiscussionPromptsViewComponent, TaskPlannerComponent, + DownloadStaffNotesComponent, TaskPlannerCardComponent, TaskPlannerPrerequisitesModalComponent, TaskOverseerReportComponent, diff --git a/src/app/doubtfire-angularjs.module.ts b/src/app/doubtfire-angularjs.module.ts index 40e8930490..1fb4868e3c 100644 --- a/src/app/doubtfire-angularjs.module.ts +++ b/src/app/doubtfire-angularjs.module.ts @@ -233,6 +233,7 @@ import {PortfolioGradeSelectStepComponent} from './projects/states/portfolio/dir import {PortfolioIncludedTasksComponent} from './projects/states/portfolio/directives/portfolio-review-step/portfolio-included-tasks/portfolio-included-tasks.component'; import {TaskSimilarityViewComponent} from './projects/states/dashboard/directives/task-dashboard/directives/task-similarity-view/task-similarity-view.component'; import {UploadGradesComponent} from './units/states/portfolios/upload-grades/upload-grades.component'; +import {DownloadStaffNotesComponent} from './units/states/portfolios/download-staff-notes/download-staff-notes.component'; import {ProjectPlanComponent} from './projects/states/plan/project-plan.component'; import {TaskPlannerComponent} from './projects/states/plan/task-planner/task-planner.component'; import {TaskPlannerCardComponent} from './projects/states/dashboard/directives/progress-dashboard/task-planner-card/task-planner-card.component'; @@ -580,6 +581,11 @@ DoubtfireAngularJSModule.directive( downgradeComponent({component: UploadGradesComponent}), ); +DoubtfireAngularJSModule.directive( + 'fDownloadStaffNotes', + downgradeComponent({component: DownloadStaffNotesComponent}), +); + DoubtfireAngularJSModule.directive( 'fProjectPlan', downgradeComponent({component: ProjectPlanComponent}), diff --git a/src/app/units/states/portfolios/download-staff-notes/download-staff-notes.component.html b/src/app/units/states/portfolios/download-staff-notes/download-staff-notes.component.html new file mode 100644 index 0000000000..529708f97c --- /dev/null +++ b/src/app/units/states/portfolios/download-staff-notes/download-staff-notes.component.html @@ -0,0 +1,3 @@ + diff --git a/src/app/units/states/portfolios/download-staff-notes/download-staff-notes.component.scss b/src/app/units/states/portfolios/download-staff-notes/download-staff-notes.component.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/app/units/states/portfolios/download-staff-notes/download-staff-notes.component.ts b/src/app/units/states/portfolios/download-staff-notes/download-staff-notes.component.ts new file mode 100644 index 0000000000..eb3e1501bd --- /dev/null +++ b/src/app/units/states/portfolios/download-staff-notes/download-staff-notes.component.ts @@ -0,0 +1,24 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {Unit} from 'src/app/api/models/unit'; +import {AlertService} from 'src/app/common/services/alert.service'; + +@Component({ + selector: 'f-download-staff-notes', + templateUrl: 'download-staff-notes.component.html', + styleUrl: 'download-staff-notes.component.scss', +}) +export class DownloadStaffNotesComponent implements OnInit { + @Input() unit: Unit; + + constructor(private alertService: AlertService) {} + + public ngOnInit(): void { + if (!this.unit) { + return console.error(`Invalid unit`); + } + } + + public downloadStaffNotesCsv() { + this.unit.downloadStaffNotesCsv(); + } +} diff --git a/src/app/units/states/portfolios/portfolios.tpl.html b/src/app/units/states/portfolios/portfolios.tpl.html index 34d00d5d7f..eaff240d73 100644 --- a/src/app/units/states/portfolios/portfolios.tpl.html +++ b/src/app/units/states/portfolios/portfolios.tpl.html @@ -236,6 +236,7 @@

Mark Portfolios

rotate="false" >
+