Skip to content

Commit

Permalink
Fixes to display the GIR type in the call details page.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorylavery committed Jul 17, 2024
1 parent ec46bf6 commit 3a27d13
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/src/v1/complaint/complaint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
} from "../../middleware/maps/automapper-dto-to-entity-maps";

import { ComplaintSearchParameters } from "../../types/models/complaints/complaint-search-parameters";
import { SearchResults } from "src/types/models/complaints/search-results";
import { SearchResults } from "../../types/models/complaints/search-results";
import { ComplaintFilterParameters } from "../../types/models/complaints/complaint-filter-parameters";
import { REQUEST } from "@nestjs/core";
import { getIdirFromRequest } from "../../common/get-idir-from-request";
Expand All @@ -51,7 +51,7 @@ import { DelegateDto } from "../../types/models/people/delegate";
import { PersonComplaintXrefService } from "../person_complaint_xref/person_complaint_xref.service";
import { AttractantHwcrXrefService } from "../attractant_hwcr_xref/attractant_hwcr_xref.service";
import { PersonComplaintXrefTable } from "../../types/tables/person-complaint-xref.table";
import { OfficeStats, OfficerStats, ZoneAtAGlanceStats } from "src/types/zone_at_a_glance/zone_at_a_glance_stats";
import { OfficeStats, OfficerStats, ZoneAtAGlanceStats } from "../../types/zone_at_a_glance/zone_at_a_glance_stats";
import { CosGeoOrgUnit } from "../cos_geo_org_unit/entities/cos_geo_org_unit.entity";
import { UUID, randomUUID } from "crypto";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const CallDetails: FC<ComplaintHeaderProps> = ({ complaintType }) => {
attractants,
violationInProgress,
violationObserved,
girType,
} = useAppSelector(selectComplaintDetails(complaintType)) as ComplaintDetails;

return (
Expand Down Expand Up @@ -98,6 +99,15 @@ export const CallDetails: FC<ComplaintHeaderProps> = ({ complaintType }) => {
</div>
</>
)}
{/* GIR Details */}
{complaintType === COMPLAINT_TYPES.GIR && (
<>
<div>
<dt>General Incident Type</dt>
<dd id="comp-details-general-incident-type">{girType}</dd>
</div>
</>
)}
</dl>

{/* Location Information */}
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/app/store/reducers/complaints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ export const selectComplaintDetails =
(state: RootState): ComplaintDetails => {
const {
complaints: { complaint },
codeTables: { "area-codes": areaCodes, attractant: attractantCodeTable },
codeTables: { "area-codes": areaCodes, attractant: attractantCodeTable, "gir-type": girTypeCodes },
} = state;

const getAttractants = (
Expand Down Expand Up @@ -785,6 +785,14 @@ export const selectComplaintDetails =
violationInProgress,
violationObserved,
};
} else if (complaintType === "GIR") {
const { girType: girTypeCode } = complaint as GeneralIncidentComplaintDto;
const girType = getGirTypeByGirTypeCode(girTypeCode, girTypeCodes);
result = {
...result,
girType,
girTypeCode,
};
}

const org = areaCodes.find(({ area }) => area === areaCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ export interface ComplaintDetails {
attractants?: Array<ComplaintDetailsAttractant>;
violationInProgress?: boolean;
violationObserved?: boolean;
girType?: string;
girTypeCode?: string;
}

0 comments on commit 3a27d13

Please sign in to comment.