Reverted changes to .pre-commit-config.yaml, changed en locales to reflect default and added filament price as default to spools/show.tsx
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -23,6 +23,15 @@ export const SpoolShow: React.FC<IResourceComponentsProps> = () => {
|
||||
|
||||
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<IResourceComponentsProps> = () => {
|
||||
<Title level={5}>{t("spool.fields.filament")}</Title>
|
||||
<TextField value={record ? filamentURL(record?.filament) : ""} />
|
||||
<Title level={5}>{t("spool.fields.price")}</Title>
|
||||
<NumberField value={record?.price ?? ""} />
|
||||
<NumberField value={record ? spoolPrice(record) : ""} />
|
||||
<Title level={5}>{t("spool.fields.registered")}</Title>
|
||||
<DateField
|
||||
value={dayjs.utc(record?.registered).local()}
|
||||
|
||||
Reference in New Issue
Block a user