@@ -217,6 +217,9 @@
|
||||
},
|
||||
"form": {
|
||||
"filament_updated": "This filament has been updated by someone/something else since you opened this page. Saving will overwrite those changes!"
|
||||
},
|
||||
"buttons": {
|
||||
"add_spool": "Add Spool"
|
||||
}
|
||||
},
|
||||
"vendor": {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Table, Button, Dropdown } from "antd";
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc";
|
||||
import { IFilament } from "./model";
|
||||
import { EditOutlined, EyeOutlined, FilterOutlined, PlusSquareOutlined } from "@ant-design/icons";
|
||||
import { EditOutlined, EyeOutlined, FileOutlined, FilterOutlined, PlusSquareOutlined } from "@ant-design/icons";
|
||||
import { TableState, useInitialTableState, useStoreInitialState } from "../../utils/saveload";
|
||||
import {
|
||||
DateColumn,
|
||||
@@ -146,10 +146,12 @@ export const FilamentList: React.FC<IResourceComponentsProps> = () => {
|
||||
}
|
||||
|
||||
const { editUrl, showUrl, cloneUrl } = useNavigation();
|
||||
const filamentAddSpoolUrl = (id: number): string => `/spool/create?filament_id=${id}`;
|
||||
const actions = (record: IFilamentCollapsed) => [
|
||||
{ name: t("buttons.show"), icon: <EyeOutlined />, link: showUrl("filament", record.id) },
|
||||
{ name: t("buttons.edit"), icon: <EditOutlined />, link: editUrl("filament", record.id) },
|
||||
{ name: t("buttons.clone"), icon: <PlusSquareOutlined />, link: cloneUrl("filament", record.id) },
|
||||
{ name: t("filament.buttons.add_spool"), icon: <FileOutlined />, link: filamentAddSpoolUrl(record.id) },
|
||||
];
|
||||
|
||||
const commonProps = {
|
||||
|
||||
@@ -47,6 +47,13 @@ export const SpoolCreate: React.FC<IResourceComponentsProps & CreateOrCloneProps
|
||||
formProps.initialValues.filament_id = formProps.initialValues.filament.id;
|
||||
}
|
||||
|
||||
// If the query variable filament_id is set, set the filament_id field to that value
|
||||
const query = new URLSearchParams(window.location.search);
|
||||
const filament_id = query.get("filament_id");
|
||||
if (filament_id) {
|
||||
formProps.initialValues.filament_id = parseInt(filament_id);
|
||||
}
|
||||
|
||||
const handleSubmit = async (redirectTo: "list" | "edit" | "create") => {
|
||||
const values = StringifiedExtras(await form.validateFields());
|
||||
if (quantity > 1) {
|
||||
|
||||
Reference in New Issue
Block a user