From 83a5e1f93e920c0c585824975a0bd1c3e4ab1f2d Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 5 Nov 2024 11:34:41 +0000 Subject: [PATCH 1/2] Fix for LoadingOverlay --- frontend/src/OrderHistoryPanel.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/OrderHistoryPanel.tsx b/frontend/src/OrderHistoryPanel.tsx index 8997e99..403c75a 100644 --- a/frontend/src/OrderHistoryPanel.tsx +++ b/frontend/src/OrderHistoryPanel.tsx @@ -1,5 +1,5 @@ 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'; @@ -388,6 +388,7 @@ function OrderHistoryPanel({context}: {context: any}) { + {(hasData || loading) ? ( @@ -404,6 +405,7 @@ function OrderHistoryPanel({context}: {context: any}) { No order history data found, based on the provided parameters )} + ); From aef2fb6a8c1a44709199adf961c88f44ac3c4bcd Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 5 Nov 2024 11:51:05 +0000 Subject: [PATCH 2/2] Preselect pricing data --- frontend/package-lock.json | 26 ++++++++++++++++++++++++++ frontend/package.json | 2 ++ frontend/src/OrderHistoryPanel.tsx | 3 ++- frontend/yarn.lock | 14 +++++++++++++- order_history/views.py | 6 ++++++ 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 2dd8577..4a6aefe 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -12,6 +12,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" @@ -1277,6 +1279,30 @@ "win32" ] }, + "node_modules/@tabler/icons": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-3.21.0.tgz", + "integrity": "sha512-5+GkkmWCr1wgMor5cOF1/YYflTQdc15y10FUikJ3HW8hDiFjfbuoAHJi17FT1vwsr1sA78rkJMn+fDoOOjnnPA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/codecalm" + } + }, + "node_modules/@tabler/icons-react": { + "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" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/codecalm" + }, + "peerDependencies": { + "react": ">= 16" + } + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", diff --git a/frontend/package.json b/frontend/package.json index 01107a9..5426ad0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -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" diff --git a/frontend/src/OrderHistoryPanel.tsx b/frontend/src/OrderHistoryPanel.tsx index 403c75a..3fbf331 100644 --- a/frontend/src/OrderHistoryPanel.tsx +++ b/frontend/src/OrderHistoryPanel.tsx @@ -4,6 +4,7 @@ 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'; @@ -376,7 +377,7 @@ function OrderHistoryPanel({context}: {context: any}) { - + downloadData('csv')}>CSV diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 74d2071..c8fc63b 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -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/icons@3.21.0": + 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" @@ -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== diff --git a/order_history/views.py b/order_history/views.py index fba71ba..5127fbb 100644 --- a/order_history/views.py +++ b/order_history/views.py @@ -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 @@ -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 @@ -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