staging #2

Merged
farhantock merged 3 commits from staging into master 5 months ago
  1. 13
      src/views/SimproV2/CreatedProyek/index.js
  2. 2
      src/views/SimproV2/Gantt/GanttFrame.js
  3. 19
      src/views/SimproV2/Gantt/index.js

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

@ -91,6 +91,7 @@ const url = "";
const format = "DD-MM-YYYY";
const CreatedProyek = ({ params, ...props }) => {
let pageRow = 10;
let role_id = 0, user_id = 0, isLogin = false, token = '', company_id = 0, all_project = null, role_name = '', hierarchy = [], user_name = '', configApp = {};
if (props && props.role_id && props.user_id) {
role_id = props.role_id;
@ -141,7 +142,9 @@ const CreatedProyek = ({ params, ...props }) => {
const [dataK3, setDataK3] = useState([]); // transfer list
const [idDelete, setIdDelete] = useState(0);
const [alertDelete, setAlertDelete] = useState(false);
const [rowsPerPage, setRowsPerPage] = useState(10);
const [rowsPerPage, setRowsPerPage] = useState(() => {
return parseInt(localStorage.getItem('pageTable')) || pageRow;
});
const [dataExport, setDataExport] = useState([]);
const [userProyek, setUserProyek] = useState([]);
const [materialProyek, setMaterialProyek] = useState([]);
@ -220,6 +223,13 @@ const CreatedProyek = ({ params, ...props }) => {
getDataProyek();
}, [search, rowsPerPage, currentPage]);
useEffect(() => {
const storedPageSize = localStorage.getItem('pageTable');
if (!storedPageSize) {
localStorage.setItem('pageTable', pageRow);
}
}, [pageRow]);
useEffect(() => {
if (dataExport.length > 0) {
exportExcel();
@ -1392,6 +1402,7 @@ const CreatedProyek = ({ params, ...props }) => {
};
const onShowSizeChange = (current, pageSize) => {
localStorage.setItem('pageTable', pageSize);
setRowsPerPage(pageSize);
};

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

@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
import { useHistory, withRouter } from 'react-router-dom';
import { BASE_SIMPRO_LUMEN } from '../../../const/ApiConst';
const GanttFrame = React.memo((props) => {
const GanttFrame = React.memo(({ versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, companyId, role_name, company_name }) => {
const history = useHistory();
const { versionGanttId, idProject, ro, timestamp, dataViewStartDate, token, companyId, role_name, company_name } = props;
const iframeSrc = `https://si-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}&role_name=${role_name}&company_id=${companyId}&company_name=${company_name}`;

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

@ -10,7 +10,21 @@ let roCount = 0;
const Gantt = (props) => {
const location = useLocation();
const { isLogin, token, role_id, user_id, company_id, dataViewStartDate, companyName, role_name } = location.state || {};
const { company_id, dataViewStartDate, companyName, role_name } = location.state || {};
let role_id = '', userId = '', isLogin = '', token = '';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id;
userId = props.location.state.user_id;
token = props.location.state.token;
isLogin = props.location.state.isLogin;
} else {
role_id = localStorage.getItem("role_id");
userId = localStorage.getItem("user_id");
token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin");
}
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -76,7 +90,7 @@ const Gantt = (props) => {
};
const cekPermission = () => {
let check = listUserGant.includes(parseInt(user_id));
let check = listUserGant.includes(parseInt(userId));
if (check) {
setRo(0);
} else {
@ -100,6 +114,7 @@ const Gantt = (props) => {
role_name={role_name}
companyId={company_id}
timestamp={timestamp}
dataViewStartDate={dataViewStartDate}
company_name={companyName}
/>
)}

Loading…
Cancel
Save