Skip to content

Commit

Permalink
Fixed User Default View in Resource and Shifting (ohcnetwork#9306)
Browse files Browse the repository at this point in the history
  • Loading branch information
nithish1018 authored Dec 10, 2024
1 parent b67f03c commit 0f7a9d8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
9 changes: 5 additions & 4 deletions src/components/Resource/ResourceBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { useTranslation } from "react-i18next";
import CareIcon from "@/CAREUI/icons/CareIcon";
import { AdvancedFilterButton } from "@/CAREUI/interactive/FiltersSlideover";

import ButtonV2 from "@/components/Common/ButtonV2";
import { Button } from "@/components/ui/button";

import { ExportButton } from "@/components/Common/Export";
import Loading from "@/components/Common/Loading";
import PageTitle from "@/components/Common/PageTitle";
Expand Down Expand Up @@ -92,10 +93,10 @@ export default function BoardView() {
currentTab={boardFilter !== ACTIVE ? 1 : 0}
/>
<div className="flex w-full flex-col gap-2 lg:mr-4 lg:w-fit lg:flex-row lg:gap-4">
<ButtonV2 className="py-[11px]" onClick={onListViewBtnClick}>
<CareIcon icon="l-list-ul" />
<Button variant={"primary"} onClick={onListViewBtnClick}>
<CareIcon icon="l-list-ul" className="mr-2" />
{t("list_view")}
</ButtonV2>
</Button>
<AdvancedFilterButton
onClick={() => advancedFilter.setShow(true)}
/>
Expand Down
13 changes: 8 additions & 5 deletions src/components/Resource/ResourceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import Chip from "@/CAREUI/display/Chip";
import CareIcon from "@/CAREUI/icons/CareIcon";
import { AdvancedFilterButton } from "@/CAREUI/interactive/FiltersSlideover";

import ButtonV2 from "@/components/Common/ButtonV2";
import { Button } from "@/components/ui/button";

import { ExportButton } from "@/components/Common/Export";
import Loading from "@/components/Common/Loading";
import Page from "@/components/Common/Page";
Expand Down Expand Up @@ -34,8 +35,10 @@ export default function ListView() {

const { t } = useTranslation();

const onBoardViewBtnClick = () =>
const onBoardViewBtnClick = () => {
navigate("/resource/board", { query: qParams });
localStorage.setItem("defaultResourceView", "board");
};
const appliedFilters = formatFilter(qParams);

const { loading, data, refetch } = useQuery(routes.listResourceRequests, {
Expand Down Expand Up @@ -216,10 +219,10 @@ export default function ListView() {
</div>

<div className="mt-2 flex w-full flex-col gap-2 lg:w-fit lg:flex-row lg:gap-4">
<ButtonV2 className="py-[11px]" onClick={onBoardViewBtnClick}>
<CareIcon icon="l-list-ul" className="rotate-90" />
<Button variant={"primary"} onClick={onBoardViewBtnClick}>
<CareIcon icon="l-list-ul" className="rotate-90 mr-2" />
{t("board_view")}
</ButtonV2>
</Button>
<AdvancedFilterButton
onClick={() => advancedFilter.setShow(true)}
/>
Expand Down
16 changes: 9 additions & 7 deletions src/components/Shifting/ShiftingBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { useTranslation } from "react-i18next";
import CareIcon from "@/CAREUI/icons/CareIcon";
import { AdvancedFilterButton } from "@/CAREUI/interactive/FiltersSlideover";

import ButtonV2 from "@/components/Common/ButtonV2";
import { Button } from "@/components/ui/button";

import ConfirmDialog from "@/components/Common/ConfirmDialog";
import { ExportButton } from "@/components/Common/Export";
import Loading from "@/components/Common/Loading";
Expand Down Expand Up @@ -75,6 +76,10 @@ export default function BoardView() {

const [boardFilter, setBoardFilter] = useState(activeBoards);
const { t } = useTranslation();
const onListViewBtnClick = () => {
navigate("/shifting/list", { query: qParams });
localStorage.setItem("defaultShiftView", "list");
};

return (
<div className="flex-col px-2 pb-2">
Expand Down Expand Up @@ -119,13 +124,10 @@ export default function BoardView() {
/>

<div className="flex w-full flex-col gap-2 lg:mr-4 lg:w-fit lg:flex-row lg:gap-4">
<ButtonV2
className="py-[11px]"
onClick={() => navigate("/shifting/list", { query: qParams })}
>
<CareIcon icon="l-list-ul" />
<Button variant={"primary"} onClick={onListViewBtnClick}>
<CareIcon icon="l-list-ul" className="mr-2" />
{t("list_view")}
</ButtonV2>
</Button>
<AdvancedFilterButton
onClick={() => advancedFilter.setShow(true)}
/>
Expand Down
16 changes: 9 additions & 7 deletions src/components/Shifting/ShiftingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useTranslation } from "react-i18next";
import CareIcon from "@/CAREUI/icons/CareIcon";
import { AdvancedFilterButton } from "@/CAREUI/interactive/FiltersSlideover";

import ButtonV2 from "@/components/Common/ButtonV2";
import { Button } from "@/components/ui/button";

import { ExportButton } from "@/components/Common/Export";
import Loading from "@/components/Common/Loading";
import Page from "@/components/Common/Page";
Expand Down Expand Up @@ -32,6 +33,10 @@ export default function ListView() {
} = useFilters({ cacheBlacklist: ["patient_name"] });

const { t } = useTranslation();
const onBoardViewBtnClick = () => {
navigate("/shifting/board", { query: qParams });
localStorage.setItem("defaultShiftView", "board");
};
const {
data: shiftData,
loading,
Expand Down Expand Up @@ -73,13 +78,10 @@ export default function ListView() {
</div>

<div className="mt-2 flex w-full flex-col gap-2 lg:w-fit lg:flex-row lg:gap-4">
<ButtonV2
className="py-[11px]"
onClick={() => navigate("/shifting/board", { query: qParams })}
>
<CareIcon icon="l-list-ul" className="rotate-90" />
<Button variant={"primary"} onClick={onBoardViewBtnClick}>
<CareIcon icon="l-list-ul" className="rotate-90 mr-2" />
{t("board_view")}
</ButtonV2>
</Button>
<AdvancedFilterButton
onClick={() => advancedFilter.setShow(true)}
/>
Expand Down

0 comments on commit 0f7a9d8

Please sign in to comment.