From ce6d4e025b81c3dd14914fc757ef14a68b18b5ec Mon Sep 17 00:00:00 2001
From: Lewis Chen <148148914+lewischen-aot@users.noreply.github.com>
Date: Tue, 21 Jan 2025 15:28:31 -0800
Subject: [PATCH] #3313 - Content: Ministry: Accounts (#4269)

- Revised "Requests accounts" to "Pending account requests"
- Revised "Make a determination....." to "Basic BCeID account requests
that require ministry review."
- Added search input box
- Revised "Name" to "Given name"
- Added "Last name"
- Added "Date of birth"
- Organized order to align with mock up

Screenshot of the updated page

![image](https://github.com/user-attachments/assets/9f3a4255-9ea8-4ea0-9eb9-3dac15660e67)
---
 .../models/student-account-application.dto.ts        |  4 +++-
 .../student-account-application.aest.controller.ts   |  5 +++--
 .../student-account-applications.models.ts           | 12 ++++++++++++
 .../student-account-applications.service.ts          |  4 +++-
 .../http/dto/StudentAccountApplication.dto.ts        |  4 +++-
 .../aest/student/StudentAccountApplications.vue      | 12 +++++++++---
 6 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/sources/packages/backend/apps/api/src/route-controllers/student-account-applications/models/student-account-application.dto.ts b/sources/packages/backend/apps/api/src/route-controllers/student-account-applications/models/student-account-application.dto.ts
index fbac0f352c..ccb298cccd 100644
--- a/sources/packages/backend/apps/api/src/route-controllers/student-account-applications/models/student-account-application.dto.ts
+++ b/sources/packages/backend/apps/api/src/route-controllers/student-account-applications/models/student-account-application.dto.ts
@@ -11,7 +11,9 @@ export class CreateStudentAccountApplicationAPIInDTO {
 
 export class StudentAccountApplicationSummaryAPIOutDTO {
   id: number;
-  fullName: string;
+  lastName: string;
+  givenNames: string;
+  dateOfBirth: string;
   submittedDate: Date;
 }
 
diff --git a/sources/packages/backend/apps/api/src/route-controllers/student-account-applications/student-account-application.aest.controller.ts b/sources/packages/backend/apps/api/src/route-controllers/student-account-applications/student-account-application.aest.controller.ts
index c42bb7afa5..b39a8826cc 100644
--- a/sources/packages/backend/apps/api/src/route-controllers/student-account-applications/student-account-application.aest.controller.ts
+++ b/sources/packages/backend/apps/api/src/route-controllers/student-account-applications/student-account-application.aest.controller.ts
@@ -38,7 +38,6 @@ import {
   StudentAccountApplicationApprovalAPIInDTO,
   StudentAccountApplicationSummaryAPIOutDTO,
 } from "./models/student-account-application.dto";
-import { getUserFullName } from "../../utilities";
 import { CustomNamedError } from "@sims/utilities";
 import { IUserToken } from "../../auth/userToken.interface";
 import {
@@ -79,7 +78,9 @@ export class StudentAccountApplicationAESTController extends BaseController {
       await this.studentAccountApplicationsService.getPendingStudentAccountApplications();
     return accountApplications.map((accountApplication) => ({
       id: accountApplication.id,
-      fullName: getUserFullName(accountApplication.user),
+      lastName: accountApplication.user.lastName,
+      givenNames: accountApplication.user.firstName,
+      dateOfBirth: accountApplication.submittedData.dateOfBirth,
       submittedDate: accountApplication.submittedDate,
     }));
   }
diff --git a/sources/packages/backend/apps/api/src/services/student-account-applications/student-account-applications.models.ts b/sources/packages/backend/apps/api/src/services/student-account-applications/student-account-applications.models.ts
index 2ae439be96..2741e3c6f7 100644
--- a/sources/packages/backend/apps/api/src/services/student-account-applications/student-account-applications.models.ts
+++ b/sources/packages/backend/apps/api/src/services/student-account-applications/student-account-applications.models.ts
@@ -1,3 +1,4 @@
+import { User } from "@sims/sims-db";
 import { StudentInfo } from "../student/student.service.models";
 
 /**
@@ -33,3 +34,14 @@ export type StudentAccountApplicationApprovalModel = StudentInfo &
 export interface AccountApplicationSubmittedData {
   sinConsent: boolean;
 }
+
+/**
+ * Data needed to obtain a list of student account applications
+ * waiting to be assessed by the Ministry.
+ */
+export interface StudentAccountApplicationSummary {
+  id: number;
+  user: User;
+  submittedData: { dateOfBirth?: string };
+  submittedDate: Date;
+}
diff --git a/sources/packages/backend/apps/api/src/services/student-account-applications/student-account-applications.service.ts b/sources/packages/backend/apps/api/src/services/student-account-applications/student-account-applications.service.ts
index de84aacb8e..7681982835 100644
--- a/sources/packages/backend/apps/api/src/services/student-account-applications/student-account-applications.service.ts
+++ b/sources/packages/backend/apps/api/src/services/student-account-applications/student-account-applications.service.ts
@@ -9,6 +9,7 @@ import {
   AccountApplicationSubmittedData,
   StudentAccountApplicationApprovalModel,
   StudentAccountApplicationCreateModel,
+  StudentAccountApplicationSummary,
 } from "./student-account-applications.models";
 import { StudentService } from "../student/student.service";
 import { CustomNamedError } from "@sims/utilities";
@@ -49,12 +50,13 @@ export class StudentAccountApplicationsService extends RecordDataModelService<St
    * @returns list of pending student account applications.
    */
   async getPendingStudentAccountApplications(): Promise<
-    StudentAccountApplication[]
+    StudentAccountApplicationSummary[]
   > {
     return this.repo.find({
       select: {
         id: true,
         submittedDate: true,
+        submittedData: true as unknown,
         user: { firstName: true, lastName: true },
       },
       relations: {
diff --git a/sources/packages/web/src/services/http/dto/StudentAccountApplication.dto.ts b/sources/packages/web/src/services/http/dto/StudentAccountApplication.dto.ts
index 54581464ce..5d128b92c4 100644
--- a/sources/packages/web/src/services/http/dto/StudentAccountApplication.dto.ts
+++ b/sources/packages/web/src/services/http/dto/StudentAccountApplication.dto.ts
@@ -7,7 +7,9 @@ export interface CreateStudentAccountApplicationAPIInDTO {
 
 export interface StudentAccountApplicationSummaryAPIOutDTO {
   id: number;
-  fullName: string;
+  lastName: string;
+  givenNames: string;
+  dateOfBirth: string;
   submittedDate: Date;
 }
 
diff --git a/sources/packages/web/src/views/aest/student/StudentAccountApplications.vue b/sources/packages/web/src/views/aest/student/StudentAccountApplications.vue
index eda644339e..ca55863b6e 100644
--- a/sources/packages/web/src/views/aest/student/StudentAccountApplications.vue
+++ b/sources/packages/web/src/views/aest/student/StudentAccountApplications.vue
@@ -4,8 +4,8 @@
       <header-navigator title="Student requests" subTitle="Accounts" />
     </template>
     <body-header
-      title="Requested accounts"
-      subTitle="Make a determination for students requesting to login with a Basic BCeID."
+      title="Pending account requests"
+      subTitle="Basic BCeID account requests that require ministry review."
       :recordsCount="accountApplications?.length"
     >
     </body-header>
@@ -25,7 +25,13 @@
               }}</span>
             </template>
           </Column>
-          <Column header="Name" field="fullName" bodyClass="w-100"></Column>
+          <Column header="Given names" field="givenNames"></Column>
+          <Column header="Last name" field="lastName"></Column>
+          <Column header="Date of birth" headerClass="text-no-wrap"
+            ><template #body="slotProps">
+              <span>{{ dateOnlyLongString(slotProps.data.dateOfBirth) }}</span>
+            </template>
+          </Column>
           <Column header="Action">
             <template #body="slotProps">
               <v-btn