diff --git a/src/views/SimproV2/Divisi/DialogForm.js b/src/views/SimproV2/Divisi/DialogForm.js index 62ce6c2..ee43a37 100644 --- a/src/views/SimproV2/Divisi/DialogForm.js +++ b/src/views/SimproV2/Divisi/DialogForm.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react' import { - Modal, ModalHeader, ModalBody, ModalFooter, - Button, Form, FormGroup, Label, Input, Col, Row + Modal, ModalHeader, ModalBody, ModalFooter, + Button, Form, FormGroup, Label, Input, Col, Row } from 'reactstrap'; import { Select } from 'antd'; import 'antd/dist/antd.css'; @@ -10,30 +10,30 @@ 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 DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataDivisions, company_id }) => { + 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 { t } = useTranslation() - const onChangeParent = (val) => { - setParent(val) - } + const onChangeParent = (val) => { + setParent(val) + } - useEffect(() => { - if (typeDialog === "Edit") { - setId(dataEdit.id) - setDescription(dataEdit.description) - setName(dataEdit.name) + useEffect(() => { + if (typeDialog === "Edit") { + setId(dataEdit.id) + setDescription(dataEdit.description) + setName(dataEdit.name) setParent(dataEdit.parent) setColor(dataEdit.color) - } else { - setId(0) + } else { + setId(0) setColor('') - } - }, [dataEdit, openDialog]) + } + }, [dataEdit, openDialog]) const validation = () => { if (!name || name === "") { @@ -51,7 +51,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi name, description, parent, - color + color, + company_id } closeDialog('save', data); } else { @@ -60,7 +61,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi name, description, parent, - color + color, + company_id } closeDialog('edit', data); } @@ -70,34 +72,34 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi setParent(null) setColor('') } - } - const handleCancel = () => { - closeDialog('cancel', 'none') - setId(0) - setDescription('') + } + const handleCancel = () => { + closeDialog('cancel', 'none') + setId(0) + setDescription('') setName('') setParent(null) - } + } - const renderForm = () => { - return ( -
- ) - } + + ) + } - return ( - <> -