diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json
index fd5823d..ae191c2 100644
--- a/client/public/locales/en/common.json
+++ b/client/public/locales/en/common.json
@@ -69,7 +69,8 @@
"list": "List",
"create": "Create",
"edit": "Edit",
- "show": "Show"
+ "show": "Show",
+ "clone": "Clone"
},
"buttons": {
"create": "Create",
diff --git a/client/src/App.tsx b/client/src/App.tsx
index cd349d2..ad355e5 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -19,7 +19,13 @@ import { useTranslation } from "react-i18next";
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";
import { Header } from "./components/header";
import { ColorModeContextProvider } from "./contexts/color-mode";
-import { SpoolCreate, SpoolEdit, SpoolList, SpoolShow } from "./pages/spools";
+import {
+ SpoolClone,
+ SpoolCreate,
+ SpoolEdit,
+ SpoolList,
+ SpoolShow,
+} from "./pages/spools";
import {
FilamentCreate,
FilamentEdit,
@@ -82,6 +88,7 @@ function App() {
name: "spool",
list: "/spool",
create: "/spool/create",
+ clone: "/spool/clone/:id",
edit: "/spool/edit/:id",
show: "/spool/show/:id",
meta: {
@@ -146,6 +153,7 @@ function App() {
} />
} />
+ } />
} />
} />
diff --git a/client/src/pages/spools/clone.tsx b/client/src/pages/spools/clone.tsx
new file mode 100644
index 0000000..f27125e
--- /dev/null
+++ b/client/src/pages/spools/clone.tsx
@@ -0,0 +1,130 @@
+import React from "react";
+import { IResourceComponentsProps } from "@refinedev/core";
+import { Create, useForm, useSelect } from "@refinedev/antd";
+import { Form, Input, DatePicker, Select, InputNumber } from "antd";
+import dayjs from "dayjs";
+import TextArea from "antd/es/input/TextArea";
+import { IFilament } from "../filaments/model";
+
+export const SpoolClone: React.FC = () => {
+ const { formProps, saveButtonProps, formLoading } = useForm();
+
+ if (formProps.initialValues) {
+ formProps.initialValues.first_used = null;
+ formProps.initialValues.last_used = null;
+ formProps.initialValues.used_weight = 0;
+ formProps.initialValues.filament_id = formProps.initialValues.filament.id;
+ }
+
+ const { queryResult } = useSelect({
+ resource: "filament",
+ });
+
+ const filamentOptions = queryResult.data?.data.map((item) => {
+ let label;
+ if (item.vendor) {
+ label = `${item.vendor.name} - ${item.name}`;
+ } else {
+ label = item.name;
+ }
+
+ return {
+ label: label,
+ value: item.id,
+ };
+ });
+
+ return (
+
+ ({
+ value: value ? dayjs(value) : undefined,
+ })}
+ >
+
+
+ ({
+ value: value ? dayjs(value) : undefined,
+ })}
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/client/src/pages/spools/index.ts b/client/src/pages/spools/index.ts
index a2c167c..6961b53 100644
--- a/client/src/pages/spools/index.ts
+++ b/client/src/pages/spools/index.ts
@@ -1,3 +1,4 @@
+export { SpoolClone } from "./clone";
export { SpoolCreate } from "./create";
export { SpoolEdit } from "./edit";
export { SpoolList } from "./list";
diff --git a/client/src/pages/spools/list.tsx b/client/src/pages/spools/list.tsx
index a81ed95..d9c742c 100644
--- a/client/src/pages/spools/list.tsx
+++ b/client/src/pages/spools/list.tsx
@@ -7,6 +7,7 @@ import {
ShowButton,
DateField,
TextField,
+ CloneButton,
} from "@refinedev/antd";
import { Table, Space } from "antd";
import { NumberFieldUnit } from "../../components/numberField";
@@ -100,6 +101,7 @@ export const SpoolList: React.FC = () => {
+
)}
/>