Skip to content

Commit

Permalink
CE-297 (#217)
Browse files Browse the repository at this point in the history
Co-authored-by: afwilcox <[email protected]>
  • Loading branch information
cnesmithsalus and afwilcox authored Dec 5, 2023
1 parent 5a1ed85 commit 6a1c704
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ export class AllegationComplaintService {
.person_complaint_xref[0]
);
}
await queryRunner.commitTransaction();
} catch (err) {
this.logger.error(err);
await queryRunner.rollbackTransaction();
Expand Down
3 changes: 2 additions & 1 deletion frontend/cypress/e2e/allegation-details-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ describe("Complaint Edit Page spec - Edit Allegation View", () => {

cy.selectItemById("status-select-id", editCallDetails.status);

cy.get("#officer-assigned-select-id").scrollIntoView();
cy.selectItemById("officer-assigned-select-id", editCallDetails.assigned);

cy.get("#complaint-description-textarea-id").click({ force: true });
Expand Down Expand Up @@ -437,7 +438,7 @@ describe("Complaint Edit Page spec - Edit Allegation View", () => {
cy.get("#officer-assigned-pair-id label").should(($label) => {
expect($label).to.contain.text("Officer Assigned");
});
cy.get("#officer-assigned-pair-id .comp-details-input").should("exist");
cy.get("#officer-assigned-pair-id .comp-details-input").contains("None");

// Check the Call Details inputs
// Complaint Location
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 @@ -408,7 +408,7 @@ describe("Complaint Edit Page spec - Edit View", () => {
cy.get("#officer-assigned-pair-id label").should(($label) => {
expect($label).to.contain.text("Officer Assigned");
});
cy.get("#officer-assigned-pair-id .comp-details-input").should("exist");
cy.get("#officer-assigned-pair-id .comp-details-input").contains("None");

// Check the Call Details inputs
// Complaint Location
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/app/components/common/comp-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ export const CompSelect: FC<Props> = ({
let items = [...options];

// If "none" is an option, lighten the colour a bit so that it doesn't appear the same as the other selectable options
if (defaultOption) {
items = [defaultOption, ...options];

styles = {
...styles,
option: (provided, state) => ({
Expand All @@ -47,7 +44,6 @@ export const CompSelect: FC<Props> = ({
: "black",
}),
};
}

//-- pass through the onChange event
const handleChange = (s: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export const ComplaintFilter: FC<Props> = ({ type, isOpen }) => {
dispatch,
} = useContext(ComplaintFilterContext);

const officers = useAppSelector(selectOfficersDropdown);
let officers = useAppSelector(selectOfficersDropdown);
if(officers && officers[0]?.value !== "Unassigned")
{
officers.unshift({value: "Unassigned", label: "Unassigned"})
}
const natureOfComplaintTypes = useAppSelector(
selectHwcrNatureOfComplaintCodeDropdown
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ export const ComplaintDetailsEdit: FC = () => {
}))
: [];

assignableOfficers.unshift({value: "Unassigned", label: "None"});

// Get the code table lists to populate the Selects
const complaintStatusCodes = useSelector(
selectComplaintStatusCodeDropdown
Expand Down Expand Up @@ -530,6 +532,7 @@ export const ComplaintDetailsEdit: FC = () => {
const { person_guid: officer } = selectedOfficer as any;

if (from(source).any() && from(source).elementAt(0)) {
source[0].active_ind = true;
const assigned = { ...source[0], person_guid: officer };
source = [assigned];
} else {
Expand All @@ -551,7 +554,6 @@ export const ComplaintDetailsEdit: FC = () => {

update.complaint_identifier = updatedParent;

setUpdateComplaint(update);
} else if (from(source).any() && from(source).elementAt(0)) {
const assigned = { ...source[0], active_ind: false };
source = [assigned];
Expand All @@ -562,8 +564,8 @@ export const ComplaintDetailsEdit: FC = () => {
};

update.complaint_identifier = updatedParent;
setUpdateComplaint(update);
}
setUpdateComplaint(update);
}
};

Expand Down Expand Up @@ -1142,10 +1144,9 @@ export const ComplaintDetailsEdit: FC = () => {
onChange={(e) => handleAssignedOfficerChange(e)}
className="comp-details-input"
options={assignableOfficers}
defaultOption={{ label: "None", value: "Unassigned" }}
placeholder="Select"
enableValidation={false}
value={selectedAssignedOfficer}
value={(updateComplaint?.complaint_identifier?.person_complaint_xref[0]?.active_ind === true ? selectedAssignedOfficer : { value: "Unassigned", label: "None" })}
/>
</div>
</div>
Expand Down

0 comments on commit 6a1c704

Please sign in to comment.