root 10 months ago
parent
commit
ae3521baf7
  1. 10
      src/views/Dashboard/DashboardBOD.js
  2. 18
      src/views/Dashboard/DashboardProjectCarousell.js
  3. 2
      src/views/Master/MasterBroadcast/DialogDetail.js
  4. 1
      src/views/Master/UserWaspang/DialogProyek.js
  5. 9
      src/views/Pages/Login/Login.js
  6. 5
      src/views/SimproV2/CreatedProyek/DialogFormProyek.js
  7. 6
      src/views/SimproV2/CreatedProyek/index.js

10
src/views/Dashboard/DashboardBOD.js

@ -15,18 +15,24 @@ 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 = ''; let role_id = '', user_id = '', isLogin = '', token = '', company_id = 0, all_project = '';
if (props.location.state && props.location.state.role_id && props.location.state.user_id) { if (props.location.state && props.location.state.role_id && props.location.state.user_id) {
role_id = props.location.state.role_id; role_id = props.location.state.role_id;
user_id = props.location.state.user_id; user_id = props.location.state.user_id;
token = props.location.state.token; token = props.location.state.token;
isLogin = props.location.state.isLogin; isLogin = props.location.state.isLogin;
company_id = props.location.state.company_id;
all_project = props.location.state.all_project;
} else { } else {
role_id = localStorage.getItem("role_id"); role_id = localStorage.getItem("role_id");
user_id = localStorage.getItem("user_id"); user_id = localStorage.getItem("user_id");
token = localStorage.getItem("token"); token = localStorage.getItem("token");
isLogin = localStorage.getItem("isLogin"); 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",
@ -74,7 +80,7 @@ const DashboardBOD = (props) => {
// project expenditure // project expenditure
const getCompanyCashFlow = async () => { const getCompanyCashFlow = async () => {
const URL = `${BASE_OSPRO}/api/dashboard/get-company-cashflow/${moment().format('YYYY')}` const URL = `${BASE_OSPRO}/api/dashboard/get-company-cashflow/${moment().format('YYYY')}/${company_id}/${all_project}/${hierarchy}`
const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response) const result = await axios.get(URL, HEADER).then(res => res).catch(err => err.response)
const content = "Get Project Expenditure."; const content = "Get Project Expenditure.";

18
src/views/Dashboard/DashboardProjectCarousell.js

@ -93,8 +93,19 @@ const DashboardProject = (args) => {
const [activeIndex, setActiveIndex] = useState(0); const [activeIndex, setActiveIndex] = useState(0);
const [animating, setAnimating] = useState(false); const [animating, setAnimating] = useState(false);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [carouselPaused, setCarouselPaused] = useState(false); const [carouselInterval, setCarouselInterval] = useState(null);
useEffect(() => {
const intervalId = setInterval(() => {
next();
}, 180000);
setCarouselInterval(intervalId);
return () => {
clearInterval(intervalId);
};
}, [activeIndex]);
useEffect(() => { useEffect(() => {
setLoading(true); setLoading(true);
@ -398,7 +409,7 @@ const DashboardProject = (args) => {
</Col> </Col>
<Col span={12} style={{ fontSize: 11 }}> <Col span={12} style={{ fontSize: 11 }}>
{item.project ? ( {item.project ? (
item.project.mulai_proyek moment(item.project.mulai_proyek).format("DD MMMM YYYY")
) : ( ) : (
<SingleTextLoader width={100} height={10} /> <SingleTextLoader width={100} height={10} />
)} )}
@ -411,7 +422,7 @@ const DashboardProject = (args) => {
</Col> </Col>
<Col span={12} style={{ fontSize: 11 }}> <Col span={12} style={{ fontSize: 11 }}>
{item.project ? ( {item.project ? (
item.project.akhir_proyek moment(item.project.akhir_proyek).format("DD MMMM YYYY")
) : ( ) : (
<SingleTextLoader width={100} height={10} /> <SingleTextLoader width={100} height={10} />
)} )}
@ -781,7 +792,6 @@ const DashboardProject = (args) => {
<Col span={24}> <Col span={24}>
<Spin tip="Loading..." spinning={loading} style={{ marginTop: 120 }}> <Spin tip="Loading..." spinning={loading} style={{ marginTop: 120 }}>
<Carousel <Carousel
pause={true}
activeIndex={activeIndex} activeIndex={activeIndex}
next={next} next={next}
previous={previous} previous={previous}

2
src/views/Master/MasterBroadcast/DialogDetail.js

@ -37,7 +37,6 @@ class DialogDetail extends Component {
async componentDidUpdate() { async componentDidUpdate() {
if (this.state.isParentClick === true) { if (this.state.isParentClick === true) {
const { dataDetail } = this.props const { dataDetail } = this.props
console.log("cek data detail", dataDetail)
this.setState({ this.setState({
id: dataDetail.id id: dataDetail.id
}, () => { }, () => {
@ -88,7 +87,6 @@ class DialogDetail extends Component {
.post(url, payload, config) .post(url, payload, config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
console.log('cek data detail', result.data)
if (result && result.data && result.data.code === 200) { if (result && result.data && result.data.code === 200) {
if (result.data.data && result.data.data) { if (result.data.data && result.data.data) {

1
src/views/Master/UserWaspang/DialogProyek.js

@ -28,7 +28,6 @@ const DialogProyek = ({openDialog, closeDialog, toggleDialog, dataWaspangProyek,
console.log("waspang id", waspangId) console.log("waspang id", waspangId)
console.log("role_id", role_id) console.log("role_id", role_id)
if (data.length > 0) { if (data.length > 0) {
console.log("cek data waspang proyek",data)
let dataObj = data[0] let dataObj = data[0]
setType("edit") setType("edit")
setProyekId(dataObj.proyek_id) setProyekId(dataObj.proyek_id)

9
src/views/Pages/Login/Login.js

@ -133,7 +133,7 @@ class Login extends Component {
} }
} }
getDataMenu = async (token, role_id, user_id, company_id, role_name) => { getDataMenu = async (token, role_id, user_id, company_id, role_name, all_project) => {
const config = { const config = {
headers: headers:
{ {
@ -159,14 +159,14 @@ 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: { role_id: role_id, user_id: user_id, token: token, isLogin: true, company_id: company_id, role_name: role_name, all_project: all_project }
}); });
} }
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 } 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 }
}); });
} else { } else {
this.props.history.push(this.state.defaultPage); this.props.history.push(this.state.defaultPage);
@ -222,7 +222,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) this.getDataMenu(access_token, data_user.role_id, data_user.id, data_user.company_id, data_user.role.name, data_user.role.all_project)
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);
@ -230,6 +230,7 @@ class Login extends Component {
window.localStorage.setItem('role_id', data_user.role_id); window.localStorage.setItem('role_id', data_user.role_id);
window.localStorage.setItem('company_id', data_user.company_id); window.localStorage.setItem('company_id', data_user.company_id);
window.localStorage.setItem('role_name', data_user.role.name); window.localStorage.setItem('role_name', data_user.role.name);
window.localStorage.setItem('all_project', data_user.role.all_project);
window.localStorage.setItem('hierarchy', JSON.stringify(data_user.hierarchy)); window.localStorage.setItem('hierarchy', JSON.stringify(data_user.hierarchy));
} else { } else {
// NotificationManager.error('Cek username atau password anda!', 'Gagal Login!'); // NotificationManager.error('Cek username atau password anda!', 'Gagal Login!');

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

@ -34,7 +34,8 @@ const DialogFormProyek = ({
dataPhaseProject, dataPhaseProject,
dataDivisions, dataDivisions,
dataPM, dataPM,
projectImage projectImage,
company_id
}) => { }) => {
const token = localStorage.getItem("token"); const token = localStorage.getItem("token");
const HEADER = { const HEADER = {
@ -274,6 +275,7 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol, currency_symbol: currencySymbol,
currency_code: currencyCode, currency_code: currencyCode,
currency_name: currencyName, currency_name: currencyName,
company_id: parseInt(company_id)
}; };
data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval }; data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval };
data.imageStructureOrg = organization ? organization : null; data.imageStructureOrg = organization ? organization : null;
@ -304,6 +306,7 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol, currency_symbol: currencySymbol,
currency_code: currencyCode, currency_code: currencyCode,
currency_name: currencyName, currency_name: currencyName,
company_id: parseInt(company_id)
}; };
data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval }; data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval };
data.imageStructureOrg = organization ? organization : null; data.imageStructureOrg = organization ? organization : null;

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

@ -91,6 +91,7 @@ const CreatedProyek = ({ params, ...props }) => {
user_id = props.location.state.user_id; user_id = props.location.state.user_id;
token = props.location.state.token; token = props.location.state.token;
isLogin = props.location.state.isLogin; isLogin = props.location.state.isLogin;
company_id = props.location.state.company_id;
} else { } else {
role_id = localStorage.getItem("role_id"); role_id = localStorage.getItem("role_id");
@ -139,7 +140,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [userProyek, setUserProyek] = useState([]); const [userProyek, setUserProyek] = useState([]);
const [materialProyek, setMaterialProyek] = useState([]); const [materialProyek, setMaterialProyek] = useState([]);
const [dataCharter, setDataCharter] = useState(null); const [dataCharter, setDataCharter] = useState(null);
const [dataView, setDataView] = useState([]); const [dataViewStartDate, setDataViewStartDate] = useState([]);
const [materialResource, setMaterialResource] = useState([]); const [materialResource, setMaterialResource] = useState([]);
const [toolsResource, setToolsResource] = useState([]); const [toolsResource, setToolsResource] = useState([]);
const [dataTypeProyek, setDataTypeProyek] = useState([]); const [dataTypeProyek, setDataTypeProyek] = useState([]);
@ -166,7 +167,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [loadHierarchy, setLoadHierarchy] = useState(false); const [loadHierarchy, setLoadHierarchy] = useState(false);
const [dataVersionGantt, setDataVersionGantt] = useState([]); const [dataVersionGantt, setDataVersionGantt] = useState([]);
const [dataHierarchy, setDataHierarchy] = useState([]); const [dataHierarchy, setDataHierarchy] = useState([]);
const [dataDetail, setDataDetail] = useState(null); const [dataDetail, setDataDetail] = useState([]);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const pageName = params.name; const pageName = params.name;
@ -1809,6 +1810,7 @@ const CreatedProyek = ({ params, ...props }) => {
dataDivisions={dataDivisions} dataDivisions={dataDivisions}
dataPM={dataPm} dataPM={dataPm}
projectImage={image} projectImage={image}
company_id={company_id}
/> />
), ),
[ [

Loading…
Cancel
Save