From d5cbc2aba01c94863b69623d8b96e4908a3cca09 Mon Sep 17 00:00:00 2001 From: Emily Jablonski <65367387+emilyjablonski@users.noreply.github.com> Date: Wed, 22 May 2024 12:40:56 -0600 Subject: [PATCH] feat: filter flagged duplicate sets (#4097) --- .../afs-query-params.dto.ts | 13 +- .../application-flagged-set.service.ts | 25 +++ .../application-flagged-set.service.spec.ts | 41 +++++ shared-helpers/src/types/backend-swagger.ts | 6 + sites/partners/__tests__/lib/helpers.test.ts | 26 +++ .../locale_overrides/general.json | 3 +- .../applications/ApplicationsColDefs.ts | 172 +++++++++--------- .../sections/DetailsApplicationData.tsx | 2 +- sites/partners/src/lib/helpers.ts | 13 +- sites/partners/src/lib/hooks.ts | 9 + .../application/[id]/applicationsCols.tsx | 3 +- sites/partners/src/pages/index.tsx | 6 +- .../[id]/applications/pending/index.tsx | 23 +-- .../[id]/applications/resolved/index.tsx | 35 ++-- 14 files changed, 247 insertions(+), 130 deletions(-) create mode 100644 sites/partners/__tests__/lib/helpers.test.ts diff --git a/api/src/dtos/application-flagged-sets/afs-query-params.dto.ts b/api/src/dtos/application-flagged-sets/afs-query-params.dto.ts index a741219648..59279bf445 100644 --- a/api/src/dtos/application-flagged-sets/afs-query-params.dto.ts +++ b/api/src/dtos/application-flagged-sets/afs-query-params.dto.ts @@ -1,6 +1,6 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { Expose } from 'class-transformer'; -import { IsEnum, IsUUID } from 'class-validator'; +import { IsEnum, IsUUID, IsString, MinLength } from 'class-validator'; import { View } from '../../enums/application-flagged-sets/view'; import { ValidationsGroupsEnum } from '../../enums/shared/validation-groups-enum'; import { PaginationAllowsAllQueryParams } from '../shared/pagination.dto'; @@ -19,4 +19,15 @@ export class AfsQueryParams extends PaginationAllowsAllQueryParams { }) @IsEnum(View, { groups: [ValidationsGroupsEnum.default] }) view?: View; + + @Expose() + @ApiPropertyOptional({ + example: 'search', + }) + @IsString({ groups: [ValidationsGroupsEnum.default] }) + @MinLength(3, { + message: 'Search must be at least 3 characters', + groups: [ValidationsGroupsEnum.default], + }) + search?: string; } diff --git a/api/src/services/application-flagged-set.service.ts b/api/src/services/application-flagged-set.service.ts index 2ba499c2f4..4e234aa998 100644 --- a/api/src/services/application-flagged-set.service.ts +++ b/api/src/services/application-flagged-set.service.ts @@ -156,6 +156,31 @@ export class ApplicationFlaggedSetService implements OnModuleInit { } } + if (params.search) { + filters.push({ + applications: { + some: { + applicant: { + OR: [ + { + firstName: { + contains: params.search, + mode: Prisma.QueryMode.insensitive, + }, + }, + { + lastName: { + contains: params.search, + mode: Prisma.QueryMode.insensitive, + }, + }, + ], + }, + }, + }, + }); + } + return { AND: filters, }; diff --git a/api/test/unit/services/application-flagged-set.service.spec.ts b/api/test/unit/services/application-flagged-set.service.spec.ts index ae84b1593a..e293d1538d 100644 --- a/api/test/unit/services/application-flagged-set.service.spec.ts +++ b/api/test/unit/services/application-flagged-set.service.spec.ts @@ -221,6 +221,47 @@ describe('Testing application flagged set service', () => { }); }); + it('should build where clause with listingId and view of pending with search', async () => { + expect( + await service.buildWhere({ + listingId: 'example id', + view: View.pending, + search: 'simple search', + }), + ).toEqual({ + AND: [ + { + listingId: 'example id', + }, + { + status: FlaggedSetStatusEnum.pending, + }, + { + applications: { + some: { + applicant: { + OR: [ + { + firstName: { + contains: 'simple search', + mode: 'insensitive', + }, + }, + { + lastName: { + contains: 'simple search', + mode: 'insensitive', + }, + }, + ], + }, + }, + }, + }, + ], + }); + }); + it('should build where clause with listingId and view of pendingNameAndDoB', async () => { expect( await service.buildWhere({ diff --git a/shared-helpers/src/types/backend-swagger.ts b/shared-helpers/src/types/backend-swagger.ts index c2478fdf73..414710ef3c 100644 --- a/shared-helpers/src/types/backend-swagger.ts +++ b/shared-helpers/src/types/backend-swagger.ts @@ -382,6 +382,8 @@ export class ApplicationFlaggedSetsService { listingId: string /** */ view?: AfsView + /** */ + search?: string } = {} as any, options: IRequestOptions = {} ): Promise { @@ -394,6 +396,7 @@ export class ApplicationFlaggedSetsService { limit: params["limit"], listingId: params["listingId"], view: params["view"], + search: params["search"], } /** 适配ios13,get请求不允许带body */ @@ -414,6 +417,8 @@ export class ApplicationFlaggedSetsService { listingId: string /** */ view?: AfsView + /** */ + search?: string } = {} as any, options: IRequestOptions = {} ): Promise { @@ -426,6 +431,7 @@ export class ApplicationFlaggedSetsService { limit: params["limit"], listingId: params["listingId"], view: params["view"], + search: params["search"], } /** 适配ios13,get请求不允许带body */ diff --git a/sites/partners/__tests__/lib/helpers.test.ts b/sites/partners/__tests__/lib/helpers.test.ts new file mode 100644 index 0000000000..c72fb0e696 --- /dev/null +++ b/sites/partners/__tests__/lib/helpers.test.ts @@ -0,0 +1,26 @@ +import { Application } from "@bloom-housing/shared-helpers/src/types/backend-swagger" +import { mergeApplicationNames } from "../../src/lib/helpers" + +describe("helpers", () => { + describe("mergeApplicationNames", () => { + it("should merge names for one application", () => { + expect( + mergeApplicationNames([ + { applicant: { firstName: "FirstA", lastName: "LastA" } } as Application, + ]) + ).toEqual("FirstA LastA") + }) + it("should merge names for multiple applications", () => { + expect( + mergeApplicationNames([ + { applicant: { firstName: "FirstA", lastName: "LastA" } } as Application, + { applicant: { firstName: "FirstB", lastName: "LastB" } } as Application, + { applicant: { firstName: "FirstC", lastName: "LastC" } } as Application, + ]) + ).toEqual("FirstA LastA, FirstB LastB, FirstC LastC") + }) + it("should merge names for no application", () => { + expect(mergeApplicationNames([])).toEqual("") + }) + }) +}) diff --git a/sites/partners/page_content/locale_overrides/general.json b/sites/partners/page_content/locale_overrides/general.json index df139e8ba3..8c6b55064b 100644 --- a/sites/partners/page_content/locale_overrides/general.json +++ b/sites/partners/page_content/locale_overrides/general.json @@ -33,7 +33,7 @@ "application.details.householdSize": "Household Size", "application.details.language": "Application Language", "application.details.monthlyIncome": "Monthly Income", - "application.details.number": "Application Number", + "application.details.number": "Confirmation Code", "application.details.preferences": "Application Preferences", "application.details.preferredContact": "Preferred Contact", "application.details.preferredUnitSizes": "Preferred Unit Sizes", @@ -69,6 +69,7 @@ "applications.pendingReview": "Pending Review", "applications.scanForDuplicates": "Scan for duplicates", "applications.table.additionalPhoneType": "Additional Phone Type", + "applications.table.additionalPhoneTypeShortened": "Addtl. Phone Type", "applications.table.altContactAgency": "Alt Contact Agency", "applications.table.altContactCity": "Alt Contact City", "applications.table.altContactEmail": "Alt Contact Email", diff --git a/sites/partners/src/components/applications/ApplicationsColDefs.ts b/sites/partners/src/components/applications/ApplicationsColDefs.ts index 15dc067380..2454599df5 100644 --- a/sites/partners/src/components/applications/ApplicationsColDefs.ts +++ b/sites/partners/src/components/applications/ApplicationsColDefs.ts @@ -2,10 +2,7 @@ import { t, formatYesNoLabel } from "@bloom-housing/ui-components" import { convertDataToLocal, formatIncome } from "../../lib/helpers" import dayjs from "dayjs" import customParseFormat from "dayjs/plugin/customParseFormat" -import { - ApplicationSubmissionTypeEnum, - IncomePeriodEnum, -} from "@bloom-housing/shared-helpers/src/types/backend-swagger" +import { IncomePeriodEnum } from "@bloom-housing/shared-helpers/src/types/backend-swagger" dayjs.extend(customParseFormat) function compareDates(a, b, node, nextNode, isInverted) { @@ -45,8 +42,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: true, unSortIcon: true, filter: false, - width: 200, - minWidth: 150, + width: 220, + minWidth: 50, sort: "asc", valueGetter: ({ data }) => { if (!data?.submissionDate) return "" @@ -64,8 +61,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "confirmationCode", sortable: false, filter: false, - width: 150, - minWidth: 120, + width: 140, + minWidth: 50, cellRenderer: "formatLinkCell", }, { @@ -74,8 +71,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, unSortIcon: true, filter: false, - width: 150, - minWidth: 120, + width: 125, + minWidth: 50, valueFormatter: ({ value }) => t(`application.details.submissionType.${value}`), comparator: compareStrings, }, @@ -87,7 +84,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { unSortIcon: true, filter: false, width: 125, - minWidth: 100, + minWidth: 50, comparator: compareStrings, }, { @@ -98,7 +95,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { unSortIcon: true, filter: "agTextColumnFilter", width: 125, - minWidth: 100, + minWidth: 50, comparator: compareStrings, }, { @@ -107,8 +104,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, unSortIcon: true, filter: false, - width: 140, - minWidth: 140, + width: 120, + minWidth: 50, type: "rightAligned", }, { @@ -117,8 +114,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, unSortIcon: true, filter: false, - width: 180, - minWidth: 150, + width: 110, + minWidth: 50, type: "rightAligned", valueGetter: (row) => { if (!row?.data?.income || !row?.data?.incomePeriod) return "" @@ -137,8 +134,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, unSortIcon: true, filter: false, - width: 180, - minWidth: 150, + width: 110, + minWidth: 50, type: "rightAligned", valueGetter: (row) => { if (!row?.data?.income || !row?.data?.incomePeriod) return "" @@ -157,8 +154,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, unSortIcon: true, filter: false, - width: 120, - minWidth: 100, + width: 100, + minWidth: 50, valueFormatter: (data) => { if (!data.value) return "" @@ -172,8 +169,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, unSortIcon: true, filter: true, - width: 120, - minWidth: 100, + width: 110, + minWidth: 50, valueGetter: (row) => { if (!row?.data?.accessibility) return "" @@ -196,8 +193,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, unSortIcon: true, filter: true, - width: 150, - minWidth: 100, + width: 180, + minWidth: 50, valueGetter: (row) => { if (!row?.data?.preferences) return "" @@ -219,8 +216,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "applicant", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 125, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" @@ -234,8 +231,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "applicant.emailAddress", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 250, + minWidth: 50, }, { headerName: t("t.phone"), @@ -243,15 +240,15 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, filter: false, width: 150, - minWidth: 100, + minWidth: 50, }, { headerName: t("applications.table.phoneType"), field: "applicant.phoneNumberType", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 90, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" return t(`application.contact.phoneNumberTypes.${value}`) @@ -263,19 +260,19 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, filter: false, width: 150, - minWidth: 100, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" return value ? value : t("t.none") }, }, { - headerName: t("applications.table.additionalPhoneType"), + headerName: t("applications.table.additionalPhoneTypeShortened"), field: "additionalPhoneNumberType", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 90, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" return value ? t(`application.contact.phoneNumberTypes.${value}`) : t("t.none") @@ -286,40 +283,40 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "applicant.applicantAddress.street", sortable: false, filter: false, - width: 175, - minWidth: 150, + width: 250, + minWidth: 50, }, { headerName: t("applications.table.residenceCity"), field: "applicant.applicantAddress.city", sortable: false, filter: false, - width: 150, - minWidth: 120, + width: 120, + minWidth: 50, }, { headerName: t("applications.table.residenceState"), field: "applicant.applicantAddress.state", sortable: false, filter: false, - width: 120, - minWidth: 100, + width: 110, + minWidth: 50, }, { headerName: t("applications.table.residenceZip"), field: "applicant.applicantAddress.zipCode", sortable: false, filter: false, - width: 120, - minWidth: 100, + width: 110, + minWidth: 50, }, { headerName: t("applications.table.mailingStreet"), field: "applicationsMailingAddress.street", sortable: false, filter: false, - width: 175, - minWidth: 150, + width: 250, + minWidth: 50, valueFormatter: function ({ data, value }) { if (!value) return "" return `${data.sendMailToMailingAddress ? value : data.applicant.applicantAddress.street}` @@ -330,8 +327,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "applicationsMailingAddress.city", sortable: false, filter: false, - width: 150, - minWidth: 120, + width: 120, + minWidth: 50, valueFormatter: function ({ data, value }) { if (!value) return "" @@ -343,8 +340,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "applicationsMailingAddress.state", sortable: false, filter: false, - width: 120, - minWidth: 100, + width: 110, + minWidth: 50, valueFormatter: function ({ data, value }) { if (!value) return "" @@ -356,8 +353,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "applicationsMailingAddress.zipCode", sortable: false, filter: false, - width: 120, - minWidth: 100, + width: 110, + minWidth: 50, valueFormatter: function ({ data, value }) { if (!value) return "" @@ -369,32 +366,32 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "applicant.applicantWorkAddress.street", sortable: false, filter: false, - width: 175, - minWidth: 150, + width: 250, + minWidth: 50, }, { headerName: t("applications.table.workCity"), field: "applicant.applicantWorkAddress.city", sortable: false, filter: false, - width: 150, - minWidth: 120, + width: 120, + minWidth: 50, }, { headerName: t("applications.table.workState"), field: "applicant.applicantWorkAddress.state", sortable: false, filter: false, - width: 120, - minWidth: 100, + width: 110, + minWidth: 50, }, { headerName: t("applications.table.workZip"), field: "applicant.applicantWorkAddress.zipCode", sortable: false, filter: false, - width: 120, - minWidth: 100, + width: 110, + minWidth: 50, }, { headerName: t("applications.table.altContactFirstName"), @@ -402,7 +399,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, filter: false, width: 125, - minWidth: 100, + minWidth: 50, }, { headerName: t("applications.table.altContactLastName"), @@ -410,15 +407,15 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, filter: false, width: 125, - minWidth: 100, + minWidth: 50, }, { headerName: t("applications.table.altContactRelationship"), field: "alternateContact.type", sortable: false, filter: false, - width: 132, - minWidth: 132, + width: 135, + minWidth: 50, valueFormatter: ({ data, value }) => { if (!value) return "" @@ -433,7 +430,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, filter: false, width: 125, - minWidth: 100, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" return value?.length ? value : t("t.none") @@ -444,8 +441,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "alternateContact.emailAddress", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 250, + minWidth: 50, }, { headerName: t("applications.table.altContactPhone"), @@ -461,32 +458,32 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "alternateContact.address.street", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 250, + minWidth: 50, }, { headerName: t("applications.table.altContactCity"), field: "alternateContact.address.city", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 120, + minWidth: 50, }, { headerName: t("applications.table.altContactState"), field: "alternateContact.address.state", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 110, + minWidth: 50, }, { headerName: t("applications.table.altContactZip"), field: "alternateContact.address.zipCode", sortable: false, filter: false, - width: 150, - minWidth: 100, + width: 110, + minWidth: 50, }, ] @@ -502,7 +499,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, filter: false, width: 125, - minWidth: 100, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" @@ -515,7 +512,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, filter: false, width: 125, - minWidth: 100, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" @@ -528,7 +525,7 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { sortable: false, filter: false, width: 125, - minWidth: 100, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" @@ -544,11 +541,10 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "householdMember", sortable: false, filter: false, - width: 132, - minWidth: 132, + width: 135, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" - return value[i]?.relationship ? t(`application.form.options.relationship.${value[i].relationship}`) : "" @@ -559,8 +555,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "householdMember", sortable: false, filter: false, - width: 125, - minWidth: 100, + width: 115, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" return formatYesNoLabel(value[i]?.sameAddress) @@ -571,8 +567,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "householdMember", sortable: false, filter: false, - width: 125, - minWidth: 100, + width: 90, + minWidth: 50, valueFormatter: ({ value }) => { if (!value) return "" return formatYesNoLabel(value[i]?.workInRegion) @@ -587,8 +583,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "flagged", sortable: false, filter: false, - width: 125, - minWidth: 100, + width: 110, + minWidth: 50, valueFormatter: ({ value }) => { return formatYesNoLabel(value) }, @@ -598,8 +594,8 @@ export function getColDefs(maxHouseholdSize: number, countyCode: string) { field: "markedAsDuplicate", sortable: false, filter: false, - width: 125, - minWidth: 100, + width: 110, + minWidth: 50, valueFormatter: ({ value }) => { return formatYesNoLabel(value) }, diff --git a/sites/partners/src/components/applications/PaperApplicationDetails/sections/DetailsApplicationData.tsx b/sites/partners/src/components/applications/PaperApplicationDetails/sections/DetailsApplicationData.tsx index a3c29b855b..ca29d7d04e 100644 --- a/sites/partners/src/components/applications/PaperApplicationDetails/sections/DetailsApplicationData.tsx +++ b/sites/partners/src/components/applications/PaperApplicationDetails/sections/DetailsApplicationData.tsx @@ -18,7 +18,7 @@ const DetailsApplicationData = () => { - {application.confirmationCode || application.id} + {application.confirmationCode ?? t("t.n/a")} {application.submissionType && ( diff --git a/sites/partners/src/lib/helpers.ts b/sites/partners/src/lib/helpers.ts index 74727862eb..f33fdfe4ee 100644 --- a/sites/partners/src/lib/helpers.ts +++ b/sites/partners/src/lib/helpers.ts @@ -15,7 +15,7 @@ dayjs.extend(customParseFormat) import { TempUnit } from "./listings/formTypes" import { FieldError } from "react-hook-form" import { - ApplicationSubmissionTypeEnum, + Application, AssetsService, IncomePeriodEnum, } from "@bloom-housing/shared-helpers/src/types/backend-swagger" @@ -288,3 +288,14 @@ export const fieldHasError = (errorObj: FieldError) => { export const fieldMessage = (errorObj: FieldError) => { return errorObj?.message } + +export const mergeApplicationNames = (applications: Application[]) => { + if (!applications?.length) return "" + + const names = applications.reduce((acc, curr) => { + acc.push(`${curr.applicant.firstName} ${curr.applicant.lastName}`) + return acc + }, []) + + return `${names.join(", ")}` +} diff --git a/sites/partners/src/lib/hooks.ts b/sites/partners/src/lib/hooks.ts index 78b7530055..14a6c6abad 100644 --- a/sites/partners/src/lib/hooks.ts +++ b/sites/partners/src/lib/hooks.ts @@ -37,6 +37,7 @@ interface UseSingleApplicationDataProps extends PaginationProps { interface UseSingleFlaggedApplicationDataProps extends UseSingleApplicationDataProps { view?: string limit: number + search?: string } type UseUserListProps = PaginationProps & { @@ -182,6 +183,7 @@ export function useFlaggedApplicationsList({ page, limit, view, + search = "", }: UseSingleFlaggedApplicationDataProps) { const { applicationFlaggedSetsService } = useContext(AuthContext) @@ -189,12 +191,19 @@ export function useFlaggedApplicationsList({ listingId, page, limit, + search, } if (view) { Object.assign(params, { view }) } + if (search?.length < 3) { + delete params.search + } else { + Object.assign(params, { search }) + } + const paramString = qs.stringify(params) const endpoint = `/api/adapter/applicationFlaggedSets?${paramString}` diff --git a/sites/partners/src/pages/application/[id]/applicationsCols.tsx b/sites/partners/src/pages/application/[id]/applicationsCols.tsx index 0a99daf799..0eead6162f 100644 --- a/sites/partners/src/pages/application/[id]/applicationsCols.tsx +++ b/sites/partners/src/pages/application/[id]/applicationsCols.tsx @@ -18,13 +18,12 @@ export const getCols = () => [ if (!data?.id && !data?.confirmationCode) return "" return ( - {data.confirmationCode || data.id} + {data.confirmationCode ?? t("t.n/a")} ) }, width: 180, }, - { headerName: t("application.name.firstName"), field: "applicant.firstName", diff --git a/sites/partners/src/pages/index.tsx b/sites/partners/src/pages/index.tsx index 4fd3a042da..16fb16caa2 100644 --- a/sites/partners/src/pages/index.tsx +++ b/sites/partners/src/pages/index.tsx @@ -82,7 +82,7 @@ export default function ListingsList() { filter: false, resizable: true, cellRenderer: "ListingsLink", - minWidth: 200, + minWidth: 250, flex: 1, }, { @@ -97,6 +97,7 @@ export default function ListingsList() { resizable: true, valueFormatter: ({ value }) => t(`listings.listingStatus.${value}`), cellRenderer: "ApplicationsLink", + minWidth: 180, }, { headerName: t("listings.applicationDeadline"), @@ -105,6 +106,7 @@ export default function ListingsList() { filter: false, resizable: true, valueFormatter: ({ value }) => (value ? dayjs(value).format("MM/DD/YYYY") : t("t.none")), + minWidth: 130, }, { headerName: t("listings.availableUnits"), @@ -112,6 +114,7 @@ export default function ListingsList() { sortable: false, filter: false, resizable: true, + minWidth: 110, }, { headerName: t("listings.waitlist.open"), @@ -120,6 +123,7 @@ export default function ListingsList() { filter: false, resizable: true, cellRenderer: "formatWaitlistStatus", + minWidth: 100, }, ] return columns diff --git a/sites/partners/src/pages/listings/[id]/applications/pending/index.tsx b/sites/partners/src/pages/listings/[id]/applications/pending/index.tsx index 254ba52575..f78af74008 100644 --- a/sites/partners/src/pages/listings/[id]/applications/pending/index.tsx +++ b/sites/partners/src/pages/listings/[id]/applications/pending/index.tsx @@ -12,12 +12,13 @@ import { BreadcrumbLink, AlertBox, } from "@bloom-housing/ui-components" +import { formatDateTime } from "@bloom-housing/shared-helpers" import { useSingleListingData, useFlaggedApplicationsList } from "../../../../../lib/hooks" import { ListingStatusBar } from "../../../../../components/listings/ListingStatusBar" import Layout from "../../../../../layouts" import { ApplicationsSideNav } from "../../../../../components/applications/ApplicationsSideNav" -import { formatDateTime } from "@bloom-housing/shared-helpers" import { NavigationHeader } from "../../../../../components/shared/NavigationHeader" +import { mergeApplicationNames } from "../../../../../lib/helpers" const ApplicationsList = () => { const router = useRouter() @@ -42,6 +43,7 @@ const ApplicationsList = () => { page: tableOptions.pagination.currentPage, limit: tableOptions.pagination.itemsPerPage, view, + search: tableOptions.filter.filterValue, }) const columns = [ @@ -50,28 +52,17 @@ const ApplicationsList = () => { field: "id", cellRenderer: "formatLinkCell", valueGetter: ({ data }) => { - if (!data?.applications?.length) return "" - const applicant = data.applications[0]?.applicant - - return `${applicant.firstName} ${applicant.lastName}: ${data.rule}` + return mergeApplicationNames(data.applications) }, flex: 1, minWidth: 250, }, - { - headerName: t("applications.duplicates.primaryApplicant"), - field: "", - valueGetter: ({ data }) => { - if (!data?.applications?.length) return "" - const applicant = data.applications[0]?.applicant - return `${applicant.firstName} ${applicant.lastName}` - }, - }, { headerName: t("t.rule"), field: "rule", - width: 150, + width: 130, + minWidth: 50, }, { headerName: t("applications.pendingReview"), @@ -81,6 +72,7 @@ const ApplicationsList = () => { }, type: "rightAligned", width: 100, + minWidth: 50, }, ] @@ -200,7 +192,6 @@ const ApplicationsList = () => { }} search={{ setSearch: tableOptions.filter.setFilterValue, - showSearch: false, }} sort={{ setSort: tableOptions.sort.setSortOptions, diff --git a/sites/partners/src/pages/listings/[id]/applications/resolved/index.tsx b/sites/partners/src/pages/listings/[id]/applications/resolved/index.tsx index 8b9418e29e..b2470d25c6 100644 --- a/sites/partners/src/pages/listings/[id]/applications/resolved/index.tsx +++ b/sites/partners/src/pages/listings/[id]/applications/resolved/index.tsx @@ -2,16 +2,18 @@ import React from "react" import { useRouter } from "next/router" import Head from "next/head" import { AgTable, t, useAgTable, Breadcrumbs, BreadcrumbLink } from "@bloom-housing/ui-components" +import { + Application, + ApplicationReviewStatusEnum, +} from "@bloom-housing/shared-helpers/src/types/backend-swagger" import { useSingleListingData, useFlaggedApplicationsList } from "../../../../../lib/hooks" import { ListingStatusBar } from "../../../../../components/listings/ListingStatusBar" import Layout from "../../../../../layouts" import { ApplicationsSideNav } from "../../../../../components/applications/ApplicationsSideNav" import { getLinkCellFormatter } from "../../../../../components/applications/helpers" import { NavigationHeader } from "../../../../../components/shared/NavigationHeader" -import { - Application, - ApplicationReviewStatusEnum, -} from "@bloom-housing/shared-helpers/src/types/backend-swagger" + +import { mergeApplicationNames } from "../../../../../lib/helpers" const ApplicationsList = () => { const router = useRouter() @@ -27,6 +29,7 @@ const ApplicationsList = () => { page: tableOptions.pagination.currentPage, limit: tableOptions.pagination.itemsPerPage, view: "resolved", + search: tableOptions.filter.filterValue, }) const columns = [ @@ -35,23 +38,16 @@ const ApplicationsList = () => { field: "id", cellRenderer: "formatLinkCell", valueGetter: ({ data }) => { - if (!data?.applications?.length) return "" - const applicant = data.applications[0]?.applicant - - return `${applicant.firstName} ${applicant.lastName}: ${data.rule}` + return mergeApplicationNames(data.applications) }, flex: 1, - minWidth: 250, + minWidth: 200, }, { - headerName: t("applications.duplicates.primaryApplicant"), - field: "", - valueGetter: ({ data }) => { - if (!data?.applications?.length) return "" - const applicant = data.applications[0]?.applicant - - return `${applicant.firstName} ${applicant.lastName}` - }, + headerName: t("t.rule"), + field: "rule", + width: 130, + minWidth: 50, }, { headerName: t("applications.duplicates.duplicateApplications"), @@ -62,7 +58,8 @@ const ApplicationsList = () => { ).length }, type: "rightAligned", - width: 130, + width: 140, + minWidth: 50, }, { headerName: t("applications.duplicates.validApplications"), @@ -74,6 +71,7 @@ const ApplicationsList = () => { }, type: "rightAligned", width: 130, + minWidth: 50, }, ] @@ -138,7 +136,6 @@ const ApplicationsList = () => { }} search={{ setSearch: tableOptions.filter.setFilterValue, - showSearch: false, }} sort={{ setSort: tableOptions.sort.setSortOptions,