diff --git a/src/views/Dashboard/DashboardBOD.js b/src/views/Dashboard/DashboardBOD.js
index 110fb0d..87625f3 100644
--- a/src/views/Dashboard/DashboardBOD.js
+++ b/src/views/Dashboard/DashboardBOD.js
@@ -613,8 +613,8 @@ const DashboardBOD = () => {
label: "",
// data: [7, 2, 4, 3],
data: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.total) : [],
- borderColor: ["#023E8A", "#C851B7", "#FD7034", "#3A0CA3", "#A36A16"],
- backgroundColor: ["#023E8A", "#C851B7", "#FD7034", "#3A0CA3", "#A36A16"],
+ borderColor: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.color) : [],
+ backgroundColor: PROJECT_PER_DIVISION ? PROJECT_PER_DIVISION.map((item, idx) => item.color) : [],
borderWidth: 2,
borderSkipped: false
},
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)} />
+
+
+
)
}
diff --git a/src/views/SimproV2/Divisi/InputColor.js b/src/views/SimproV2/Divisi/InputColor.js
new file mode 100644
index 0000000..ff2f865
--- /dev/null
+++ b/src/views/SimproV2/Divisi/InputColor.js
@@ -0,0 +1,46 @@
+import React from "react";
+import Input from "antd/lib/input";
+import Button from "antd/lib/button";
+import Dropdown from "antd/lib/dropdown";
+import { Panel } from 'rc-color-picker'
+import "antd/dist/antd.css";
+import "./styles.css";
+
+export default function InputColor(props) {
+ const { color, onChange } = props;
+
+ const [internalColor, setInternalColor] = React.useState(color);
+
+ const handleChange = (color) => {
+ setInternalColor(color.color);
+
+ if (onChange) {
+ onChange(color);
+ }
+ };
+
+ const overlay = (
+
+ );
+
+ return (
+ <>
+ setInternalColor(e.target.value)}
+ suffix={
+
+
+
+ }
+ />
+ >
+ );
+}
+
diff --git a/src/views/SimproV2/Divisi/index.js b/src/views/SimproV2/Divisi/index.js
index 16b43bd..17e576a 100644
--- a/src/views/SimproV2/Divisi/index.js
+++ b/src/views/SimproV2/Divisi/index.js
@@ -25,6 +25,7 @@ const config = {
const column = [
{ name: "Nama" },
{ name: "Deskripsi" },
+ { name: "Color" },
]
const ProjectType = ({ params }) => {
@@ -99,7 +100,7 @@ const ProjectType = ({ params }) => {
"orders": {
"ascending": true,
"columns": [
- 'id'
+ 'name'
]
},
"paging": {
@@ -351,7 +352,16 @@ const ProjectType = ({ params }) => {
{n.name} |
- {n.description} |
+ {n.description ?? '-'} |
+ {n.color != null ? (
+
+
+
+
+ |
+ ): (
+ No color set |
+ )}
)
})}
diff --git a/src/views/SimproV2/Divisi/styles.css b/src/views/SimproV2/Divisi/styles.css
new file mode 100644
index 0000000..d48cce6
--- /dev/null
+++ b/src/views/SimproV2/Divisi/styles.css
@@ -0,0 +1,41 @@
+.App {
+ font-family: sans-serif;
+ padding: 20px;
+}
+
+h2 {
+ margin-top: 40px;
+}
+
+.rc-color-picker-panel {
+ border: 1px solid #ccc;
+}
+.rc-color-picker-panel-inner {
+ border: none;
+ box-shadow: none;
+}
+.rc-color-picker-panel-board-hsv {
+ border-radius: 12px;
+ outline: none;
+}
+.rc-color-picker-panel-board-value {
+ border: none;
+ border-radius: 12px;
+}
+.rc-color-picker-panel-board-saturation {
+ border: none;
+ border-radius: 12px;
+}
+.rc-color-picker-panel-ribbon {
+ border-radius: 12px;
+}
+.rc-color-picker-panel-wrap-preview {
+ border-radius: 12px;
+}
+.rc-color-picker-panel-preview span {
+ border-radius: 12px;
+}
+.rc-color-picker-panel-preview input {
+ border-radius: 12px;
+}
+