Commit bc515672 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-dev(pc)' into 'master'

+++

See merge request !391
parents bc7aa7ec a41156ea
...@@ -202,6 +202,7 @@ const create = (type = "") => { ...@@ -202,6 +202,7 @@ const create = (type = "") => {
const submitMasterBudget = (body) => api.post('transaction/master_budget/submit_master_budget', body) const submitMasterBudget = (body) => api.post('transaction/master_budget/submit_master_budget', body)
const checkIsSubmit = (body) => api.post('transaction/master_budget/is_can_submit', body) const checkIsSubmit = (body) => api.post('transaction/master_budget/is_can_submit', body)
const checkApprover = () => api.get('transaction/master_budget/is_approver') const checkApprover = () => api.get('transaction/master_budget/is_approver')
const approvalSubmission = (body) => api.post('transaction/master_budget/approval_submission', body)
const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body) const getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body) const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
...@@ -363,7 +364,8 @@ const create = (type = "") => { ...@@ -363,7 +364,8 @@ const create = (type = "") => {
getIdDeleteFromExcel, getIdDeleteFromExcel,
getDashboard, getDashboard,
historyApproval, historyApproval,
checkApprover checkApprover,
approvalSubmission
} }
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -521,64 +521,6 @@ export default class ProfitLoss extends Component { ...@@ -521,64 +521,6 @@ export default class ProfitLoss extends Component {
return a return a
} }
const handleFormula = (data, tableMeta, month) => { const handleFormula = (data, tableMeta, month) => {
let rilFormula = String(tableMeta.rowData[3])
if (rilFormula.includes('#')) {
if (this.props.status === "not-yet") {
let splitOrder = String(tableMeta.rowData[3]).split('@')
for (let index = 0; index < splitOrder.length; index++) {
if (splitOrder[index] === "") {
} else {
if (splitOrder[index].includes('#')) {
} else {
let splitOperator = splitOrder[index].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let reg = /^\d+$/
splitOperator.map((item) => {
if (reg.test(item) === true) {
let i = dataTable2.findIndex((val) => val[23] == item)
if (i > 0) {
rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
}
}
})
}
}
}
let body = {
"submission_id": null,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
console.log(response);
// if (response.data) {
// if (response.data.status === "success") {
// return response.data.data.result
// }
// }
})
} else {
let body = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"report_id": this.props.report_id,
"year": this.props.periode,
"month": month,
"formula": rilFormula
}
api.create().countingFormula(body).then(response => {
// console.log(response)
if (response.data) {
if (response.data.status === "success") {
return response.data.data.result
}
}
})
}
} else {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = [] let arrayJumlah = []
arrayFormula.map((item, indexs) => { arrayFormula.map((item, indexs) => {
...@@ -620,49 +562,6 @@ export default class ProfitLoss extends Component { ...@@ -620,49 +562,6 @@ export default class ProfitLoss extends Component {
}) })
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
return a return a
}
// console.log(rilFormula);
// let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
// let arrayJumlah = []
// arrayFormula.map((item, indexs) => {
// let index = dataTable2.findIndex((val) => val[1] == item)
// if (index > 0) {
// arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
// } else {
// arrayJumlah.push(item)
// }
// // if (indexs % 2 !== 0) {
// // operator.push(item)
// // }
// })
// let array = arrayJumlah
// let total = 0
// let opt = ""
// array.map((item, index) => {
// if (item == "+") {
// opt = "tambah"
// } else if (item == "-") {
// opt = "kurang"
// } else if (item == "*") {
// opt = "kali"
// } else if (item == "/") {
// opt = "bagi"
// } else {
// if (opt == "tambah") {
// total = Number(total) + Number(item)
// } else if (opt == "kurang") {
// total = Number(total) - Number(item)
// } else if (opt == "kali") {
// total = Number(total) * Number(item)
// } else if (opt == "bagi") {
// total = Number(total) / Number(item)
// } else {
// total += item
// }
// }
// })
// let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
// return a
} }
......
...@@ -24,7 +24,7 @@ class HomePage extends Component { ...@@ -24,7 +24,7 @@ class HomePage extends Component {
api.create().getDetailUser(userId).then((response) => { api.create().getDetailUser(userId).then((response) => {
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({userData: response.data.data}, () => { this.setState({ userData: response.data.data }, () => {
console.log(this.state.userData) console.log(this.state.userData)
}) })
} }
...@@ -33,7 +33,7 @@ class HomePage extends Component { ...@@ -33,7 +33,7 @@ class HomePage extends Component {
this.getDashboard() this.getDashboard()
} }
componentDidUpdate(){ componentDidUpdate() {
window.onpopstate = e => { window.onpopstate = e => {
//your code... //your code...
this.props.selectIndex('Home') this.props.selectIndex('Home')
...@@ -43,12 +43,13 @@ class HomePage extends Component { ...@@ -43,12 +43,13 @@ class HomePage extends Component {
getDashboard() { getDashboard() {
let listDashboard = [] let listDashboard = []
api.create().getDashboard().then((response) => { api.create().getDashboard().then((response) => {
console.log(response);
if (String(response.data.status).toLocaleLowerCase() == 'success') { if (String(response.data.status).toLocaleLowerCase() == 'success') {
let data = response.data.data let data = response.data.data
data.map((item,index) => { data.map((item, index) => {
listDashboard.push([index+1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status]) listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status])
}) })
this.setState({listDashboard}) this.setState({ listDashboard, rawData: response.data.data })
} }
}) })
} }
...@@ -58,9 +59,16 @@ class HomePage extends Component { ...@@ -58,9 +59,16 @@ class HomePage extends Component {
name: "Action", name: "Action",
options: { options: {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
// console.log(tableMeta);
return ( return (
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
<Link to={{pathname: `/home/master-budget/`, state: {userType: 'approver'}}}> <Link to={{
pathname: `/home/master-budget/`,
state: {
userType: 'approver',
rawData: this.state.rawData[tableMeta.rowIndex]
}
}}>
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -126,7 +134,7 @@ class HomePage extends Component { ...@@ -126,7 +134,7 @@ class HomePage extends Component {
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }}> <div style={{ flex: 1, backgroundColor: '#f8f8f8' }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '24px', color: 'white' }}>{this.state.userData === null? '' : `Welcome, ${this.state.userData.fullname} !`}</Typography> <Typography style={{ fontSize: '24px', color: 'white' }}>{this.state.userData === null ? '' : `Welcome, ${this.state.userData.fullname} !`}</Typography>
</div> </div>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
<div style={{ display: 'flex' }}> <div style={{ display: 'flex' }}>
...@@ -138,7 +146,7 @@ class HomePage extends Component { ...@@ -138,7 +146,7 @@ class HomePage extends Component {
<div> <div>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={data} data={this.state.listDashboard}
columns={columns} columns={columns}
options={options} options={options}
/> />
......
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