Formatted client files
This commit is contained in:
@@ -2,11 +2,7 @@
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
env: { browser: true, es2020: true },
|
env: { browser: true, es2020: true },
|
||||||
extends: [
|
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended"],
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:react-hooks/recommended",
|
|
||||||
],
|
|
||||||
parser: "@typescript-eslint/parser",
|
parser: "@typescript-eslint/parser",
|
||||||
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
|
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
|
||||||
plugins: ["react-refresh"],
|
plugins: ["react-refresh"],
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ export const SpoolCreate: React.FC<IResourceComponentsProps & CreateOrCloneProps
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filamentChange = (newID: number) => {
|
const filamentChange = (newID: number) => {
|
||||||
|
|
||||||
const newSelectedFilament = filamentOptions?.find((obj) => {
|
const newSelectedFilament = filamentOptions?.find((obj) => {
|
||||||
return obj.value === newID;
|
return obj.value === newID;
|
||||||
});
|
});
|
||||||
@@ -168,12 +167,12 @@ export const SpoolCreate: React.FC<IResourceComponentsProps & CreateOrCloneProps
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getSpoolWeight = (): number => {
|
const getSpoolWeight = (): number => {
|
||||||
return spoolWeightValue ?? (selectedFilament?.spool_weight ?? 0);
|
return spoolWeightValue ?? selectedFilament?.spool_weight ?? 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getFilamentWeight = (): number => {
|
const getFilamentWeight = (): number => {
|
||||||
return initialWeightValue ?? (selectedFilament?.weight ?? 0)
|
return initialWeightValue ?? selectedFilament?.weight ?? 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getGrossWeight = (): number => {
|
const getGrossWeight = (): number => {
|
||||||
const net_weight = getFilamentWeight();
|
const net_weight = getFilamentWeight();
|
||||||
@@ -183,30 +182,29 @@ export const SpoolCreate: React.FC<IResourceComponentsProps & CreateOrCloneProps
|
|||||||
|
|
||||||
const getTotalWeightFromFilament = (): number => {
|
const getTotalWeightFromFilament = (): number => {
|
||||||
return (selectedFilament?.weight ?? 0) + (selectedFilament?.spool_weight ?? 0);
|
return (selectedFilament?.weight ?? 0) + (selectedFilament?.spool_weight ?? 0);
|
||||||
}
|
};
|
||||||
|
|
||||||
const getMeasuredWeight = (): number => {
|
const getMeasuredWeight = (): number => {
|
||||||
const grossWeight = getGrossWeight();
|
const grossWeight = getGrossWeight();
|
||||||
|
|
||||||
return grossWeight - usedWeight;
|
return grossWeight - usedWeight;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getRemainingWeight = (): number => {
|
const getRemainingWeight = (): number => {
|
||||||
const initial_weight = getFilamentWeight();
|
const initial_weight = getFilamentWeight();
|
||||||
|
|
||||||
return initial_weight - usedWeight;
|
return initial_weight - usedWeight;
|
||||||
}
|
};
|
||||||
|
|
||||||
const isMeasuredWeightEnabled = (): boolean => {
|
const isMeasuredWeightEnabled = (): boolean => {
|
||||||
|
|
||||||
if (!isRemainingWeightEnabled()) {
|
if (!isRemainingWeightEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const spool_weight = spoolWeightValue;
|
const spool_weight = spoolWeightValue;
|
||||||
|
|
||||||
return (spool_weight || selectedFilament?.spool_weight) ? true : false;
|
return spool_weight || selectedFilament?.spool_weight ? true : false;
|
||||||
}
|
};
|
||||||
|
|
||||||
const isRemainingWeightEnabled = (): boolean => {
|
const isRemainingWeightEnabled = (): boolean => {
|
||||||
const initial_weight = initialWeightValue;
|
const initial_weight = initialWeightValue;
|
||||||
@@ -216,25 +214,22 @@ export const SpoolCreate: React.FC<IResourceComponentsProps & CreateOrCloneProps
|
|||||||
}
|
}
|
||||||
|
|
||||||
return selectedFilament?.weight ? true : false;
|
return selectedFilament?.weight ? true : false;
|
||||||
}
|
};
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (weightToEnter >= WeightToEnter.measured_weight)
|
if (weightToEnter >= WeightToEnter.measured_weight) {
|
||||||
{
|
|
||||||
if (!isMeasuredWeightEnabled()) {
|
if (!isMeasuredWeightEnabled()) {
|
||||||
setWeightToEnter(WeightToEnter.remaining_weight);
|
setWeightToEnter(WeightToEnter.remaining_weight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (weightToEnter >= WeightToEnter.remaining_weight)
|
if (weightToEnter >= WeightToEnter.remaining_weight) {
|
||||||
{
|
|
||||||
if (!isRemainingWeightEnabled()) {
|
if (!isRemainingWeightEnabled()) {
|
||||||
setWeightToEnter(WeightToEnter.used_weight);
|
setWeightToEnter(WeightToEnter.used_weight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [selectedFilament])
|
}, [selectedFilament]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Create
|
<Create
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ export const SpoolEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filamentChange = (newID: number) => {
|
const filamentChange = (newID: number) => {
|
||||||
|
|
||||||
const newSelectedFilament = filamentOptions?.find((obj) => {
|
const newSelectedFilament = filamentOptions?.find((obj) => {
|
||||||
return obj.value === newID;
|
return obj.value === newID;
|
||||||
});
|
});
|
||||||
@@ -135,12 +134,12 @@ export const SpoolEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getSpoolWeight = (): number => {
|
const getSpoolWeight = (): number => {
|
||||||
return spoolWeightValue ?? (selectedFilament?.spool_weight ?? 0);
|
return spoolWeightValue ?? selectedFilament?.spool_weight ?? 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getFilamentWeight = (): number => {
|
const getFilamentWeight = (): number => {
|
||||||
return initialWeightValue ?? (selectedFilament?.weight ?? 0)
|
return initialWeightValue ?? selectedFilament?.weight ?? 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getGrossWeight = (): number => {
|
const getGrossWeight = (): number => {
|
||||||
const net_weight = getFilamentWeight();
|
const net_weight = getFilamentWeight();
|
||||||
@@ -150,30 +149,29 @@ const getSpoolWeight = (): number => {
|
|||||||
|
|
||||||
const getTotalWeightFromFilament = (): number => {
|
const getTotalWeightFromFilament = (): number => {
|
||||||
return (selectedFilament?.weight ?? 0) + (selectedFilament?.spool_weight ?? 0);
|
return (selectedFilament?.weight ?? 0) + (selectedFilament?.spool_weight ?? 0);
|
||||||
}
|
};
|
||||||
|
|
||||||
const getMeasuredWeight = (): number => {
|
const getMeasuredWeight = (): number => {
|
||||||
const grossWeight = getGrossWeight();
|
const grossWeight = getGrossWeight();
|
||||||
|
|
||||||
return grossWeight - usedWeight;
|
return grossWeight - usedWeight;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getRemainingWeight = (): number => {
|
const getRemainingWeight = (): number => {
|
||||||
const initial_weight = getFilamentWeight();
|
const initial_weight = getFilamentWeight();
|
||||||
|
|
||||||
return initial_weight - usedWeight;
|
return initial_weight - usedWeight;
|
||||||
}
|
};
|
||||||
|
|
||||||
const isMeasuredWeightEnabled = (): boolean => {
|
const isMeasuredWeightEnabled = (): boolean => {
|
||||||
|
|
||||||
if (!isRemainingWeightEnabled()) {
|
if (!isRemainingWeightEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const spool_weight = spoolWeightValue;
|
const spool_weight = spoolWeightValue;
|
||||||
|
|
||||||
return (spool_weight || selectedFilament?.spool_weight) ? true : false;
|
return spool_weight || selectedFilament?.spool_weight ? true : false;
|
||||||
}
|
};
|
||||||
|
|
||||||
const isRemainingWeightEnabled = (): boolean => {
|
const isRemainingWeightEnabled = (): boolean => {
|
||||||
const initial_weight = initialWeightValue;
|
const initial_weight = initialWeightValue;
|
||||||
@@ -183,24 +181,22 @@ const getSpoolWeight = (): number => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return selectedFilament?.weight ? true : false;
|
return selectedFilament?.weight ? true : false;
|
||||||
}
|
};
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (weightToEnter >= WeightToEnter.measured_weight)
|
if (weightToEnter >= WeightToEnter.measured_weight) {
|
||||||
{
|
|
||||||
if (!isMeasuredWeightEnabled()) {
|
if (!isMeasuredWeightEnabled()) {
|
||||||
setWeightToEnter(WeightToEnter.remaining_weight);
|
setWeightToEnter(WeightToEnter.remaining_weight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (weightToEnter >= WeightToEnter.remaining_weight)
|
if (weightToEnter >= WeightToEnter.remaining_weight) {
|
||||||
{
|
|
||||||
if (!isRemainingWeightEnabled()) {
|
if (!isRemainingWeightEnabled()) {
|
||||||
setWeightToEnter(WeightToEnter.used_weight);
|
setWeightToEnter(WeightToEnter.used_weight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [selectedFilament])
|
}, [selectedFilament]);
|
||||||
|
|
||||||
const initialUsedWeight = formProps.initialValues?.used_weight || 0;
|
const initialUsedWeight = formProps.initialValues?.used_weight || 0;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -370,10 +366,7 @@ const getSpoolWeight = (): number => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label={t("spool.fields.remaining_weight")} help={t("spool.fields_help.remaining_weight")}>
|
||||||
label={t("spool.fields.remaining_weight")}
|
|
||||||
help={t("spool.fields_help.remaining_weight")}
|
|
||||||
>
|
|
||||||
<InputNumber
|
<InputNumber
|
||||||
min={0}
|
min={0}
|
||||||
addonAfter="g"
|
addonAfter="g"
|
||||||
@@ -387,10 +380,7 @@ const getSpoolWeight = (): number => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item label={t("spool.fields.measured_weight")} help={t("spool.fields_help.measured_weight")}>
|
||||||
label={t("spool.fields.measured_weight")}
|
|
||||||
help={t("spool.fields_help.measured_weight")}
|
|
||||||
>
|
|
||||||
<InputNumber
|
<InputNumber
|
||||||
min={0}
|
min={0}
|
||||||
addonAfter="g"
|
addonAfter="g"
|
||||||
|
|||||||
4
client/src/pages/vendors/create.tsx
vendored
4
client/src/pages/vendors/create.tsx
vendored
@@ -97,9 +97,7 @@ export const VendorCreate: React.FC<IResourceComponentsProps & CreateOrCloneProp
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber
|
<InputNumber addonAfter="g" precision={1} />
|
||||||
addonAfter="g"
|
|
||||||
precision={1}/>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Typography.Title level={5}>{t("settings.extra_fields.tab")}</Typography.Title>
|
<Typography.Title level={5}>{t("settings.extra_fields.tab")}</Typography.Title>
|
||||||
{extraFields.data?.map((field, index) => (
|
{extraFields.data?.map((field, index) => (
|
||||||
|
|||||||
4
client/src/pages/vendors/edit.tsx
vendored
4
client/src/pages/vendors/edit.tsx
vendored
@@ -112,9 +112,7 @@ export const VendorEdit: React.FC<IResourceComponentsProps> = () => {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber
|
<InputNumber addonAfter="g" precision={1} />
|
||||||
addonAfter="g"
|
|
||||||
precision={1}/>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Typography.Title level={5}>{t("settings.extra_fields.tab")}</Typography.Title>
|
<Typography.Title level={5}>{t("settings.extra_fields.tab")}</Typography.Title>
|
||||||
{extraFields.data?.map((field, index) => (
|
{extraFields.data?.map((field, index) => (
|
||||||
|
|||||||
9
client/src/pages/vendors/list.tsx
vendored
9
client/src/pages/vendors/list.tsx
vendored
@@ -7,7 +7,14 @@ import utc from "dayjs/plugin/utc";
|
|||||||
import { IVendor } from "./model";
|
import { IVendor } from "./model";
|
||||||
import { TableState, useInitialTableState, useStoreInitialState } from "../../utils/saveload";
|
import { TableState, useInitialTableState, useStoreInitialState } from "../../utils/saveload";
|
||||||
import { EditOutlined, EyeOutlined, FilterOutlined, PlusSquareOutlined } from "@ant-design/icons";
|
import { EditOutlined, EyeOutlined, FilterOutlined, PlusSquareOutlined } from "@ant-design/icons";
|
||||||
import { DateColumn, RichColumn, SortedColumn, ActionsColumn, CustomFieldColumn, NumberColumn } from "../../components/column";
|
import {
|
||||||
|
DateColumn,
|
||||||
|
RichColumn,
|
||||||
|
SortedColumn,
|
||||||
|
ActionsColumn,
|
||||||
|
CustomFieldColumn,
|
||||||
|
NumberColumn,
|
||||||
|
} from "../../components/column";
|
||||||
import { useLiveify } from "../../components/liveify";
|
import { useLiveify } from "../../components/liveify";
|
||||||
import { removeUndefined } from "../../utils/filtering";
|
import { removeUndefined } from "../../utils/filtering";
|
||||||
import { EntityType, useGetFields } from "../../utils/queryFields";
|
import { EntityType, useGetFields } from "../../utils/queryFields";
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import react from "@vitejs/plugin-react";
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import svgr from "vite-plugin-svgr";
|
import svgr from "vite-plugin-svgr";
|
||||||
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: '',
|
base: "",
|
||||||
plugins: [react(), svgr()],
|
plugins: [react(), svgr()],
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user