diff --git a/alcs-frontend/src/app/features/home/assigned/assigned.component.html b/alcs-frontend/src/app/features/home/assigned/assigned.component.html index 8d84cdbcc7..093529bc02 100644 --- a/alcs-frontend/src/app/features/home/assigned/assigned.component.html +++ b/alcs-frontend/src/app/features/home/assigned/assigned.component.html @@ -12,7 +12,7 @@

Cards Assigned to Me: {{ totalFiles }}

-
Non-Applications
+
Planning Referrals
diff --git a/alcs-frontend/src/app/features/home/subtask/subtask-table/subtask-table.component.html b/alcs-frontend/src/app/features/home/subtask/subtask-table/subtask-table.component.html index 3c6e515460..768a2af105 100644 --- a/alcs-frontend/src/app/features/home/subtask/subtask-table/subtask-table.component.html +++ b/alcs-frontend/src/app/features/home/subtask/subtask-table/subtask-table.component.html @@ -30,12 +30,6 @@ [type]="RECON_TYPE_LABEL" > - - {{ subtaskLabel }} Subtasks: {{ totalSubtaskCount }}
-
Notice of Intent
+
Notices of Intent
@@ -10,7 +10,7 @@

{{ subtaskLabel }} Subtasks: {{ totalSubtaskCount }}

-
Non-Applications
+
Planning Reviews
diff --git a/alcs-frontend/src/styles.scss b/alcs-frontend/src/styles.scss index c865196401..6c3be8512c 100644 --- a/alcs-frontend/src/styles.scss +++ b/alcs-frontend/src/styles.scss @@ -132,13 +132,13 @@ $alcs-warn: mat.define-palette($mat-custom-warn); // Create the theme object. A theme consists of configurations for individual // theming systems such as "color" or "typography". $alcs-theme: mat.define-light-theme( - ( - color: ( - primary: $alcs-primary, - accent: $alcs-accent, - warn: $alcs-warn, - ), - ) + ( + color: ( + primary: $alcs-primary, + accent: $alcs-accent, + warn: $alcs-warn, + ), + ) ); // Include theme styles for core and each component used in your app. @@ -176,7 +176,7 @@ body { mat-dialog-content, div[mat-dialog-content] { flex-grow: 1; - max-height: 80vh; + max-height: unset; } } } diff --git a/services/apps/alcs/src/alcs/card/card-subtask/card-subtask.dto.ts b/services/apps/alcs/src/alcs/card/card-subtask/card-subtask.dto.ts index de1449b8a4..4f8ec51eb1 100644 --- a/services/apps/alcs/src/alcs/card/card-subtask/card-subtask.dto.ts +++ b/services/apps/alcs/src/alcs/card/card-subtask/card-subtask.dto.ts @@ -2,6 +2,7 @@ import { AutoMap } from 'automapper-classes'; import { IsOptional, IsUUID } from 'class-validator'; import { ApplicationTypeDto } from '../../code/application-code/application-type/application-type.dto'; import { AssigneeDto } from '../../../user/user.dto'; +import { PlanningReviewTypeDto } from '../../planning-review/planning-review.dto'; import { CardDto } from '../card.dto'; export enum PARENT_TYPE { @@ -58,7 +59,7 @@ export class CardSubtaskDto { export class HomepageSubtaskDTO extends CardSubtaskDto { card: CardDto; title: string; - appType?: ApplicationTypeDto; + appType?: PlanningReviewTypeDto; parentType: PARENT_TYPE; activeDays?: number; paused: boolean; diff --git a/services/apps/alcs/src/alcs/home/home.controller.spec.ts b/services/apps/alcs/src/alcs/home/home.controller.spec.ts index b4ad6e82a3..c5369c4b15 100644 --- a/services/apps/alcs/src/alcs/home/home.controller.spec.ts +++ b/services/apps/alcs/src/alcs/home/home.controller.spec.ts @@ -30,6 +30,8 @@ import { NoticeOfIntent } from '../notice-of-intent/notice-of-intent.entity'; import { NoticeOfIntentService } from '../notice-of-intent/notice-of-intent.service'; import { Notification } from '../notification/notification.entity'; import { NotificationService } from '../notification/notification.service'; +import { PlanningReferral } from '../planning-review/planning-referral/planning-referral.entity'; +import { PlanningReferralService } from '../planning-review/planning-referral/planning-referral.service'; import { HomeController } from './home.controller'; describe('HomeController', () => { @@ -42,6 +44,7 @@ describe('HomeController', () => { let mockNoticeOfIntentService: DeepMocked; let mockNoticeOfIntentModificationService: DeepMocked; let mockNotificationService: DeepMocked; + let mockPlanningReferralService: DeepMocked; beforeEach(async () => { mockApplicationService = createMock(); @@ -52,6 +55,7 @@ describe('HomeController', () => { mockNoticeOfIntentService = createMock(); mockNoticeOfIntentModificationService = createMock(); mockNotificationService = createMock(); + mockPlanningReferralService = createMock(); const module: TestingModule = await Test.createTestingModule({ imports: [ @@ -101,6 +105,10 @@ describe('HomeController', () => { provide: NotificationService, useValue: mockNotificationService, }, + { + provide: PlanningReferralService, + useValue: mockPlanningReferralService, + }, ApplicationProfile, ApplicationSubtaskProfile, UserProfile, @@ -124,6 +132,8 @@ describe('HomeController', () => { mockNoticeOfIntentModificationService.mapToDtos.mockResolvedValue([]); mockNotificationService.getBy.mockResolvedValue([]); mockNotificationService.mapToDtos.mockResolvedValue([]); + mockPlanningReferralService.getBy.mockResolvedValue([]); + mockPlanningReferralService.mapToDtos.mockResolvedValue([]); mockNoticeOfIntentService.getTimes.mockResolvedValue(new Map()); mockApplicationTimeTrackingService.fetchActiveTimes.mockResolvedValue( @@ -149,6 +159,9 @@ describe('HomeController', () => { mockNotificationService.getWithIncompleteSubtaskByType.mockResolvedValue( [], ); + mockPlanningReferralService.getWithIncompleteSubtaskByType.mockResolvedValue( + [], + ); }); it('should be defined', () => { diff --git a/services/apps/alcs/src/alcs/home/home.controller.ts b/services/apps/alcs/src/alcs/home/home.controller.ts index 1ceafe44c5..9b2397130a 100644 --- a/services/apps/alcs/src/alcs/home/home.controller.ts +++ b/services/apps/alcs/src/alcs/home/home.controller.ts @@ -36,8 +36,9 @@ import { NoticeOfIntentService } from '../notice-of-intent/notice-of-intent.serv import { NotificationDto } from '../notification/notification.dto'; import { Notification } from '../notification/notification.entity'; import { NotificationService } from '../notification/notification.service'; -import { PlanningReviewDto } from '../planning-review/planning-review.dto'; -import { PlanningReview } from '../planning-review/planning-review.entity'; +import { PlanningReferral } from '../planning-review/planning-referral/planning-referral.entity'; +import { PlanningReferralService } from '../planning-review/planning-referral/planning-referral.service'; +import { PlanningReferralDto } from '../planning-review/planning-review.dto'; const HIDDEN_CARD_STATUSES = [ CARD_STATUS.CANCELLED, @@ -57,6 +58,7 @@ export class HomeController { private noticeOfIntentService: NoticeOfIntentService, private noticeOfIntentModificationService: NoticeOfIntentModificationService, private notificationService: NotificationService, + private planningReferralService: PlanningReferralService, ) {} @Get('/assigned') @@ -66,7 +68,7 @@ export class HomeController { noticeOfIntentModifications: NoticeOfIntentModificationDto[]; applications: ApplicationDto[]; reconsiderations: ApplicationReconsiderationDto[]; - planningReferrals: PlanningReviewDto[]; + planningReferrals: PlanningReferralDto[]; modifications: ApplicationModificationDto[]; notifications: NotificationDto[]; }> { @@ -86,8 +88,8 @@ export class HomeController { const reconsiderations = await this.reconsiderationService.getBy(assignedFindOptions); - // const planningReviews = - // await this.planningReviewService.getBy(assignedFindOptions); + const planningReviews = + await this.planningReferralService.getBy(assignedFindOptions); const modifications = await this.modificationService.getBy(assignedFindOptions); @@ -111,7 +113,8 @@ export class HomeController { applications: await this.applicationService.mapToDtos(applications), reconsiderations: await this.reconsiderationService.mapToDtos(reconsiderations), - planningReferrals: [], + planningReferrals: + await this.planningReferralService.mapToDtos(planningReviews), modifications: await this.modificationService.mapToDtos(modifications), notifications: await this.notificationService.mapToDtos(notifications), }; @@ -145,13 +148,13 @@ export class HomeController { ); const reconSubtasks = this.mapReconToDto(reconsiderationWithSubtasks); - // const planningReviewsWithSubtasks = - // await this.planningReviewService.getWithIncompleteSubtaskByType( - // subtaskType, - // ); - // const planningReviewSubtasks = this.mapPlanningReviewsToDtos( - // planningReviewsWithSubtasks, - // ); + const planningReferralsWithSubtasks = + await this.planningReferralService.getWithIncompleteSubtaskByType( + subtaskType, + ); + const planningReferralSubtasks = this.mapPlanningReferralsToDtos( + planningReferralsWithSubtasks, + ); const modificationsWithSubtasks = await this.modificationService.getWithIncompleteSubtaskByType( @@ -191,6 +194,7 @@ export class HomeController { ...reconSubtasks, ...modificationSubtasks, ...noiModificationsSubtasks, + ...planningReferralSubtasks, ...notificationSubtasks, ]; } @@ -251,24 +255,24 @@ export class HomeController { return result; } - private mapPlanningReviewsToDtos(planingReviews: PlanningReview[]) { + private mapPlanningReferralsToDtos(planningReferrals: PlanningReferral[]) { const result: HomepageSubtaskDTO[] = []; - // TODO - // for (const planningReview of planingReviews) { - // for (const subtask of planningReview.card.subtasks) { - // result.push({ - // type: subtask.type, - // createdAt: subtask.createdAt.getTime(), - // assignee: this.mapper.map(subtask.assignee, User, AssigneeDto), - // uuid: subtask.uuid, - // card: this.mapper.map(planningReview.card, Card, CardDto), - // completedAt: subtask.completedAt?.getTime(), - // paused: false, - // title: `${planningReview.fileNumber} (${planningReview.type})`, - // parentType: PARENT_TYPE.PLANNING_REVIEW, - // }); - // } - // } + for (const planningReferral of planningReferrals) { + for (const subtask of planningReferral.card.subtasks) { + result.push({ + type: subtask.type, + createdAt: subtask.createdAt.getTime(), + assignee: this.mapper.map(subtask.assignee, User, AssigneeDto), + uuid: subtask.uuid, + card: this.mapper.map(planningReferral.card, Card, CardDto), + completedAt: subtask.completedAt?.getTime(), + paused: false, + title: `${planningReferral.planningReview.fileNumber} (${planningReferral.planningReview.documentName})`, + parentType: PARENT_TYPE.PLANNING_REVIEW, + appType: planningReferral.planningReview.type, + }); + } + } return result; } diff --git a/services/apps/alcs/src/alcs/planning-review/planning-referral/planning-referral.service.ts b/services/apps/alcs/src/alcs/planning-review/planning-referral/planning-referral.service.ts index da903ebb1c..39faeca8d7 100644 --- a/services/apps/alcs/src/alcs/planning-review/planning-referral/planning-referral.service.ts +++ b/services/apps/alcs/src/alcs/planning-review/planning-referral/planning-referral.service.ts @@ -2,10 +2,18 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Mapper } from 'automapper-core'; import { InjectMapper } from 'automapper-nestjs'; -import { FindOptionsRelations, IsNull, Not, Repository } from 'typeorm'; +import { + FindOptions, + FindOptionsRelations, + FindOptionsWhere, + IsNull, + Not, + Repository, +} from 'typeorm'; import { formatIncomingDate } from '../../../utils/incoming-date.formatter'; import { filterUndefined } from '../../../utils/undefined'; import { Board } from '../../board/board.entity'; +import { CARD_SUBTASK_TYPE } from '../../card/card-subtask/card-subtask.dto'; import { CARD_TYPE } from '../../card/card-type/card-type.entity'; import { CardService } from '../../card/card.service'; import { @@ -33,6 +41,7 @@ export class PlanningReferralService { type: true, status: true, board: true, + assignee: true, }, planningReview: { localGovernment: true, @@ -150,4 +159,38 @@ export class PlanningReferralService { await this.referralRepository.softRemove(existingReferral); } + + async getBy(assignedFindOptions: FindOptionsWhere) { + return this.referralRepository.find({ + where: assignedFindOptions, + relations: this.DEFAULT_RELATIONS, + }); + } + + async getWithIncompleteSubtaskByType(subtaskType: CARD_SUBTASK_TYPE) { + return this.referralRepository.find({ + where: { + card: { + subtasks: { + completedAt: IsNull(), + type: { + code: subtaskType, + }, + }, + }, + }, + relations: { + planningReview: { + type: true, + localGovernment: true, + }, + card: { + status: true, + board: true, + type: true, + subtasks: { type: true, assignee: true }, + }, + }, + }); + } } diff --git a/services/apps/alcs/src/alcs/planning-review/planning-review.service.ts b/services/apps/alcs/src/alcs/planning-review/planning-review.service.ts index 109fde16f2..4f93794003 100644 --- a/services/apps/alcs/src/alcs/planning-review/planning-review.service.ts +++ b/services/apps/alcs/src/alcs/planning-review/planning-review.service.ts @@ -101,7 +101,12 @@ export class PlanningReviewService { }, relations: { ...this.DEFAULT_RELATIONS, - referrals: true, + referrals: { + card: { + board: true, + type: true, + }, + }, }, order: { referrals: {