-
Notifications
You must be signed in to change notification settings - Fork 532
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
Modified the UI of events log and switch tab #8825
Merged
Merged
Changes from 10 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
bc268bf
both sort buttons brought to the parent component
JOSHIK27 6dd1e60
achieved intented functionality
JOSHIK27 52ba802
included pluginMap file
JOSHIK27 888ed24
merge conflicts fixed
JOSHIK27 41a3e43
Merge branch 'develop' into fixes#8286
JOSHIK27 7bc91fb
Merge branch 'develop' into fixes#8286
JOSHIK27 1b46d44
Merge branch 'develop' into fixes#8286
JOSHIK27 ab660b9
Delete src/pluginMap.ts
JOSHIK27 0505676
Merge branch 'develop' into fixes#8286
JOSHIK27 cad099d
Merge branch 'develop' into fixes#8286
JOSHIK27 cb0d8ba
i18n fixes
JOSHIK27 c444120
Merge branch 'develop' into fixes#8286
JOSHIK27 1c2d8a0
Merge branch 'develop' into fixes#8286
JOSHIK27 c3ca2d0
changed to small cases
JOSHIK27 38a65d5
Merge branch 'develop' into fixes#8286
JOSHIK27 faf8a88
Merge branch 'develop' into fixes#8286
JOSHIK27 67ded13
margin issues and filter button variant adjustments fixed
JOSHIK27 77d7552
cleared merge conflicts
JOSHIK27 3908f54
Merge branch 'develop' into fixes#8286
JOSHIK27 1e9ba09
Merge branch 'develop' into fixes#8286
JOSHIK27 8292d27
Merge branch 'develop' into fixes#8286
JOSHIK27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,19 @@ import routes from "../../../Redux/api"; | |
import CareIcon from "../../../CAREUI/icons/CareIcon"; | ||
import EncounterSymptomsCard from "../../Symptoms/SymptomsCard"; | ||
import Tabs from "../../Common/components/Tabs"; | ||
import { QueryParams } from "../../../Utils/request/types"; | ||
import { EVENTS_SORT_OPTIONS } from "../../../Common/constants"; | ||
import DailyRoundsFilter from "../Consultations/DailyRoundsFilter"; | ||
import ButtonV2 from "../../Common/components/ButtonV2"; | ||
import { classNames } from "../../../Utils/utils"; | ||
|
||
import { useTranslation } from "react-i18next"; | ||
import { | ||
Popover, | ||
PopoverButton, | ||
PopoverPanel, | ||
Transition, | ||
} from "@headlessui/react"; | ||
|
||
import PageTitle from "@/Components/Common/PageTitle"; | ||
|
||
|
@@ -33,6 +46,9 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { | |
const [monitorBedData, setMonitorBedData] = useState<AssetBedModel>(); | ||
const [ventilatorBedData, setVentilatorBedData] = useState<AssetBedModel>(); | ||
const [showEvents, setShowEvents] = useState(true); | ||
const [eventsQuery, setEventsQuery] = useState<QueryParams>(); | ||
const [dailyRoundsQuery, setDailyRoundsQuery] = useState<QueryParams>(); | ||
const { t } = useTranslation(); | ||
|
||
const vitals = useVitalsAspectRatioConfig({ | ||
default: undefined, | ||
|
@@ -651,32 +667,107 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { | |
</div> | ||
</div> | ||
<div className="w-full pl-0 md:pl-4 xl:w-1/3"> | ||
<Tabs | ||
className="mt-3 w-full lg:w-full" | ||
tabs={[ | ||
{ | ||
text: ( | ||
<div className="flex items-center justify-center gap-1 text-sm"> | ||
Events | ||
<span className="rounded-lg bg-warning-400 p-px px-1 text-xs text-white"> | ||
beta | ||
</span> | ||
</div> | ||
), | ||
value: 1, | ||
}, | ||
{ text: "Daily Rounds", value: 0 }, | ||
]} | ||
onTabChange={(v) => setShowEvents(!!v)} | ||
currentTab={showEvents ? 1 : 0} | ||
/> | ||
<div className="flex items-center"> | ||
<Tabs | ||
className="mr-2 mt-3 w-full lg:w-full" | ||
tabs={[ | ||
{ | ||
text: ( | ||
<div className="flex items-center justify-center gap-1 text-sm"> | ||
Events | ||
<span className="rounded-lg bg-warning-400 p-px px-1 text-xs text-white"> | ||
beta | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing i18n |
||
</span> | ||
</div> | ||
), | ||
value: 1, | ||
}, | ||
{ text: "Daily Rounds", value: 0 }, | ||
]} | ||
onTabChange={(v) => setShowEvents(!!v)} | ||
currentTab={showEvents ? 1 : 0} | ||
/> | ||
{showEvents ? ( | ||
<Popover className="relative mt-3"> | ||
<PopoverButton> | ||
<ButtonV2 className="border p-3" variant="secondary"> | ||
<CareIcon icon="l-filter" /> | ||
</ButtonV2> | ||
</PopoverButton> | ||
<Transition | ||
enter="transition ease-out duration-200" | ||
enterFrom="opacity-0 translate-y-1" | ||
enterTo="opacity-100 translate-y-0" | ||
leave="transition ease-in duration-150" | ||
leaveFrom="opacity-100 translate-y-0" | ||
leaveTo="opacity-0 translate-y-1" | ||
> | ||
<PopoverPanel className="absolute right-0 z-30"> | ||
<div className="rounded-lg shadow-lg ring-1 ring-secondary-400"> | ||
<div className="relative flex flex-col rounded-b-lg bg-white"> | ||
{EVENTS_SORT_OPTIONS.map(({ isAscending, value }) => { | ||
return ( | ||
<div | ||
className={classNames( | ||
"dropdown-item-primary pointer-events-auto m-2 flex w-56 cursor-pointer items-center justify-start gap-3 rounded border-0 px-4 py-2 text-sm font-normal transition-all duration-200 ease-in-out", | ||
eventsQuery?.ordering?.toString() === value | ||
? "bg-primary-100 !font-medium text-primary-500" | ||
: "", | ||
)} | ||
onClick={() => { | ||
setEventsQuery({ | ||
ordering: value, | ||
}); | ||
}} | ||
> | ||
<CareIcon | ||
className="text-primary-600" | ||
icon={ | ||
isAscending | ||
? "l-sort-amount-up" | ||
: "l-sort-amount-down" | ||
} | ||
/> | ||
<span>{t("SORT_OPTIONS__" + value)}</span> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
</PopoverPanel> | ||
</Transition> | ||
</Popover> | ||
) : ( | ||
<DailyRoundsSortDropdown | ||
setDailyRoundsQuery={setDailyRoundsQuery} | ||
/> | ||
)} | ||
</div> | ||
|
||
{showEvents ? ( | ||
<EventsList /> | ||
<EventsList query={eventsQuery!} /> | ||
) : ( | ||
<DailyRoundsList consultation={props.consultationData} /> | ||
<DailyRoundsList | ||
consultation={props.consultationData} | ||
query={dailyRoundsQuery!} | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
function DailyRoundsSortDropdown({ | ||
setDailyRoundsQuery, | ||
}: { | ||
setDailyRoundsQuery: (query: QueryParams) => void; | ||
}) { | ||
return ( | ||
<DailyRoundsFilter | ||
onApply={(query) => { | ||
setDailyRoundsQuery(query); | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,84 +42,81 @@ export default function DailyRoundsFilter(props: Props) { | |
); | ||
|
||
return ( | ||
<div className="flex flex-row-reverse items-center gap-4 md:flex-row"> | ||
<Popover className="relative"> | ||
<PopoverButton> | ||
<ButtonV2 | ||
variant={isFilterApplied ? "primary" : "secondary"} | ||
className="mr-5 border" | ||
> | ||
<CareIcon icon="l-filter" /> | ||
{t("filter")} | ||
</ButtonV2> | ||
</PopoverButton> | ||
<Transition | ||
enter="transition ease-out duration-200" | ||
enterFrom="opacity-0 translate-y-1" | ||
enterTo="opacity-100 translate-y-0" | ||
leave="transition ease-in duration-150" | ||
leaveFrom="opacity-100 translate-y-0" | ||
leaveTo="opacity-0 translate-y-1" | ||
<Popover className="relative mt-3"> | ||
<PopoverButton> | ||
<ButtonV2 | ||
variant={isFilterApplied ? "primary" : "secondary"} | ||
className="border p-3" | ||
> | ||
<PopoverPanel className="absolute right-0 z-30 mt-1 w-80 px-4 sm:px-0 md:w-96 lg:max-w-3xl"> | ||
<div className="rounded-lg shadow-lg ring-1 ring-secondary-400"> | ||
<div className="rounded-t-lg bg-secondary-100 px-6 py-4"> | ||
<div className="flow-root rounded-md"> | ||
<span className="block text-sm text-secondary-800"> | ||
{t("filter_by")} | ||
</span> | ||
</div> | ||
<CareIcon icon="l-filter" /> | ||
</ButtonV2> | ||
</PopoverButton> | ||
<Transition | ||
enter="transition ease-out duration-200" | ||
enterFrom="opacity-0 translate-y-1" | ||
enterTo="opacity-100 translate-y-0" | ||
leave="transition ease-in duration-150" | ||
leaveFrom="opacity-100 translate-y-0" | ||
leaveTo="opacity-0 translate-y-1" | ||
> | ||
<PopoverPanel className="absolute right-0 z-30 mt-1 w-80 px-4 sm:px-0 md:w-96 lg:max-w-3xl"> | ||
<div className="rounded-lg shadow-lg ring-1 ring-secondary-400"> | ||
<div className="rounded-t-lg bg-secondary-100 px-6 py-4"> | ||
<div className="flow-root rounded-md"> | ||
<span className="block text-sm text-secondary-800"> | ||
{t("filter_by")} | ||
</span> | ||
</div> | ||
<div className="relative flex flex-col gap-4 rounded-b-lg bg-white p-6"> | ||
<SelectFormField | ||
{...field("rounds_type")} | ||
label={t("LOG_UPDATE_FIELD_LABEL__rounds_type")} | ||
options={DailyRoundTypes} | ||
placeholder={t("show_all")} | ||
optionLabel={(o) => t(`ROUNDS_TYPE__${o}`)} | ||
optionValue={(o) => o} | ||
/> | ||
<TextFormField | ||
{...field("taken_at_after")} | ||
label="Measured after" | ||
type="datetime-local" | ||
max={dayjs().format("YYYY-MM-DDTHH:mm")} | ||
/> | ||
<TextFormField | ||
{...field("taken_at_before")} | ||
label="Measured before" | ||
type="datetime-local" | ||
max={dayjs().format("YYYY-MM-DDTHH:mm")} | ||
/> | ||
</div> | ||
<div className="relative flex flex-col gap-4 rounded-b-lg bg-white p-6"> | ||
<SelectFormField | ||
{...field("rounds_type")} | ||
label={t("LOG_UPDATE_FIELD_LABEL__rounds_type")} | ||
options={DailyRoundTypes} | ||
placeholder={t("show_all")} | ||
optionLabel={(o) => t(`ROUNDS_TYPE__${o}`)} | ||
optionValue={(o) => o} | ||
/> | ||
<TextFormField | ||
{...field("taken_at_after")} | ||
label="Measured after" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing i18n |
||
type="datetime-local" | ||
max={dayjs().format("YYYY-MM-DDTHH:mm")} | ||
/> | ||
<TextFormField | ||
{...field("taken_at_before")} | ||
label="Measured before" | ||
type="datetime-local" | ||
max={dayjs().format("YYYY-MM-DDTHH:mm")} | ||
/> | ||
|
||
<PopoverButton> | ||
<ButtonV2 | ||
variant="secondary" | ||
onClick={() => { | ||
setFilter({}); | ||
props.onApply({}); | ||
}} | ||
border | ||
className="w-full" | ||
> | ||
{t("clear")} | ||
</ButtonV2> | ||
</PopoverButton> | ||
<PopoverButton> | ||
<ButtonV2 | ||
variant="primary" | ||
onClick={() => props.onApply(filter)} | ||
border | ||
className="w-full" | ||
> | ||
{t("apply")} | ||
</ButtonV2> | ||
</PopoverButton> | ||
</div> | ||
<PopoverButton> | ||
<ButtonV2 | ||
variant="secondary" | ||
onClick={() => { | ||
setFilter({}); | ||
props.onApply({}); | ||
}} | ||
border | ||
className="w-full" | ||
> | ||
{t("clear")} | ||
</ButtonV2> | ||
</PopoverButton> | ||
<PopoverButton> | ||
<ButtonV2 | ||
variant="primary" | ||
onClick={() => props.onApply(filter)} | ||
border | ||
className="w-full" | ||
> | ||
{t("apply")} | ||
</ButtonV2> | ||
</PopoverButton> | ||
</div> | ||
</PopoverPanel> | ||
</Transition> | ||
</Popover> | ||
</div> | ||
</div> | ||
</PopoverPanel> | ||
</Transition> | ||
</Popover> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing i18n