diff --git a/front/src/App.tsx b/front/src/App.tsx index 1c89cd1bb..47c17b035 100644 --- a/front/src/App.tsx +++ b/front/src/App.tsx @@ -13,6 +13,7 @@ import CreateShipmentView from "views/Transfers/CreateShipment/CreateShipmentVie import ShipmentsOverviewView from "views/Transfers/ShipmentsOverview/ShipmentsOverviewView"; import ShipmentView from "views/Transfers/ShipmentView/ShipmentView"; import Products from "views/Products/ProductsView"; +import StandardProductsView from "views/Products/StandardProductsView"; import EnableStandardProductView from "views/EnableStandardProduct/EnableStandardProductView"; import QrReaderView from "views/QrReader/QrReaderView"; import NotFoundView from "views/NotFoundView/NotFoundView"; @@ -280,6 +281,17 @@ function App() { /> } /> + } + redirectPath={prevLocation} + requiredAbps={["manage_products"]} + minBeta={4} + /> + } + /> - - Manage Products - - - - - {baseName ? baseName?.toUpperCase() : }{" "} - PRODUCTS - - - ASSORT STANDARD PRODUCTS - - - - - - } - > - }> - - - - - - - } - > - - - - - + + + Manage Products + + + Check ASSORT Standard Products {">"} + + + + } + > + }> + + + ); } diff --git a/front/src/views/Products/StandardProductsView.tsx b/front/src/views/Products/StandardProductsView.tsx new file mode 100644 index 000000000..5a4381048 --- /dev/null +++ b/front/src/views/Products/StandardProductsView.tsx @@ -0,0 +1,30 @@ +import { Heading, Text } from "@chakra-ui/react"; +import StandardProductsContainer from "./components/StandardProductsContainer"; +import { MobileBreadcrumbButton } from "components/BreadcrumbNavigation"; +import { ErrorBoundary } from "@sentry/react"; +import { AlertWithoutAction } from "components/Alerts"; + +function StandardProductsView() { + return ( + <> + + + Explore ASSORT + + + ASSORT is a standardized inventory classification system developed in partnership with IHA, + HERMINE, and DistributeAid in full compliance with SPHERE and CHS standards for easy and + effective use even by small volunteer teams. + + + } + > + + + + ); +} + +export default StandardProductsView; diff --git a/front/src/views/Products/components/ProductsTable.tsx b/front/src/views/Products/components/ProductsTable.tsx index 1cb6d20f7..b039d84ee 100644 --- a/front/src/views/Products/components/ProductsTable.tsx +++ b/front/src/views/Products/components/ProductsTable.tsx @@ -1,4 +1,4 @@ -import { useCallback, useEffect, useMemo } from "react"; +import { useCallback, useEffect, useMemo, useState } from "react"; import { Column, Filters, @@ -21,6 +21,9 @@ import { Button, HStack, useDisclosure, + FormControl, + FormLabel, + Switch, } from "@chakra-ui/react"; import { Link } from "react-router-dom"; import { AddIcon, ChevronRightIcon, ChevronLeftIcon } from "@chakra-ui/icons"; @@ -58,6 +61,13 @@ function ProductsTable({ genderOptions, sizeRangeOptions, }: ProductTableProps) { + const [showOnlyAssort, setShowOnlyAssort] = useState(false); + + const filteredData = useMemo( + () => (showOnlyAssort ? tableData.filter((row) => row.isStandard) : tableData), + [showOnlyAssort, tableData], + ); + // Add custom filter function to filter objects in a column https://react-table-v7.tanstack.com/docs/examples/filtering const filterTypes = useMemo( () => ({ @@ -83,7 +93,7 @@ function ProductsTable({ } = useTable( { columns, - data: tableData, + data: filteredData, filterTypes, initialState: { hiddenColumns: tableConfig.getHiddenColumns(), @@ -145,6 +155,17 @@ function ProductsTable({ + + setShowOnlyAssort(e.target.checked)} + mr={2} + /> + + Show only ASSORT products + + column.id !== "actionButton")} /> diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 14f5ab6be..8588bd7a7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -214,8 +214,8 @@ importers: specifier: 2.5.1 version: 2.5.1(@types/emscripten@1.41.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) jotai: - specifier: ^2.19.1 - version: 2.19.1(@babel/core@7.28.4)(@babel/template@7.27.2)(@types/react@18.3.14)(react@18.3.1) + specifier: ^2.20.0 + version: 2.20.0(@babel/core@7.28.4)(@babel/template@7.27.2)(@types/react@18.3.14)(react@18.3.1) react-big-calendar: specifier: ^1.19.4 version: 1.19.4(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -3511,8 +3511,8 @@ packages: jose@6.2.2: resolution: {integrity: sha512-d7kPDd34KO/YnzaDOlikGpOurfF0ByC2sEV4cANCtdqLlTfBlw2p14O/5d/zv40gJPbIQxfES3nSx1/oYNyuZQ==} - jotai@2.19.1: - resolution: {integrity: sha512-sqm9lVZiqBHZH8aSRk32DSiZDHY3yUIlulXYn9GQj7/LvoUdYXSMti7ZPJGo+6zjzKFt5a25k/I6iBCi43PJcw==} + jotai@2.20.0: + resolution: {integrity: sha512-b5GAqgmXmXzB4WPaTH26ppk9Sl7AA9WSQX7yfdM+gJ1rFROiWcVbi97gFuN/yVCojOcbcvop2sfLL+fjxW0JVg==} engines: {node: '>=12.20.0'} peerDependencies: '@babel/core': '>=7.0.0' @@ -8984,7 +8984,7 @@ snapshots: jose@6.2.2: {} - jotai@2.19.1(@babel/core@7.28.4)(@babel/template@7.27.2)(@types/react@18.3.14)(react@18.3.1): + jotai@2.20.0(@babel/core@7.28.4)(@babel/template@7.27.2)(@types/react@18.3.14)(react@18.3.1): optionalDependencies: '@babel/core': 7.28.4 '@babel/template': 7.27.2