diff --git a/src/const/ApiConst.js b/src/const/ApiConst.js index f964656..07b56d8 100644 --- a/src/const/ApiConst.js +++ b/src/const/ApiConst.js @@ -464,8 +464,8 @@ export const PANIC_BUTTON_UPDATE = (id) => { return `${BASE_SIMPRO_LUMEN}/panic- export const HIERARCHY_FTTH_GET = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths` export const HIERARCHY_FTTH_ADD = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths` export const HIERARCHY_FTTH_SEARCH = `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/search` -export const HIERARCHY_FTTH_SHOW = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`} -export const HIERARCHY_FTTH_UPDATE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`} -export const HIERARCHY_FTTH_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}`} - +export const HIERARCHY_FTTH_SHOW = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}` } +export const HIERARCHY_FTTH_UPDATE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}` } +export const HIERARCHY_FTTH_DELETE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/${id}` } +export const HIERARCHY_FTTH_TREE = (id) => { return `${BASE_SIMPRO_LUMEN}/hierarchy-ftths/tree/${id}` } export const WAYPOINT_SEARCH = `${BASE_SIMPRO_LUMEN}/waypoint/search` diff --git a/src/views/SimproV2/CreatedProyek/DIalogFormHierarchy.js b/src/views/SimproV2/CreatedProyek/DIalogFormHierarchy.js new file mode 100644 index 0000000..11296b5 --- /dev/null +++ b/src/views/SimproV2/CreatedProyek/DIalogFormHierarchy.js @@ -0,0 +1,117 @@ +import React, { useEffect, useState } from 'react' +import { + Modal, ModalHeader, ModalBody, ModalFooter, + Button, Form, FormGroup, Label, Input, Col, Row +} from 'reactstrap'; +import { DatePicker, Tooltip, Select } from 'antd'; +import { formatRupiah, formatNumber } from '../../../const/CustomFunc' +import moment from 'moment'; +import 'antd/dist/antd.css'; +import { useTranslation } from 'react-i18next'; + +const DialogFormHierarchy = ({ openDialog, closeDialog, toggleDialog, typeDialog, parentId, idProject }) => { + const [id, setId] = useState(0) + const [nameDaerah, setNameDaerah] = useState('') + const [nameArea, setNameArea] = useState('') + const { t } = useTranslation(); + const handleSaveDaerah = () => { + let data = ''; + if (typeDialog === "Save") { + data = { + project_id: idProject, + name: nameDaerah, + } + closeDialog('save', data); + } else { + data = { + id, + name: nameDaerah, + } + closeDialog('edit', data); + } + + } + const handleSaveArea = () => { + let data = ''; + if (typeDialog === "SaveArea") { + data = { + project_id: idProject, + name: nameArea, + } + + if (parentId && parentId > 0) { + data['parent_id'] = parentId + } + closeDialog('save', data); + } else { + data = { + id, + project_id: idProject, + parent_id: parentId, + name: nameArea, + } + closeDialog('edit', data); + } + + } + + const handleCancel = () => { + closeDialog('cancel', 'none') + } + const renderFormDaerah = () => { + return ( +
+ ) + } + const renderFormArea = () => { + return ( + + ) + } + return ( + <> + {typeDialog === "SaveArea" ? ( +