From c9267b0a424fd77ea61bb121cc12742c644ef43e Mon Sep 17 00:00:00 2001 From: wahyuun Date: Mon, 16 Oct 2023 11:00:22 +0700 Subject: [PATCH] add form color --- src/views/SimproV2/Divisi/DialogForm.js | 59 ++++++++++++++++--------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/src/views/SimproV2/Divisi/DialogForm.js b/src/views/SimproV2/Divisi/DialogForm.js index 27ba40d..62ce6c2 100644 --- a/src/views/SimproV2/Divisi/DialogForm.js +++ b/src/views/SimproV2/Divisi/DialogForm.js @@ -6,12 +6,16 @@ import { import { Select } from 'antd'; import 'antd/dist/antd.css'; import { useTranslation } from 'react-i18next'; +import InputColor from "./InputColor"; +import "./styles.css"; +import "rc-color-picker/assets/index.css"; const { Option } = Select const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataDivisions }) => { const [id, setId] = useState(0) const [name, setName] = useState('') const [parent, setParent] = useState(null) const [description, setDescription] = useState('') + const [color, setColor] = useState('') const { t } = useTranslation() const onChangeParent = (val) => { @@ -23,9 +27,11 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi setId(dataEdit.id) setDescription(dataEdit.description) setName(dataEdit.name) - setParent(dataEdit.parent) + setParent(dataEdit.parent) + setColor(dataEdit.color) } else { setId(0) + setColor('') } }, [dataEdit, openDialog]) @@ -42,17 +48,19 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi if (!err) { if (typeDialog === "Save") { data = { - name: name, + name, description, - parent + parent, + color } closeDialog('save', data); } else { data = { id, - name: name, + name, description, - parent + parent, + color } closeDialog('edit', data); } @@ -60,6 +68,7 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi setDescription('') setName('') setParent(null) + setColor('') } } const handleCancel = () => { @@ -91,22 +100,22 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi - - - - - - - + + + + + + + @@ -114,6 +123,14 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi + + + + + setColor(e.color)} /> + + + ) }