Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show only those facilties that aren't linked to user #6253

Merged
merged 9 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions cypress/e2e/users_spec/user_creation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,7 @@ describe("User Creation", () => {
// .click()
// .type("Dummy Facility 1")
// .wait("@getFacilities");
// cy.get("li[role='option']").first().click();
// cy.intercept(/\/api\/v1\/users\/\w+\/add_facility\//).as("addFacility");
// cy.get("button[id='link-facility']").click();
// cy.wait("@addFacility")
// // .its("response.statusCode")
// // .should("eq", 201)
// .get("span")
// .contains("Facility - User Already has permission to this facility");
// cy.get("li[role='option']").should("not.exist");
// });

// describe("Edit User Profile & Error Validation", () => {
Expand Down
3 changes: 3 additions & 0 deletions src/Components/Common/FacilitySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { FacilityModel } from "../Facility/models";

interface FacilitySelectProps {
name: string;
exclude_user: string;
errors?: string | undefined;
className?: string;
searchAll?: boolean;
Expand All @@ -22,6 +23,7 @@ interface FacilitySelectProps {
export const FacilitySelect = (props: FacilitySelectProps) => {
const {
name,
exclude_user,
multiple,
selected,
setSelected,
Expand All @@ -45,6 +47,7 @@ export const FacilitySelect = (props: FacilitySelectProps) => {
search_text: text,
all: searchAll,
facility_type: facilityType,
exclude_user: exclude_user,
district,
};

Expand Down
1 change: 1 addition & 0 deletions src/Components/Users/ManageUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ function UserFacilities(props: { user: any }) {
<FacilitySelect
multiple={false}
name="facility"
exclude_user={username}
showAll={false} // Show only facilities that user has access to link (not all facilities)
showNOptions={8}
selected={facility}
Expand Down
Loading