Browse Source

update props

pull/1/head
wahyun 12 months ago
parent
commit
5d854478f5
  1. 55
      src/containers/DefaultLayout/DefaultLayout.js
  2. 31
      src/views/Dashboard/DashboardBOD.js
  3. 27
      src/views/Dashboard/DashboardCustomer.js
  4. 20
      src/views/Dashboard/DashboardProject.js
  5. 31
      src/views/Dashboard/DashboardProjectCarousell.js
  6. 31
      src/views/MapMonitoring/index.js
  7. 28
      src/views/Master/MasterRoles/index.js
  8. 27
      src/views/Master/ProjectExpenditure/index.js
  9. 27
      src/views/Master/ProjectFinancialHealth/index.js
  10. 27
      src/views/Master/ProjectInvoice/index.js
  11. 791
      src/views/Master/ProjectPhase/index.js
  12. 27
      src/views/Master/ProjectScheduleHealth/index.js
  13. 26
      src/views/Master/RoleProject/index.js
  14. 43
      src/views/Pages/Login/Login.js
  15. 1263
      src/views/Report/k3/index.js
  16. 44
      src/views/SimproV2/CreatedProyek/index.js
  17. 29
      src/views/SimproV2/Divisi/index.js
  18. 17
      src/views/SimproV2/Gantt/GanttFrame.js
  19. 27
      src/views/SimproV2/Gantt/index.js
  20. 27
      src/views/SimproV2/ProjectType/index.js
  21. 27
      src/views/SimproV2/ResourceWorker/index.js
  22. 30
      src/views/SimproV2/Satuan/index.js

55
src/containers/DefaultLayout/DefaultLayout.js

@ -36,18 +36,34 @@ const config = {
}; };
class DefaultLayout extends Component { class DefaultLayout extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {
role_id: localStorage.getItem('role_id'), let role_id = '', token = '', company_id = 0, menu=''
token: localStorage.getItem('token'), if (props.location.state && props.location.state.role_id) {
menu: { items: [] }, role_id = props.location.state.role_id;
routes2: routes, token = props.location.state.token;
finalRoutes: [], company_id = props.location.state.company_id;
breadrCrumbReady: false, menu = props.location.state.menu_login;
minimized: true } else {
} role_id = localStorage.getItem("role_id");
} token = localStorage.getItem("token");
company_id = localStorage.getItem('company_id');
menu = localStorage.getItem("menu_login");
}
this.state = {
role_id: role_id,
token: token,
menu: { items: [] },
routes2: routes,
finalRoutes: [],
breadrCrumbReady: false,
minimized: true,
company_id: company_id
};
}
async componentDidMount() { async componentDidMount() {
const menu = localStorage.getItem("menu_login") const menu = localStorage.getItem("menu_login")
@ -295,7 +311,20 @@ class DefaultLayout extends Component {
exact={route.exact} exact={route.exact}
name={route.name} name={route.name}
render={props => ( render={props => (
<route.component params={{ name: route.name }} {...props} /> <route.component
params={{ name: route.name }}
hierarchy={props.location.state ? props.location.state.hierarchy : localStorage.getItem("hierarchy")}
user_id={props.location.state ? props.location.state.user_id : localStorage.getItem("user_id")}
role_id={props.location.state ? props.location.state.role_id : localStorage.getItem("role_id")}
isLogin={props.location.state ? props.location.state.isLogin : localStorage.getItem("isLogin")}
company_id={props.location.state ? props.location.state.company_id : localStorage.getItem("company_id")}
role_name={props.location.state ? props.location.state.role_name : localStorage.getItem("role_name")}
all_project={props.location.state ? props.location.state.all_project : localStorage.getItem("all_project")}
token={props.location.state ? props.location.state.token : localStorage.getItem("token")}
menu_login={props.location.state ? props.location.state.menu_login : localStorage.getItem("menu_login")}
user_name={props.location.state ? props.location.state.user_name : localStorage.getItem("user_name")}
{...props}
/>
)} /> )} />
) : (null); ) : (null);
})} })}

31
src/views/Dashboard/DashboardBOD.js

@ -15,24 +15,19 @@ import { HealthByBudget, HealthBySchedule } from './Components';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const DashboardBOD = (props) => { const DashboardBOD = (props) => {
let role_id = '', user_id = '', isLogin = '', token = '', company_id = 0, all_project = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
company_id = props.location.state.company_id; company_id = props.company_id;
all_project = props.location.state.all_project; all_project = props.all_project;
} else { role_name = props.role_name;
role_id = localStorage.getItem("role_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin"); }
company_id = localStorage.getItem('company_id');
all_project = localStorage.getItem('all_project');
}
let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

27
src/views/Dashboard/DashboardCustomer.js

@ -26,18 +26,19 @@ const center = {
} }
const DashboardCustomer = (props) => { const DashboardCustomer = (props) => {
let role_id = '', user_id = '', isLogin = '', token = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
} else { company_id = props.company_id;
role_id = localStorage.getItem("role_id"); all_project = props.all_project;
user_id = localStorage.getItem("user_id"); role_name = props.role_name;
token = localStorage.getItem("token"); isLogin = props.isLogin;
isLogin = localStorage.getItem("isLogin"); hierarchy = props.hierarchy;
} user_name = props.user_name;
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -45,7 +46,7 @@ const DashboardCustomer = (props) => {
} }
} }
const { PROJECT_ID, GANTT_ID, SCURVE } = useParams(); const { PROJECT_ID, GANTT_ID, SCURVE } = useParams();
const URL_GANTT = `https://konstruksi-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1`; const URL_GANTT = `https://project-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1`;
const mapRef = useRef() const mapRef = useRef()
const [projectName, setProjectName] = useState(""); const [projectName, setProjectName] = useState("");
const [projectManagerName, setProjectManagerName] = useState(''); const [projectManagerName, setProjectManagerName] = useState('');

20
src/views/Dashboard/DashboardProject.js

@ -63,8 +63,22 @@ const center = {
lng: 106.816666, lng: 106.816666,
}; };
const DashboardProject = () => { const DashboardProject = (props) => {
const token = localStorage.getItem("token");
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props && props.role_id && props.user_id) {
role_id = props.role_id;
user_id = props.user_id;
token = props.token;
isLogin = props.isLogin;
company_id = props.company_id;
all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
hierarchy = props.hierarchy;
user_name = props.user_name;
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -72,7 +86,7 @@ const DashboardProject = () => {
}, },
}; };
const { PROJECT_ID, GANTT_ID, SCURVE } = useParams(); const { PROJECT_ID, GANTT_ID, SCURVE } = useParams();
const URL_GANTT = `https://konstruksi-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1`; const URL_GANTT = `https://project-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${GANTT_ID}&proyek_id=${PROJECT_ID}&token=${token}&ro=1`;
const mapRef = useRef(); const mapRef = useRef();
const [projectName, setProjectName] = useState(""); const [projectName, setProjectName] = useState("");
const [projectManagerName, setProjectManagerName] = useState(""); const [projectManagerName, setProjectManagerName] = useState("");

31
src/views/Dashboard/DashboardProjectCarousell.js

@ -69,16 +69,21 @@ const center = {
lng: 106.816666, lng: 106.816666,
}; };
const DashboardProject = (args) => { const DashboardProject = ({args,...props}) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, all_project = '', hierarchy = []; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
role_id = localStorage.getItem("role_id"); if (props && props.role_id && props.user_id) {
proyek_id = localStorage.getItem("proyek_id"); role_id = props.role_id;
user_id = localStorage.getItem("user_id"); user_id = props.user_id;
token = localStorage.getItem("token"); token = props.token;
isLogin = localStorage.getItem("isLogin"); isLogin = props.isLogin;
company_id = localStorage.getItem('company_id'); company_id = props.company_id;
all_project = localStorage.getItem('all_project'); all_project = props.all_project;
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy"))); role_name = props.role_name;
isLogin = props.isLogin;
hierarchy = props.hierarchy;
user_name = props.user_name;
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -231,7 +236,7 @@ const DashboardProject = (args) => {
let URL_GANTT = ""; let URL_GANTT = "";
let version_gantt = ""; let version_gantt = "";
if (item.gantt !== null) { if (item.gantt !== null) {
URL_GANTT = `http://localhost:8444/adw-gantt/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${item.gantt.id}&proyek_id=${item.gantt.proyek_id}&token=${token}&ro=1`; URL_GANTT = `https://project-gantt.ospro.id/view-mode/index.html?base_url=${BASE_OSPRO}/api&gantt_id=${item.gantt.id}&proyek_id=${item.gantt.proyek_id}&token=${token}&ro=1`;
version_gantt = item.gantt.name_version version_gantt = item.gantt.name_version
} else { } else {
URL_GANTT = ""; URL_GANTT = "";
@ -803,10 +808,10 @@ const DashboardProject = (args) => {
> >
{slides} {slides}
<div style={{ position: 'absolute', top: '95%', left: 0, zIndex: 1000 }}> <div style={{ position: 'absolute', top: '95%', left: 0, zIndex: 1000 }}>
<Button onClick={previous}><i class="fa fa-chevron-left"></i></Button> <Button onClick={previous}><i className="fa fa-chevron-left"></i></Button>
</div> </div>
<div style={{ position: 'absolute', top: '95%', right: 0, zIndex: 1000 }}> <div style={{ position: 'absolute', top: '95%', right: 0, zIndex: 1000 }}>
<Button onClick={next}><i class="fa fa-chevron-right"></i></Button> <Button onClick={next}><i className="fa fa-chevron-right"></i></Button>
</div> </div>
</Carousel > </Carousel >
</Spin> </Spin>

31
src/views/MapMonitoring/index.js

@ -28,20 +28,19 @@ import 'leaflet-control-geocoder/dist/Control.Geocoder.js'
import moment from 'moment'; import moment from 'moment';
import axios from "../../const/interceptorApi"; import axios from "../../const/interceptorApi";
const MapMonitoring = ({ ...props }) => { const MapMonitoring = ({ ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin"); }
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -67,7 +66,7 @@ const MapMonitoring = ({ ...props }) => {
let markerCluster = L.markerClusterGroup({ let markerCluster = L.markerClusterGroup({
name: "userPointLayer", name: "userPointLayer",
// disableClusteringAtZoom: 17, // disableClusteringAtZoom: 17,
showCoverageOnHover: false, showCoverageOnHover: false,
// spiderfyOnMaxZoom: false // spiderfyOnMaxZoom: false
}); });
@ -333,4 +332,4 @@ const MapMonitoring = ({ ...props }) => {
return MapContent return MapContent
} }
export default MapMonitoring; export default MapMonitoring;

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

@ -16,21 +16,19 @@ const LENGTH_DATA = 10
class index extends Component { class index extends Component {
constructor(props) { constructor(props) {
let role_id = '', user_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
company_id = props.location.state.company_id; company_id = props.company_id;
role_name = props.location.state.role_name; all_project = props.all_project;
role_name = props.role_name;
isLogin = props.isLogin;
} else { hierarchy = props.hierarchy;
token = window.localStorage.getItem('token'); user_name = props.user_name;
role_name = window.localStorage.getItem('role_name'); }
company_id = window.localStorage.getItem('company_id');
}
super(props) super(props)
this.config = { this.config = {
headers: { headers: {

27
src/views/Master/ProjectExpenditure/index.js

@ -12,21 +12,18 @@ import { useTranslation } from 'react-i18next';
const ProjectExpenditure = ({ params, ...props }) => { const ProjectExpenditure = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name');
} }
const HEADER = { const HEADER = {

27
src/views/Master/ProjectFinancialHealth/index.js

@ -12,21 +12,18 @@ import { useTranslation } from 'react-i18next';
const ProjectFinancialHealth = ({ params, ...props }) => { const ProjectFinancialHealth = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name');
} }
const HEADER = { const HEADER = {

27
src/views/Master/ProjectInvoice/index.js

@ -12,21 +12,18 @@ import { useTranslation } from 'react-i18next';
const ProjectInvoice = ({ params, ...props }) => { const ProjectInvoice = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name');
} }
const HEADER = { const HEADER = {

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

@ -1,397 +1,394 @@
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import DialogForm from './DialogForm'; import DialogForm from './DialogForm';
import React, { useState, useEffect, useMemo } from 'react'; import React, { useState, useEffect, useMemo } from 'react';
import SweetAlert from 'react-bootstrap-sweetalert'; import SweetAlert from 'react-bootstrap-sweetalert';
import axios from "../../../const/interceptorApi" import axios from "../../../const/interceptorApi"
import moment from 'moment' import moment from 'moment'
import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap'; import { Card, CardBody, CardHeader, Col, Row, Input } from 'reactstrap';
import { NotificationContainer, NotificationManager } from 'react-notifications'; import { NotificationContainer, NotificationManager } from 'react-notifications';
import { PROJECT_PHASE_ADD, PROJECT_PHASE_EDIT, PROJECT_PHASE_DELETE, PROJECT_PHASE_SEARCH, PROJECT_PHASE_LIST, BASE_OSPRO } from '../../../const/ApiConst'; import { PROJECT_PHASE_ADD, PROJECT_PHASE_EDIT, PROJECT_PHASE_DELETE, PROJECT_PHASE_SEARCH, PROJECT_PHASE_LIST, BASE_OSPRO } from '../../../const/ApiConst';
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 ProjectPhase = ({ params, ...props }) => { const ProjectPhase = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin"); }
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name'); const HEADER = {
} headers: {
"Content-Type": "application/json",
const HEADER = { "Authorization": `Bearer ${token}`
headers: { }
"Content-Type": "application/json", }
"Authorization": `Bearer ${token}` const pageName = params.name;
}
} const [alertDelete, setAlertDelete] = useState(false)
const pageName = params.name; const [allDataMenu, setAllDataMenu] = useState([])
const [clickOpenModal, setClickOpenModal] = useState(false)
const [alertDelete, setAlertDelete] = useState(false) const [currentPage, setCurrentPage] = useState(1)
const [allDataMenu, setAllDataMenu] = useState([]) const [dataEdit, setDataEdit] = useState([])
const [clickOpenModal, setClickOpenModal] = useState(false) const [dataExport, setDataExport] = useState([])
const [currentPage, setCurrentPage] = useState(1) const [dataTable, setDatatable] = useState([])
const [dataEdit, setDataEdit] = useState([]) const [idDelete, setIdDelete] = useState(0)
const [dataExport, setDataExport] = useState([]) const [idPhaseProject, setIdPhaseProject] = useState(0)
const [dataTable, setDatatable] = useState([]) const [openDialog, setOpenDialog] = useState(false)
const [idDelete, setIdDelete] = useState(0) const [openDialogIG, setOpenDialogIG] = useState(false)
const [idPhaseProject, setIdPhaseProject] = useState(0) const [rowsPerPage, setRowsPerPage] = useState(10)
const [openDialog, setOpenDialog] = useState(false) const [search, setSearch] = useState('')
const [openDialogIG, setOpenDialogIG] = useState(false) const [totalPage, setTotalPage] = useState(0)
const [rowsPerPage, setRowsPerPage] = useState(10) const [typeDialog, setTypeDialog] = useState('Save')
const [search, setSearch] = useState('') const { t } = useTranslation()
const [totalPage, setTotalPage] = useState(0) useEffect(() => {
const [typeDialog, setTypeDialog] = useState('Save') getDataProjectPhase()
const { t } = useTranslation() }, [currentPage, rowsPerPage, search])
useEffect(() => {
getDataProjectPhase() useEffect(() => {
}, [currentPage, rowsPerPage, search]) const cekData = dataExport || []
if (cekData.length > 0) {
useEffect(() => { exportExcel()
const cekData = dataExport || [] }
if (cekData.length > 0) { }, [dataExport])
exportExcel()
} const getDataProjectPhase = async () => {
}, [dataExport]) let start = 0;
if (currentPage !== 1 && currentPage > 1) {
const getDataProjectPhase = async () => { start = (currentPage * rowsPerPage) - rowsPerPage
let start = 0; }
if (currentPage !== 1 && currentPage > 1) { const payload = {
start = (currentPage * rowsPerPage) - rowsPerPage "columns": [
} {
const payload = { "name": "name",
"columns": [ "logic_operator": "ilike",
{ "value": search,
"name": "name", "operator": "AND"
"logic_operator": "ilike", }
"value": search, ],
"operator": "AND" "orders": {
} "ascending": true,
], "columns": [
"orders": { 'id'
"ascending": true, ]
"columns": [ },
'id' "paging": {
] "length": rowsPerPage,
}, "start": start
"paging": { }
"length": rowsPerPage, }
"start": start if (role_name !== "Super Admin") {
} payload.columns.push(
} { "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" },
if (role_name !== "Super Admin") { )
payload.columns.push( } else {
{ "name": "company_id", "logic_operator": "=", "value": company_id, "operator": "AND" }, payload.columns.push(
) { "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" },
} else { )
payload.columns.push( }
{ "name": "company_id", "logic_operator": "is null", "value": "", "operator": "AND" }, const result = await axios
) .post(PROJECT_PHASE_SEARCH, payload, HEADER)
} .then((res) => res)
const result = await axios .catch((err) => err.response);
.post(PROJECT_PHASE_SEARCH, payload, HEADER)
.then((res) => res) if (result && result.data && result.data.code == 200) {
.catch((err) => err.response); result.data.data.map((res) => {
res.key = res.id.toString()
if (result && result.data && result.data.code == 200) { });
result.data.data.map((res) => { setDatatable(result.data.data);
res.key = res.id.toString() setTotalPage(result.data.totalRecord);
}); } else {
setDatatable(result.data.data); NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
setTotalPage(result.data.totalRecord); }
} else { }
NotificationManager.error('Gagal Mengambil Data!!', 'Failed');
} const handleSearch = e => {
} const value = e.target.value
setSearch(value);
const handleSearch = e => { setCurrentPage(1)
const value = e.target.value };
setSearch(value); const handleOpenDialog = (type) => {
setCurrentPage(1) setOpenDialog(true)
}; setTypeDialog(type)
const handleOpenDialog = (type) => { }
setOpenDialog(true)
setTypeDialog(type) const handleExportExcel = async () => {
} let start = 0;
const handleExportExcel = async () => { if (currentPage !== 1 && currentPage > 1) {
let start = 0; start = (currentPage * rowsPerPage) - rowsPerPage
}
if (currentPage !== 1 && currentPage > 1) {
start = (currentPage * rowsPerPage) - rowsPerPage const payload = {
} "columns": [
{
const payload = { "name": "name",
"columns": [ "logic_operator": "like",
{ "value": search,
"name": "name", "operator": "AND"
"logic_operator": "like", }
"value": search, ],
"operator": "AND" "orders": {
} "ascending": true,
], "columns": [
"orders": { 'id'
"ascending": true, ]
"columns": [ },
'id' "paging": {
] "length": rowsPerPage,
}, "start": start
"paging": { }
"length": rowsPerPage, }
"start": start
} const result = await axios
} .post(PROJECT_PHASE_SEARCH, payload, HEADER)
.then(res => res)
const result = await axios .catch((error) => error.response);
.post(PROJECT_PHASE_SEARCH, payload, HEADER) if (result && result.data && result.data.code == 200) {
.then(res => res) let resData = result.data.data;
.catch((error) => error.response); const excelData = [];
if (result && result.data && result.data.code == 200) { resData.map((val, index) => {
let resData = result.data.data; let dataRow = {
const excelData = []; "Nama": val.name,
resData.map((val, index) => { "Color": val.color,
let dataRow = { }
"Nama": val.name, excelData.push(dataRow)
"Color": val.color, })
} await setDataExport(excelData)
excelData.push(dataRow) } else {
}) NotificationManager.error('Gagal Export Data!!', 'Failed');
await setDataExport(excelData) }
} else { }
NotificationManager.error('Gagal Export Data!!', 'Failed');
} const exportExcel = () => {
} const dataExcel = dataExport || [];
const fileName = `Data ${pageName}.xlsx`;
const exportExcel = () => { const ws = XLSX.utils.json_to_sheet(dataExcel);
const dataExcel = dataExport || []; const wb = XLSX.utils.book_new();
const fileName = `Data ${pageName}.xlsx`; XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`);
const ws = XLSX.utils.json_to_sheet(dataExcel); XLSX.writeFile(wb, fileName);
const wb = XLSX.utils.book_new(); setDataExport([])
XLSX.utils.book_append_sheet(wb, ws, `Data ${pageName}`); }
XLSX.writeFile(wb, fileName);
setDataExport([]) const handleEdit = (data) => {
} setDataEdit(data)
handleOpenDialog('Edit');
const handleEdit = (data) => { }
setDataEdit(data)
handleOpenDialog('Edit'); const handleDelete = async (id) => {
} await setAlertDelete(true)
await setIdDelete(id)
const handleDelete = async (id) => { }
await setAlertDelete(true)
await setIdDelete(id) const handleCloseDialog = (type, data) => {
} if (type === "save") {
saveProjectPhase(data);
const handleCloseDialog = (type, data) => { } else if (type === "edit") {
if (type === "save") { editProjectPhase(data);
saveProjectPhase(data); }
} else if (type === "edit") { setDataEdit([])
editMaterialR(data); setOpenDialog(false)
} }
setDataEdit([])
setOpenDialog(false) const saveProjectPhase = async (data) => {
} const formData = data
const result = await axios.post(PROJECT_PHASE_ADD, formData, HEADER)
const saveProjectPhase = async (data) => { .then(res => res)
const formData = data .catch((error) => error.response);
const result = await axios.post(PROJECT_PHASE_ADD, formData, HEADER)
.then(res => res) if (result && result.data && result.data.code === 200) {
.catch((error) => error.response); getDataProjectPhase()
NotificationManager.success(`Data project type berhasil ditambah`, 'Success!!');
if (result && result.data && result.data.code === 200) { } else {
getDataProjectPhase() NotificationManager.error(`${result.data.message}`, 'Failed!!');
NotificationManager.success(`Data project type berhasil ditambah`, 'Success!!'); }
} else { }
NotificationManager.error(`${result.data.message}`, 'Failed!!');
} const editProjectPhase = async (data) => {
} let urlEdit = PROJECT_PHASE_EDIT(data.id)
const formData = data
const editMaterialR = async (data) => {
let urlEdit = PROJECT_PHASE_EDIT(data.id) const result = await axios.put(urlEdit, formData, HEADER)
const formData = data .then(res => res)
.catch((error) => error.response);
const result = await axios.put(urlEdit, formData, HEADER)
.then(res => res) if (result && result.data && result.data.code === 200) {
.catch((error) => error.response); getDataProjectPhase();
NotificationManager.success(`Data project phase berhasil diedit`, 'Success!!');
if (result && result.data && result.data.code === 200) { } else {
getDataProjectPhase(); NotificationManager.error(`Data project phase gagal di edit`, `Failed!!`);
NotificationManager.success(`Data project phase berhasil diedit`, 'Success!!'); }
} else { }
NotificationManager.error(`Data project phase gagal di edit`, `Failed!!`);
} const toggleAddDialog = () => {
} setOpenDialog(!openDialog)
}
const toggleAddDialog = () => {
setOpenDialog(!openDialog) const handleDialogIg = (id) => {
} setIdPhaseProject(id)
setOpenDialogIG(true)
const handleDialogIg = (id) => { }
setIdPhaseProject(id)
setOpenDialogIG(true) const closeDialogIG = () => {
} setIdPhaseProject(0)
setOpenDialogIG(false)
const closeDialogIG = () => { }
setIdPhaseProject(0)
setOpenDialogIG(false) const toggleDialogIG = () => {
} if (openDialogIG) {
setIdPhaseProject(0)
const toggleDialogIG = () => { }
if (openDialogIG) { setOpenDialogIG(!openDialogIG);
setIdPhaseProject(0) }
}
setOpenDialogIG(!openDialogIG); const onConfirmDelete = async () => {
} let url = PROJECT_PHASE_DELETE(idDelete);
const onConfirmDelete = async () => { const result = await axios.delete(url, HEADER)
let url = PROJECT_PHASE_DELETE(idDelete); .then(res => res)
.catch((error) => error.response);
const result = await axios.delete(url, HEADER)
.then(res => res) if (result && result.data && result.data.code === 200) {
.catch((error) => error.response); getDataProjectPhase()
setIdDelete(0)
if (result && result.data && result.data.code === 200) { setAlertDelete(false)
getDataProjectPhase() NotificationManager.success(`Data project phase berhasil dihapus!`, 'Success!!');
setIdDelete(0) } else {
setAlertDelete(false) setIdDelete(0)
NotificationManager.success(`Data project phase berhasil dihapus!`, 'Success!!'); setAlertDelete(false)
} else { NotificationManager.error(`Data project phase gagal dihapus!}`, 'Failed!!');
setIdDelete(0) }
setAlertDelete(false) }
NotificationManager.error(`Data project phase gagal dihapus!}`, 'Failed!!');
} const cancelDelete = () => {
} setAlertDelete(false)
setIdDelete(0)
const cancelDelete = () => { }
setAlertDelete(false)
setIdDelete(0) const onShowSizeChange = (current, pageSize) => {
} setRowsPerPage(pageSize)
}
const onShowSizeChange = (current, pageSize) => {
setRowsPerPage(pageSize) const onPagination = (current, pageSize) => {
} setCurrentPage(current)
}
const onPagination = (current, pageSize) => {
setCurrentPage(current) const dataNotAvailable = () => {
} if (dataTable.length === 0) {
return (
const dataNotAvailable = () => { <tr>
if (dataTable.length === 0) { <td align="center" colSpan="3">{t('noData')}</td>
return ( </tr>
<tr> )
<td align="center" colSpan="3">{t('noData')}</td> }
</tr> }
)
} const renderTable = useMemo(() => {
} const columns = [
{
const renderTable = useMemo(() => { title: t('action'),
const columns = [ dataIndex: '',
{ key: 'x',
title: t('action'), className: 'nowrap',
dataIndex: '', render: (text, record) => <>
key: 'x', <Tooltip title={t('delete')}>
className: 'nowrap', <i className="fa fa-trash" style={{ color: 'red', marginRight: '10px', cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i>
render: (text, record) => <> </Tooltip>
<Tooltip title={t('delete')}> <Tooltip title={t('Edit')}>
<i className="fa fa-trash" style={{ color: 'red', marginRight: '10px', cursor: "pointer" }} onClick={() => handleDelete(text.id)}></i> <i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i>
</Tooltip> </Tooltip>{" "}
<Tooltip title={t('Edit')}> </>,
<i className="fa fa-edit" style={{ color: 'green', cursor: "pointer" }} onClick={() => handleEdit(text)}></i> },
</Tooltip>{" "} { title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap" },
</>, {
}, title: t('color'),
{ title: t('phase'), dataIndex: 'name', key: 'name', className: "nowrap" }, dataIndex: 'color',
{ key: 'color',
title: t('color'), render: (text) => <>
dataIndex: 'color', <Tooltip title={text}>
key: 'color', <i className="fa fa-square" style={{ color: text }} ></i>
render: (text) => <> </Tooltip>
<Tooltip title={text}> </>,
<i className="fa fa-square" style={{ color: text }} ></i> },
</Tooltip> ];
</>, return (
}, <Table
]; rowKey="id"
return ( size="small"
<Table columns={columns}
rowKey="id" dataSource={dataTable}
size="small" pagination={false}
columns={columns} />
dataSource={dataTable} )
pagination={false} }, [dataTable])
/>
) return (
}, [dataTable]) <div>
<NotificationContainer />
return ( <SweetAlert
<div> show={alertDelete}
<NotificationContainer /> warning
<SweetAlert showCancel
show={alertDelete} confirmBtnText="Delete"
warning confirmBtnBsStyle="danger"
showCancel title={t('deleteConfirm')}
confirmBtnText="Delete" onConfirm={onConfirmDelete}
confirmBtnBsStyle="danger" onCancel={cancelDelete}
title={t('deleteConfirm')} focusCancelBtn
onConfirm={onConfirmDelete} >
onCancel={cancelDelete} {t('deleteMsg')}
focusCancelBtn </SweetAlert>
> <DialogForm
{t('deleteMsg')} openDialog={openDialog}
</SweetAlert> closeDialog={handleCloseDialog}
<DialogForm toggleDialog={() => toggleAddDialog}
openDialog={openDialog} typeDialog={typeDialog}
closeDialog={handleCloseDialog} dataEdit={dataEdit}
toggleDialog={() => toggleAddDialog} clickOpenModal={clickOpenModal}
typeDialog={typeDialog} dataParent={allDataMenu}
dataEdit={dataEdit} />
clickOpenModal={clickOpenModal} <Card>
dataParent={allDataMenu} <CardHeader style={{ display: "flex", justifyContent: "space-between" }}>
/> <h4 className="capitalize">{pageName}</h4>
<Card> <Row>
<CardHeader style={{ display: "flex", justifyContent: "space-between" }}> <Col>
<h4 className="capitalize">{pageName}</h4> <Input onChange={handleSearch} value={search} type="text" name="search" id="search" placeholder={t('searchPhase')} />
<Row> </Col>
<Col> <Col>
<Input onChange={handleSearch} value={search} type="text" name="search" id="search" placeholder={t('searchPhase')} /> <Tooltip title={t('projectPhase')}>
</Col> <Button style={{ background: "#4caf50", color: "#fff" }} onClick={() => handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button>
<Col> </Tooltip>
<Tooltip title={t('projectPhase')}> <Tooltip title={t('exportExcel')}>
<Button style={{ background: "#4caf50", color: "#fff" }} onClick={() => handleOpenDialog('Save')}><i className="fa fa-plus"></i></Button> <Button style={{ marginLeft: "5px" }} onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button>
</Tooltip> </Tooltip>
<Tooltip title={t('exportExcel')}> </Col>
<Button style={{ marginLeft: "5px" }} onClick={() => handleExportExcel()}><i className="fa fa-print"></i></Button> </Row>
</Tooltip> </CardHeader>
</Col> <CardBody>
</Row> {renderTable}
</CardHeader> <Pagination
<CardBody> style={{ marginTop: "25px" }}
{renderTable} showSizeChanger
<Pagination onShowSizeChange={onShowSizeChange}
style={{ marginTop: "25px" }} onChange={onPagination}
showSizeChanger defaultCurrent={currentPage}
onShowSizeChange={onShowSizeChange} pageSize={rowsPerPage}
onChange={onPagination} total={totalPage}
defaultCurrent={currentPage} pageSizeOptions={["10", "15", "20", "25", "30", "35", "40"]}
pageSize={rowsPerPage} />
total={totalPage} </CardBody>
pageSizeOptions={["10", "15", "20", "25", "30", "35", "40"]} </Card>
/> </div>
</CardBody> )
</Card> }
</div>
) export default ProjectPhase;
}
export default ProjectPhase;

27
src/views/Master/ProjectScheduleHealth/index.js

@ -12,21 +12,18 @@ import { useTranslation } from 'react-i18next';
const ProjectScheduleHealth = ({ params, ...props }) => { const ProjectScheduleHealth = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name');
} }
const HEADER = { const HEADER = {

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

@ -35,18 +35,18 @@ const LENGTH_DATA = 10
class index extends Component { class index extends Component {
constructor(props) { constructor(props) {
let role_id = '', user_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
company_id = props.location.state.company_id; company_id = props.company_id;
role_name = props.location.state.role_name; all_project = props.all_project;
} else { role_name = props.role_name;
token = window.localStorage.getItem('token'); isLogin = props.isLogin;
role_name = window.localStorage.getItem('role_name'); hierarchy = props.hierarchy;
company_id = window.localStorage.getItem('company_id'); user_name = props.user_name;
} }
super(props) super(props)
this.state = { this.state = {
@ -408,4 +408,4 @@ class index extends Component {
) )
} }
} }
export default withTranslation()(index); export default withTranslation()(index);

43
src/views/Pages/Login/Login.js

@ -120,7 +120,7 @@ class Login extends Component {
} }
} }
getDataMenu = async (token, role_id, user_id, company_id, role_name, all_project) => { getDataMenu = async (token, role_id, hierarchy, user_id, company_id, role_name, all_project, user_name) => {
const config = { const config = {
headers: headers:
{ {
@ -146,14 +146,36 @@ class Login extends Component {
else { else {
this.props.history.push({ this.props.history.push({
pathname: "/dashboard", pathname: "/dashboard",
state: { role_id: role_id, user_id: user_id, token: token, isLogin: true, company_id: company_id, role_name: role_name, all_project: all_project } state: {
menu_login: JSON.stringify(resData),
hierarchy,
role_id,
user_id,
token,
isLogin: true,
company_id,
role_name,
all_project,
user_name
}
}); });
} }
if (this.state.defaultPage) { if (this.state.defaultPage) {
if (role_id === 44) { if (role_id === 44) {
this.props.history.push({ this.props.history.push({
pathname: this.state.defaultPage, pathname: this.state.defaultPage,
state: { role_id: role_id, user_id: user_id, token: token, isLogin: true, company_id: company_id, role_name: role_name, all_project: all_project } state: {
menu_login: JSON.stringify(resData),
hierarchy,
role_id,
user_id,
token,
isLogin: true,
company_id,
role_name,
all_project,
user_name
}
}); });
} else { } else {
this.props.history.push(this.state.defaultPage); this.props.history.push(this.state.defaultPage);
@ -164,7 +186,18 @@ class Login extends Component {
else { else {
this.props.history.push({ this.props.history.push({
pathname: "/dashboard", pathname: "/dashboard",
state: { role_id: role_id, user_id: user_id, token: token, isLogin: true, company_id: company_id, role_name: role_name } state: {
menu_login: JSON.stringify(resData),
hierarchy,
role_id,
user_id,
token,
isLogin: true,
company_id,
role_name,
all_project,
user_name
}
}); });
} }
} else { } else {
@ -209,7 +242,7 @@ class Login extends Component {
if (doLogin && doLogin.data && doLogin.data.code === 200) { if (doLogin && doLogin.data && doLogin.data.code === 200) {
const { access_token, data_user } = doLogin.data.data const { access_token, data_user } = doLogin.data.data
this.getDataRole(access_token, data_user.role_id) this.getDataRole(access_token, data_user.role_id)
this.getDataMenu(access_token, data_user.role_id, data_user.id, data_user.company_id, data_user.role.name, data_user.role.all_project) this.getDataMenu(access_token, data_user.role_id, data_user.hierarchy, data_user.id, data_user.company_id, data_user.role.name, data_user.role.all_project, data_user.user_name)
window.localStorage.setItem('isLogin', true); window.localStorage.setItem('isLogin', true);
window.localStorage.setItem('token', access_token); window.localStorage.setItem('token', access_token);
window.localStorage.setItem('user_id', data_user.id); window.localStorage.setItem('user_id', data_user.id);

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

File diff suppressed because it is too large Load Diff

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

@ -85,23 +85,18 @@ const url = "";
const format = "DD-MM-YYYY"; const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => { const CreatedProyek = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, all_project = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
company_id = props.location.state.company_id; company_id = props.company_id;
all_project = props.location.state.all_project; all_project = props.all_project;
role_name = props.role_name;
} else { isLogin = props.isLogin;
role_id = localStorage.getItem("role_id"); hierarchy = props.hierarchy;
proyek_id = localStorage.getItem("proyek_id"); user_name = props.user_name;
user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
all_project = localStorage.getItem('all_project');
} }
const history = useHistory(); const history = useHistory();
const HEADER = { const HEADER = {
@ -370,7 +365,6 @@ const CreatedProyek = ({ params, ...props }) => {
column_join: "type_proyek_id", column_join: "type_proyek_id",
column_results: ["name", "description"], column_results: ["name", "description"],
}, },
// { "name": "subproyeks.m_subproyek", "column_join": "parent_id", "column_results": ["nama", "biaya", "color_progress", "jumlah_pekerja", "pic", "mulai_proyek", "akhir_proyek", "biaya_actual", "persentase_progress_plan", "persentase_progress_actual"] }
], ],
orders: { columns: ["nama"], ascending: true }, orders: { columns: ["nama"], ascending: true },
paging: { start: start, length: rowsPerPage }, paging: { start: start, length: rowsPerPage },
@ -512,7 +506,6 @@ const CreatedProyek = ({ params, ...props }) => {
}; };
const handleOpenDialogGantt = (data) => { const handleOpenDialogGantt = (data) => {
console.log('data.mulai_proyek', data.mulai_proyek);
setDataViewStartDate(data.mulai_proyek) setDataViewStartDate(data.mulai_proyek)
setidTask(data.id); setidTask(data.id);
setProyekName(data.nama); setProyekName(data.nama);
@ -718,7 +711,6 @@ const CreatedProyek = ({ params, ...props }) => {
orders: { columns: ["id"], ascending: true }, orders: { columns: ["id"], ascending: true },
paging: { start: 0, length: -1 }, paging: { start: 0, length: -1 },
}; };
// const url = PROJECT_MI(proyek_id)
const result = await axios const result = await axios
.post(ASSIGN_HR_PROJECT_SEARCH, payload, HEADER) .post(ASSIGN_HR_PROJECT_SEARCH, payload, HEADER)
.then((res) => res) .then((res) => res)
@ -1342,9 +1334,13 @@ const CreatedProyek = ({ params, ...props }) => {
orders: { columns: ["id"], ascending: false }, orders: { columns: ["id"], ascending: false },
}; };
if (parseInt(role_id) !== 1) { if (all_project !== null && all_project === true) {
payload["columns"] = [
{ name: "company_id", logic_operator: "like", value: company_id, operator: "AND" }
];
} else {
payload["columns"] = [ payload["columns"] = [
{ name: "id", logic_operator: "=", value: proyek_id, operator: "AND" }, { name: "created_by_id", logic_operator: "IN", value: hierarchy, operator: "AND" }
]; ];
} }
@ -2039,7 +2035,6 @@ const CreatedProyek = ({ params, ...props }) => {
)} )}
<Tooltip title="Export"> <Tooltip title="Export">
<Popover <Popover
// content={<a onClick={hide}>Close</a>}
title="Export" title="Export"
trigger="click" trigger="click"
placement="leftBottom" placement="leftBottom"
@ -2064,12 +2059,9 @@ const CreatedProyek = ({ params, ...props }) => {
</Button> </Button>
</> </>
} }
// visible={visible}
// onVisibleChange={handleVisibleChange}
> >
<Button <Button
style={{ marginLeft: "5px" }} style={{ marginLeft: "5px" }}
// onClick={() => handleExportExcel()}
> >
<i className="fa fa-print"></i> <i className="fa fa-print"></i>
</Button> </Button>

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

@ -17,22 +17,19 @@ const column = [
] ]
const ProjectType = ({ params, ...props }) => { const ProjectType = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin"); }
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name');
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

17
src/views/SimproV2/Gantt/GanttFrame.js

@ -3,22 +3,9 @@ import { useHistory, withRouter } from 'react-router-dom';
import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst'; import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
const GanttFrame = React.memo((props) => { const GanttFrame = React.memo((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;
isLogin = props.location.state.isLogin;
token = props.location.state.token;
} else {
role_id = localStorage.getItem("role_id");
proyek_id = localStorage.getItem("proyek_id");
user_id = localStorage.getItem("user_id");
isLogin = localStorage.getItem("isLogin");
token = localStorage.getItem("token");
}
const history = useHistory(); const history = useHistory();
const { versionGanttId, idProject, ro, timestamp, dataViewStartDate } = props; const { versionGanttId, idProject, ro, timestamp, dataViewStartDate, token } = props;
const iframeSrc = `http://localhost:8444/adw-gantt/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}`; const iframeSrc = `https://project-gantt.ospro.id/edit-mode/index.html?base_url=${BASE_SIMPRO_LUMEN}&gantt_id=${versionGanttId}&proyek_id=${idProject}&token=${token}&ro=${ro}&timestamp=${timestamp}&start=${dataViewStartDate}`;
const [batchEntityData, setBatchEntityData] = useState(null); const [batchEntityData, setBatchEntityData] = useState(null);
useEffect(() => { useEffect(() => {

27
src/views/SimproV2/Gantt/index.js

@ -15,18 +15,18 @@ import GanttFrame from "./GanttFrame";
let roCount = 0; let roCount = 0;
const Gantt = (props) => { const Gantt = (props) => {
let role_id = '', userId = '', isLogin = '', token = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
userId = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
} else { company_id = props.company_id;
role_id = localStorage.getItem("role_id"); all_project = props.all_project;
userId = localStorage.getItem("user_id"); role_name = props.role_name;
token = localStorage.getItem("token"); isLogin = props.isLogin;
isLogin = localStorage.getItem("isLogin"); hierarchy = props.hierarchy;
user_name = props.user_name;
} }
const HEADER = { const HEADER = {
headers: { headers: {
@ -39,7 +39,6 @@ const Gantt = (props) => {
const timestamp = props.match.params.timestamp const timestamp = props.match.params.timestamp
? props.match.params.timestamp ? props.match.params.timestamp
: 0; : 0;
const [ro, setRo] = useState(1); const [ro, setRo] = useState(1);
const [listUserGant, setListUserGantt] = useState([]); const [listUserGant, setListUserGantt] = useState([]);
const [ready, setReady] = useState(false); const [ready, setReady] = useState(false);
@ -93,7 +92,7 @@ const Gantt = (props) => {
}; };
const cekPermission = () => { const cekPermission = () => {
let check = listUserGant.includes(parseInt(userId)); let check = listUserGant.includes(parseInt(user_id));
if (check) { if (check) {
setRo(0); setRo(0);
} else { } else {

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

@ -13,21 +13,18 @@ import { Pagination, Button, Tooltip, Table } from 'antd';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const ProjectType = ({ params, ...props }) => { const ProjectType = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name');
} }
const HEADER = { const HEADER = {
headers: { headers: {

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

@ -15,21 +15,18 @@ import {
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
const ResourceWorker = ({ params, ...props }) => { const ResourceWorker = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin");
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name');
} }
const HEADER = { const HEADER = {

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

@ -11,22 +11,20 @@ import { useTranslation } from 'react-i18next';
const Satuan = ({ params, ...props }) => { const Satuan = ({ params, ...props }) => {
let role_id = '', user_id = '', proyek_id = '', isLogin = '', token = '', company_id = 0, role_name = ''; let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name='', hierarchy=[], user_name='';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props && props.role_id && props.user_id) {
role_id = props.location.state.role_id; role_id = props.role_id;
user_id = props.location.state.user_id; user_id = props.user_id;
token = props.location.state.token; token = props.token;
isLogin = props.location.state.isLogin; isLogin = props.isLogin;
role_name = props.location.state.role_name; company_id = props.company_id;
} else { all_project = props.all_project;
role_id = localStorage.getItem("role_id"); role_name = props.role_name;
proyek_id = localStorage.getItem("proyek_id"); isLogin = props.isLogin;
user_id = localStorage.getItem("user_id"); hierarchy = props.hierarchy;
token = localStorage.getItem("token"); user_name = props.user_name;
isLogin = localStorage.getItem("isLogin"); }
company_id = localStorage.getItem('company_id');
role_name = localStorage.getItem('role_name');
}
const HEADER = { const HEADER = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",

Loading…
Cancel
Save