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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change home facility indicator in linked facilities slideover #7710

Merged
merged 2 commits into from
Apr 30, 2024
Merged
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
33 changes: 21 additions & 12 deletions src/Components/Users/ManageUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export default function ManageUsers() {
open={expandFacilityList}
setOpen={setExpandFacilityList}
slideFrom="right"
title={t("facilities")}
title={t("linked_facilities")}
dialogClass="md:w-[400px]"
>
<UserFacilities user={selectedUser} />
Expand Down Expand Up @@ -728,6 +728,7 @@ export function UserFacilities(props: { user: any }) {
handleOk={handleUnlinkFacilitySubmit}
/>
)}

<div className="mb-4 flex items-stretch gap-2">
<FacilitySelect
multiple={false}
Expand All @@ -749,6 +750,8 @@ export function UserFacilities(props: { user: any }) {
{t("add")}
</ButtonV2>
</div>
<hr className="my-2 border-gray-300" />

{isLoading || userFacilitiesLoading ? (
<div className="flex items-center justify-center">
<CircularProgress />
Expand All @@ -757,13 +760,23 @@ export function UserFacilities(props: { user: any }) {
<div className="flex flex-col">
{/* Home Facility section */}
{user?.home_facility_object && (
<div className="mt-2" id="home-facility">
<div className="mb-2 ml-2 text-lg font-bold">
{t("home_facility")}
</div>
<div className="py-2" id="home-facility">
<div className="relative rounded p-2 transition hover:bg-gray-200 focus:bg-gray-200 md:rounded-lg">
<div className="flex items-center justify-between">
<span>{user?.home_facility_object?.name}</span>
<div className="flex items-center justify-between gap-2">
<div className="flex content-center items-center justify-center gap-2">
<span>{user?.home_facility_object?.name}</span>{" "}
<span
className={
"flex items-center justify-center rounded-xl bg-green-600 px-2 py-0.5 text-sm font-medium text-white"
}
>
<CareIcon
icon="l-estate"
className="mr-1 pt-[1px] text-lg"
/>
Home Facility
</span>
</div>
<div className="flex items-center gap-2">
<button
className="tooltip text-lg text-red-600"
Expand All @@ -784,16 +797,12 @@ export function UserFacilities(props: { user: any }) {
</div>
</div>
</div>
<hr className="my-2 border-gray-300" />
</div>
)}

{/* Linked Facilities section */}
{!!userFacilities?.results.length && (
<div className="mt-2" id="linked-facility-list">
<div className="mb-2 ml-2 text-lg font-bold">
{t("linked_facilities")}
</div>
<div id="linked-facility-list">
<div className="flex flex-col">
{userFacilities.results.map(
(facility: FacilityModel, i: number) => {
Expand Down
Loading