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

Improvements #8

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"@mantine/core": "^7.13.3",
"@mantine/dates": "^7.13.4",
"@mantine/hooks": "^7.13.3",
"@tabler/icons": "^3.21.0",
"@tabler/icons-react": "^3.21.0",
"dayjs": "^1.11.13",
"react": "^18.3.1",
"react-dom": "^18.3.1"
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/OrderHistoryPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { BarChart, BarChartSeries } from '@mantine/charts';
import { Alert, Button, Card, Group, LoadingOverlay, MantineProvider, Menu, Paper, Select, Text} from '@mantine/core';
import { Alert, Box, Button, Card, Group, LoadingOverlay, MantineProvider, Menu, Paper, Select, Text} from '@mantine/core';
import { DateValue, MonthPickerInput } from '@mantine/dates';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { createRoot } from 'react-dom/client';
import dayjs from 'dayjs';
import { IconFileDownload } from '@tabler/icons-react';

type OrderHistoryPeriod = 'M' | 'Q' | 'Y';

Expand Down Expand Up @@ -376,7 +377,7 @@ function OrderHistoryPanel({context}: {context: any}) {
<Group gap="xs" justify='flex-end'>
<Menu>
<Menu.Target>
<Button>Export Data</Button>
<Button leftSection={<IconFileDownload />}>Export</Button>
</Menu.Target>
<Menu.Dropdown>
<Menu.Item onClick={() => downloadData('csv')}>CSV</Menu.Item>
Expand All @@ -388,6 +389,7 @@ function OrderHistoryPanel({context}: {context: any}) {
</Group>
</Paper>
<Paper withBorder p="sm" m="sm">
<Box pos="relative">
<LoadingOverlay visible={loading} />
{(hasData || loading) ? (
<Card>
Expand All @@ -404,6 +406,7 @@ function OrderHistoryPanel({context}: {context: any}) {
<Text>No order history data found, based on the provided parameters</Text>
</Alert>
)}
</Box>
</Paper>
</>
);
Expand Down
14 changes: 13 additions & 1 deletion frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,18 @@
resolved "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.0.tgz"
integrity sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==

"@tabler/icons-react@^3.21.0":
version "3.21.0"
resolved "https://registry.npmjs.org/@tabler/icons-react/-/icons-react-3.21.0.tgz"
integrity sha512-Qq0GnZzzccbv/zuMyXAUUPlogNAqx9KsF8cr/ev3bxs+GMObqNEjXv1eZl9GFzxyQTS435siJNU8A1BaIYhX8g==
dependencies:
"@tabler/icons" "3.21.0"

"@tabler/icons@^3.21.0", "@tabler/[email protected]":
version "3.21.0"
resolved "https://registry.npmjs.org/@tabler/icons/-/icons-3.21.0.tgz"
integrity sha512-5+GkkmWCr1wgMor5cOF1/YYflTQdc15y10FUikJ3HW8hDiFjfbuoAHJi17FT1vwsr1sA78rkJMn+fDoOOjnnPA==

"@types/babel__core@^7.20.5":
version "7.20.5"
resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz"
Expand Down Expand Up @@ -1515,7 +1527,7 @@ react-transition-group@^4.4.5:
loose-envify "^1.4.0"
prop-types "^15.6.2"

"react@^0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18.2.0, react@^18.3.1, react@>=16.6.0, react@>=16.8.0:
"react@^0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.8.0 || ^17.0.0 || ^18.0.0", react@^18.2.0, react@^18.3.1, "react@>= 16", react@>=16.6.0, react@>=16.8.0:
version "18.3.1"
resolved "https://registry.npmjs.org/react/-/react-18.3.1.tgz"
integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==
Expand Down
6 changes: 6 additions & 0 deletions order_history/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def generate_purchase_order_history(self):
received__gt=0
).prefetch_related(
'part', 'part__part', 'order'
).select_related(
'part__part__pricing_data'
)

# Filter by part
Expand Down Expand Up @@ -176,6 +178,8 @@ def generate_sales_order_history(self):
shipped__gt=0
).prefetch_related(
'part', 'order', 'allocations'
).select_related(
'part__pricing_data'
)

# Filter by part
Expand Down Expand Up @@ -228,6 +232,8 @@ def generate_return_order_history(self):
order__status__in=ReturnOrderStatusGroups.COMPLETE,
).prefetch_related(
'item', 'item__part', 'order'
).select_related(
'item__part__pricing_data'
)

# Filter by part
Expand Down
Loading