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,MAAO,YACZ,GAAAL,EAAAG,GAAA,EAACO,EAAAA,EAAIA,CAAAA,CAAC2B,WAAW,OAAOzD,SAAU,WAAG,eAGrC,GAAAoB,EAAAG,GAAA,EAACO,EAAAA,EAAIA,CAAAA,UAAC,mEAGN,GAAAV,EAAAC,IAAA,EAACS,EAAAA,EAAIA,CAAAA,WACH,GAAAV,EAAAG,GAAA,EAACO,EAAAA,EAAIA,CAAAA,CAAC2B,WAAW,OAAOC,GAAG,gBAAO,YAE1B,IAAI,kBAGd,GAAAtC,EAAAC,IAAA,EAACS,EAAAA,EAAIA,CAAAA,WACH,GAAAV,EAAAG,GAAA,EAACO,EAAAA,EAAIA,CAAAA,CAAC2B,WAAW,OAAOC,GAAG,gBAAO,WAE1B,IACR,GAAAtC,EAAAG,GAAA,EAACO,EAAAA,EAAIA,CAAAA,CACH4B,GAAG,IACH5D,MAAM,OACN2D,WAAW,OACXuD,KAAK,uCACLC,OAAO,SACPC,IAAI,+BACL,qCAIH,GAAA9F,EAAAC,IAAA,EAACS,EAAAA,EAAIA,CAAAA,WACH,GAAAV,EAAAG,GAAA,EAACO,EAAAA,EAAIA,CAAAA,CAAC2B,WAAW,OAAOC,GAAG,gBAAO,YAE1B,IAAI,kBAGd,GAAAtC,EAAAG,GAAA,EAACO,EAAAA,EAAIA,CAAAA,UAAC,0DACN,GAAAV,EAAAC,IAAA,EAACS,EAAAA,EAAIA,CAAAA,WAAC,WACI,GAAAV,EAAAG,GAAA,EAAC4F,KAAAA,CAAAA,GACT,GAAA/F,EAAAG,GAAA,EAAC4F,KAAAA,CAAAA,GAAK,+BAOpB","sources":["webpack://_N_E/","webpack://_N_E/./src/components/booking-summary-card/summary-card.tsx","webpack://_N_E/./src/components/booking-summary-card/summary-mobile-card.tsx","webpack://_N_E/./src/components/booking-summary-card/booking-summary-card.tsx","webpack://_N_E/./src/pages/index.tsx"],"sourcesContent":["\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/\",\n function () {\n return require(\"private-next-pages/index.tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/\"])\n });\n }\n ","import {\n BasicTable,\n Button,\n Card,\n Cell,\n CellHeader,\n DividerItem,\n Grid,\n Row,\n Text,\n VisuallyHidden,\n} from 'components/ui';\nimport { WeeklyBookingReport } from 'lib/api/generated';\nimport { useRouter } from 'next/router';\nimport { FC } from 'react';\nimport styled from 'styled-components';\nimport { globalTheme } from '../../styles/global-theme';\nimport { format } from 'date-fns';\n\nexport interface SummaryCardProps {\n name: string;\n details?: WeeklyBookingReport[];\n productId: string;\n}\n\nconst ActionsHeader = styled(CellHeader)`\n text-align: right;\n position: relative;\n`;\n\nconst ButtonCell = styled(Cell)`\n padding-right: 40px;\n`;\n\nconst ColorButton = styled(Button)(() => ({\n color: 'white',\n backgroundColor: '#C934E1',\n fontSize: globalTheme.fontSizes[3],\n}));\n\nconst SummaryList = styled.div`\n max-height: 200px;\n overflow-y: scroll;\n`;\n\nconst CellValue = styled(Cell)`\n font-size: ${globalTheme.fontSizes[3]};\n`;\n\nconst LargeCellHeader = styled(CellHeader)`\n font-size: ${globalTheme.fontSizes[3]};\n`;\n\nexport const SummaryCard: FC = ({\n name,\n details,\n productId,\n}) => {\n const router = useRouter();\n\n const handleClickSummary = (startDate: Date, endDate: Date, type: string) => {\n router.push(`/stockbook?type=${type}&date=${startDate}&date_to=${endDate}`);\n };\n\n return (\n \n \n \n {name}\n \n \n \n \n Week Commencing\n Incoming\n Outgoing\n \n Actions\n \n \n \n \n \n {details?.map((item: any, index: number) => {\n return (\n \n \n {format(new Date(item.start_date), 'd MMM')}\n \n {item.incoming[productId]}\n {item.outgoing[productId]}\n \n \n handleClickSummary?.(\n item.start_date,\n item.end_date,\n productId\n )\n }\n >\n View\n \n \n \n );\n })}\n \n \n \n );\n};\n","import { Icon, Text, Tooltip } from 'components/ui';\nimport { format, getISOWeek } from 'date-fns';\nimport { WeeklyBookingReport } from 'lib/api/generated';\nimport { useRouter } from 'next/router';\nimport { FC } from 'react';\nimport styled from 'styled-components';\nimport { globalTheme } from 'styles/global-theme';\n\nexport interface SummaryCardProps {\n name: string;\n details: WeeklyBookingReport[];\n productId: string;\n}\n\nexport const CardWrapper = styled.div`\n display: grid;\n grid-gap: 10px;\n margin-bottom: ${globalTheme.space[2]};\n padding: ${globalTheme.space[1]} ${globalTheme.space[1]};\n background-color: #f8f8f8;\n border-radius: 8px;\n`;\n\nexport const RowInner = styled.div`\n text-align: center;\n`;\n\nexport const RowWrapper = styled.div`\n padding: ${globalTheme.space[0]} ${globalTheme.space[1]};\n background-color: ${globalTheme.colors.white};\n border-radius: 8px;\n`;\n\nconst SummaryBox = styled(RowWrapper)`\n background-color: #ffffff;\n`;\n\nconst InOutCount = styled.div`\n display: flex;\n gap: ${globalTheme.space[1]};\n align-items: center;\n justify-content: center;\n`;\n\nconst IconWrapper = styled.div`\n display: flex;\n align-items: center;\n gap: ${globalTheme.space[0]};\n`;\n\nexport const SummaryMobileCard: FC = ({\n name,\n details,\n productId,\n}) => {\n const router = useRouter();\n\n const handleClickSummary = (startDate: Date, endDate: Date, type: string) => {\n router.push(`/stockbook?type=${type}&date=${startDate}&date_to=${endDate}`);\n };\n\n return (\n <>\n \n {name}\n {details?.map((item: any, index: number) => {\n return (\n <>\n \n handleClickSummary?.(\n item.start_date,\n item.end_date,\n productId\n )\n }\n >\n \n \n Wk {getISOWeek(new Date(item?.end_date))} :{' '}\n {format(new Date(item?.start_date), 'dd MMM')} -{' '}\n {format(new Date(item?.end_date), 'dd MMM')}\n \n \n\n \n \n \n \n \n {item.incoming[productId]}\n \n \n \n \n \n \n \n {item.outgoing[productId]}\n \n \n \n \n \n \n );\n })}\n \n \n );\n};\n","import { useAbility } from '@casl/react';\nimport { useQuery } from '@tanstack/react-query';\nimport { AbilityContext } from 'components/can';\nimport { Grid, Loader } from 'components/ui';\nimport { useBuyerOrg } from 'hooks/use-buyer-org';\nimport { ApiClient } from 'lib/api/client';\nimport { useMedia } from 'react-use';\nimport { breakpoints } from 'styles/breakpoints';\nimport { SummaryCard } from './summary-card';\nimport { SummaryMobileCard } from './summary-mobile-card';\n\nexport const BookingSummaryCard = () => {\n const isMobile = useMedia(`(max-width: ${breakpoints.medium})`);\n const { data: org } = useBuyerOrg();\n const ability = useAbility(AbilityContext);\n const canRead = ability.can('read', 'Stockbook');\n\n const { isLoading, data: activeFields } = useQuery(['activeFields'], () =>\n new ApiClient().organisationApi.orgConfigRetrieve({\n buyerOrgId: org?.buyer_org_id || '',\n })\n );\n\n const { isLoading: weeklyLoading, data: weeklyData } = useQuery(\n ['weeklyData'],\n () =>\n new ApiClient().reportsApi.orgReportBookingWeeklyList({\n buyerOrgId: org?.buyer_org_id || '',\n })\n );\n\n if (isLoading && weeklyLoading) {\n return ;\n }\n if (canRead) {\n return (\n <>\n {isMobile ? (\n <>\n {activeFields?.data?.products.map((product, index: number) => {\n return (\n \n );\n })}\n \n ) : (\n \n {activeFields?.data?.products.map((product, index: number) => {\n return (\n \n );\n })}\n \n )}\n \n );\n } else {\n return null;\n }\n};\n","import { BookingSummaryCard } from 'components/booking-summary-card/booking-summary-card';\nimport { Layout } from 'components/layout';\nimport { IconProps, Loader, PageWrapper, Stack, Text } from 'components/ui';\nimport { withAuth } from 'components/with-auth';\nimport { NextPage } from 'next';\nimport { PATHS } from 'settings/config';\nimport styled from 'styled-components';\nimport { useBuyerOrg } from '../hooks/use-buyer-org';\nimport { useQuery } from '@tanstack/react-query';\nimport { ApiClient } from '../lib/api/client';\nimport React from 'react';\nimport StockbookRequiredSummary from './stockbook-required-summary';\n\ntype Feature = {\n title: string;\n description: string;\n buttonText: string;\n link: string;\n icon: IconProps['component'];\n};\n\n{\n /** TODO: disable for the moment. As the page is quite busy with the other features. [Mon 20 Jan] */\n}\n// const features: Feature[] = [\n// {\n// title: 'Set up your company profile',\n// description:\n// 'Set up your company profile information, delivery addresses, and users. Manage your subscription plan.',\n// buttonText: 'Company Profile',\n// link: PATHS.organisation.profile,\n// icon: 'BusinessIcon',\n// },\n// {\n// title: 'Build your supplier list',\n// description:\n// 'Search for suppliers (vendors and agents) on Agora Livestock, or send them an invite to join.',\n// buttonText: 'Suppliers',\n// link: PATHS.contacts.home,\n// icon: 'ContactsIcon',\n// },\n// {\n// title: 'Create your networks',\n// description:\n// 'Organise your contacts into networks (e.g. premium suppliers, certified suppliers, etc.)',\n// buttonText: 'Networks',\n// link: PATHS.privateGroups.home,\n// icon: 'PadlockIcon',\n// },\n// {\n// title: 'Create and manage your prices',\n// description:\n// 'Create or upload your price grids, manage who can see them (private, public vs. contacts only), and see interested suppliers.',\n// buttonText: 'My prices',\n// link: PATHS.prices.home,\n// icon: 'PriceTagIcon',\n// },\n// {\n// title: 'Send and receive contracts',\n// description:\n// 'Send booking confirmations to suppliers, and review offers that you have received.',\n// buttonText: 'Contracts',\n// link: PATHS.offers.home,\n// icon: 'PageIcon',\n// },\n// {\n// title: 'Stockbook',\n// description:\n// 'Record the important details about your upcoming deliveries and contracts in one place for your entire organisation to view and manage.',\n// buttonText: 'Stockbook',\n// link: PATHS.stockbook.home,\n// icon: 'StockbookIcon',\n// },\n// ];\n\nconst Wrapper = styled(Stack)`\n max-width: 960px;\n`;\n\nconst HomePage: NextPage = () => {\n const { data: org } = useBuyerOrg();\n\n const { isLoading, data: config } = useQuery(['reports'], () =>\n new ApiClient().organisationApi.orgConfigRetrieve({\n buyerOrgId: org?.buyer_org_id || '',\n })\n );\n\n {\n /** TODO: disable for the moment. As the page is quite busy with the other features. [Mon 20 Jan] */\n }\n // const [stockRequiredRef, setStockRequiredRef] = useState(null);\n\n // const handleChildRef = (ref: any) => {\n // setStockRequiredRef(ref);\n // };\n\n return (\n \n \n \n {/*todo hook this up to the config api*/}\n {isLoading ? (\n \n ) : (\n <>\n {config?.data.reports.homepage?.find(\n (feature) => feature.id === 'booking_summary'\n ) && }\n\n <>\n {config?.data.reports.homepage?.find(\n (feature) => feature.id === 'stockbook_summary'\n ) && }\n \n \n )}\n {/*todo disable for the moment. As the page is quite busy with the other features*/}\n {/**/}\n {/* {features.map(({ title, description, link, icon, buttonText }) => (*/}\n {/* */}\n {/* */}\n {/* */}\n {/* {title}*/}\n {/* */}\n {/* {description}*/}\n {/* */}\n {/* */}\n {/* */}\n {/* */}\n {/* */}\n {/* ))}*/}\n {/**/}\n\n \n \n Need help?\n \n \n If you have any other questions, please contact us immediately\n \n \n \n Office:\n {' '}\n 1300 812 345\n \n \n \n Email:\n {' '}\n \n support@agoralivestock.com.au\n \n \n \n \n Mobile:\n {' '}\n 0427 279 988\n \n Feature requests or feedback are greatly appreciated!\n \n Thanks,
\n
Agora Livestock\n
\n
\n
\n
\n
\n );\n};\n\nexport default withAuth(HomePage);\n"],"names":["window","__NEXT_P","push","__webpack_require__","ActionsHeader","styled","CellHeader","ButtonCell","Cell","ColorButton","Button","color","backgroundColor","fontSize","globalTheme","fontSizes","SummaryList","div","withConfig","CellValue","LargeCellHeader","SummaryCard","name","details","productId","param","router","useRouter","handleClickSummary","startDate","endDate","type","concat","jsx_runtime","jsxs","Card","jsx","DividerItem","space","Grid","columns","gap","stackOnSmall","Text","BasicTable","fixed","className","Row","VisuallyHidden","map","item","index","format","Date","start_date","incoming","outgoing","size","onClick","end_date","CardWrapper","RowInner","RowWrapper","colors","white","SummaryBox","InOutCount","IconWrapper","SummaryMobileCard","Fragment","fontWeight","as","getISOWeek","Tooltip","label","Icon","component","BookingSummaryCard","activeFields","isMobile","useMedia","breakpoints","medium","data","org","useBuyerOrg","canRead","ability","useAbility","AbilityContext","can","isLoading","useQuery","ApiClient","organisationApi","orgConfigRetrieve","buyerOrgId","buyer_org_id","weeklyLoading","weeklyData","reportsApi","orgReportBookingWeeklyList","Loader","products","product","product_id","auto","min","Wrapper","Stack","pages","withAuth","config","Layout","meta","title","PageWrapper","fullHeight","includeMarginTop","reports","homepage","find","feature","id","StockbookRequiredSummary","href","target","rel","br"],"sourceRoot":""}