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

Fix: Layout update of Asset Page #9466

Closed
Changes from 2 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
35f5e5c
updated layout of asset page
AdityaJ2305 Dec 16, 2024
67f8536
updated some css
AdityaJ2305 Dec 16, 2024
ca7cb2e
cypress failed fix
AdityaJ2305 Dec 16, 2024
aaf7b9a
update import
AdityaJ2305 Dec 17, 2024
d0fa0c9
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 17, 2024
0d84f46
Fix minor typo error
AdityaJ2305 Dec 17, 2024
ddcdbf4
Merge branch 'issue/9349/button_layout_in_asset_page' of https://gith…
AdityaJ2305 Dec 17, 2024
85e0417
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 17, 2024
ac674d2
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 18, 2024
296254b
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 18, 2024
d9a94d5
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 18, 2024
a4e8e03
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
nihal467 Dec 19, 2024
d6e856e
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 19, 2024
0db3dd1
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 20, 2024
8d0ac4a
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 20, 2024
d5f2645
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 21, 2024
093fb9e
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 22, 2024
1874cca
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 22, 2024
6bbf58e
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
nihal467 Dec 23, 2024
f71839a
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 23, 2024
98a4a80
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 23, 2024
7851d0e
just minor key fix
AdityaJ2305 Dec 23, 2024
35d1b3e
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 23, 2024
043aa9f
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 23, 2024
e36eb05
Fix: the spacing update to shadcn button
AdityaJ2305 Dec 23, 2024
48450a8
Fix: cypress failing
AdityaJ2305 Dec 23, 2024
e3adf77
Fix: cypress failing
AdityaJ2305 Dec 23, 2024
c1adae7
Add support of shadcn dropdown button in export
AdityaJ2305 Dec 24, 2024
27b55b8
Fix linting issue
AdityaJ2305 Dec 24, 2024
d70981f
Fix linting issue
AdityaJ2305 Dec 24, 2024
88d0685
Fix linting issue
AdityaJ2305 Dec 24, 2024
a1d19d3
move out as ExportItem func comp
AdityaJ2305 Dec 24, 2024
6bc0559
use Anyone for auth
AdityaJ2305 Dec 24, 2024
e64ff5a
fix onclick
AdityaJ2305 Dec 24, 2024
e2f6337
fix onclick
AdityaJ2305 Dec 24, 2024
2d721bd
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 24, 2024
7febc9d
import fix
AdityaJ2305 Dec 24, 2024
7278966
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
nihal467 Dec 24, 2024
37af4c5
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
nihal467 Dec 24, 2024
8a1d0ff
Empty-Commit
AdityaJ2305 Dec 24, 2024
a24b580
removed buttonv2 fully
AdityaJ2305 Dec 24, 2024
1ba382c
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 25, 2024
8806cab
Empty-Commit
AdityaJ2305 Dec 25, 2024
a2ef603
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 25, 2024
6b5529f
Empty-Commit
AdityaJ2305 Dec 25, 2024
b678a74
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 26, 2024
75a0a84
rename to filterbutton
AdityaJ2305 Dec 27, 2024
e83d58f
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 27, 2024
d248444
prettier fixed
AdityaJ2305 Dec 27, 2024
9718801
Merge branch 'issue/9349/button_layout_in_asset_page' of https://gith…
AdityaJ2305 Dec 27, 2024
ab8d30d
Empty-Commit
AdityaJ2305 Dec 27, 2024
e3ae33a
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 28, 2024
4625f0c
change apply and clear button to shadcn button
AdityaJ2305 Dec 28, 2024
07e5a4b
change apply and clear button to shadcn button
AdityaJ2305 Dec 28, 2024
00dd3eb
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 29, 2024
0ec25f1
Merge branch 'develop' into issue/9349/button_layout_in_asset_page
AdityaJ2305 Dec 30, 2024
72391aa
import fix
AdityaJ2305 Dec 30, 2024
b803308
Empty-Commit
AdityaJ2305 Dec 30, 2024
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
121 changes: 70 additions & 51 deletions src/components/Assets/AssetsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import { AdvancedFilterButton } from "@/CAREUI/interactive/FiltersSlideover";
import AssetFilter from "@/components/Assets/AssetFilter";
import AssetImportModal from "@/components/Assets/AssetImportModal";
import { AssetData, assetClassProps } from "@/components/Assets/AssetTypes";
import ButtonV2 from "@/components/Common/ButtonV2";
import ExportMenu from "@/components/Common/Export";
import Loading from "@/components/Common/Loading";
import Page from "@/components/Common/Page";
import FacilitiesSelectDialogue from "@/components/ExternalResult/FacilitiesSelectDialogue";
import { FacilityModel } from "@/components/Facility/models";
import SearchInput from "@/components/Form/SearchInput";

import useFilters from "@/hooks/useFilters";
import { useIsAuthorized } from "@/hooks/useIsAuthorized";
Expand All @@ -29,6 +27,9 @@ import routes from "@/Utils/request/api";
import request from "@/Utils/request/request";
import useTanStackQueryInstead from "@/Utils/request/useQuery";

import SearchByMultipleFields from "../Common/SearchByMultipleFields";
import { Button } from "../ui/button";
AdityaJ2305 marked this conversation as resolved.
Show resolved Hide resolved

const AssetsList = () => {
const { t } = useTranslation();
const {
Expand All @@ -38,6 +39,7 @@ const AssetsList = () => {
FilterBadges,
advancedFilter,
resultsPerPage,
clearSearch,
} = useFilters({
limit: 18,
cacheBlacklist: ["search"],
Expand Down Expand Up @@ -317,9 +319,53 @@ const AssetsList = () => {
breadcrumbs={false}
hideBack
options={
<>
<div className="flex flex-wrap items-center gap-3">
<div className="mb-2 flex w-full flex-col items-center gap-3 lg:mb-0 lg:w-fit lg:flex-row lg:gap-5">
<div className="w-full lg:w-fit">
<Button
variant="primary"
size="lg"
className="w-full p-[10px] md:w-auto"
onClick={() => setIsScannerActive(true)}
>
<CareIcon icon="l-search" className="text-base mr-2" />
Scan Asset QR
</Button>
</div>

<div className="w-full lg:w-fit" data-testid="create-asset-button">
<Button
variant="primary"
size="lg"
disabled={!NonReadOnlyUsers}
className="w-full p-[10px] md:w-auto"
onClick={() => {
if (qParams.facility) {
navigate(`/facility/${qParams.facility}/assets/new`);
} else {
setShowFacilityDialog(true);
}
}}
>
<CareIcon icon="l-plus-circle" className="text-lg mr-2" />
<span>{t("create_asset")}</span>
</Button>
</div>
</div>

{/* Advanced Filter Button */}
<div className="w-full md:w-auto">
<AdvancedFilterButton
AdityaJ2305 marked this conversation as resolved.
Show resolved Hide resolved
onClick={() => advancedFilter.setShow(true)}
/>
</div>

{/* Import/Export Menu */}
{authorizedForImportExport && (
<div className="tooltip" data-testid="import-asset-button">
<div
className="tooltip w-full md:w-auto"
data-testid="import-asset-button"
>
<ExportMenu
label={importAssetModalOpen ? "Importing..." : "Import/Export"}
exportItems={[
Expand Down Expand Up @@ -371,62 +417,35 @@ const AssetsList = () => {
/>
</div>
)}
</>
</div>
}
>
<div className="mt-5 gap-3 space-y-2 lg:flex">
<div className="mt-4 gap-4 lg:gap-16 flex flex-col lg:flex-row lg:items-center">
<CountBlock
text="Total Assets"
count={totalCount}
loading={loading}
icon="d-folder"
className="flex-1"
className=""
/>
<SearchByMultipleFields
id="asset-search"
options={[
{
key: "Name/ Serial no./ QR code ID",
label: "name/serial no./QR code ID",
type: "text" as const,
placeholder: "Search by name/serial no./QR code ID",
value: qParams.search || "",
shortcutKey: "f",
},
]}
className="w-full"
onSearch={(key, value) => updateQuery({ search: value })}
clearSearch={clearSearch}
/>
<div className="flex-1">
<SearchInput
id="asset-search"
name="search"
value={qParams.search}
onChange={(e) => updateQuery({ [e.name]: e.value })}
placeholder="Search by name/serial no./QR code ID"
/>
</div>
<div className="flex flex-col items-start justify-start gap-2 lg:ml-2">
<div className="flex w-full flex-col gap-2 md:flex-row lg:w-auto">
<div className="w-full">
<AdvancedFilterButton
onClick={() => advancedFilter.setShow(true)}
/>
</div>
<ButtonV2
className="w-full py-[11px]"
onClick={() => setIsScannerActive(true)}
>
<CareIcon icon="l-search" className="mr-1 text-base" /> Scan Asset
QR
</ButtonV2>
</div>
<div
className="flex w-full flex-col md:flex-row"
data-testid="create-asset-buttom"
>
<ButtonV2
authorizeFor={NonReadOnlyUsers}
className="inline-flex w-full items-center justify-center"
onClick={() => {
if (qParams.facility) {
navigate(`/facility/${qParams.facility}/assets/new`);
} else {
setShowFacilityDialog(true);
}
}}
>
<CareIcon icon="l-plus-circle" className="text-lg" />
<span>{t("create_asset")}</span>
</ButtonV2>
</div>
</div>
</div>

<AssetFilter {...advancedFilter} key={window.location.search} />
{isLoading ? (
<Loading />
Expand Down
Loading