Browse Source

Merge pull request 'update filter and add project by company' (#16) from Dev-Farhan into staging

Reviewed-on: ibnu/generic-ospro-frontend#16
pull/1/head
farhantock 11 months ago
parent
commit
255647d2d1
  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';
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) {
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;
all_project = props.location.state.all_project;
} else {
role_id = localStorage.getItem("role_id");
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');
}
let hierarchy = [];
hierarchy.push(JSON.parse(localStorage.getItem("hierarchy")));
const HEADER = {
headers: {
"Content-Type": "application/json",
@ -74,7 +80,7 @@ const DashboardBOD = (props) => {
// project expenditure
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 content = "Get Project Expenditure.";

18
src/views/Dashboard/DashboardProjectCarousell.js

@ -93,8 +93,19 @@ const DashboardProject = (args) => {
const [activeIndex, setActiveIndex] = useState(0);
const [animating, setAnimating] = useState(false);
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(() => {
setLoading(true);
@ -397,7 +408,7 @@ const DashboardProject = (args) => {
</Col>
<Col span={12} style={{ fontSize: 11 }}>
{item.project ? (
item.project.mulai_proyek
moment(item.project.mulai_proyek).format("DD MMMM YYYY")
) : (
<SingleTextLoader width={100} height={10} />
)}
@ -410,7 +421,7 @@ const DashboardProject = (args) => {
</Col>
<Col span={12} style={{ fontSize: 11 }}>
{item.project ? (
item.project.akhir_proyek
moment(item.project.akhir_proyek).format("DD MMMM YYYY")
) : (
<SingleTextLoader width={100} height={10} />
)}
@ -780,7 +791,6 @@ const DashboardProject = (args) => {
<Col span={24}>
<Spin tip="Loading..." spinning={loading} style={{ marginTop: 120 }}>
<Carousel
pause={true}
activeIndex={activeIndex}
next={next}
previous={previous}

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

@ -37,7 +37,6 @@ class DialogDetail extends Component {
async componentDidUpdate() {
if (this.state.isParentClick === true) {
const { dataDetail } = this.props
console.log("cek data detail", dataDetail)
this.setState({
id: dataDetail.id
}, () => {
@ -88,7 +87,6 @@ class DialogDetail extends Component {
.post(url, payload, config)
.then(res => res)
.catch((error) => error.response);
console.log('cek data detail', result.data)
if (result && result.data && result.data.code === 200) {
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("role_id", role_id)
if (data.length > 0) {
console.log("cek data waspang proyek",data)
let dataObj = data[0]
setType("edit")
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 = {
headers:
{
@ -159,14 +159,14 @@ class Login extends Component {
else {
this.props.history.push({
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 (role_id === 44) {
this.props.history.push({
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 {
this.props.history.push(this.state.defaultPage);
@ -222,7 +222,7 @@ class Login extends Component {
if (doLogin && doLogin.data && doLogin.data.code === 200) {
const { access_token, data_user } = doLogin.data.data
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('token', access_token);
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('company_id', data_user.company_id);
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));
} else {
// NotificationManager.error('Cek username atau password anda!', 'Gagal Login!');

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

@ -34,7 +34,8 @@ const DialogFormProyek = ({
dataPhaseProject,
dataDivisions,
dataPM,
projectImage
projectImage,
company_id
}) => {
const token = localStorage.getItem("token");
const HEADER = {
@ -274,6 +275,7 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol,
currency_code: currencyCode,
currency_name: currencyName,
company_id: parseInt(company_id)
};
data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval };
data.imageStructureOrg = organization ? organization : null;
@ -304,6 +306,7 @@ const DialogFormProyek = ({
currency_symbol: currencySymbol,
currency_code: currencyCode,
currency_name: currencyName,
company_id: parseInt(company_id)
};
data.projectCharter = { checklist, issue, potentialRisks, participants, milestones, approval };
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;
token = props.location.state.token;
isLogin = props.location.state.isLogin;
company_id = props.location.state.company_id;
} else {
role_id = localStorage.getItem("role_id");
@ -139,7 +140,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [userProyek, setUserProyek] = useState([]);
const [materialProyek, setMaterialProyek] = useState([]);
const [dataCharter, setDataCharter] = useState(null);
const [dataView, setDataView] = useState([]);
const [dataViewStartDate, setDataViewStartDate] = useState([]);
const [materialResource, setMaterialResource] = useState([]);
const [toolsResource, setToolsResource] = useState([]);
const [dataTypeProyek, setDataTypeProyek] = useState([]);
@ -166,7 +167,7 @@ const CreatedProyek = ({ params, ...props }) => {
const [loadHierarchy, setLoadHierarchy] = useState(false);
const [dataVersionGantt, setDataVersionGantt] = useState([]);
const [dataHierarchy, setDataHierarchy] = useState([]);
const [dataDetail, setDataDetail] = useState(null);
const [dataDetail, setDataDetail] = useState([]);
const [loading, setLoading] = useState(true);
const pageName = params.name;
@ -1809,6 +1810,7 @@ const CreatedProyek = ({ params, ...props }) => {
dataDivisions={dataDivisions}
dataPM={dataPm}
projectImage={image}
company_id={company_id}
/>
),
[

Loading…
Cancel
Save