Commit f3f16c6c authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into deni-dev(pc)

parents e97ee85e 268ea085
...@@ -298,7 +298,7 @@ export default class ApprovalMatrix extends Component { ...@@ -298,7 +298,7 @@ export default class ApprovalMatrix extends Component {
}); });
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -360,7 +360,7 @@ export default class ApprovalMatrix extends Component { ...@@ -360,7 +360,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -413,7 +413,7 @@ export default class ApprovalMatrix extends Component { ...@@ -413,7 +413,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -440,7 +440,7 @@ export default class ApprovalMatrix extends Component { ...@@ -440,7 +440,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -467,7 +467,7 @@ export default class ApprovalMatrix extends Component { ...@@ -467,7 +467,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -494,7 +494,7 @@ export default class ApprovalMatrix extends Component { ...@@ -494,7 +494,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -552,7 +552,7 @@ export default class ApprovalMatrix extends Component { ...@@ -552,7 +552,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ visibleAM: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleAM: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -584,7 +584,7 @@ export default class ApprovalMatrix extends Component { ...@@ -584,7 +584,7 @@ export default class ApprovalMatrix extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -72,7 +72,7 @@ export default class CreateApprovalMatrix extends Component { ...@@ -72,7 +72,7 @@ export default class CreateApprovalMatrix extends Component {
this.setState({ approvedBy: defaultProps, userData: response.data.data}) this.setState({ approvedBy: defaultProps, userData: response.data.data})
} else { } else {
// alert('Approver Name: ' +response.data.message) // alert('Approver Name: ' +response.data.message)
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -111,7 +111,7 @@ export default class CreateApprovalMatrix extends Component { ...@@ -111,7 +111,7 @@ export default class CreateApprovalMatrix extends Component {
this.setState({ types: typeProps, typeData: response.data.data }) this.setState({ types: typeProps, typeData: response.data.data })
} else { } else {
// alert('Approval Type: ' +response.data.message) // alert('Approval Type: ' +response.data.message)
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -151,7 +151,7 @@ export default class CreateApprovalMatrix extends Component { ...@@ -151,7 +151,7 @@ export default class CreateApprovalMatrix extends Component {
this.setState({ operators: operatorProps, operatorData: response.data.data }) this.setState({ operators: operatorProps, operatorData: response.data.data })
} else { } else {
// alert('Operator: ' +response.data.message) // alert('Operator: ' +response.data.message)
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
......
...@@ -71,7 +71,7 @@ export default class EditApprovalMatrix extends Component { ...@@ -71,7 +71,7 @@ export default class EditApprovalMatrix extends Component {
}, () => this.getUserData(), this.getTypeData(), this.getOperatorData()) }, () => this.getUserData(), this.getTypeData(), this.getOperatorData())
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -110,7 +110,7 @@ export default class EditApprovalMatrix extends Component { ...@@ -110,7 +110,7 @@ export default class EditApprovalMatrix extends Component {
} else { } else {
// alert('Pemberi Persetujuan: ' +response.data.message) // alert('Pemberi Persetujuan: ' +response.data.message)
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -150,7 +150,7 @@ export default class EditApprovalMatrix extends Component { ...@@ -150,7 +150,7 @@ export default class EditApprovalMatrix extends Component {
this.setState({ operators: operatorProps, operatorData: response.data.data, getOperators: index == -1 ? operatorData[0]: operatorData[index] }) this.setState({ operators: operatorProps, operatorData: response.data.data, getOperators: index == -1 ? operatorData[0]: operatorData[index] })
} else { } else {
// alert('Operator: ' +response.data.message) // alert('Operator: ' +response.data.message)
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
...@@ -190,7 +190,7 @@ export default class EditApprovalMatrix extends Component { ...@@ -190,7 +190,7 @@ export default class EditApprovalMatrix extends Component {
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0]: typeData[index] }) this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0]: typeData[index] })
} else { } else {
// alert('Approval Type: ' +response.data.message) // alert('Approval Type: ' +response.data.message)
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
......
...@@ -34,7 +34,7 @@ export default class PopUpDeleteAM extends Component { ...@@ -34,7 +34,7 @@ export default class PopUpDeleteAM extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -64,7 +64,7 @@ export default class VisualisasiAM extends Component { ...@@ -64,7 +64,7 @@ export default class VisualisasiAM extends Component {
this.setState({ types: typeProps, typeData: response.data.data }) this.setState({ types: typeProps, typeData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -111,7 +111,7 @@ export default class VisualisasiAM extends Component { ...@@ -111,7 +111,7 @@ export default class VisualisasiAM extends Component {
// console.log(listVisual); // console.log(listVisual);
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -114,7 +114,7 @@ export default class BudgetTahunan extends Component { ...@@ -114,7 +114,7 @@ export default class BudgetTahunan extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -92,7 +92,7 @@ export default class CreateParameter extends Component { ...@@ -92,7 +92,7 @@ export default class CreateParameter extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -131,7 +131,7 @@ export default class CreateParameter extends Component { ...@@ -131,7 +131,7 @@ export default class CreateParameter extends Component {
this.getParameterByGroup(this.state.getTypes.setting_group_id)}) this.getParameterByGroup(this.state.getTypes.setting_group_id)})
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -172,7 +172,7 @@ export default class CreateParameter extends Component { ...@@ -172,7 +172,7 @@ export default class CreateParameter extends Component {
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPerusahaan: index === -1 ? 'Company has been inactive' : "", errorPerusahaan: index === -1 ? true : false }) this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPerusahaan: index === -1 ? 'Company has been inactive' : "", errorPerusahaan: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -208,7 +208,7 @@ export default class CreateParameter extends Component { ...@@ -208,7 +208,7 @@ export default class CreateParameter extends Component {
this.setState({ types: typeProps, typeData: response.data.data }) this.setState({ types: typeProps, typeData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -248,7 +248,7 @@ export default class CreateParameter extends Component { ...@@ -248,7 +248,7 @@ export default class CreateParameter extends Component {
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data }) this.setState({ perusahaan: typeProps, perusahaanData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -286,7 +286,7 @@ export default class CreateParameter extends Component { ...@@ -286,7 +286,7 @@ export default class CreateParameter extends Component {
this.setState({ enableParameter: true, parameter: typeProps, parameterData: response.data.data, getParameter: index == -1 ? typeData[0] : typeData[index] }) this.setState({ enableParameter: true, parameter: typeProps, parameterData: response.data.data, getParameter: index == -1 ? typeData[0] : typeData[index] })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -92,7 +92,7 @@ export default class Parameter extends Component { ...@@ -92,7 +92,7 @@ export default class Parameter extends Component {
this.setState({ dataTable: listData, data: response.data.data }) this.setState({ dataTable: listData, data: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -139,7 +139,7 @@ export default class Parameter extends Component { ...@@ -139,7 +139,7 @@ export default class Parameter extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -166,7 +166,7 @@ export default class Parameter extends Component { ...@@ -166,7 +166,7 @@ export default class Parameter extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -242,7 +242,7 @@ export default class Parameter extends Component { ...@@ -242,7 +242,7 @@ export default class Parameter extends Component {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -588,7 +588,7 @@ export default class Parameter extends Component { ...@@ -588,7 +588,7 @@ export default class Parameter extends Component {
}); });
} else { } else {
this.setState({ dataLoaded: true, cols: [], rows: [], alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ dataLoaded: true, cols: [], rows: [], alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -626,7 +626,7 @@ export default class Parameter extends Component { ...@@ -626,7 +626,7 @@ export default class Parameter extends Component {
this.setState({ visibleParameter: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleParameter: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -657,7 +657,7 @@ export default class Parameter extends Component { ...@@ -657,7 +657,7 @@ export default class Parameter extends Component {
this.setState({ visibleDelete: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleDelete: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -94,7 +94,7 @@ export default class CreatePerusahaan extends Component { ...@@ -94,7 +94,7 @@ export default class CreatePerusahaan extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -146,7 +146,7 @@ export default class CreatePerusahaan extends Component { ...@@ -146,7 +146,7 @@ export default class CreatePerusahaan extends Component {
this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index] }) this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index] })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -186,7 +186,7 @@ export default class CreatePerusahaan extends Component { ...@@ -186,7 +186,7 @@ export default class CreatePerusahaan extends Component {
this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index] }) this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? null : typeData[index] })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -32,7 +32,7 @@ export default class DeletePerusahaan extends Component { ...@@ -32,7 +32,7 @@ export default class DeletePerusahaan extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -71,11 +71,11 @@ export default class Perusahaan extends Component { ...@@ -71,11 +71,11 @@ export default class Perusahaan extends Component {
if (item.length > 0) { if (item.length > 0) {
payload.push({ payload.push({
"id": index + 1, "id": index + 1,
"company_name": item[0], "company_name": item[0] === undefined ? "" : item[0],
"company_parent": item[1] === undefined ? null : item[1], "company_parent": item[1] === undefined ? "" : item[1],
"unit_bisnis": item[2], "unit_bisnis": item[2] === undefined ? "" : item[2],
"startDate": item[3], "start_date": item[3] === undefined ? "" : item[3],
"endDate": item[4], "end_date": item[4] === undefined ? "" :item[4],
}) })
} }
}) })
...@@ -111,16 +111,16 @@ export default class Perusahaan extends Component { ...@@ -111,16 +111,16 @@ export default class Perusahaan extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('company_name')) check = tableMeta.rowData[5].findIndex((val) => val.field.includes('company_name'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="company_name"> <a data-tip={tableMeta.rowData[5][check].message} data-for="company_name">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -136,16 +136,16 @@ export default class Perusahaan extends Component { ...@@ -136,16 +136,16 @@ export default class Perusahaan extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('company_parent')) check = tableMeta.rowData[5].findIndex((val) => val.field.includes('company_parent'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="company_parent"> <a data-tip={tableMeta.rowData[5][check].message} data-for="company_parent">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -161,16 +161,16 @@ export default class Perusahaan extends Component { ...@@ -161,16 +161,16 @@ export default class Perusahaan extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('unit_bisnis')) check = tableMeta.rowData[5].findIndex((val) => val.field.includes('unit_bisnis'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="unit_bisnis"> <a data-tip={tableMeta.rowData[5][check].message} data-for="unit_bisnis">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -186,16 +186,16 @@ export default class Perusahaan extends Component { ...@@ -186,16 +186,16 @@ export default class Perusahaan extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('start_date')) check = tableMeta.rowData[5].findIndex((val) => val.field.includes('start_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="startdate"> <a data-tip={tableMeta.rowData[5][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -211,16 +211,16 @@ export default class Perusahaan extends Component { ...@@ -211,16 +211,16 @@ export default class Perusahaan extends Component {
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[6] != null) { if (tableMeta.rowData[5] != null) {
check = tableMeta.rowData[6].findIndex((val) => val.field.includes('end_date')) check = tableMeta.rowData[5].findIndex((val) => val.field.includes('end_date'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
} }
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[6] != null && check > -1 ? {tableMeta.rowData[5] != null && check > -1 ?
<a data-tip={tableMeta.rowData[6][check].message} data-for="enddate"> <a data-tip={tableMeta.rowData[5][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
...@@ -239,7 +239,7 @@ export default class Perusahaan extends Component { ...@@ -239,7 +239,7 @@ export default class Perusahaan extends Component {
} }
] ]
// console.log(dataRow); console.log(dataRow);
this.setState({ this.setState({
dataLoaded: true, dataLoaded: true,
cols: columns, cols: columns,
...@@ -248,7 +248,7 @@ export default class Perusahaan extends Component { ...@@ -248,7 +248,7 @@ export default class Perusahaan extends Component {
}); });
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -305,7 +305,7 @@ export default class Perusahaan extends Component { ...@@ -305,7 +305,7 @@ export default class Perusahaan extends Component {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -358,7 +358,7 @@ export default class Perusahaan extends Component { ...@@ -358,7 +358,7 @@ export default class Perusahaan extends Component {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -385,7 +385,7 @@ export default class Perusahaan extends Component { ...@@ -385,7 +385,7 @@ export default class Perusahaan extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -412,7 +412,7 @@ export default class Perusahaan extends Component { ...@@ -412,7 +412,7 @@ export default class Perusahaan extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -469,7 +469,7 @@ export default class Perusahaan extends Component { ...@@ -469,7 +469,7 @@ export default class Perusahaan extends Component {
this.setState({ visiblePerusahaan: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visiblePerusahaan: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -496,7 +496,7 @@ export default class Perusahaan extends Component { ...@@ -496,7 +496,7 @@ export default class Perusahaan extends Component {
this.setState({ visibleDelete: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleDelete: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -525,40 +525,49 @@ export default class Perusahaan extends Component { ...@@ -525,40 +525,49 @@ export default class Perusahaan extends Component {
sort: false, sort: false,
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ display: 'flex' }}> this.state.edit && (
{this.state.edit && ( <div style={{ display: 'flex' }}>
<button <a data-tip={'Edit'} data-for="edit">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent' cursor: 'pointer',
}} borderColor: 'transparent'
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })} }}
onClick={() => this.openPopUp(tableMeta.rowData, 'edit')} // onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
> onClick={() => this.openPopUp(tableMeta.rowData, 'edit')}
<div style={{ display: 'flex' }}> >
{!tableMeta.rowData[2].includes("TIA") ? <div style={{ display: 'flex' }}>
<img src={Images.editCopy} /> : {!tableMeta.rowData[2].includes("TIA") ?
null <img src={Images.editCopy} /> :
} null
</div > }
</button> </div >
)} </button>
{this.state.edit && ( </a>
<button <ReactTooltip border={true} id="edit" place="bottom" type="light" effect="solid" />
style={{ <a data-tip={'Delete'} data-for="delete">
backgroundColor: 'transparent', <button
cursor: 'pointer', style={{
borderColor: 'transparent', backgroundColor: 'transparent',
marginLeft: 10 cursor: 'pointer',
}} borderColor: 'transparent',
// onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })} marginLeft: 10
onClick={() => this.openPopUp(tableMeta.rowData, 'delete')} }}
> // onClick={() => this.setState({ visibleEdit: true, data: tableMeta.rowData })}
<img src={Images.delete} /> onClick={() => this.openPopUp(tableMeta.rowData, 'delete')}
</button> >
)} <div style={{ display: 'flex' }}>
</div > {!tableMeta.rowData[2].includes("TIA") ?
<img src={Images.delete} /> :
null
}
</div >
</button>
</a>
<ReactTooltip border={true} id="delete" place="bottom" type="light" effect="solid" />
</div>
)
); );
} }
} }
......
...@@ -62,7 +62,7 @@ export default class VisualPerusahaan extends Component { ...@@ -62,7 +62,7 @@ export default class VisualPerusahaan extends Component {
console.log(response.data.data) console.log(response.data.data)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -107,11 +107,12 @@ export default class VisualPerusahaan extends Component { ...@@ -107,11 +107,12 @@ export default class VisualPerusahaan extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }, () => {
setTimeout(() => { setTimeout(() => {
this.props.onClickClose() this.props.onClickClose()
window.location.reload();
}, 1000); }, 1000);
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
import React, { Component } from "react"; import React, { Component } from "react";
import { createMuiTheme, MuiThemeProvider, withStyles } from '@material-ui/core/styles'; import { createMuiTheme, MuiThemeProvider} from '@material-ui/core/styles';
import Images from "../../assets/Images"; import Images from "../../assets/Images";
import MUIDataTable from "mui-datatables"; import MUIDataTable from "mui-datatables";
import { InputBase, Snackbar } from "@material-ui/core"; import { InputBase, Snackbar, withStyles } from "@material-ui/core";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import MuiAlert from '@material-ui/lab/Alert'; import MuiAlert from '@material-ui/lab/Alert';
...@@ -47,7 +47,8 @@ export default class ReportItems extends Component { ...@@ -47,7 +47,8 @@ export default class ReportItems extends Component {
load: false, load: false,
judul: '', judul: '',
reportNameDelete: '', reportNameDelete: '',
visibleDelete: false visibleDelete: false,
invalidTemplate: false
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -68,27 +69,34 @@ export default class ReportItems extends Component { ...@@ -68,27 +69,34 @@ export default class ReportItems extends Component {
payload.push({ payload.push({
id: index + 1, id: index + 1,
report: item[0] === undefined ? "" : item[0], report: item[0] === undefined ? "" : item[0],
company: item[1] == undefined ? "" : item[1], company: item[1] === undefined ? "" : item[1],
orders: item[2] === undefined ? "" : item[2], orders: item[2] === undefined ? "" : item[2],
description: item[3] === undefined ? "-" : item[3], description: item[3] === undefined ? "" : item[3],
parent: item[4] === undefined ? 0 : item[4], parent: item[4] === undefined ? 0 : item[4],
uom: item[5] === undefined ? null : item[5], uom: item[5] === undefined ? "" : item[5],
weight: item[6] === undefined ? "" : item[6], weight: item[6] === undefined ? "" : item[6],
type_report: item[7], type_report: item[7] === undefined ? "" : item[7],
formula: item[8], formula: item[8] === undefined ? "" : item[8],
condition_it_should_be: item[9] === undefined ? null : item[9], condition_it_should_be: item[9] === undefined ? "" : item[9],
condition_if_wrong: item[10] === undefined ? null : item[10], condition_if_wrong: item[10] === undefined ? "" : item[10],
kpi_type: item[11] === undefined ? "" : item[11], kpi_type: item[11] === undefined ? "" : item[11],
max_ach: item[12] === undefined ? "" : item[12], max_ach: item[12] === undefined ? "" : item[12],
formula_ytd: item[13] === undefined ? "" : item[13], formula_ytd: item[13] === undefined ? "" : item[13],
start_date: item[14], start_date: item[14] === undefined ? "" : item[14],
end_date: item[15], end_date: item[15] === undefined ? "" : item[15],
}) })
} }
}) })
let body = { let body = {
item_report: payload item_report: payload
} }
if (resp.rows[2].length !== 16) {
this.setState({ invalidTemplate: true })
} else {
this.setState({ invalidTemplate: false })
}
console.log(resp.rows[1]) console.log(resp.rows[1])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] }) this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
} }
...@@ -104,7 +112,6 @@ export default class ReportItems extends Component { ...@@ -104,7 +112,6 @@ export default class ReportItems extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
dataRow = response.data.data.map((item, index) => { dataRow = response.data.data.map((item, index) => {
return [ return [
// index + 1,
item.report, item.report,
item.company, item.company,
item.orders, item.orders,
...@@ -131,7 +138,7 @@ export default class ReportItems extends Component { ...@@ -131,7 +138,7 @@ export default class ReportItems extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
let check = null let check = null
if (tableMeta.rowData[16] != null) { if (tableMeta.rowData[16] != null) {
check = tableMeta.rowData[16].findIndex((val) => val.field.includes('report')) check = tableMeta.rowData[16].findIndex((val) => val.field.includes('report_type'))
if (check > -1) { if (check > -1) {
this.setState({ buttonError: true }) this.setState({ buttonError: true })
} }
...@@ -140,9 +147,9 @@ export default class ReportItems extends Component { ...@@ -140,9 +147,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="reportname"> <a data-tip={tableMeta.rowData[16][check].message} data-for="reportname">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="reportname" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="reportname" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -165,9 +172,9 @@ export default class ReportItems extends Component { ...@@ -165,9 +172,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="companyname"> <a data-tip={tableMeta.rowData[16][check].message} data-for="companyname">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="companyname" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="companyname" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -190,9 +197,9 @@ export default class ReportItems extends Component { ...@@ -190,9 +197,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="order"> <a data-tip={tableMeta.rowData[16][check].message} data-for="order">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === null ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="order" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -215,9 +222,9 @@ export default class ReportItems extends Component { ...@@ -215,9 +222,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="desc"> <a data-tip={tableMeta.rowData[16][check].message} data-for="desc">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="desc" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="desc" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -240,9 +247,9 @@ export default class ReportItems extends Component { ...@@ -240,9 +247,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="parents"> <a data-tip={tableMeta.rowData[16][check].message} data-for="parents">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="parents" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="parents" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -265,9 +272,9 @@ export default class ReportItems extends Component { ...@@ -265,9 +272,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="uoms"> <a data-tip={tableMeta.rowData[16][check].message} data-for="uoms">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="uoms" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="uoms" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -290,9 +297,9 @@ export default class ReportItems extends Component { ...@@ -290,9 +297,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="weights"> <a data-tip={tableMeta.rowData[16][check].message} data-for="weights">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="weights" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="weights" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -315,9 +322,9 @@ export default class ReportItems extends Component { ...@@ -315,9 +322,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="datatype"> <a data-tip={tableMeta.rowData[16][check].message} data-for="datatype">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="datatype" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="datatype" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -340,9 +347,9 @@ export default class ReportItems extends Component { ...@@ -340,9 +347,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="formulas"> <a data-tip={tableMeta.rowData[16][check].message} data-for="formulas">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="formulas" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="formulas" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -365,9 +372,9 @@ export default class ReportItems extends Component { ...@@ -365,9 +372,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="values"> <a data-tip={tableMeta.rowData[16][check].message} data-for="values">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="values" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="values" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -390,9 +397,9 @@ export default class ReportItems extends Component { ...@@ -390,9 +397,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="conditions"> <a data-tip={tableMeta.rowData[16][check].message} data-for="conditions">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="conditions" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="conditions" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -415,9 +422,9 @@ export default class ReportItems extends Component { ...@@ -415,9 +422,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="kpi_type"> <a data-tip={tableMeta.rowData[16][check].message} data-for="kpi_type">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="kpi_type" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="kpi_type" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -440,9 +447,9 @@ export default class ReportItems extends Component { ...@@ -440,9 +447,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="max_ach"> <a data-tip={tableMeta.rowData[16][check].message} data-for="max_ach">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="max_ach" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="max_ach" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -465,9 +472,9 @@ export default class ReportItems extends Component { ...@@ -465,9 +472,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="formula_ytd"> <a data-tip={tableMeta.rowData[16][check].message} data-for="formula_ytd">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val}</span>
} }
<ReactTooltip border={true} id="formula_ytd" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="formula_ytd" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -490,9 +497,9 @@ export default class ReportItems extends Component { ...@@ -490,9 +497,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="startdate"> <a data-tip={tableMeta.rowData[16][check].message} data-for="startdate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="startdate" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -515,9 +522,9 @@ export default class ReportItems extends Component { ...@@ -515,9 +522,9 @@ export default class ReportItems extends Component {
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
{tableMeta.rowData[16] != null && check > -1 ? {tableMeta.rowData[16] != null && check > -1 ?
<a data-tip={tableMeta.rowData[16][check].message} data-for="enddate"> <a data-tip={tableMeta.rowData[16][check].message} data-for="enddate">
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
</a> : </a> :
<span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "-" : val}</span> <span style={{ color: check != null && check > -1 ? "red" : 'black' }}>{val === "" ? "Empty" : val}</span>
} }
<ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" /> <ReactTooltip border={true} id="enddate" place="bottom" type="light" effect="solid" />
</div > </div >
...@@ -542,7 +549,7 @@ export default class ReportItems extends Component { ...@@ -542,7 +549,7 @@ export default class ReportItems extends Component {
}); });
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -602,7 +609,7 @@ export default class ReportItems extends Component { ...@@ -602,7 +609,7 @@ export default class ReportItems extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -630,7 +637,7 @@ export default class ReportItems extends Component { ...@@ -630,7 +637,7 @@ export default class ReportItems extends Component {
this.setState({ visibleDelete: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleDelete: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -683,7 +690,7 @@ export default class ReportItems extends Component { ...@@ -683,7 +690,7 @@ export default class ReportItems extends Component {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -710,7 +717,7 @@ export default class ReportItems extends Component { ...@@ -710,7 +717,7 @@ export default class ReportItems extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -767,7 +774,7 @@ export default class ReportItems extends Component { ...@@ -767,7 +774,7 @@ export default class ReportItems extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -794,7 +801,7 @@ export default class ReportItems extends Component { ...@@ -794,7 +801,7 @@ export default class ReportItems extends Component {
this.setState({ itemReport: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ itemReport: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -1196,7 +1203,7 @@ export default class ReportItems extends Component { ...@@ -1196,7 +1203,7 @@ export default class ReportItems extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' }) this.setState({ uploadStatus: 'idle', percentage: '0' })
}} }}
onUpload={() => { onUpload={() => {
this.state.judul === "MASTER DATA - REPORT ITEMS" ? this.state.judul === "MASTER DATA - REPORT ITEMS" && !this.state.invalidTemplate ?
this.checkUpload() : this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}} }}
......
...@@ -192,7 +192,7 @@ export default class UnitBisnis extends Component { ...@@ -192,7 +192,7 @@ export default class UnitBisnis extends Component {
}); });
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -254,7 +254,7 @@ export default class UnitBisnis extends Component { ...@@ -254,7 +254,7 @@ export default class UnitBisnis extends Component {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -308,7 +308,7 @@ export default class UnitBisnis extends Component { ...@@ -308,7 +308,7 @@ export default class UnitBisnis extends Component {
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -335,7 +335,7 @@ export default class UnitBisnis extends Component { ...@@ -335,7 +335,7 @@ export default class UnitBisnis extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -363,7 +363,7 @@ export default class UnitBisnis extends Component { ...@@ -363,7 +363,7 @@ export default class UnitBisnis extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -420,7 +420,7 @@ export default class UnitBisnis extends Component { ...@@ -420,7 +420,7 @@ export default class UnitBisnis extends Component {
this.setState({ visibleUnitBisnis: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleUnitBisnis: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -452,7 +452,7 @@ export default class UnitBisnis extends Component { ...@@ -452,7 +452,7 @@ export default class UnitBisnis extends Component {
this.setState({ visibleDelete: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleDelete: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -229,7 +229,7 @@ export default class CreateReportItems extends Component { ...@@ -229,7 +229,7 @@ export default class CreateReportItems extends Component {
this.setState({ listInputType: defaultProps, inputData: response.data.data }) this.setState({ listInputType: defaultProps, inputData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -271,7 +271,7 @@ export default class CreateReportItems extends Component { ...@@ -271,7 +271,7 @@ export default class CreateReportItems extends Component {
this.setState({ listCompany: typeProps, companyData: response.data.data }) this.setState({ listCompany: typeProps, companyData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -310,7 +310,7 @@ export default class CreateReportItems extends Component { ...@@ -310,7 +310,7 @@ export default class CreateReportItems extends Component {
} else { } else {
// alert(response.data.message) // alert(response.data.message)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -352,7 +352,7 @@ export default class CreateReportItems extends Component { ...@@ -352,7 +352,7 @@ export default class CreateReportItems extends Component {
this.setState({ listParent: defaultProps, parentData: response.data.data }) this.setState({ listParent: defaultProps, parentData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -200,7 +200,7 @@ export default class EditReportItems extends Component { ...@@ -200,7 +200,7 @@ export default class EditReportItems extends Component {
console.log(response.data.data) console.log(response.data.data)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -239,7 +239,7 @@ export default class EditReportItems extends Component { ...@@ -239,7 +239,7 @@ export default class EditReportItems extends Component {
this.setState({ listInputType: defaultProps, InputType: index === -1 ? null : inputData[index] }) this.setState({ listInputType: defaultProps, InputType: index === -1 ? null : inputData[index] })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -282,7 +282,7 @@ export default class EditReportItems extends Component { ...@@ -282,7 +282,7 @@ export default class EditReportItems extends Component {
this.setState({ listCompany: defaultProps, companyData: response.data.data, company: index === -1 ? null : companyData[index], msgErrorPerusahaan: index === -1 ? 'Company has been Inactive.' : "", errorPerusahaan: index === -1 ? true : false }, () => this.getParent()) this.setState({ listCompany: defaultProps, companyData: response.data.data, company: index === -1 ? null : companyData[index], msgErrorPerusahaan: index === -1 ? 'Company has been Inactive.' : "", errorPerusahaan: index === -1 ? true : false }, () => this.getParent())
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -321,7 +321,7 @@ export default class EditReportItems extends Component { ...@@ -321,7 +321,7 @@ export default class EditReportItems extends Component {
this.setState({ listReportType: defaultProps, reportType: index === -1 ? null : reportTypeData[index] }, () => this.getParent()) this.setState({ listReportType: defaultProps, reportType: index === -1 ? null : reportTypeData[index] }, () => this.getParent())
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -374,7 +374,7 @@ export default class EditReportItems extends Component { ...@@ -374,7 +374,7 @@ export default class EditReportItems extends Component {
this.setState({ listParent: defaultProps, parent: index == -1 ? null : parentData[index] }) this.setState({ listParent: defaultProps, parent: index == -1 ? null : parentData[index] })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -96,7 +96,7 @@ export default class VisualReportItems extends Component { ...@@ -96,7 +96,7 @@ export default class VisualReportItems extends Component {
this.setState({ listReport: defaultProps, report: reportData[0] }) this.setState({ listReport: defaultProps, report: reportData[0] })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -134,7 +134,7 @@ export default class VisualReportItems extends Component { ...@@ -134,7 +134,7 @@ export default class VisualReportItems extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -228,7 +228,7 @@ export default class VisualReportItems extends Component { ...@@ -228,7 +228,7 @@ export default class VisualReportItems extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -75,7 +75,7 @@ export default class CreateUnitBisnis extends Component { ...@@ -75,7 +75,7 @@ export default class CreateUnitBisnis extends Component {
} }
else { else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -71,7 +71,7 @@ export default class UserRole extends Component { ...@@ -71,7 +71,7 @@ export default class UserRole extends Component {
this.setState({ listUser: listData }) this.setState({ listUser: listData })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -123,7 +123,7 @@ export default class UserRole extends Component { ...@@ -123,7 +123,7 @@ export default class UserRole extends Component {
this.setState({ listUser: listData }) this.setState({ listUser: listData })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -346,7 +346,7 @@ export default class UserRole extends Component { ...@@ -346,7 +346,7 @@ export default class UserRole extends Component {
}); });
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -403,7 +403,7 @@ export default class UserRole extends Component { ...@@ -403,7 +403,7 @@ export default class UserRole extends Component {
this.closeEdit() this.closeEdit()
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -432,7 +432,7 @@ export default class UserRole extends Component { ...@@ -432,7 +432,7 @@ export default class UserRole extends Component {
this.getUser() this.getUser()
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -475,7 +475,7 @@ export default class UserRole extends Component { ...@@ -475,7 +475,7 @@ export default class UserRole extends Component {
this.setState({ visibleUser: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' }) this.setState({ visibleUser: true, alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -242,7 +242,7 @@ export default class AddUser extends Component { ...@@ -242,7 +242,7 @@ export default class AddUser extends Component {
this.setState({ listRole: defaultProps }) this.setState({ listRole: defaultProps })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -268,7 +268,7 @@ export default class AddUser extends Component { ...@@ -268,7 +268,7 @@ export default class AddUser extends Component {
console.log(response.data.data) console.log(response.data.data)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -175,7 +175,7 @@ export default class EditUser extends Component { ...@@ -175,7 +175,7 @@ export default class EditUser extends Component {
console.log(response.data.data) console.log(response.data.data)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -257,7 +257,7 @@ export default class EditUser extends Component { ...@@ -257,7 +257,7 @@ export default class EditUser extends Component {
this.setState({ listRole: defaultProps, role: index === -1 ? null : roleData[index], msgErrorRN: index === -1 ? 'Role has been inactive' : '', errorRoleName: index === -1 ? true : false }) this.setState({ listRole: defaultProps, role: index === -1 ? null : roleData[index], msgErrorRN: index === -1 ? 'Role has been inactive' : '', errorRoleName: index === -1 ? true : false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -285,7 +285,7 @@ export default class EditUser extends Component { ...@@ -285,7 +285,7 @@ export default class EditUser extends Component {
this.setState({ listCompany: dataBaru }) this.setState({ listCompany: dataBaru })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -70,7 +70,7 @@ class UserRole extends Component { ...@@ -70,7 +70,7 @@ class UserRole extends Component {
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -122,7 +122,7 @@ class UserRole extends Component { ...@@ -122,7 +122,7 @@ class UserRole extends Component {
this.setState({ listRole: listData }) this.setState({ listRole: listData })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -170,7 +170,7 @@ class UserRole extends Component { ...@@ -170,7 +170,7 @@ class UserRole extends Component {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', popupDel: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', popupDel: false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', popupDel: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', popupDel: false }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -145,7 +145,7 @@ export default class AddRole extends Component { ...@@ -145,7 +145,7 @@ export default class AddRole extends Component {
}, 750); }, 750);
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -197,7 +197,7 @@ export default class AddRole extends Component { ...@@ -197,7 +197,7 @@ export default class AddRole extends Component {
// this.setState({ menuData: response.data.data }) // this.setState({ menuData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -105,7 +105,7 @@ export default class EditRole extends Component { ...@@ -105,7 +105,7 @@ export default class EditRole extends Component {
console.log(response.data.data.start_date) console.log(response.data.data.start_date)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -172,7 +172,7 @@ export default class EditRole extends Component { ...@@ -172,7 +172,7 @@ export default class EditRole extends Component {
}, 750); }, 750);
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -224,7 +224,7 @@ export default class EditRole extends Component { ...@@ -224,7 +224,7 @@ export default class EditRole extends Component {
// this.setState({ menuData: response.data.data }) // this.setState({ menuData: response.data.data })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
...@@ -123,7 +123,7 @@ export default class Profile extends Component { ...@@ -123,7 +123,7 @@ export default class Profile extends Component {
this.setState({ errorOldPassword: true, msgOldPassword: 'Incorrect password.' }) this.setState({ errorOldPassword: true, msgOldPassword: 'Incorrect password.' })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -162,7 +162,7 @@ export default class Profile extends Component { ...@@ -162,7 +162,7 @@ export default class Profile extends Component {
console.log(response) console.log(response)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -189,7 +189,7 @@ export default class Profile extends Component { ...@@ -189,7 +189,7 @@ export default class Profile extends Component {
console.log(response.data.data) console.log(response.data.data)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
...@@ -335,7 +335,7 @@ export default class Profile extends Component { ...@@ -335,7 +335,7 @@ export default class Profile extends Component {
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Token")) { if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => { setTimeout(() => {
localStorage.removeItem(Constant.TOKEN) localStorage.removeItem(Constant.TOKEN)
window.location.reload(); window.location.reload();
......
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