Skip to content

Commit

Permalink
Merge branch 'golden-eagle' into feat/CE-236-Standardization-of-Offic…
Browse files Browse the repository at this point in the history
…er-Name-Fields
  • Loading branch information
afwilcox authored Jul 5, 2024
2 parents dc71d45 + 9bafebb commit 3efe188
Show file tree
Hide file tree
Showing 21 changed files with 180 additions and 141 deletions.
16 changes: 2 additions & 14 deletions backend/db/migrations/R__reset-complaint-templates.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
--
-- Reset the CDOGS template hashes every time the database scripts run
-- this is to make sure that the most up to date template is used
--
UPDATE "configuration"
SET
configuration_value = ''
WHERE
configuration_code = 'HWCTMPLATE';

UPDATE "configuration"
SET
configuration_value = ''
WHERE
configuration_code = 'ERSTMPLATE';
-- Not Required
--
5 changes: 5 additions & 0 deletions backend/db/migrations/V0.22.1__CE-787.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
UPDATE "configuration"
SET
configuration_value = ''
WHERE
configuration_code = 'ERSTMPLATE';
41 changes: 21 additions & 20 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"date-fns": "^3.6.0",
"date-fns-tz": "^3.1.3",
"dotenv": "^16.0.1",
"escape-html": "^1.0.3",
"form-data": "^4.0.0",
"geojson": "^0.5.0",
"jest-mock": "^29.6.1",
Expand Down
14 changes: 12 additions & 2 deletions backend/src/middleware/maps/automapper-entity-to-dto-maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,12 @@ export const mapWildlifeReport = (mapper: Mapper, tz: string = "America/Vancouve
),
forMember(
(destination) => destination.reportedOn,
mapFrom((source) => source.complaint_identifier.incident_reported_utc_timestmp),
mapFrom((source) => {
const {
complaint_identifier: { incident_reported_utc_timestmp: reported },
} = source;
return reported || "";
}),
),
forMember(
(destination) => destination.updatedOn,
Expand Down Expand Up @@ -1162,7 +1167,12 @@ export const mapAllegationReport = (mapper: Mapper, tz: string = "America/Vancou
),
forMember(
(destination) => destination.reportedOn,
mapFrom((source) => source.complaint_identifier.incident_reported_utc_timestmp),
mapFrom((source) => {
const {
complaint_identifier: { incident_reported_utc_timestmp: reported },
} = source;
return reported || "";
}),
),
forMember(
(destination) => destination.updatedOn,
Expand Down
7 changes: 6 additions & 1 deletion backend/src/v1/complaint/complaint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export class ComplaintService {
case "violation_code":
case "in_progress_ind":
return "allegation";
case "area_name":
return "cos_organization";
case "complaint_identifier":
default:
return "complaint";
Expand Down Expand Up @@ -1439,7 +1441,10 @@ export class ComplaintService {

data.reportedOn = _applyTimezone(data.reportedOn, tz, "datetime");
data.updatedOn = _applyTimezone(data.updatedOn, tz, "datetime");
if (data?.incidentDateTime) {

//-- incidentDateTime may not be set, if there's no date
//-- don't try and apply the incident date
if (data.incidentDateTime) {
data.incidentDateTime = _applyTimezone(data.incidentDateTime, tz, "datetime");
}

Expand Down
5 changes: 2 additions & 3 deletions backend/src/v1/document/document.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Roles } from "../../auth/decorators/roles.decorator";
import { Token } from "../../auth/decorators/token.decorator";
import { COMPLAINT_TYPE } from "../../types/models/complaints/complaint-type";
import { format } from "date-fns";
import { escape } from "escape-html";

@UseGuards(JwtRoleGuard)
@ApiTags("document")
Expand All @@ -27,8 +28,6 @@ export class DocumentController {
@Res() res: Response,
): Promise<void> {
try {
this.logger.debug("TIMEZONE: ", tz);

const fileName = `Complaint-${id}-${type}-${format(new Date(), "yyyy-MM-dd")}.pdf`;
const response = await this.service.exportComplaint(id, type, fileName, tz);

Expand All @@ -47,7 +46,7 @@ export class DocumentController {
res.end(buffer);
} catch (error) {
this.logger.error(`exception: unable to export document for complaint: ${id} - error: ${error}`);
res.status(500).send(`exception: unable to export document for complaint: ${id} - error: ${error}`);
res.status(500).send(`exception: unable to export document for complaint: ${escape(id)}`);
}
}
}
Binary file modified backend/templates/complaint/CDOGS-ERS-COMPLAINT-TEMPLATE-v1.docx
Binary file not shown.
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/allegation-details-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ describe("Complaint Edit Page spec - Edit Allegation View", () => {

// Reffered by / Complaint Agency
cy.get("#reported-pair-id label").should(($label) => {
expect($label).to.contain.text("Reporting Organization");
expect($label).to.contain.text("Organization Reporting the Complaint");
});
cy.get("#reported-pair-id input").should("exist");

Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/hwcr-details-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ describe("Complaint Edit Page spec - Edit View", () => {

// Reffered by / Complaint Agency
cy.get("#reported-pair-id label").should(($label) => {
expect($label).to.contain.text("Reporting Organization");
expect($label).to.contain.text("Organization Reporting the Complaint");
});
cy.get("#reported-pair-id input").should("exist");
});
Expand Down
38 changes: 19 additions & 19 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions frontend/src/app/components/common/comp-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Props = {
value?: Option | null;
onChange?: (selectedOption: Option | null) => void;
isDisabled?: boolean;
isClearable?: boolean;
};

export const CompSelect: FC<Props> = ({
Expand All @@ -30,6 +31,7 @@ export const CompSelect: FC<Props> = ({
classNamePrefix,
errorMessage,
isDisabled,
isClearable,
}) => {
let styles: StylesConfig = {};

Expand All @@ -46,6 +48,27 @@ export const CompSelect: FC<Props> = ({
...provided,
color: state.label === "None" || state.label === "Unassigned" ? "#a1a1a1" : "black",
}),
//custom style for clear btn to match with DatePicker's clear btn
clearIndicator: (defaultStyles: any) => {
return {
...defaultStyles,
background: "#216ba5",
borderRadius: "50%",
color: "#fff",
cursor: "pointer",
maxHeight: "20px",
maxWidth: "20px",
padding: "2px",
marginRight: "6px",
svg: {
width: "12px",
height: "12px",
},
"&:hover": {
color: "#fff",
},
};
},
};

//-- pass through the onChange event
Expand All @@ -71,6 +94,7 @@ export const CompSelect: FC<Props> = ({
isDisabled={isDisabled}
menuPlacement="auto"
menuPosition="fixed"
isClearable={isClearable ?? false}
/>
{enableValidation && <div className="error-message">{errorMessage}</div>}
</div>
Expand Down
Loading

0 comments on commit 3efe188

Please sign in to comment.