From 1ec1e05c40544164dc3e8917f344a7291467d787 Mon Sep 17 00:00:00 2001 From: pdsccode Date: Wed, 10 Jan 2024 19:22:26 +0100 Subject: [PATCH] Reverted changes to .pre-commit-config.yaml, changed en locales to reflect default and added filament price as default to spools/show.tsx --- .pre-commit-config.yaml | 2 +- client/public/locales/en/common.json | 2 +- client/src/pages/spools/show.tsx | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a7d5009..628d25f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ default_language_version: - python: python3 + python: python3.9 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index fd26c6f..23e3f97 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -151,7 +151,7 @@ "archived": "Archived" }, "fields_help": { - "price": "Price of a full spool in the system configured currency.", + "price": "Price of a full spool in the system configured currency. If not set, the price of the filament will be assumed instead.", "weight_to_use": "Select what weight value to enter. Measured weight is only available if the spool weight is set for the selected filament.", "used_weight": "How much filament has been used from the spool. A new spool should have 0g used.", "remaining_weight": "How much filament is left on the spool. For a new spool this should match the spool weight.", diff --git a/client/src/pages/spools/show.tsx b/client/src/pages/spools/show.tsx index bae1b39..f068b00 100644 --- a/client/src/pages/spools/show.tsx +++ b/client/src/pages/spools/show.tsx @@ -23,6 +23,15 @@ export const SpoolShow: React.FC = () => { const record = data?.data; + const spoolPrice = (item: ISpool) => { + let spoolPrice = ""; + if (!item.price){ + spoolPrice = `${item.filament.price}`; + return spoolPrice; + } + return item.price; + } + const formatFilament = (item: IFilament) => { let vendorPrefix = ""; if (item.vendor) { @@ -59,7 +68,7 @@ export const SpoolShow: React.FC = () => { {t("spool.fields.filament")} {t("spool.fields.price")} - + {t("spool.fields.registered")}