Commit fb040c34 authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

push conflict index dan hp xiaomi

parents 2b709459 f0391691
...@@ -210,6 +210,7 @@ const create = (type = "") => { ...@@ -210,6 +210,7 @@ const create = (type = "") => {
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body) const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getDashboard = (body) => api.get('transaction/get_dashboard') const getDashboard = (body) => api.get('transaction/get_dashboard')
const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body) const historyApproval = (body) => api.post('transaction/master_budget/history_approval', body)
const getDashboardUser = () => api.get('transaction/get_dashboard_sub_co')
const getDashboardMB = (body) => api.get('transaction/get_dashboard_table') const getDashboardMB = (body) => api.get('transaction/get_dashboard_table')
const getOpetratingIndID = (body) => api.post('transaction/operating_indicator/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/operating_indicator/get_operating_indicator_id', body)
...@@ -423,7 +424,8 @@ const create = (type = "") => { ...@@ -423,7 +424,8 @@ const create = (type = "") => {
checkApproverOLPA, checkApproverOLPA,
getLastPeriodeOI, getLastPeriodeOI,
getSubmitOI, getSubmitOI,
getLastPeriodOI getLastPeriodOI,
getDashboardUser
} }
} }
......
...@@ -78,7 +78,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -78,7 +78,9 @@ export default class CorporateAnnualTarget extends Component {
buttonDraft: true, buttonDraft: true,
updateBy: '', updateBy: '',
handleTekTekTek: 0, handleTekTekTek: 0,
editable: false editable: false,
dataCustomerPrs: [],
dataInternalBsn: []
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -104,12 +106,35 @@ export default class CorporateAnnualTarget extends Component { ...@@ -104,12 +106,35 @@ export default class CorporateAnnualTarget extends Component {
// console.log(JSON.stringify(payload)) // console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => { api.create().getDetailReportMB(payload).then(response => {
let dataTable = [] let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
// console.log(response) // console.log(response)
let res = response.data.data let res = response.data.data
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE' let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
if (item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataInternalBsn.push({
id: item.id,
name: item.description,
check: false
})
}
}
if (item.parent_name == 'CUSTOMER PERSPECTIVE') {
if (item.type_report_id !== 4) {
dataCustomerPrs.push({
id: item.id,
name: item.description,
check: false
})
}
}
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -192,7 +217,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -192,7 +217,9 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}) })
this.setState({ dataTable, loading: false, dataReal: res, editable: true }) this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => {
console.log(dataCustomerPrs)
})
}) })
} }
...@@ -325,13 +352,37 @@ export default class CorporateAnnualTarget extends Component { ...@@ -325,13 +352,37 @@ export default class CorporateAnnualTarget extends Component {
console.log(JSON.stringify(this.state.payload)) console.log(JSON.stringify(this.state.payload))
api.create().checkUploadMB(this.state.payload).then(response => { api.create().checkUploadMB(this.state.payload).then(response => {
// // console.log(JSON.stringify(this.state.payload)); // // console.log(JSON.stringify(this.state.payload));
// console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleCAT: false }) // this.setState({ visibleUpload: false, visibleCAT: false })
this.setState({ visibleUpload: false, visibleCAT: false }) this.setState({ visibleUpload: false, visibleCAT: false })
let dataTable = response.data.data.map((item, index) => { let dataTable = []
return [ let custoId = 0
let bisnsId = 0
let dataDelete = this.state.dataDelete
response.data.data.map((item, index) => {
if (item.item_report == 'CUSTOMER PERSPECTIVE') {
custoId = item.item_report_id
}
if (item.item_report == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
bisnsId = item.item_report_id
}
if (item.type_report_id !== 4 && item.parent !== null && (item.parent == custoId || item.parent == bisnsId)) {
let indexCust = this.state.dataCustomerPrs.findIndex((val) => val.name == item.item_report)
let indexBisn = this.state.dataInternalBsn.findIndex((val) => val.name == item.item_report)
if (indexCust !== -1 && item.item_report_id == 0) {
dataDelete.push(this.state.dataCustomerPrs[indexCust].id)
}
if (indexBisn !== -1 && item.item_report_id == 0) {
dataDelete.push(this.state.dataInternalBsn[indexBisn].id)
}
}
dataTable.push([
item.type_report_id, item.type_report_id,
item.item_report_id, item.item_report_id,
item.parent, item.parent,
...@@ -363,11 +414,11 @@ export default class CorporateAnnualTarget extends Component { ...@@ -363,11 +414,11 @@ export default class CorporateAnnualTarget extends Component {
item.strategic, item.strategic,
item.pic, item.pic,
item.error item.error
] ])
}) })
// console.log(dataTable) console.log(dataTable)
// console.log(this.state.buttonError) // console.log(this.state.buttonError)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, dataDelete }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[30].length > 0) { if (item[30].length > 0) {
// console.log('masuk') // console.log('masuk')
...@@ -382,8 +433,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -382,8 +433,9 @@ export default class CorporateAnnualTarget extends Component {
} }
uploadCAT(type) { uploadCAT(type) {
// let dataDelete = this.state.dataDelete
// console.log(dataDelete)
let payload = { "item_report_id": this.state.dataDelete } let payload = { "item_report_id": this.state.dataDelete }
if (this.state.dataDelete.length > 0) { if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => { api.create().deleteAllItemReport(payload).then((response) => {
this.functionUpload(type) this.functionUpload(type)
...@@ -436,7 +488,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -436,7 +488,7 @@ export default class CorporateAnnualTarget extends Component {
"cat": data "cat": data
} }
// console.log(data); // console.log(data);
// console.log(JSON.stringify(body)) console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMasterBudget(body).then(response => { api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// console.log(response); // console.log(response);
if (response.data) { if (response.data) {
...@@ -888,7 +940,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -888,7 +940,7 @@ export default class CorporateAnnualTarget extends Component {
} }
const handleTambah = (data, rowIndex) => { const handleTambah = (data, rowIndex) => {
// console.log(dataTable2) console.log(dataTable2)
let newData = [] let newData = []
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
newData.push(item) newData.push(item)
...@@ -932,6 +984,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -932,6 +984,7 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ dataTable: dataTable2 }, () => { this.setState({ dataTable: dataTable2 }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.setState({ loading: false })
console.log(dataTable2)
}, 500) }, 500)
}) })
} }
......
...@@ -512,10 +512,15 @@ export default class FixedAssetsMovement extends Component { ...@@ -512,10 +512,15 @@ export default class FixedAssetsMovement extends Component {
} else { } else {
// console.log(item) // console.log(item)
let indexID = dataTable2.findIndex((val) => val[22] == item) let indexID = dataTable2.findIndex((val) => val[22] == item)
// console.log(dataTable2[indexID][tableMeta.columnIndex]) // console.log(dataTable2[indexID])
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
anjay.push(valuezz == "" ? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
} else {
if (item === '(-1)') {
anjay.push(-1)
}
// console.log(item);
} }
} }
} }
...@@ -551,8 +556,8 @@ export default class FixedAssetsMovement extends Component { ...@@ -551,8 +556,8 @@ export default class FixedAssetsMovement extends Component {
// console.log(dataTable2[tableMeta.rowIndex][22]) // console.log(dataTable2[tableMeta.rowIndex][22])
// console.log(tableMeta.rowData[5]) // console.log(tableMeta.rowData[5])
// if (tableMeta.rowData[5] == 'Beginning Balance') { // if (tableMeta.rowData[5] == 'Beginning Balance') {
// console.log(baru) // console.log(baru)
// console.log(anjay) // console.log(anjay)
// console.log(total) // console.log(total)
// } // }
......
...@@ -23,6 +23,8 @@ class HomePage extends Component { ...@@ -23,6 +23,8 @@ class HomePage extends Component {
{ nama: 'Daya Group', status: 'open' }, { nama: 'Daya Group', status: 'open' },
], ],
isApprover: true, isApprover: true,
listSubcoMB: [],
valueSubmit: 0,
listdmb: [], listdmb: [],
dataTableMB: [] dataTableMB: []
} }
...@@ -49,6 +51,7 @@ class HomePage extends Component { ...@@ -49,6 +51,7 @@ class HomePage extends Component {
// } // }
// }) // })
this.getApprMat() this.getApprMat()
this.getListUserSubco()
this.getDashboardMB() this.getDashboardMB()
} }
...@@ -59,6 +62,26 @@ class HomePage extends Component { ...@@ -59,6 +62,26 @@ class HomePage extends Component {
} }
} }
getListUserSubco() {
api.create().getDashboardUser().then(response => {
console.log(response);
let valueSubmit = 0
if (response.data) {
if (response.data.status === "success") {
response.data.data.map((item, index) => {
if (item.is_submit === true) {
valueSubmit += 1
}
})
this.setState({
listSubcoMB: response.data.data,
valueSubmit
})
}
}
})
}
getDashboard() { getDashboard() {
let listDashboard = [] let listDashboard = []
api.create().getDashboard().then((response) => { api.create().getDashboard().then((response) => {
...@@ -77,14 +100,14 @@ class HomePage extends Component { ...@@ -77,14 +100,14 @@ class HomePage extends Component {
api.create().getAM().then((response) => { api.create().getAM().then((response) => {
console.log(response); console.log(response);
let actAM = response.data.data.map((item, index) => { let actAM = response.data.data.map((item, index) => {
if(String(item.status).toLocaleLowerCase() == 'active'){ if (String(item.status).toLocaleLowerCase() == 'active') {
return item return item
} }
}) })
let userId = localStorage.getItem(Constant.USER) let userId = localStorage.getItem(Constant.USER)
let indexId = actAM.findIndex((val) => val.user_id == userId) let indexId = actAM.findIndex((val) => val.user_id == userId)
if (indexId === -1){ if (indexId === -1) {
this.setState({ isApprover: false }) this.setState({ isApprover: false })
} }
console.log(actAM) console.log(actAM)
...@@ -223,7 +246,7 @@ class HomePage extends Component { ...@@ -223,7 +246,7 @@ class HomePage extends Component {
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
</div> </div>
<div style={{ marginTop: 20 }}> {/* <div style={{ marginTop: 20 }}>
<Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Status Laporan</Typography> <Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Status Laporan</Typography>
<div style={{ marginTop: 10, display: 'flex' }}> <div style={{ marginTop: 10, display: 'flex' }}>
<div style={{ width: 280, height: 400, padding: 20, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4', marginRight: 25 }}> <div style={{ width: 280, height: 400, padding: 20, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4', marginRight: 25 }}>
...@@ -350,7 +373,7 @@ class HomePage extends Component { ...@@ -350,7 +373,7 @@ class HomePage extends Component {
</div> </div>
</div> </div>
</div> </div>
</div> </div> */}
</div> </div>
</div> </div>
: :
...@@ -364,16 +387,33 @@ class HomePage extends Component { ...@@ -364,16 +387,33 @@ class HomePage extends Component {
</div> </div>
</div> </div>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ width: 400, padding: 20, borderRadius: 10 }}> <Paper style={{ width: 450, padding: 20, borderRadius: 10 }}>
<Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>Master Budget - Oct 2020 (1/4)</Typography> <Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>{`Master Budget ${this.state.valueSubmit}/${this.state.listSubcoMB.length}`}</Typography>
{this.state.listMasterBudget.map((item, index) => { {this.state.listSubcoMB.map((item, index) => {
return ( return (
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 10, paddingLeft: 10 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 10, paddingLeft: 10 }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<img src={item.status === "overdue" ? Images.dotOverdue : item.status === "open" ? Images.dotOpen : Images.dotDone} /> <img src={item.is_submit === true ? Images.dotDone : item.is_overdue === true ? Images.dotOverdue : Images.dotOpen} />
<Typography style={{ marginLeft: 10, color: '#5198ea', fontSize: 13 }}>{item.nama}</Typography> <Link to={{
pathname: `/home/master-budget/`,
state: {
userType: 'user',
rawData: item
}
}}>
<button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
margin: 5,
outline: 'none'
}}>
<Typography style={{ marginLeft: 10, color: '#5198ea', fontSize: 13 }}>{item.company_name}</Typography>
</button>
</Link>
</div> </div>
{item.status === 'overdue' && ( {item.is_overdue && (
<div style={{ backgroundColor: '#f65a4c', paddingRight: 5, paddingLeft: 5, borderRadius: 5, alignSelf: 'center' }}> <div style={{ backgroundColor: '#f65a4c', paddingRight: 5, paddingLeft: 5, borderRadius: 5, alignSelf: 'center' }}>
<Typography style={{ fontSize: 11, color: '#fff' }}>Overdue</Typography> <Typography style={{ fontSize: 11, color: '#fff' }}>Overdue</Typography>
</div> </div>
...@@ -387,6 +427,7 @@ class HomePage extends Component { ...@@ -387,6 +427,7 @@ class HomePage extends Component {
} }
</div> </div>
); );
} }
} }
......
...@@ -240,6 +240,7 @@ export default class OperatingIndicator extends Component { ...@@ -240,6 +240,7 @@ export default class OperatingIndicator extends Component {
options: periodeData, options: periodeData,
getOptionLabel: (option) => option.periode, getOptionLabel: (option) => option.periode,
}; };
console.log(defaultProps)
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod) let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode) let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
...@@ -554,13 +555,13 @@ export default class OperatingIndicator extends Component { ...@@ -554,13 +555,13 @@ export default class OperatingIndicator extends Component {
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
</div> </div>
{this.state.isSubmit && ( {/* {this.state.isSubmit && (
<div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} > <div style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', display: 'flex', justifyContent: 'flex-end' }} >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div> </div>
</div> </div>
)} )} */}
</Paper> </Paper>
</div> </div>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment