Commit 8fddc6ee authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

apdet

See merge request !184
parents 7a8f4f68 08e0dbf6
......@@ -55,30 +55,7 @@ export default class VisualReportItems extends Component {
super(props)
this.state = {
open: false,
items: [
{
id: 0, GG: 'Accumulated Depreciation (negative value)', collapse: false,
children: [
{ id: 3, GG: 'Beginning Balance', collapse: false },
{ id: 4, GG: 'Depreciation expense MTD (please fill in, if any)', collapse: false },
{ id: 5, GG: 'Depreciation expense MTD (please fill in, if any)', collapse: false }
]
}, {
id: 1, GG: 'Control Gain/(Loss) on Fixed Assets', collapse: false
}, {
id: 2, GG: 'Gain/(Loss) on Fixed Assets', collapse: false,
children: [
{
id: 6, GG: 'NBV', collapse: false,
children: [
{ id: 8, GG: 'Cost', collapse: false },
{ id: 9, GG: 'Accm. Depreciation', collapse: false },
]
},
{ id: 7, GG: 'Proceed from sale or disposal of Fixed Assets (please fill in, if any)', collapse: false },
]
},
],
items: [],
arrayCollapse: [],
defaultCollapsed: false,
listReport: null,
......@@ -87,7 +64,8 @@ export default class VisualReportItems extends Component {
company: null,
alert: false,
tipeAlert: '',
messageAlert: ''
messageAlert: '',
realItems: []
}
}
......@@ -168,7 +146,7 @@ export default class VisualReportItems extends Component {
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
this.setState({ items: response.data.data })
this.setState({ items: response.data.data, realItems: response.data.data})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
......@@ -215,6 +193,13 @@ export default class VisualReportItems extends Component {
let payload = {
"item_report": this.state.items
}
if (JSON.stringify(this.state.items) === JSON.stringify(this.state.realItems)) {
this.setState({ alert: true, messageAlert: 'Save visualization item report success!', tipeAlert: 'success' }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 1000);
})
} else {
api.create().saveVisualisasiReport(payload).then((response) => {
console.log(response);
// if (response.data.status == 'ucces') {
......@@ -241,6 +226,8 @@ export default class VisualReportItems extends Component {
})
}
}
renderItem = ({ item, collapseIcon }) => {
return (
<div>
......
......@@ -195,8 +195,10 @@ export default class AddUser extends Component {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
setTimeout(() => {
this.props.onClickClose()
this.props.refresh()
}, 750);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
......
......@@ -198,12 +198,16 @@ export default class EditUser extends Component {
}
api.create().updateUser(payload).then((response) => {
console.log(response.data.message)
console.log(response.data.status)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
setTimeout(() => {
this.props.onClickClose()
this.props.refresh()
}, 750);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
......@@ -296,6 +300,8 @@ export default class EditUser extends Component {
if (indexIDs !== -1) {
company.splice(indexIDs, 1)
}
}
if (item.children !== null) {
if (item.children.length > 0) {
item.children.map((items,indexs) => {
......@@ -304,7 +310,6 @@ export default class EditUser extends Component {
}
}
}
}
this.setState({ company })
}
......
......@@ -138,8 +138,10 @@ export default class AddRole extends Component {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.props.refresh()
setTimeout(() => {
this.props.onClickClose()
this.props.refresh()
}, 750);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
......
......@@ -158,8 +158,10 @@ export default class EditRole extends Component {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success' })
this.props.refresh()
setTimeout(() => {
this.props.onClickClose()
this.props.refresh()
}, 750);
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' })
}
......
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