From d8b1d58fd0e4cd0222f8ff6f9c7736acf19cb899 Mon Sep 17 00:00:00 2001 From: erikaas24 Date: Thu, 7 Nov 2024 18:48:39 +0100 Subject: [PATCH] Add more styling to table --- .../components/pages/organization/OrgShop.tsx | 30 +++++++++++-------- .../src/components/pages/orgs/ShopSale.tsx | 6 ++-- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/pages/organization/OrgShop.tsx b/frontend/src/components/pages/organization/OrgShop.tsx index f6404a007..bc527c0de 100644 --- a/frontend/src/components/pages/organization/OrgShop.tsx +++ b/frontend/src/components/pages/organization/OrgShop.tsx @@ -2,18 +2,17 @@ import { useQuery } from "@apollo/client"; import { Box, Grid, Stack, Typography } from "@mui/material"; import { useTheme } from "@mui/material/styles"; import { useState } from "react"; - import { AdminOrganizationFragment, PaginatedShopOrdersDocument } from "@/generated/graphql"; - import { ShopSale } from "../orgs/ShopSale"; import { TableStepper } from "../orgs/TableStepper"; +import { HEADER_DESKTOP_HEIGHT} from "@/lib/mui/theme/constants"; type Props = { organization: AdminOrganizationFragment; }; export const OrgProducts: React.FC = ({ organization }) => { const theme = useTheme(); - const limit = 5; + const limit = 100; const [page, setPage] = useState(0); const handlePageChange = (newValue: number) => { @@ -50,25 +49,26 @@ export const OrgProducts: React.FC = ({ organization }) => { spacing={0} padding={1} borderBottom={1} - sx={{ bgcolor: theme.palette.background.elevated, color: theme.palette.text.primary }} + position={"sticky"} + sx={{ bgcolor: theme.palette.background.elevated, color: theme.palette.text.primary, top: HEADER_DESKTOP_HEIGHT - 20, zIndex:1}} > - Navn på kunde + Navn på kunde - Kjøpt produkt + Kjøpt produkt - Antall bestilt + Antall bestilt - Betalt status + Betalt status - Mulige handlinger + Mulige handlinger - Har vi levert varen + Har vi levert varen @@ -78,10 +78,16 @@ export const OrgProducts: React.FC = ({ organization }) => { data && ( <> - {data?.paginatedShopOrders?.slice(0, limit).map((order) => { + {data?.paginatedShopOrders?.slice(0, limit).map((order, index) => { return ( - + = ({ name, product_name, quantity, has_paid, is_delivered, order_id }) => { + const theme = useTheme(); const [delivered, setdelivered] = useState(is_delivered); const [deliverProduct] = useMutation(DeliveredProductDocument); + function handle_click(bool: boolean) { setdelivered(bool); deliverProduct({ variables: { orderId: order_id } }); } return ( - + {name}