unit template
This commit is contained in:
1 parent
c15e69f7b5
commit
3bea468d23
11 files changed
+391
-4
No files matched your search
@@ -13,6 +13,7 @@ import { UnitCopyDialog } from "./unitCopyDialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { api_units_delete } from "@/actions/rk2/api-units";
|
||||
import { SaveTemplateDialog } from './saveTemplateDialog';
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +34,7 @@ export const UnitEdit = ({ anlage, groups, selectedUnit, componentTypes,componen
|
||||
const { getGroupById } = useGroups({ groups });
|
||||
const [showSelectGroup, setShowSelectGroup] = useState(false);
|
||||
const [showCopy, setShowCopy] = useState(false);
|
||||
const [showTemplate, setShowTemplate] = useState(false);
|
||||
const [showDelete, setShowDelete] = useState(false);
|
||||
const [deleting, setDeleting] = useState(false);
|
||||
const [deleteError, setDeleteError] = useState('');
|
||||
@@ -83,6 +85,8 @@ export const UnitEdit = ({ anlage, groups, selectedUnit, componentTypes,componen
|
||||
|
||||
return (
|
||||
<div className="" >
|
||||
{selectedUnit && <Button className="mb-4 mr-2" type="button" variant="secondary" onClick={() => setShowTemplate(true)}>Als Vorlage speichern</Button>}
|
||||
{showTemplate && selectedUnit && <SaveTemplateDialog unit={selectedUnit} onClose={() => setShowTemplate(false)} />}
|
||||
{selectedUnit && <Button className="mb-4" type="button" variant="secondary" onClick={() => setShowCopy(true)}>Unit kopieren</Button>}
|
||||
{showCopy && selectedUnit && <UnitCopyDialog unit={selectedUnit} groups={groups} onClose={() => setShowCopy(false)} />}
|
||||
{selectedUnit && <Button className="mb-4 ml-2" type="button" variant="secondary" onClick={() => { setDeleteError(''); setShowDelete(true); }}>Unit löschen</Button>}
|
||||
|
||||
Reference in new issue
Block a user