Browse Source

Merge pull request 'Dev-Farhan' (#140) from Dev-Farhan into general

Reviewed-on: ordo/adw-frontend#140
pull/2/head
farhantock 1 year ago
parent
commit
0bf1c5b901
  1. 4
      src/views/Dashboard/DashboardBOD.js
  2. 14
      src/views/Dashboard/DashboardProject.js
  3. 8
      src/views/Master/MasterMenu/DialogForm.js
  4. 7
      src/views/Master/MasterMenu/index.js
  5. 19
      src/views/Master/MasterRoles/DialogForm.js
  6. 9
      src/views/Master/MasterRoles/index.js
  7. 7
      src/views/Master/ProjectPhase/DialogForm.js
  8. 8
      src/views/Master/ProjectPhase/index.js
  9. 12
      src/views/Master/RoleProject/DialogForm.js
  10. 12
      src/views/Master/RoleProject/index.js
  11. 3
      src/views/Pages/Login/Login.js
  12. 293
      src/views/SimproV2/CreatedProyek/ReportAnalysis.js
  13. 30
      src/views/SimproV2/CreatedProyek/index.js
  14. 13
      src/views/SimproV2/Divisi/index.js
  15. 7
      src/views/SimproV2/ProjectType/DialogForm.js
  16. 7
      src/views/SimproV2/ProjectType/index.js
  17. 7
      src/views/SimproV2/ResourceWorker/DialogForm.js
  18. 8
      src/views/SimproV2/ResourceWorker/index.js
  19. 7
      src/views/SimproV2/Satuan/DialogForm.js
  20. 8
      src/views/SimproV2/Satuan/index.js

4
src/views/Dashboard/DashboardBOD.js

@ -666,8 +666,8 @@ const DashboardBOD = () => {
label: "", label: "",
// data: [50, 120, 72, 60], // data: [50, 120, 72, 60],
data: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.total).filter(value => value !== 0) : [], data: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.total).filter(value => value !== 0) : [],
borderColor: ["#023E8A", "#C851B7", "#FD7034", "#3A0CA3", "#A36A16"], borderColor: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.color) : [],
backgroundColor: ["#023E8A", "#C851B7", "#FD7034", "#3A0CA3", "#A36A16"], backgroundColor: PROJECT_VALUE_PER_DIVISION ? PROJECT_VALUE_PER_DIVISION.map((item, idx) => item.color) : [],
borderWidth: 2, borderWidth: 2,
borderSkipped: false borderSkipped: false
}, },

14
src/views/Dashboard/DashboardProject.js

@ -1018,7 +1018,7 @@ const DashboardProject = () => {
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Col span={8}> <Col span={24}>
<div <div
style={{ style={{
border: "solid", border: "solid",
@ -1143,7 +1143,7 @@ const DashboardProject = () => {
</div> </div>
</div> </div>
</Col> </Col>
<Col span={16}> {/* <Col span={16}>
<div <div
style={{ style={{
border: "solid", border: "solid",
@ -1366,7 +1366,7 @@ const DashboardProject = () => {
</div> </div>
</div> </div>
</div> </div>
</Col> </Col> */}
</Row> </Row>
<div <div
style={{ style={{
@ -1553,7 +1553,7 @@ const DashboardProject = () => {
</Row> </Row>
</Col> </Col>
</Row> </Row>
<Row> {/* <Row>
<Col span={24}> <Col span={24}>
<div <div
style={{ style={{
@ -1565,12 +1565,12 @@ const DashboardProject = () => {
marginBottom: 5, marginBottom: 5,
marginRight: 2, marginRight: 2,
}} }}
> > */}
{/* <div style={{color: '#000000', textAlign: 'center', marginBottom: 10, fontWeight: 'bold', fontSize: 12}}>Health By Schedule</div> {/* <div style={{color: '#000000', textAlign: 'center', marginBottom: 10, fontWeight: 'bold', fontSize: 12}}>Health By Schedule</div>
<div style={{backgroundColor: '#52AC0B', color: '#FFFFFF', padding: 5, borderRadius: 10, marginBottom: 10}}> <div style={{backgroundColor: '#52AC0B', color: '#FFFFFF', padding: 5, borderRadius: 10, marginBottom: 10}}>
<div style={{textAlign: 'center', fontWeight: 500, fontSize: 12}}>On Budget</div> <div style={{textAlign: 'center', fontWeight: 500, fontSize: 12}}>On Budget</div>
</div> */} </div> */}
<Row> {/* <Row>
<Col span={12}>Total Invoice</Col> <Col span={12}>Total Invoice</Col>
<Col span={12} style={{ textAlign: "right" }}> <Col span={12} style={{ textAlign: "right" }}>
{isReadyIntegrationInvoice ? ( {isReadyIntegrationInvoice ? (
@ -1626,7 +1626,7 @@ const DashboardProject = () => {
</Row> </Row>
</div> </div>
</Col> </Col>
</Row> </Row> */}
<Row> <Row>
<Col span={24}> <Col span={24}>
<div <div

8
src/views/Master/MasterMenu/DialogForm.js

@ -7,7 +7,7 @@ import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select const { Option } = Select
const company_id = window.localStorage.getItem('company_id');
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataMenu }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataMenu }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [name, setName] = useState('') const [name, setName] = useState('')
@ -68,7 +68,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
url, url,
sequence: parseInt(sequence), sequence: parseInt(sequence),
icon, icon,
alias_name: aliasName alias_name: aliasName,
company_id
} }
if (parentId && parentId > 0) { if (parentId && parentId > 0) {
@ -83,7 +84,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
url, url,
sequence: parseInt(sequence), sequence: parseInt(sequence),
icon, icon,
alias_name: aliasName alias_name: aliasName,
company_id
} }
if (parentId && parentId > 0) { if (parentId && parentId > 0) {

7
src/views/Master/MasterMenu/index.js

@ -10,7 +10,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import { Pagination, Tooltip, Table } from 'antd'; import { Pagination, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = window.localStorage.getItem('company_id');
const column = [ const column = [
{ name: "Nama" }, { name: "Nama" },
{ name: "Url" }, { name: "Url" },
@ -79,7 +79,7 @@ const Index = ({ params }) => {
arr.push(dataRes[v]) arr.push(dataRes[v])
} }
setAllDataMenu(arr); setAllDataMenu(arr);
}else { } else {
NotificationManager.error('Gagal Mengambil Data!!', 'Failed'); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} }
} }
@ -94,7 +94,8 @@ const Index = ({ params }) => {
const payload = { const payload = {
"paging": { "start": start, "length": rowsPerPage }, "paging": { "start": start, "length": rowsPerPage },
"columns": [ "columns": [
{ "name": "name", "logic_operator": "ilike", "value": search, "operator": "AND" } { "name": "name", "logic_operator": "ilike", "value": search, "operator": "AND" },
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
], ],
"joins": [{ "joins": [{
"name": "m_menu", "name": "m_menu",

19
src/views/Master/MasterRoles/DialogForm.js

@ -9,6 +9,7 @@ import { MENU_SEARCH } from '../../../const/ApiConst.js';
const { Option } = Select const { Option } = Select
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = localStorage.getItem("company_id")
const config = { const config = {
headers: headers:
{ {
@ -27,7 +28,8 @@ class DialogForm extends Component {
openDialog: false, openDialog: false,
isParentClick: false, isParentClick: false,
menu: [], menu: [],
selectedMenu: null selectedMenu: null,
company_id
} }
} }
@ -44,7 +46,8 @@ class DialogForm extends Component {
id: dataEdit.id, id: dataEdit.id,
name: dataEdit.name, name: dataEdit.name,
description: dataEdit.description, description: dataEdit.description,
selectedMenu: dataEdit.default_page selectedMenu: dataEdit.default_page,
company_id
}) })
} else { } else {
this.setState({ this.setState({
@ -96,26 +99,30 @@ class DialogForm extends Component {
id, id,
name, name,
description, description,
selectedMenu selectedMenu,
company_id
} = this.state } = this.state
let data = ''; let data = '';
const err = this.validation(); const err = this.validation();
if(!err) { if (!err) {
if (this.props.typeDialog === "Save") { if (this.props.typeDialog === "Save") {
data = { data = {
id, id,
name, name,
description, description,
selectedMenu selectedMenu,
company_id
} }
// console.log('data', data);
this.props.closeDialog('save', data); this.props.closeDialog('save', data);
} else { } else {
data = { data = {
id, id,
name, name,
description, description,
selectedMenu selectedMenu,
company_id
} }
this.props.closeDialog('edit', data); this.props.closeDialog('edit', data);
} }

9
src/views/Master/MasterRoles/index.js

@ -12,6 +12,8 @@ import { ROLE_ADD, ROLE_SEARCH, ROLE_EDIT, ROLE_DELETE, ROLEMENU_ADD, ROLEMENU_S
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = window.localStorage.getItem('company_id');
const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/"; const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/";
@ -55,6 +57,7 @@ class index extends Component {
tooltipTambah: false, tooltipTambah: false,
totalPage: 0, totalPage: 0,
typeDialog: 'Save', typeDialog: 'Save',
company_id: company_id
} }
this.columns = [ this.columns = [
@ -108,7 +111,8 @@ class index extends Component {
const formData = { const formData = {
"paging": { "start": start, "length": this.state.rowsPerPage }, "paging": { "start": start, "length": this.state.rowsPerPage },
"columns": [ "columns": [
{ "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND" } { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND" },
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }
], ],
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
@ -180,7 +184,8 @@ class index extends Component {
const formData = { const formData = {
name: data.name, name: data.name,
description: data.description, description: data.description,
default_page : data.selectedMenu default_page: data.selectedMenu,
company_id: company_id
} }
const result = await axios.post(ROLE_ADD, formData, config) const result = await axios.post(ROLE_ADD, formData, config)

7
src/views/Master/ProjectPhase/DialogForm.js

@ -8,6 +8,7 @@ import InputColor from "./InputColor";
import "./styles.css"; import "./styles.css";
import "rc-color-picker/assets/index.css"; import "rc-color-picker/assets/index.css";
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const company_id = localStorage.getItem("company_id")
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
const [projectType, setProjectType] = useState('') const [projectType, setProjectType] = useState('')
@ -31,14 +32,16 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: projectType, name: projectType,
color color,
company_id
} }
closeDialog('save', data); closeDialog('save', data);
} else { } else {
data = { data = {
id, id,
name: projectType, name: projectType,
color color,
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }

8
src/views/Master/ProjectPhase/index.js

@ -10,6 +10,7 @@ import { PROJECT_PHASE_ADD, PROJECT_PHASE_EDIT, PROJECT_PHASE_DELETE, PROJECT_PH
import { Pagination, Button, Tooltip, Table } from 'antd'; import { Pagination, Button, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = window.localStorage.getItem('company_id');
const config = { const config = {
headers: headers:
{ {
@ -20,6 +21,7 @@ const config = {
const ProjectPhase = ({ params }) => { const ProjectPhase = ({ params }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const company_id = localStorage.getItem("company_id")
/*const HEADER = { /*const HEADER = {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
@ -74,6 +76,12 @@ const ProjectPhase = ({ params }) => {
"logic_operator": "ilike", "logic_operator": "ilike",
"value": search, "value": search,
"operator": "AND" "operator": "AND"
},
{
"name": "company_id",
"logic_operator": "=",
"value": company_id,
"operator": "AND"
} }
], ],
"orders": { "orders": {

12
src/views/Master/RoleProject/DialogForm.js

@ -3,7 +3,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form, FormGroup, Label, Input } from 'reactstrap'; import { Button, Form, FormGroup, Label, Input } from 'reactstrap';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
const company_id = localStorage.getItem("company_id")
class DialogForm extends Component { class DialogForm extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -13,6 +13,7 @@ class DialogForm extends Component {
description: "", description: "",
openDialog: false, openDialog: false,
isParentClick: false, isParentClick: false,
company_id
} }
} }
@ -27,7 +28,8 @@ class DialogForm extends Component {
this.setState({ this.setState({
id: dataEdit.id, id: dataEdit.id,
name: dataEdit.name, name: dataEdit.name,
description: dataEdit.description description: dataEdit.description,
company_id
}) })
} else { } else {
this.setState({ this.setState({
@ -58,14 +60,16 @@ class DialogForm extends Component {
data = { data = {
id, id,
name, name,
description description,
company_id
} }
this.props.closeDialog('save', data); this.props.closeDialog('save', data);
} else { } else {
data = { data = {
id, id,
name, name,
description description,
company_id
} }
this.props.closeDialog('edit', data); this.props.closeDialog('edit', data);
} }

12
src/views/Master/RoleProject/index.js

@ -10,7 +10,7 @@ import { PROJECT_ROLE_ADD, PROJECT_ROLE_SEARCH, PROJECT_ROLE_EDIT, PROJECT_ROLE_
import { Pagination, Tooltip, Table } from 'antd'; import { Pagination, Tooltip, Table } from 'antd';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = localStorage.getItem("company_id")
const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/"; const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/";
const config = { const config = {
@ -60,6 +60,7 @@ class index extends Component {
tooltipTambah: false, tooltipTambah: false,
totalPage: 0, totalPage: 0,
typeDialog: 'Save', typeDialog: 'Save',
company_id
} }
this.columns = [ this.columns = [
{ {
@ -108,7 +109,8 @@ class index extends Component {
const formData = { const formData = {
"paging": { "start": start, "length": this.state.rowsPerPage }, "paging": { "start": start, "length": this.state.rowsPerPage },
"columns": [ "columns": [
{ "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND" } { "name": "name", "logic_operator": "ilike", "value": this.state.search, "operator": "AND" },
{ "name": "company_id", "logic_operator": "=", "value": this.state.company_id, "operator": "AND" }
], ],
"joins": [], "joins": [],
"orders": { "columns": ["id"], "ascending": false } "orders": { "columns": ["id"], "ascending": false }
@ -178,7 +180,8 @@ class index extends Component {
const formData = { const formData = {
name: data.name, name: data.name,
description: data.description description: data.description,
company_id
} }
const result = await axios.post(PROJECT_ROLE_ADD, formData, config) const result = await axios.post(PROJECT_ROLE_ADD, formData, config)
@ -198,7 +201,8 @@ class index extends Component {
const formData = { const formData = {
name: data.name, name: data.name,
description: data.description description: data.description,
company_id
} }
const url = PROJECT_ROLE_EDIT(data.id) const url = PROJECT_ROLE_EDIT(data.id)
const result = await axios.put(url, formData, config) const result = await axios.put(url, formData, config)

3
src/views/Pages/Login/Login.js

@ -129,7 +129,7 @@ class Login extends Component {
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
let resData = result.data.data let resData = result.data.data
this.setState({defaultPage: resData[0].join_first_url}) this.setState({ defaultPage: resData[0].join_first_url })
} }
} }
@ -215,6 +215,7 @@ class Login extends Component {
window.localStorage.setItem('user_id', data_user.id); window.localStorage.setItem('user_id', data_user.id);
window.localStorage.setItem('user_name', data_user.name); window.localStorage.setItem('user_name', data_user.name);
window.localStorage.setItem('role_id', data_user.role_id); window.localStorage.setItem('role_id', data_user.role_id);
window.localStorage.setItem('company_id', data_user.company_id);
} else { } else {
console.log("kode : ", doLogin.data.code); console.log("kode : ", doLogin.data.code);
// NotificationManager.error('Cek username atau password anda!', 'Gagal Login!'); // NotificationManager.error('Cek username atau password anda!', 'Gagal Login!');

293
src/views/SimproV2/CreatedProyek/ReportAnalysis.js

@ -0,0 +1,293 @@
import React, {useState, useEffect} from 'react'
import { Modal, ModalHeader, ModalBody, ModalFooter, Card, CardHeader, CardBody } from 'reactstrap';
import { TabContent, TabPane, Nav, NavItem, NavLink, Row, Col, Input } from 'reactstrap';
import { Button } from 'reactstrap';
import axios from "../../../const/interceptorApi";
import {
NotificationManager,
} from "react-notifications";
import { BASE_SIMPRO_LUMEN } from "../../../const/ApiConst";
import 'antd/dist/antd.css';
import './style.css'
import { Select, Table } from 'antd';
const { Option } = Select
const ReportAnalysis = ({ openDialog, closeDialog, toggleDialog, projectId }) => {
const token = localStorage.getItem("token");
const [activeTab, setActiveTab] = useState('1');
const [search, setSearch] = useState('');
const [avgActivity, setAvgActivity] = useState(0);
const [dataTable, setDatatable] = useState([]);
const [dataTableActivityToHr, setDataTableActivityToHr] = useState([]);
const [hrList, setHrList] = useState([]);
const [selectedHr, setSelectedHr] = useState(null);
const toggle = (tab) => {
if (activeTab !== tab) {
setActiveTab(tab);
}
};
const HEADER = {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
};
const columns = [
{title: "Activity", dataIndex: "name", key: "name"},
{title: "Gantt", dataIndex: "name_version", key: "name_version"},
{title: "Assign HR", dataIndex: "user_name", key: "user_name"},
{title: "Progress (%)", dataIndex: "persentase_progress", key: "persentase_progress"},
]
const columnActivityToHr = [
{title: "Activity", dataIndex: "join_third_name", key: "join_third_name"},
{title: "Human Resource", dataIndex: "join_second_name", key: "join_second_name"},
{title: "Report Date", dataIndex: "report_date", key: "report_date"},
{title: "Volume Actual", dataIndex: "qty", key: "qty"},
{title: "Volume Planned", dataIndex: "join_first_qty_planning", key: "join_first_qty_planning"},
{title: "Description", dataIndex: "description", key: "description"}
]
useEffect(() => {
if (search) {
getDataActivity()
}
}, [search]);
useEffect(() => {
if (selectedHr) {
getDataActivityToHr()
}
}, [selectedHr]);
useEffect(() => {
getDataHr()
}, []);
const handleSearch = (e) => {
const value = e.target.value;
setSearch(value);
};
const getDataHr = async () => {
const result = await axios
.get(`${BASE_SIMPRO_LUMEN}/human-resource/list`, HEADER)
.then((res) => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [];
setHrList(dataRes);
} else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
}
const getDataActivityToHr = async () => {
setAvgActivity(0);
let sum = 0;
const payload = {
columns: [
{
name: "user_id",
logic_operator: "=",
value: selectedHr,
operator: "AND",
},
{
name: "proyek_id",
logic_operator: "=",
value: projectId,
table_name: "m_activity",
operator: "AND",
}
],
joins: [
{
name: "assign_material_to_activity",
column_join: "assign_material_id",
column_results: ["qty_planning"]
},
{
name: "m_users",
column_join: "user_id",
column_results: ["name"]
},
{
name: "m_activity",
column_join: "activity_id",
column_results: ["name", "persentase_progress"]
}
],
orders: { columns: ["id"], ascending: false },
paging: { start: 0, length: -1 },
};
const result = await axios
.post(`${BASE_SIMPRO_LUMEN}/report-activity-material/search`, payload, HEADER)
.then((res) => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [];
dataRes.forEach(element => {
element.join_third_persentase_progress ? sum += parseInt(element.join_third_persentase_progress) : sum += 0;
});
setAvgActivity(sum / dataRes.length);
setDataTableActivityToHr(dataRes);
} else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
};
const getDataActivity = async () => {
setAvgActivity(0);
let sum = 0;
const payload = {
columns: [
{
name: "name",
logic_operator: "ilike",
value: search,
operator: "AND",
},
{
name: "proyek_id",
logic_operator: "=",
value: projectId,
operator: "AND",
},
],
orders: { columns: ["id"], ascending: false },
paging: { start: 0, length: -1 },
};
const result = await axios
.post(`${BASE_SIMPRO_LUMEN}/activity/search-analysis`, payload, HEADER)
.then((res) => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
let dataRes = result.data.data || [];
dataRes.forEach(element => {
element.persentase_progress ? sum += parseInt(element.persentase_progress) : sum += 0;
});
setAvgActivity(sum / dataRes.length);
setDatatable(dataRes);
} else {
NotificationManager.error("Gagal Mengambil Data!!", "Failed");
}
};
return (
<>
<Modal size="xl" isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>Project</ModalHeader>
<ModalBody>
<div>
<Nav tabs>
<NavItem>
<NavLink
className={activeTab === '1' ? "active" : null}
onClick={() => {
toggle('1');
}}
>
Activity
</NavLink>
</NavItem>
<NavItem>
<NavLink
className={activeTab === '2' ? "active" : null}
onClick={() => {
toggle('2');
}}
>
Human Resource
</NavLink>
</NavItem>
</Nav>
<TabContent activeTab={activeTab}>
<TabPane tabId="1">
<Card>
<CardHeader>
<Row>
<Col>
<Input
onChange={handleSearch}
value={search}
type="text"
name="search"
id="search"
placeholder={`Search Activity Name`}
style={{ width: 200 }}
/>
</Col>
</Row>
</CardHeader>
<CardBody>
<div style={{ textAlign: 'center' }}>
<h1>
{
search && avgActivity ? `Activity ${search} adalah ${avgActivity.toFixed(2)} %` : null
}
</h1>
</div>
<Table
size="small"
columns={columns}
dataSource={dataTable}
pagination={false}
rowKey={"id"}
/>
</CardBody>
</Card>
</TabPane>
<TabPane tabId="2">
<Card>
<CardHeader>
<Row>
<Col>
<Select showSearch value={selectedHr} onChange={(val) => setSelectedHr(val)} placeholder="Select Human Resource" filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
} style={{ width: '100%' }}>
{hrList && hrList.map(res => (
<Option key={res.id} value={res.id}>{`${res.name}`}</Option>
))}
</Select>
</Col>
</Row>
</CardHeader>
<CardBody>
<div style={{ textAlign: 'center' }}>
<h1>
{
selectedHr && avgActivity ? `Activity user ini adalah ${avgActivity.toFixed(2)} %` : null
}
</h1>
</div>
<Table
size="small"
columns={columnActivityToHr}
dataSource={dataTableActivityToHr}
pagination={false}
rowKey={"id"}
/>
</CardBody>
</Card>
</TabPane>
</TabContent>
</div>
</ModalBody>
<ModalFooter>
<Button color="primary" onClick={closeDialog}>Close</Button>
</ModalFooter>
</Modal>
</>
)
}
export default ReportAnalysis;

30
src/views/SimproV2/CreatedProyek/index.js

@ -87,6 +87,7 @@ import AssignHrProject from "./AsignHrProject";
import AssignCustProject from "./AsignCustProject"; import AssignCustProject from "./AsignCustProject";
import AssignK3Project from "./AssignK3Project"; import AssignK3Project from "./AssignK3Project";
import ViewProject from "./ViewProject"; import ViewProject from "./ViewProject";
import ReportAnalysis from "./ReportAnalysis";
import { Icon } from "@iconify/react"; import { Icon } from "@iconify/react";
// import { Link } from 'react-router-dom'; // import { Link } from 'react-router-dom';
// import SubProyekComp from './SubProyekComp'; // import SubProyekComp from './SubProyekComp';
@ -116,12 +117,14 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const [idTask, setidTask] = useState(0); const [idTask, setidTask] = useState(0);
const [projectId, setProjectId] = useState(0);
const [dataTable, setDatatable] = useState([]); const [dataTable, setDatatable] = useState([]);
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [totalPage, setTotalPage] = useState(0); const [totalPage, setTotalPage] = useState(0);
const [openDialog, setOpenDialog] = useState(false); const [openDialog, setOpenDialog] = useState(false);
const [openDialogViewDetail, setOpenDialogViewDetail] = useState(false); const [openDialogViewDetail, setOpenDialogViewDetail] = useState(false);
const [openDialogRA, setOpenDialogRA] = useState(false);
const [openDialogMaterial, setOpenDialogMaterial] = useState(false); const [openDialogMaterial, setOpenDialogMaterial] = useState(false);
const [openDialogTools, setOpenDialogTools] = useState(false); const [openDialogTools, setOpenDialogTools] = useState(false);
const [openDialogGantt, setOpenDialogGantt] = useState(false); const [openDialogGantt, setOpenDialogGantt] = useState(false);
@ -593,6 +596,13 @@ const CreatedProyek = ({ params, ...props }) => {
getProjectDetail(data.id); getProjectDetail(data.id);
}; };
const handleOpenReport = async (data) => {
setOpenDialogRA(true);
setProjectId(data.id);
}
const handleCloseReport = async (data) => {
setOpenDialogRA(false);
}
const getDataProject = async (proyek_id) => { const getDataProject = async (proyek_id) => {
const url = PROYEK_GET_ID(proyek_id); const url = PROYEK_GET_ID(proyek_id);
const result = await axios const result = await axios
@ -851,6 +861,7 @@ const CreatedProyek = ({ params, ...props }) => {
const toggleAddDialog = () => setOpenDialog(!openDialog); const toggleAddDialog = () => setOpenDialog(!openDialog);
const toggleAddDialogProyek = () => setOpenDialogProyek(!openDialogProyek); const toggleAddDialogProyek = () => setOpenDialogProyek(!openDialogProyek);
const toggleAddDialogRA = () => setOpenDialogRA(!openDialogRA);
const toggleAddDialogView = () => { const toggleAddDialogView = () => {
if (openDialogViewDetail) { if (openDialogViewDetail) {
setProjectApproval(null); setProjectApproval(null);
@ -1506,6 +1517,12 @@ const CreatedProyek = ({ params, ...props }) => {
</span> </span>
<span className="menu-text">S Curve</span> <span className="menu-text">S Curve</span>
</div> </div>
<div className="menu-list" onClick={() => handleOpenReport(text)}>
<span className="menu-icon">
<i className="fa fa-pie-chart"></i>
</span>
<span className="menu-text">Report Analysis</span>
</div>
{/* </Link> */} {/* </Link> */}
<div <div
className="menu-list" className="menu-list"
@ -1889,7 +1906,17 @@ const CreatedProyek = ({ params, ...props }) => {
), ),
[openDialogViewDetail] [openDialogViewDetail]
); );
const renderReportAnalysis = useMemo(
() => (
<ReportAnalysis
openDialog={openDialogRA}
closeDialog={handleCloseReport}
toggleDialog={toggleAddDialogRA}
projectId={projectId}
/>
),
[openDialogRA]
);
const renderDialogGantt = useMemo( const renderDialogGantt = useMemo(
() => ( () => (
<DialogGantt <DialogGantt
@ -1933,6 +1960,7 @@ const CreatedProyek = ({ params, ...props }) => {
Delete this data Delete this data
</SweetAlert> </SweetAlert>
{ViewProyek} {ViewProyek}
{renderReportAnalysis}
{RenderDialogForm} {RenderDialogForm}
{RenderDialogFormProyek} {RenderDialogFormProyek}
{RenderDialogFormMaterial} {RenderDialogFormMaterial}

13
src/views/SimproV2/Divisi/index.js

@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next';
const url = ""; const url = "";
const proyek_id = localStorage.getItem('proyek_id'); const proyek_id = localStorage.getItem('proyek_id');
const role_id = localStorage.getItem('role_id'); const role_id = localStorage.getItem('role_id');
const company_id = localStorage.getItem("company_id")
const format = "DD-MM-YYYY"; const format = "DD-MM-YYYY";
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const config = { const config = {
@ -95,6 +96,12 @@ const ProjectType = ({ params }) => {
logic_operator: "ilike", logic_operator: "ilike",
value: search, value: search,
operator: "AND" operator: "AND"
},
{
name: "company_id",
logic_operator: "=",
value: company_id,
operator: "AND"
} }
], ],
"orders": { "orders": {
@ -277,7 +284,7 @@ const ProjectType = ({ params }) => {
if (dataTable.length === 0) { if (dataTable.length === 0) {
return ( return (
<tr> <tr>
<td align="center" colSpan="3">{t('noData')}</td> <td align="center" colSpan="4">{t('noData')}</td>
</tr> </tr>
) )
} }
@ -359,8 +366,8 @@ const ProjectType = ({ params }) => {
<span className="fa fa-square" style={{ color: n.color }}></span> <span className="fa fa-square" style={{ color: n.color }}></span>
</Tooltip> </Tooltip>
</td> </td>
): ( ) : (
<td><small style={{ color:"grey",fontStyle:"italic" }}>No color set</small></td> <td><small style={{ color: "grey", fontStyle: "italic" }}>No color set</small></td>
)} )}
</tr> </tr>
) )

7
src/views/SimproV2/ProjectType/DialogForm.js

@ -9,6 +9,7 @@ import moment from 'moment';
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const { Option } = Select const { Option } = Select
const company_id = window.localStorage.getItem('company_id');
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
@ -39,7 +40,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: projectType, name: projectType,
description description,
company_id
} }
closeDialog('save', data); closeDialog('save', data);
@ -47,7 +49,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
data = { data = {
id, id,
name: projectType, name: projectType,
description description,
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }

7
src/views/SimproV2/ProjectType/index.js

@ -16,6 +16,7 @@ const proyek_id = localStorage.getItem('proyek_id');
const role_id = localStorage.getItem('role_id'); const role_id = localStorage.getItem('role_id');
const format = "DD-MM-YYYY"; const format = "DD-MM-YYYY";
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = window.localStorage.getItem('company_id');
const config = { const config = {
headers: headers:
{ {
@ -81,6 +82,12 @@ const ProjectType = ({ params }) => {
"logic_operator": "like", "logic_operator": "like",
"value": search, "value": search,
"operator": "AND" "operator": "AND"
},
{
"name": "company_id",
"logic_operator": "like",
"value": company_id,
"operator": "AND"
} }
], ],
"orders": { "orders": {

7
src/views/SimproV2/ResourceWorker/DialogForm.js

@ -12,6 +12,7 @@ import { useTranslation } from 'react-i18next';
const { Option } = Select const { Option } = Select
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = localStorage.getItem("company_id")
const config = { const config = {
headers: headers:
{ {
@ -117,7 +118,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
divisi_id: divisionId, divisi_id: divisionId,
address, address,
status_resource: statusResource, status_resource: statusResource,
status_boundary: statusRestriction status_boundary: statusRestriction,
company_id: company_id
} }
console.log(data) console.log(data)
@ -165,7 +167,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
divisi_id: divisionId, divisi_id: divisionId,
address, address,
status_resource: statusResource, status_resource: statusResource,
status_boundary: statusRestriction status_boundary: statusRestriction,
company_id: company_id
} }
if (birthDate && birthDate != "") { if (birthDate && birthDate != "") {

8
src/views/SimproV2/ResourceWorker/index.js

@ -28,6 +28,7 @@ const config = {
const ResourceWorker = ({ params }) => { const ResourceWorker = ({ params }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const company_id = localStorage.getItem("company_id")
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -171,6 +172,11 @@ const ResourceWorker = ({ params }) => {
"logic_operator": "~*", "logic_operator": "~*",
"value": search "value": search
}, },
{
"name": "company_id",
"logic_operator": "=",
"value": company_id
},
] ]
}, },
"joins": [ "joins": [
@ -232,7 +238,7 @@ const ResourceWorker = ({ params }) => {
const handleSync = async () => { const handleSync = async () => {
await axios.get(USER_SYNC, HEADER) await axios.get(USER_SYNC, HEADER)
.then(res => res) .then(res => res)
.catch((error)=>error.response) .catch((error) => error.response)
} }
const handleExportExcel = async () => { const handleExportExcel = async () => {

7
src/views/SimproV2/Satuan/DialogForm.js

@ -6,6 +6,7 @@ import {
import 'antd/dist/antd.css'; import 'antd/dist/antd.css';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const company_id = localStorage.getItem("company_id")
const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => { const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit }) => {
const [id, setId] = useState(0) const [id, setId] = useState(0)
@ -31,7 +32,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
if (typeDialog === "Save") { if (typeDialog === "Save") {
data = { data = {
name: name, name: name,
description description,
company_id
} }
closeDialog('save', data); closeDialog('save', data);
@ -39,7 +41,8 @@ const DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdi
data = { data = {
id, id,
name: name, name: name,
description description,
company_id
} }
closeDialog('edit', data); closeDialog('edit', data);
} }

8
src/views/SimproV2/Satuan/index.js

@ -10,6 +10,7 @@ import { SATUAN_ADD, SATUAN_EDIT, SATUAN_DELETE, SATUAN_SEARCH } from '../../../
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const token = window.localStorage.getItem('token'); const token = window.localStorage.getItem('token');
const company_id = window.localStorage.getItem('company_id');
const config = { const config = {
headers: headers:
{ {
@ -20,6 +21,7 @@ const config = {
const Satuan = ({ params }) => { const Satuan = ({ params }) => {
const token = localStorage.getItem("token") const token = localStorage.getItem("token")
const company_id = localStorage.getItem("company_id")
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -72,6 +74,12 @@ const Satuan = ({ params }) => {
"logic_operator": "ilike", "logic_operator": "ilike",
"value": search, "value": search,
"operator": "AND" "operator": "AND"
},
{
"name": "company_id",
"logic_operator": "=",
"value": company_id,
"operator": "AND"
} }
], ],
"orders": { "orders": {

Loading…
Cancel
Save