Skip to content

Commit

Permalink
Merge branch 'golden-eagle' into bug/CE-746
Browse files Browse the repository at this point in the history
  • Loading branch information
afwilcox authored Jul 5, 2024
2 parents 52fea41 + 72e6b06 commit c4e6f7b
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 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
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)}`);
}
}
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export const ComplaintFilter: FC<Props> = ({ type }) => {
placeholder="Select"
enableValidation={false}
value={natureOfComplaint}
isClearable={true}
/>
</div>
</div>
Expand All @@ -130,6 +131,7 @@ export const ComplaintFilter: FC<Props> = ({ type }) => {
placeholder="Select"
enableValidation={false}
value={species}
isClearable={true}
/>
</div>
</div>
Expand All @@ -154,6 +156,7 @@ export const ComplaintFilter: FC<Props> = ({ type }) => {
placeholder="Select"
enableValidation={false}
value={violationType}
isClearable={true}
/>
</div>
</div>
Expand Down Expand Up @@ -237,6 +240,7 @@ export const ComplaintFilter: FC<Props> = ({ type }) => {
placeholder="Select"
enableValidation={false}
value={status}
isClearable={true}
/>
</div>
</div>
Expand Down Expand Up @@ -267,6 +271,7 @@ export const ComplaintFilter: FC<Props> = ({ type }) => {
placeholder="Select"
enableValidation={false}
value={region}
isClearable={true}
/>
</div>
</div>
Expand All @@ -287,6 +292,7 @@ export const ComplaintFilter: FC<Props> = ({ type }) => {
placeholder="Select"
enableValidation={false}
value={zone}
isClearable={true}
/>
</div>
</div>
Expand All @@ -308,6 +314,7 @@ export const ComplaintFilter: FC<Props> = ({ type }) => {
placeholder="Select"
enableValidation={false}
value={community}
isClearable={true}
/>
</div>
</div>
Expand All @@ -330,6 +337,7 @@ export const ComplaintFilter: FC<Props> = ({ type }) => {
placeholder="Select"
enableValidation={false}
value={officer}
isClearable={true}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const LeafletMapWithMultiplePoints: React.FC<MapProps> = ({ complaintType, marke
const bannerType = unmappedComplaints >= 1 ? "unmapped" : "no-results";
const info =
unmappedComplaints >= 1
? `The exact location of ${unmappedComplaints} complaint${isPluralized} could not be determined.`
? `${unmappedComplaints} complaint${isPluralized} could not be mapped`
: "No complaints found.";

return (
Expand Down

0 comments on commit c4e6f7b

Please sign in to comment.