Browse Source

merge

pull/1/head
root 1 year ago
parent
commit
e15177d586
  1. 2
      src/routes.js
  2. 53
      src/services/api/modules/project/index.js
  3. 10
      src/views/Dashboard/DashboardBOD.js
  4. 1007
      src/views/Dashboard/DashboardProjectCarousell.js
  5. 33
      src/views/MapMonitoring/index.js
  6. 84
      src/views/Master/MasterRoles/DialogForm.js
  7. 64
      src/views/Master/MasterRoles/DialogMenuRoles.js
  8. 6
      src/views/Master/MasterRoles/index.js
  9. 51
      src/views/Report/k3/index.js
  10. 8
      src/views/SimproV2/ChecklistK3/DialogForm.js
  11. 1
      src/views/SimproV2/ChecklistK3/index.js
  12. 3
      src/views/SimproV2/CreatedProyek/AsignCustProject.js
  13. 29
      src/views/SimproV2/CreatedProyek/AsignHrProject.js
  14. 5
      src/views/SimproV2/CreatedProyek/DialogAssignCust.js
  15. 21
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  16. 11
      src/views/SimproV2/CreatedProyek/DialogUserGantt.js
  17. 86
      src/views/SimproV2/CreatedProyek/index.js
  18. 8
      src/views/SimproV2/Divisi/DialogForm.js
  19. 26
      src/views/SimproV2/Divisi/index.js
  20. 34
      src/views/SimproV2/ResourceWorker/index.js

2
src/routes.js

@ -56,7 +56,7 @@ const routes = [
{ path: '/dashboard', name: 'DashboardBOD', component: DashboardBOD },
{ path: '/dashboard-customer/:PROJECT_ID/:GANTT_ID/:SCURVE', name: 'DashboardCustomer', component: DashboardCustomer },
{ path: '/dashboard-project/:PROJECT_ID/:GANTT_ID', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/dashboard-project-carousell', exact: true, name: 'Dashboard Project Carousell', component: DashboardProjectCarousell },
{ path: '/dashboard-perproject', exact: true, name: 'Dashboard Project Carousell', component: DashboardProjectCarousell },
{ path: '/dashboard-project/:PROJECT_ID/:GANTT_ID/:SCURVE', exact: true, name: 'Dashboard Project', component: DashboardProject },
{ path: '/projects', exact: true, name: 'Projects', component: CreatedProyek },
{ path: '/projects/:id/import/activity', exact: true, name: 'Gantt Import Activity', component: GanttImportActivity },

53
src/services/api/modules/project/index.js

@ -2,34 +2,33 @@ import { BASE_SIMPRO_LUMEN } from "../../../../const/ApiConst";
import RequestApi from '../../base';
export default class ApiProject extends RequestApi {
static async list() {
static async search(role_id) {
// const user_id = store.getState().userReducer && store.getState().userReducer.user && store.getState().userReducer.user.data_user ? store.getState().userReducer.user.data_user.id : 0;
const URL = `${BASE_SIMPRO_LUMEN}/project/list`
// const payload = {
// "paging": { "start": 0, "length": 25 },
// // "columns": [
// // { "name": "user_id", "logic_operator": "=", "value": user_id }
// // ],
// // "joins": [
// // {
// // "name": "m_proyek",
// // "column_join": "proyek_id",
// // "column_results": [
// // "nama", "kode_sortname", "mulai_proyek", "akhir_proyek"
// // ]
// // },
// // {
// // "name": "m_activity",
// // "column_join": "activity_id",
// // "column_results": [
// // "name", "start_date", "end_date", "persentase_progress"
// // ]
// // }
// // ],
// "orders": { "columns": ["id"], "ascending": false }
// }
return await RequestApi.Request().get(
URL,
const URL = `${BASE_SIMPRO_LUMEN}/project/search`
let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
const payload = {
columns: [],
select: [
"id",
"nama",
"kode_sortname",
"type_proyek_id",
"currency_symbol",
"mulai_proyek",
"akhir_proyek",
],
orders: { columns: ["nama"], ascending: true },
paging: { start: 0, length: -1 },
};
if (parseInt(role_id) !== 70) {
payload["columns"] = [
{ name: "created_by_id", logic_operator: "IN", value: hierarchy, operator: "AND" }
];
}
return await RequestApi.Request().post(
URL, payload,
RequestApi.HeaderWithToken()).then(res => {
if (res) {
if (res && res.data && res.data.data) {

10
src/views/Dashboard/DashboardBOD.js

@ -132,7 +132,7 @@ const DashboardBOD = (props) => {
}
if (result.status !== 200) {
NotificationManager.error(`${content} ${result.data.message}`, "Failed");
// NotificationManager.error(`${content} ${result.data.message}`, "Failed");
SET_READY_PROJECT_BY_SCHEDULE_HEALTH(true)
return;
}
@ -203,7 +203,7 @@ const DashboardBOD = (props) => {
}
if (result.status !== 200) {
NotificationManager.error(`${content} ${result.data.message}`, "Failed");
// NotificationManager.error(`${content} ${result.data.message}`, "Failed");
SET_READY_PROJECT_SCHEDULE_BUDGET_HEALTH_PER_DIVISION(true);
return;
}
@ -378,7 +378,7 @@ const DashboardBOD = (props) => {
return (
<BottomModal
isReady={READY_TABLE_DETAIL_EXPENDITURE}
title="Detail Project Expenditure"
title="Detail Project"
tableHeader={[
{ title: "Project Code", key: "kode_sortname" },
{ title: "Project Name", key: "project_name" },
@ -433,9 +433,9 @@ const DashboardBOD = (props) => {
</div>
</div>
<div style={{ flex: 6, display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Link to="/dashboard-project-carousell" style={{ textDecoration: 'none' }}>
<Link to="/dashboard-perproject" style={{ textDecoration: 'none' }}>
<div style={{ backgroundColor: '#DDDDDD', color: '#4C4747', borderRadius: 5, padding: 4, fontWeight: 500, cursor: 'pointer', fontSize: 12, textAlign: 'center', lineHeight: 'normal' }}>
View All Gantt
All Dashboard
</div>
</Link>
</div>

1007
src/views/Dashboard/DashboardProjectCarousell.js

File diff suppressed because it is too large Load Diff

33
src/views/MapMonitoring/index.js

@ -15,7 +15,7 @@ import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import './MapMonitoring.css';
import { BASE_SIMPRO_LUMEN_IMAGE } from '../../const/ApiConst';
import { BASE_SIMPRO_LUMEN_IMAGE, PROYEK_SEARCH } from '../../const/ApiConst';
import DEFAULT_USER_ICON from '../../assets/img/avatars/user.png';
import pinRouteStart from '../../assets/img/map/pin_route_green.png';
import pinRouteEnd from '../../assets/img/map/pin_route_red.png';
@ -26,9 +26,28 @@ import 'leaflet.markercluster/dist/leaflet.markercluster.js'
import 'leaflet-control-geocoder/dist/Control.Geocoder.css'
import 'leaflet-control-geocoder/dist/Control.Geocoder.js'
import moment from 'moment';
import axios from "../../const/interceptorApi";
const MapMonitoring = ({ ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id;
user_id = props.location.state.user_id;
token = props.location.state.token;
isLogin = props.location.state.isLogin;
const MapMonitoring = () => {
} else {
role_id = localStorage.getItem("role_id");
proyek_id = localStorage.getItem("proyek_id");
user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin");
}
const HEADER = {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
};
const GRID_LEFT = 6;
const GRID_MIDDLE = 12;
const GRID_RIGHT = 6;
@ -155,9 +174,11 @@ const MapMonitoring = () => {
// init for left content panel, get projects and build tree select antd
const getMapLeftContent = async () => {
store.dispatch(setMapLoading(true));
let project = await ApiProject.list();
// console.log('project', project);
if (project && project.status && project.data && project.data.length > 0) {
let project = await ApiProject.search(role_id);
// console.log('projectsearch', projectsearch.data.data);
console.log('project', project);
if (project && project.data && project.data.length > 0) {
let projectData = [
{
"title": 'All',

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

@ -5,7 +5,7 @@ import 'antd/dist/antd.css';
import { withTranslation } from 'react-i18next';
import axios from 'axios';
import { Select } from 'antd';
import { MENU_COMPANY_SEARCH, MENU_SEARCH } from '../../../const/ApiConst.js';
import { MENU_SEARCH } from '../../../const/ApiConst.js';
const { Option } = Select
const token = window.localStorage.getItem('token');
@ -18,7 +18,6 @@ const config = {
}
};
class DialogForm extends Component {
constructor(props) {
super(props)
@ -30,6 +29,8 @@ class DialogForm extends Component {
isParentClick: false,
menu: [],
selectedMenu: null,
all_project: false,
company_id
}
}
@ -53,7 +54,8 @@ class DialogForm extends Component {
id: 0,
name: "",
description: "",
selectedMenu: null
selectedMenu: null,
company_id
})
}
this.setState({ isParentClick: false });
@ -61,49 +63,12 @@ class DialogForm extends Component {
}
getAllMenu = async () => {
const { companyID } = this.props;
const { roleName } = this.props;
if (roleName !== "Super Admin") {
const payload = {
"paging": {
"start": 0,
"length": -1
},
"columns": [{
"name": "company_id",
"logic_operator": "=",
"value": companyID,
"operator": "AND"
}],
"joins": [{
"name": "m_menu",
"column_join": "menu_id",
"column_results": [
"name"
]
}],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.post(MENU_COMPANY_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ menu: result.data.data });
}
} else {
const payload = {
"paging": {
"start": 0,
"length": -1
},
"columns": [{
"name": "name",
"logic_operator": "ilike",
"value": "",
"operator": "AND"
}],
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" }
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
@ -115,8 +80,6 @@ class DialogForm extends Component {
}
}
}
showDialog = () => {
this.setState({ isParentClick: true });
}
@ -133,13 +96,13 @@ class DialogForm extends Component {
}
handleSave = () => {
const { companyID } = this.props;
const {
id,
name,
description,
selectedMenu,
company_id,
all_project
} = this.state
let data = '';
@ -151,7 +114,8 @@ class DialogForm extends Component {
name,
description,
selectedMenu,
company_id: companyID
company_id,
all_project
}
// console.log('data', data);
this.props.closeDialog('save', data);
@ -161,7 +125,8 @@ class DialogForm extends Component {
name,
description,
selectedMenu,
company_id: companyID
company_id,
all_project
}
this.props.closeDialog('edit', data);
}
@ -206,13 +171,28 @@ class DialogForm extends Component {
}}>
{this.state.menu.map((item) => (
<option key={item.id} value={item.id}>
{item.name ?? item.join_first_name}
{item.name}
</option>
))}
</Input>
</FormGroup>
</Col>
</Row>
<FormGroup check>
<Input
id="checkedAllProject"
name="checkedAllProject"
checked={this.state.all_project}
onChange={(e) => this.setState({ all_project: e.target.checked })}
type="checkbox"
/>
<Label
check
for="checkedAllProject"
>
See All Project
</Label>
</FormGroup>
</Form >
)
}

64
src/views/Master/MasterRoles/DialogMenuRoles.js

@ -3,8 +3,9 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Row, Col, Table } from 'rea
import { Button, Form, FormGroup, Label, Input } from 'reactstrap';
import 'antd/dist/antd.css';
import axios from 'axios';
import { MENU_COMPANY_SEARCH, MENU_SEARCH } from '../../../const/ApiConst.js';
import { MENU_SEARCH } from '../../../const/ApiConst.js';
import { withTranslation, WithTranslation } from 'react-i18next';
const BASE_URL = "http://siopas.co.id/custom-php/api/geohr/";
const token = window.localStorage.getItem('token');
@ -51,61 +52,30 @@ class DialogMenuRoles extends Component {
}
getAllMenu = async () => {
const { companyID } = this.props;
const { roleName } = this.props;
if (roleName !== "Super Admin") {
const payload = {
"paging": {
"start": 0,
"length": -1
},
"columns": [{
"name": "company_id",
"logic_operator": "=",
"value": companyID,
"operator": "AND"
}],
"joins": [{
"name": "m_menu",
"column_join": "menu_id",
"column_results": [
"name"
]
}],
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "name", "logic_operator": "ilike", "value": "", "operator": "AND" }
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.post(MENU_COMPANY_SEARCH, payload, config)
.post(MENU_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ menu: result.data.data }, () => {
this.setStateMenu(false);
});
} else {
}
} else {
const payload = {
"paging": {
"start": 0,
"length": -1
},
"columns": [{
"name": "name",
"logic_operator": "ilike",
"value": "",
"operator": "AND"
}],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.post(MENU_SEARCH, payload, config)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.code == 200) {
this.setState({ menu: result.data.data });
}
}
}
setStateMenu = edit => {
@ -126,14 +96,13 @@ class DialogMenuRoles extends Component {
let copyStateMenu = [...this.state.stateMenu];
this.props.menuRoles.map((val, indexMenu) => {
let index = this.getIndexDataMenu(val.menu_id);
console.log('index true', index);
console.log("index true", val.menu_id);
if (index >= 0) {
copyStateMenu[index] = true;
}
})
this.setState({ stateMenu: [] }, () => {
let check = copyStateMenu.some(this.checkArray);
console.log('icheck', check);
if (check === false) {
this.setState({ allChecked: true, stateMenu: copyStateMenu })
} else {
@ -182,12 +151,11 @@ class DialogMenuRoles extends Component {
renderForm = () => {
const { menu, stateMenu } = this.state
console.log('stateMenu', stateMenu);
return (
menu.map((val, index) => {
return (
<tr key={index}>
<td>{val.join_first_name ?? val.name}</td>
<td>{val.name}</td>
<td><input type="checkbox" onClick={(e) => this.handleChangeCheckbox(e.target.checked, index)} defaultChecked={stateMenu[index]} /></td>
</tr>
)

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

@ -198,7 +198,8 @@ class index extends Component {
name: data.name,
description: data.description,
default_page: data.selectedMenu,
company_id: data.company_id
company_id: data.company_id,
all_project: data.all_project
}
const result = await axios.post(ROLE_ADD, formData, this.config)
@ -219,7 +220,8 @@ class index extends Component {
name: data.name,
description: data.description,
default_page: data.selectedMenu,
company_id: data.company_id
company_id: data.company_id,
all_project: data.all_project
}
const url = ROLE_EDIT(data.id)
const result = await axios.put(url, formData, this.config)

51
src/views/Report/k3/index.js

@ -13,14 +13,7 @@ import { PRESENSI_SEARCH, PROYEK_SEARCH, USERPROYEK_SEARCH, K3_SEARCH, SIMPRO_BA
import { withTranslation } from 'react-i18next';
const { RangePicker } = DatePicker;
const { Option } = Select
const token = localStorage.getItem('token');
const config = {
headers:
{
Authorization: `Bearer ${token}`,
"Content-type": `application/json`
}
};
const BASE_URL = ""
@ -31,8 +24,33 @@ const momentFormat = 'DD-MM-YY';
const LENGTH_DATA = 10
class index extends Component {
constructor(props) {
let role_id = '', user_id = '', isLogin = '', token = '', company_id = 0, role_name = '', hierarchy = [];
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id;
user_id = props.location.state.user_id;
token = props.location.state.token;
isLogin = props.location.state.isLogin;
company_id = props.location.state.company_id;
role_name = props.location.state.role_name;
hierarchy = props.location.state.hierarchy;
} else {
token = window.localStorage.getItem('token');
role_name = window.localStorage.getItem('role_name');
company_id = window.localStorage.getItem('company_id');
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
}
super(props)
this.config = {
headers: {
Authorization: `Bearer ${token}`,
"Content-type": "application/json"
}
};
this.state = {
dataTable: [],
dataExport: [],
@ -61,7 +79,11 @@ class index extends Component {
allUserToProyek: [],
proyekIds: [],
allDataProyek: [],
finishSetupOption: false
finishSetupOption: false,
company_id: company_id,
role_name: role_name,
role_id: role_id,
hierarchy: hierarchy
}
}
@ -111,9 +133,14 @@ class index extends Component {
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
if (this.state.role_id !== "Super Admin") {
payload.columns.push(
{ name: "created_by_id", logic_operator: "IN", value: this.state.hierarchy, operator: "AND" }
)
}
const result = await axios
.post(PROYEK_SEARCH, payload, config)
.post(PROYEK_SEARCH, payload, this.config)
.then(res => res)
.catch((error) => error.response);
@ -194,7 +221,7 @@ class index extends Component {
}
const result = await axios
.post(K3_SEARCH, payload, config)
.post(K3_SEARCH, payload, this.config)
.then(res => res)
.catch((error) => error.response);
@ -394,7 +421,7 @@ class index extends Component {
const result = await axios
.post(K3_SEARCH, payload, config)
.post(K3_SEARCH, payload, this.config)
.then(res => res)
.catch((error) => error.response);

8
src/views/SimproV2/ChecklistK3/DialogForm.js

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

1
src/views/SimproV2/ChecklistK3/index.js

@ -285,6 +285,7 @@ const ChecklistK3 = ({ params }) => {
dataEdit={dataEdit}
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
company_id={company_id}
/>
<Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

3
src/views/SimproV2/CreatedProyek/AsignCustProject.js

@ -13,7 +13,7 @@ import { NotificationContainer, NotificationManager } from 'react-notifications'
import SweetAlert from 'react-bootstrap-sweetalert';
import FormAsignCust from './DialogAssignCust';
const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName }) => {
const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proyekName, company_id }) => {
const token = localStorage.getItem("token")
const HEADER = {
headers: {
@ -200,6 +200,7 @@ const AssignCustProject = ({ openDialog, closeDialog, toggleDialog, idTask, proy
closeDialog={handleCloseDialogFormTools}
toggleDialog={toogleDialogFormTools}
idTask={idTask}
company_id={company_id}
/>
</>
)

29
src/views/SimproV2/CreatedProyek/AsignHrProject.js

@ -4,14 +4,14 @@ import { Button, Form } from 'reactstrap';
import { Table, Tooltip, Spin } from 'antd';
import 'antd/dist/antd.css';
import moment from 'moment';
import { API_ADW, TOKEN_ADW, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, USER_LIST, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_EDIT } from '../../../const/ApiConst';
import { USER_SEARCH, ASSIGN_HR_PROJECT_SEARCH, ASSIGN_HR_PROJECT_DELETE, PROJECT_ROLE_SEARCH, ASSIGN_HR_PROJECT_ADD, ASSIGN_HR_PROJECT_EDIT } from '../../../const/ApiConst';
import axios from "../../../const/interceptorApi"
import { NotificationContainer, NotificationManager } from 'react-notifications';
import SweetAlert from 'react-bootstrap-sweetalert';
import FormAsignHr from './FormAsignHr';
import { formatThousand } from '../../../const/CustomFunc';
const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsResource, proyekName }) => {
const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, company_id, proyekName }) => {
const token = localStorage.getItem("token")
const HEADER = {
headers: {
@ -81,14 +81,29 @@ const AssignHrProject = ({ openDialog, closeDialog, toggleDialog, idTask, toolsR
}
const getDataUser = async () => {
const HEADER_ADW = {
headers: {
"Authorization": `${TOKEN_ADW}`
const payload = {
"select": [
"id",
"name",
"role_id"
],
"paging": {
"start": 0,
"length": -1
},
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id },
],
"orders": {
"columns": [
"id"
],
"ascending": false
}
}
const result = await axios
// .get(`${API_ADW}employees`, HEADER_ADW)
.get(USER_LIST, HEADER)
.post(USER_SEARCH, payload, HEADER)
.then(res => res)
.catch((error) => error.response);
if (result && result.data && result.data.data.length != 0) {

5
src/views/SimproV2/CreatedProyek/DialogAssignCust.js

@ -12,7 +12,7 @@ import 'antd/dist/antd.css';
import { NotificationManager } from 'react-notifications';
const role_id = localStorage.getItem('role_id');
const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) => {
const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask, company_id }) => {
const token = localStorage.getItem("token")
const HEADER = {
headers: {
@ -51,7 +51,8 @@ const DialogAssignCust = ({ openDialog, closeDialog, toggleDialog, idTask }) =>
"length": -1
},
"columns": [
{ "name": "role_id", "logic_operator": "=", "value": 44 }
{ "name": "role_id", "logic_operator": "=", "value": 44 },
{ "name": "company_id", "logic_operator": "=", "value": company_id },
],
"orders": {
"columns": [

21
src/views/SimproV2/CreatedProyek/DialogFormProyek.js

@ -1,7 +1,7 @@
import React, { useEffect, useState, useMemo } from "react";
import { Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap";
import { Button, Form, FormGroup, Label, Input, Col, Row } from "reactstrap";
import { DatePicker, Tooltip, Select, Divider } from "antd";
import { DatePicker, Tooltip, Select, Divider, Spin } from "antd";
import axios from "../../../const/interceptorApi";
import moment from "moment";
import { CKEditor } from '@ckeditor/ckeditor5-react';
@ -88,8 +88,9 @@ const DialogFormProyek = ({
const [lastIdxRisks, setLastIdxRisks] = useState(0);
const [lastIdxMilestones, setLastIdxMilestones] = useState(0);
const [lastIdxApproval, setLastIdxApproval] = useState(0);
const [loading, setLoading] = useState(true);
const handleGetdataIdproyek = async (id) => {
setLoading(true)
const result = await axios
.get(`${PROYEK_GET_ID(id)}`, HEADER)
.then((res) => res)
@ -122,6 +123,7 @@ const DialogFormProyek = ({
setCurrencyCode(val.currency_code);
setCurrencySymbol(val.currency_symbol);
setCurrencyName(val.currency_name);
setLoading(false)
} else {
NotificationManager.error(`Data proyek gagal di edit`, `Failed!!`);
}
@ -457,8 +459,7 @@ const DialogFormProyek = ({
const handleInputChangeParticipants = (e, index) => {
const { name, value } = e.target;
const existingParticipant = participants.find((participant) => participant.tittle === "PM");
if(value.toLowerCase() === "pm" && name === "tittle" && existingParticipant)
{
if (value.toLowerCase() === "pm" && name === "tittle" && existingParticipant) {
alert('PM is already exist!');
setParticipants((prevParticipants) =>
prevParticipants.map((participant, i) => {
@ -1166,7 +1167,7 @@ const DialogFormProyek = ({
}
const RenderChecklist = () => {
if (checklist.length > 0) {
if (checklist?.length > 0) {
return checklist.map((item, index) => {
return (
<Row key={index} style={{ marginBottom: 10 }}>
@ -1280,7 +1281,7 @@ const DialogFormProyek = ({
};
const RenderRisk = () => {
if (potentialRisks.length > 0) {
if (potentialRisks?.length > 0) {
return potentialRisks.map((item, index) => {
return (
<Row key={index} style={{ marginBottom: 10 }}>
@ -1348,7 +1349,7 @@ const DialogFormProyek = ({
};
const RenderParticipants = () => {
if (participants.length > 0) {
if (participants?.length > 0) {
return participants.map((item, index) => {
return (
<Row key={index} style={{ marginBottom: 10 }}>
@ -1516,7 +1517,11 @@ const DialogFormProyek = ({
: "Add Project"
: "Project Charter"}
</ModalHeader>
<ModalBody>{ RenderFormProject() }</ModalBody>
<ModalBody>
<Spin tip="Loading..." spinning={loading}>
{RenderFormProject()}
</Spin>
</ModalBody>
<ModalFooter>
{step === 1 ? (
<>

11
src/views/SimproV2/CreatedProyek/DialogUserGantt.js

@ -3,7 +3,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { Button, Form } from 'reactstrap';
import axios from "../../../const/interceptorApi";
import { USER_VERSION_GANTT_ADDS, USER_VERSION_GANTT_SEARCH, USER_LIST } from '../../../const/ApiConst';
import { Transfer } from 'antd';
import { Transfer, Spin } from 'antd';
import 'antd/dist/antd.css';
const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt }) => {
@ -17,7 +17,7 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
const [id, setId] = useState(0)
const [targetKeys, setTargetKeys] = useState([])
const [humanResource, setHumanResource] = useState([])
const [loading, setLoading] = useState(true);
const handleCLearData = () => {
setId(0)
@ -64,6 +64,7 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
}
const getUserGantt = async () => {
setLoading(true)
const payload = {
"columns": [
{ "name": "version_gantt_id", "logic_operator": "=", "value": idGantt, "operator": "AND" }
@ -77,6 +78,7 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
if (result && result.status == 200) {
console.log("cek resource get user gantt", result.data.data)
setUserGantt(result.data.data);
setLoading(false)
} else {
}
@ -135,6 +137,9 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
}}>
<Transfer
showSearch
filterOption={(inputValue, option) =>
option.title.toLowerCase().includes(inputValue.toLowerCase())
}
titles={['Available HR', 'Granted to']}
dataSource={humanResource}
targetKeys={targetKeys}
@ -155,7 +160,9 @@ const DialogUserGantt = ({ openDialog, closeDialog, toggleDialog, idGantt}) => {
<Modal size="lg" style={{ maxWidth: '600px', width: '100%' }} isOpen={openDialog} toggle={toggleDialog}>
<ModalHeader className="capitalize" toggle={closeDialog}>Gantt Permission</ModalHeader>
<ModalBody>
<Spin tip="Loading..." spinning={loading}>
{renderForm()}
</Spin>
</ModalBody>
<ModalFooter>
<Button color="primary" onClick={() => handleSave()}>Save</Button>{' '}

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

@ -23,31 +23,23 @@ import {
} from "antd";
import {
PROJECT_APPROVAL_ADD,
PROJECT_APPROVAL_EDIT,
PROJECT_PARTICIPANT_ADD,
PROJECT_CHECKLIST_ADD,
PROJECT_ISSUE_ADD,
PROJECT_RISK_ADD,
PROJECT_PARTICIPANT_EDIT,
PROJECT_MILESTONE_ADD,
PROJECT_MILESTONE_EDIT,
PROJECT_PARTICIPANT_DELETE_BY_PROYEK,
PROJECT_MILESTONE_DELETE_BY_PROYEK,
PROJECT_APPROVAL_DELETE_BY_PROYEK,
USER_LIST,
TYPE_PROYEK,
USER_SEARCH,
PROJECT_TYPE_SEARCH,
PROYEK_ADD,
PROYEK_SEARCH,
PROYEK_SEARCH_BY_USER,
PROYEK_EDIT,
ASSIGN_HR_PROJECT_SEARCH,
PROJECT_CHECKLIST_SEARCH,
PROYEK_DELETE,
TOOLS_RESOURCE_SEARCH,
MATERIAL_RESOURCE_SEARCH,
USER_SEARCH,
PROJECT_CHARTER_SEARCH,
HIERARCHY_FTTH_SEARCH,
PROJECT_ISSUE_SEARCH,
PROJECT_RISK_SEARCH,
PROJECT_CHECKLIST_DELETE_BY_PROYEK,
@ -61,18 +53,15 @@ import {
PROJECT_APPROVAL_SEARCH,
CHECKLIST_K3_LIST,
VERSION_GANTT_SEARCH,
PHASE_PROYEK,
DIVISI_LIST,
PROJECT_PHASE_SEARCH,
DIVISI_SEARCH,
BASE_OSPRO,
IMAGE_UPLOAD,
IMAGE_GET_BY_ID,
IMAGE_DELETE,
} from "../../../const/ApiConst";
import {
formatNumber,
formatRupiah,
formatThousand,
renderFormatRupiah,
formatThousand
} from "../../../const/CustomFunc";
import moment from "moment";
// import DialogFormResource from './DialogFormResource';
@ -96,7 +85,7 @@ const url = "";
const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '';
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0;
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id;
user_id = props.location.state.user_id;
@ -109,6 +98,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
}
const history = useHistory();
const HEADER = {
@ -234,8 +224,17 @@ const CreatedProyek = ({ params, ...props }) => {
};
const handleGetTipeProject = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.get(TYPE_PROYEK, HEADER)
.post(PROJECT_TYPE_SEARCH, payload, HEADER)
.then((res) => res)
.catch((err) => err.response);
if (result && result.data && result.data.code === 200) {
@ -245,8 +244,17 @@ const CreatedProyek = ({ params, ...props }) => {
};
const handleGetPhaseProject = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.get(PHASE_PROYEK, HEADER)
.post(PROJECT_PHASE_SEARCH, payload, HEADER)
.then((res) => res)
.catch((err) => err.response);
if (result && result.data && result.data.code === 200) {
@ -255,8 +263,17 @@ const CreatedProyek = ({ params, ...props }) => {
};
const handleGetDivisions = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.get(DIVISI_LIST, HEADER)
.post(DIVISI_SEARCH, payload, HEADER)
.then((res) => res)
.catch((err) => err.response);
if (result && result.data && result.data.code === 200) {
@ -266,9 +283,18 @@ const CreatedProyek = ({ params, ...props }) => {
}
};
const handleGetDataPm = async (text) => {
const handleGetDataPm = async () => {
const payload = {
"paging": { "start": 0, "length": -1 },
"columns": [
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
],
"joins": [],
"orders": { "columns": ["id"], "ascending": false }
}
const result = await axios
.get(USER_LIST, HEADER)
.post(USER_SEARCH, payload, HEADER)
.then((res) => res)
.catch((err) => err.response);
if (result && result.data && result.data.code === 200) {
@ -304,6 +330,7 @@ const CreatedProyek = ({ params, ...props }) => {
};
const getDataProyek = async () => {
setLoading(true);
let start = 0;
let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
@ -468,10 +495,6 @@ const CreatedProyek = ({ params, ...props }) => {
}
};
const handleOpenDialog = (id) => {
setOpenDialog(true);
setidTask(id);
};
const handleOpenDialogProyek = async (id) => {
setOpenDialogProyek(true);
@ -531,12 +554,6 @@ const CreatedProyek = ({ params, ...props }) => {
setOpenDialogAssignK3(true);
};
const handleOpenDialogTools = (data) => {
setOpenDialogTools(true);
setidTask(data.id);
setProyekName(data.nama);
setUserProyek(data.user_proyeks);
};
const handleOpenDialogViewDetail = async (data) => {
setLoading(true);
@ -1132,6 +1149,7 @@ const CreatedProyek = ({ params, ...props }) => {
};
const editProyek = async (data) => {
setLoading(true)
const { checklist, issue, potentialRisks, participants, milestones, approval } = data.projectCharter;
const imageObject = data.imageStructureOrg;
@ -1852,6 +1870,7 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignHr}
idTask={idTask}
proyekName={proyekName}
company_id={company_id}
/>
),
[openDialogAsignHR]
@ -1867,6 +1886,7 @@ const CreatedProyek = ({ params, ...props }) => {
handleClose={handleCloseDialogAsignCust}
idTask={idTask}
proyekName={proyekName}
company_id={company_id}
/>
),
[openDialogAsignCust]

8
src/views/SimproV2/Divisi/DialogForm.js

@ -10,7 +10,7 @@ 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 DialogForm = ({ openDialog, closeDialog, toggleDialog, typeDialog, dataEdit, dataDivisions, company_id }) => {
const [id, setId] = useState(0)
const [name, setName] = useState('')
const [parent, setParent] = useState(null)
@ -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);
}

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

@ -69,8 +69,31 @@ const ProjectType = ({ params, ...props }) => {
}, [dataExport])
const getListDivision = async () => {
const payload = {
columns: [],
"orders": {
"ascending": true,
"columns": [
'name'
]
},
"paging": {
"length": 0,
"start": -1
}
}
if (role_name !== "Super Admin") {
payload.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
payload.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
}
const listDivions = await axios
.get(DIVISI_LIST, HEADER)
.post(DIVISI_SEARCH, payload, HEADER)
.then(res => res)
.catch((error) => error.response);
@ -321,6 +344,7 @@ const ProjectType = ({ params, ...props }) => {
clickOpenModal={clickOpenModal}
dataParent={allDataMenu}
dataDivisions={dataDivisions}
company_id={company_id}
/>
<Card>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}>

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

@ -87,7 +87,17 @@ const ResourceWorker = ({ params, ...props }) => {
const getRoleList = async () => {
const formData = {
"paging": { "start": 0, "length": -1 },
"orders": { "columns": ["id"], "ascending": false }
"orders": { "columns": ["id"], "ascending": false },
"columns": [],
}
if (role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
}
const result = await axios
@ -103,7 +113,18 @@ const ResourceWorker = ({ params, ...props }) => {
const getDivisiList = async () => {
const formData = {
"paging": { "start": 0, "length": -1 },
"orders": { "columns": ["id"], "ascending": false }
"orders": { "columns": ["id"], "ascending": false },
"columns": [],
}
if (role_name !== "Super Admin") {
formData.columns.push(
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
)
} else {
formData.columns.push(
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
)
}
const result = await axios
@ -248,12 +269,6 @@ const ResourceWorker = ({ params, ...props }) => {
}
const handleSync = async () => {
await axios.get(USER_SYNC, HEADER)
.then(res => res)
.catch((error) => error.response)
}
const handleExportExcel = async () => {
let start = 0;
@ -580,9 +595,6 @@ const ResourceWorker = ({ params, ...props }) => {
<Tooltip title={t('hradd')}>
<Button style={{ background: "#4caf50", color: "#fff" }} onClick={() => handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button>
</Tooltip>
<Tooltip title="HR Sync">
<Button style={{ background: "#007bff ", color: "#fff", marginLeft: "5px" }} onClick={() => handleSync()}><i className="fa fa-spinner"></i></Button>
</Tooltip>
<Tooltip title={t('exportExcel')}>
<Button style={{ marginLeft: "5px" }} onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button>
</Tooltip>

Loading…
Cancel
Save