Files
InvenTree/src/frontend/src/pages/part/pricing/PricingPanel.tsx
T
Oliver d3a2eced97 [PUI] pricing tab (#6985)
* Add recharts package

- Brings us in-line with mantine v7

* Add skeleton pricing page

* Fetch pricing data

* Rough implementation of variant pricing chart

- Needs better labels for tooltip and axis

* Cleanup

* More cleanup

* Improve rendering

* Add pricing overview

* Add pie chart for BOM pricing

- Needs extra work!

* Split components into separate files

* Backend: allow ordering parts by pricing

* Bump API version

* Update VariantPricingPanel:

- Table drives data selection now

* Refactor BomPricingPanel

- Table drives the data

* Allow BomItemList to be sorted by pricing too

* Sort bom table

* Make record index available to render function

* Refactor BomPricingPanel

- Better rendering of pie chart

* Update pricing overview panel

* Further updates

- Expose "pricing_updated" column to API endpoints
- Allow ordering by "pricing_updated" column

* Update API endpoint for PurchaseOrderLineItem

* Implement PurchaseOrderHistory panel

* Cleanup PurchaseHistoryPanel

* Enhance API for SupplierPriceBreak

* Implement SupplierPricingPanel

* Fix for getDetailUrl

- Take base URL into account also!

* Further fixes for getDetailUrl

* Fix number form field

* Implement SupplierPriceBreakTable

* Tweaks for StockItemTable

* Ensure frontend is translated when compiling static files

* Fixes for BomPricingPanel

* Simplify price rendering for bom table

* Update BomItem serializer

- Add pricing_min_total
- Add pricing_max_total
- Fix existing 1+N query issue

* Use values provided by API

* Fix BomItem serializer lookup

* Refactor pricing charts

* Fix for VariantPricingPanel

* Remove unused imports

* Implement SalePriceBreak table

- Refactor the InternalPriceBreak table to be generic

* Allow price breaks to be ordered by 'price'

* Display alert for no available data

* Update backend API filters

* Allow ordering by customer

* Implement SaleHistoryPanel

* Allow user to select pie or bar chart for BOM pricing detail

* Remove extra padding
2024-04-16 01:05:56 +10:00

41 lines
967 B
TypeScript

import { t } from '@lingui/macro';
import { Accordion, Alert, Space, Stack, Text } from '@mantine/core';
import { IconExclamationCircle } from '@tabler/icons-react';
import { ReactNode } from 'react';
import { StylishText } from '../../../components/items/StylishText';
export default function PricingPanel({
content,
label,
title,
visible
}: {
content: ReactNode;
label: string;
title: string;
visible: boolean;
}): ReactNode {
return (
visible && (
<Accordion.Item value={label}>
<Accordion.Control>
<StylishText size="lg">{title}</StylishText>
</Accordion.Control>
<Accordion.Panel>{content}</Accordion.Panel>
</Accordion.Item>
)
);
}
export function NoPricingData() {
return (
<Stack spacing="xs">
<Alert icon={<IconExclamationCircle />} color="blue" title={t`No Data`}>
<Text>{t`No pricing data available`}</Text>
</Alert>
<Space />
</Stack>
);
}