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 = "") => {
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getDashboard = (body) => api.get('transaction/get_dashboard')
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 getOpetratingIndID = (body) => api.post('transaction/operating_indicator/get_operating_indicator_id', body)
......@@ -423,7 +424,8 @@ const create = (type = "") => {
checkApproverOLPA,
getLastPeriodeOI,
getSubmitOI,
getLastPeriodOI
getLastPeriodOI,
getDashboardUser
}
}
......
......@@ -78,7 +78,9 @@ export default class CorporateAnnualTarget extends Component {
buttonDraft: true,
updateBy: '',
handleTekTekTek: 0,
editable: false
editable: false,
dataCustomerPrs: [],
dataInternalBsn: []
}
this.fileHandler = this.fileHandler.bind(this);
......@@ -104,12 +106,35 @@ export default class CorporateAnnualTarget extends Component {
// console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => {
let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
// console.log(response)
let res = response.data.data
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
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([
item.type_report_id,
item.id,
......@@ -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 {
console.log(JSON.stringify(this.state.payload))
api.create().checkUploadMB(this.state.payload).then(response => {
// // console.log(JSON.stringify(this.state.payload));
// console.log(response)
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleCAT: false })
this.setState({ visibleUpload: false, visibleCAT: false })
let dataTable = response.data.data.map((item, index) => {
return [
let dataTable = []
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.item_report_id,
item.parent,
......@@ -363,11 +414,11 @@ export default class CorporateAnnualTarget extends Component {
item.strategic,
item.pic,
item.error
]
])
})
// console.log(dataTable)
console.log(dataTable)
// 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 => {
if (item[30].length > 0) {
// console.log('masuk')
......@@ -382,8 +433,9 @@ export default class CorporateAnnualTarget extends Component {
}
uploadCAT(type) {
// let dataDelete = this.state.dataDelete
// console.log(dataDelete)
let payload = { "item_report_id": this.state.dataDelete }
if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => {
this.functionUpload(type)
......@@ -436,7 +488,7 @@ export default class CorporateAnnualTarget extends Component {
"cat": data
}
// console.log(data);
// console.log(JSON.stringify(body))
console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// console.log(response);
if (response.data) {
......@@ -888,7 +940,7 @@ export default class CorporateAnnualTarget extends Component {
}
const handleTambah = (data, rowIndex) => {
// console.log(dataTable2)
console.log(dataTable2)
let newData = []
dataTable2.map((item, index) => {
newData.push(item)
......@@ -932,6 +984,7 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ dataTable: dataTable2 }, () => {
setTimeout(() => {
this.setState({ loading: false })
console.log(dataTable2)
}, 500)
})
}
......
......@@ -512,10 +512,15 @@ export default class FixedAssetsMovement extends Component {
} else {
// console.log(item)
let indexID = dataTable2.findIndex((val) => val[22] == item)
// console.log(dataTable2[indexID][tableMeta.columnIndex])
// console.log(dataTable2[indexID])
if (indexID !== -1) {
let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
anjay.push(valuezz == "" ? 0 : valuezz)
} else {
if (item === '(-1)') {
anjay.push(-1)
}
// console.log(item);
}
}
}
......
......@@ -23,6 +23,8 @@ class HomePage extends Component {
{ nama: 'Daya Group', status: 'open' },
],
isApprover: true,
listSubcoMB: [],
valueSubmit: 0,
listdmb: [],
dataTableMB: []
}
......@@ -49,6 +51,7 @@ class HomePage extends Component {
// }
// })
this.getApprMat()
this.getListUserSubco()
this.getDashboardMB()
}
......@@ -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() {
let listDashboard = []
api.create().getDashboard().then((response) => {
......@@ -77,14 +100,14 @@ class HomePage extends Component {
api.create().getAM().then((response) => {
console.log(response);
let actAM = response.data.data.map((item, index) => {
if(String(item.status).toLocaleLowerCase() == 'active'){
if (String(item.status).toLocaleLowerCase() == 'active') {
return item
}
})
let userId = localStorage.getItem(Constant.USER)
let indexId = actAM.findIndex((val) => val.user_id == userId)
if (indexId === -1){
if (indexId === -1) {
this.setState({ isApprover: false })
}
console.log(actAM)
......@@ -223,7 +246,7 @@ class HomePage extends Component {
</MuiThemeProvider>
</div>
</div>
<div style={{ marginTop: 20 }}>
{/* <div style={{ marginTop: 20 }}>
<Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Status Laporan</Typography>
<div style={{ marginTop: 10, display: 'flex' }}>
<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 {
</div>
</div>
</div>
</div>
</div> */}
</div>
</div>
:
......@@ -364,16 +387,33 @@ class HomePage extends Component {
</div>
</div>
<div style={{ flex: 1, padding: 20, width: '100%' }}>
<Paper style={{ width: 400, padding: 20, borderRadius: 10 }}>
<Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>Master Budget - Oct 2020 (1/4)</Typography>
{this.state.listMasterBudget.map((item, index) => {
<Paper style={{ width: 450, padding: 20, borderRadius: 10 }}>
<Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>{`Master Budget ${this.state.valueSubmit}/${this.state.listSubcoMB.length}`}</Typography>
{this.state.listSubcoMB.map((item, index) => {
return (
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 10, paddingLeft: 10 }}>
<div style={{ display: 'flex' }}>
<img src={item.status === "overdue" ? Images.dotOverdue : item.status === "open" ? Images.dotOpen : Images.dotDone} />
<Typography style={{ marginLeft: 10, color: '#5198ea', fontSize: 13 }}>{item.nama}</Typography>
<img src={item.is_submit === true ? Images.dotDone : item.is_overdue === true ? Images.dotOverdue : Images.dotOpen} />
<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>
{item.status === 'overdue' && (
{item.is_overdue && (
<div style={{ backgroundColor: '#f65a4c', paddingRight: 5, paddingLeft: 5, borderRadius: 5, alignSelf: 'center' }}>
<Typography style={{ fontSize: 11, color: '#fff' }}>Overdue</Typography>
</div>
......@@ -387,6 +427,7 @@ class HomePage extends Component {
}
</div>
);
}
}
......
......@@ -240,6 +240,7 @@ export default class OperatingIndicator extends Component {
options: periodeData,
getOptionLabel: (option) => option.periode,
};
console.log(defaultProps)
let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
let index = data.sort((a, b) => a - b).findIndex((val) => val === periode)
this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] }, () => {
......@@ -554,13 +555,13 @@ export default class OperatingIndicator extends Component {
</MuiThemeProvider>
</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={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Submit</Typography>
</div>
</div>
)}
)} */}
</Paper>
</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