Commit 40113c65 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 7991b197 1c026c14
......@@ -202,13 +202,14 @@ const create = (type = "") => {
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 getIdDeleteFromExcel = (body) => api.post('transaction/master_budget/delete_from_excel', body)
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body)
const getOperatingIndDetail = (body) => api.post('transaction/operating_indicator/get_operating_indicator_report_hierarki', body)
const createOpetaingInd = (body) => api.post('transaction/operating_indicator/create_submission_report', body)
const checkUploadOperatingInd = (body) => api.post('transaction/operating_indicator/check_import', body)
const uploadOperatingInd = (body) => api.post('transaction/operating_indicator/import_operating_indicator', body)
const getDashboard = (body) => api.get('transaction/master_budget/get_dashboard')
//Template
const downloadTemplate = (fileName, fileType) => api.get(`attachment/download_file?fileName=${fileName}&&fileType=${fileType}`)
......@@ -356,7 +357,9 @@ const create = (type = "") => {
getLastestUpdateMB,
countingFormula,
submitMasterBudget,
checkIsSubmit
checkIsSubmit,
getIdDeleteFromExcel,
getDashboard
}
}
......
......@@ -55,7 +55,7 @@ export default class BudgetTahunan extends Component {
}
componentDidMount() {
this.getCompanyActive()
this.getDetailUser()
}
getReportAttachment() {
......@@ -104,6 +104,21 @@ export default class BudgetTahunan extends Component {
})
}
getDetailUser() {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ userCompany: response.data.data.company, isSubmit: false}, () => {
this.getCompanyActive()
})
}
}
}
})
}
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
if (response.data) {
......@@ -115,11 +130,21 @@ export default class BudgetTahunan extends Component {
company_name: item.company_name,
}
})
let arrayBaru = []
this.state.userCompany.map((item,index) => {
let indexID = companyData.findIndex((val) => val.company_id == item)
if (indexID !== -1) {
arrayBaru.push(companyData[indexID])
}
})
let defaultProps = {
options: companyData,
options: arrayBaru,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: companyData[0], isSubmit: false }, () => {
this.setState({ listCompany: defaultProps, company: arrayBaru[0] }, () => {
this.getPeriode()
})
} else {
......@@ -135,7 +160,6 @@ export default class BudgetTahunan extends Component {
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listCompany: null, company: null })
}
})
}
......
......@@ -284,6 +284,19 @@ export default class CorporateAnnualTarget extends Component {
}
checkUpload() {
let dataDelete = this.state.dataDelete
api.create().getIdDeleteFromExcel(this.state.payload).then((response) => {
if (response.data) {
let idDelete = response.data.data.item_report_id
if (idDelete.length > 0) {
idDelete.map((item,index) => {
dataDelete.push(item)
})
this.setState({dataDelete})
}
}
})
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
......@@ -343,11 +356,24 @@ export default class CorporateAnnualTarget extends Component {
}
uploadCAT(type) {
let payload = {"item_report_id": this.state.dataDelete}
if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => {
this.functionUpload(type)
})
} else {
this.functionUpload(type)
}
}
functionUpload(type) {
let data = []
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[0],
"item_report_id": i[1],
"item_report": String(i[6]),
"weight": String(i[7]),
"uom": String(i[8]),
......@@ -534,6 +560,7 @@ export default class CorporateAnnualTarget extends Component {
// })
})
} else {
console.log('sini jing')
// api.create().validateSubmitReport(payloadBro).then((response) => {
// console.log(response)
// if (response.data.data.result) {
......@@ -732,7 +759,7 @@ export default class CorporateAnnualTarget extends Component {
const handleAction = (idParent) => {
if (idParent !== null) {
let indexsss = dataTable2.findIndex((val) => val[1] == idParent)
if (dataTable2[indexsss][6] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][6] == 'INTERNAL PERSPECTIVE') {
if (dataTable2[indexsss][6] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
return true
} else {
return false
......@@ -1901,7 +1928,7 @@ export default class CorporateAnnualTarget extends Component {
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleCAT? <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget Submission - Corporate Annual Target</Typography>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Corporate Annual Target</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
......@@ -2068,6 +2095,7 @@ export default class CorporateAnnualTarget extends Component {
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
......
......@@ -89,7 +89,7 @@ export default class FixedAssetsMovement extends Component {
}
// console.log(payload);
api.create().getDetailReportMB(payload).then(response => {
console.log(response);
// console.log(response);
let dataTable = []
if (response.data) {
let res = response.data.data
......@@ -118,7 +118,8 @@ export default class FixedAssetsMovement extends Component {
item.fixed_asset_movement.december,
item.fixed_asset_movement.total_current_year,
item.fixed_asset_movement.total_next_year,
item.fixed_asset_movement.total_more_year
item.fixed_asset_movement.total_more_year,
item.order
])
}
if (item.children !== null) {
......@@ -152,7 +153,8 @@ export default class FixedAssetsMovement extends Component {
item.fixed_asset_movement.december,
item.fixed_asset_movement.total_current_year,
item.fixed_asset_movement.total_next_year,
item.fixed_asset_movement.total_more_year
item.fixed_asset_movement.total_more_year,
item.order
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -329,6 +331,7 @@ export default class FixedAssetsMovement extends Component {
item.total_current_year,
item.total_next_year,
item.total_more_year,
item.order,
item.error
]
})
......@@ -346,7 +349,7 @@ export default class FixedAssetsMovement extends Component {
})
}
uploadFAM() {
uploadFAM(type) {
let data = []
this.state.dataTable.map(i => {
data.push({
......@@ -374,7 +377,8 @@ export default class FixedAssetsMovement extends Component {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
fixed_asset_movement: data
fixed_asset_movement: data,
status: type
}
console.log(data);
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
......@@ -500,49 +504,111 @@ export default class FixedAssetsMovement extends Component {
// console.log(indexParent);
return a
}
const handleFormula = (data, tableMeta) => {
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])
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") {
setTimeout(() => {
return response.data.data.result
}, 2000);
}
}
})
} else {
arrayJumlah.push(item)
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") {
setTimeout(() => {
return response.data.data.result
}, 2000);
}
}
})
}
// 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 {
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 {
total += item
arrayJumlah.push(item)
}
}
})
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
return a
// 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
}
}
const columns = [{
name: "",
......@@ -581,6 +647,7 @@ export default class FixedAssetsMovement extends Component {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 300 }}>
{/* {console.log(tableMeta.rowData)} */}
{tableMeta.rowData[22] ?
tableMeta.rowData[22].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
......@@ -691,15 +758,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 1)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -780,15 +846,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 2)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -869,15 +934,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 3)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -958,15 +1022,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 4)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1047,15 +1110,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 5)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1136,15 +1198,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 6)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1225,15 +1286,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 7)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1314,15 +1374,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 8)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1403,15 +1462,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 9)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1492,15 +1550,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 10)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1581,15 +1638,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 11)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1670,15 +1726,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1797,15 +1852,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -1886,15 +1940,14 @@ export default class FixedAssetsMovement extends Component {
null
:
tableMeta.rowData[0] === 6 ?
// <NumberFormat
// thousandSeparator={true}
// style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// disabled={true}
// value={handleFormula(value, tableMeta)}
// />
null
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={Number(handleFormula(value, tableMeta, 12)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
// <NumberFormat
......@@ -2046,7 +2099,7 @@ export default class FixedAssetsMovement extends Component {
}, 100);
})}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
......@@ -2071,8 +2124,8 @@ export default class FixedAssetsMovement extends Component {
})
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
......@@ -2159,7 +2212,7 @@ export default class FixedAssetsMovement extends Component {
})}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
......@@ -2182,8 +2235,8 @@ export default class FixedAssetsMovement extends Component {
})
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
......
......@@ -121,7 +121,8 @@ export default class TaxPlanning extends Component {
{tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf},
item.tax_planning.total_current_year,
{tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf},
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf}
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf},
item.order
])
}
if (item.children !== null) {
......@@ -158,7 +159,8 @@ export default class TaxPlanning extends Component {
{tbc : item.tax_planning.december.tbc, fcp: item.tax_planning.december.fcp, tbf: item.tax_planning.december.tbf},
item.tax_planning.total_current_year,
{tbc : item.tax_planning.total_next_year.tbc, fcp: item.tax_planning.total_next_year.fcp, tbf: item.tax_planning.total_next_year.tbf},
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf}
{tbc : item.tax_planning.total_more_year.tbc, fcp: item.tax_planning.total_more_year.fcp, tbf: item.tax_planning.total_more_year.tbf},
item.order
])
if (item.children !== null) {
if (item.children.length > 0) {
......@@ -800,7 +802,7 @@ export default class TaxPlanning extends Component {
let reg = /^\d+$/
splitOperator.map((item) => {
if (reg.test(item) === true) {
let i = dataTable2.findIndex((val) => val[23] == item)
let i = dataTable2.findIndex((val) => val[24] == item)
if (i > 0) {
rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
}
......@@ -846,7 +848,7 @@ export default class TaxPlanning extends Component {
let arrayFormula = kondisi.match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
arrayFormula.map((item, indexs) => {
let index = dataTable2.findIndex((val) => val[23] == item)
let index = dataTable2.findIndex((val) => val[24] == item)
if (index > 0) {
arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
} else {
......
......@@ -282,9 +282,11 @@ export default class EditManagementDoc extends Component {
const formData = new FormData();
if (this.state.file == this.state.filePath){
formData.append("updated", 0);
formData.append("file", null);
} else {
formData.append("updated", 1);
formData.append("file", this.state.file);
}
formData.append("updated", 1);
formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_id);
formData.append("settingId", this.state.getDocument.document_category_id);
formData.append("documentMonth", this.state.monthId.month_id);
......@@ -295,7 +297,12 @@ export default class EditManagementDoc extends Component {
this.setState({ formData }, () => {
this.props.updateDocument(this.state.formData)
})
console.log(JSON.stringify(formData))
var object = {};
formData.forEach(function(value, key){
object[key] = value;
});
var json = JSON.stringify(object);
console.log(json)
}
}
......
......@@ -13,7 +13,8 @@ class HomePage extends Component {
constructor(props) {
super(props)
this.state = {
userData: null
userData: null,
listDashboard: []
}
}
......@@ -28,10 +29,24 @@ class HomePage extends Component {
}
}
})
this.getDashboard()
}
getDashboard() {
let listDashboard = []
api.create().getDashboard().then((response) => {
if (String(response.data.status).toLocaleLowerCase() == 'success') {
let data = response.data.data
data.map((item,index) => {
listDashboard.push([index+1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status])
})
this.setState({listDashboard})
}
})
}
render() {
const columns = ["#", "Nama Perusahaan", "Revisi", "Status", {
const columns = ["#", "ID", "Nama Perusahaan", "Jenis Report", "Revisi", "Status", {
name: "Action",
options: {
customBodyRender: (val, tableMeta) => {
......@@ -123,7 +138,7 @@ class HomePage extends Component {
<div>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={data}
data={this.state.listDashboard}
columns={columns}
options={options}
/>
......
......@@ -9,6 +9,7 @@ import { titleCase } from '../../library/Utils';
import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../../library/Upload";
import { format } from 'date-fns';
import Constant from '../../library/Constant';
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
......@@ -35,7 +36,7 @@ export default class OperatingIndicator extends Component {
}
componentDidMount() {
this.getCompanyActive()
this.getDetailUser()
}
getReportAttachment() {
......@@ -82,25 +83,61 @@ export default class OperatingIndicator extends Component {
})
}
getDetailUser() {
let userId = localStorage.getItem(Constant.USER)
api.create().getDetailUser(userId).then((response) => {
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
this.setState({ userCompany: response.data.data.company}, () => {
this.getCompanyActive()
})
}
}
}
})
}
getCompanyActive() {
api.create().getPerusahaanActive().then((response) => {
if (response.data.status === 'success') {
let data = response.data.data
let companyData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name,
}
})
let defaultProps = {
options: companyData,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: companyData[0] }, () => {
this.getPeriode()
})
if (response.data) {
if (response.data.status === 'success') {
let data = response.data.data
let companyData = data.map((item) => {
return {
company_id: item.company_id,
company_name: item.company_name,
}
})
let arrayBaru = []
this.state.userCompany.map((item,index) => {
let indexID = companyData.findIndex((val) => val.company_id == item)
if (indexID !== -1) {
arrayBaru.push(companyData[indexID])
}
})
let defaultProps = {
options: arrayBaru,
getOptionLabel: (option) => titleCase(option.company_name),
};
this.setState({ listCompany: defaultProps, company: arrayBaru[0] }, () => {
this.getPeriode()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
alert(response.data.message)
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listCompany: null, company: null })
}
})
}
......@@ -224,6 +261,12 @@ export default class OperatingIndicator extends Component {
})
}
saveOperatingInd(payload) {
api.create().createOpetaingInd(payload).then((response) => {
this.getReport()
})
}
render() {
const columns = ["#", "Jenis Laporan",
// {
......@@ -378,7 +421,13 @@ export default class OperatingIndicator extends Component {
debug
disableClearable
style={{ width: 250 }}
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
renderInput={(params) =>
<TextField
{...params}
label="Company"
margin="normal"
style={{ marginTop: 7 }}
/>}
value={this.state.company}
/>
</div>
......@@ -410,6 +459,9 @@ export default class OperatingIndicator extends Component {
height={this.props.height}
width={this.props.width}
onClickClose={() => this.setState({ visibleDetailOpt: false, visibleOperatingIndicator: true }, this.forceUpdate())}
getReport={() => this.getReport()}
saveOperatingInd={this.saveOperatingInd.bind(this)}
/>
}
......
......@@ -43,7 +43,7 @@ export default class BalanceSheet extends Component {
// ["Accounts Receivable", "172,031", "97,112"],
// ["Trade Receivables - Third Party", "142,668", "77,480"],
],
visibleBalanceSheet: true,
visibleOI: true,
disabledSave: true
}
this.handleValue = this.handleValue.bind(this)
......@@ -66,9 +66,10 @@ export default class BalanceSheet extends Component {
}
console.log(payload)
api.create().getOperatingIndDetail(payload).then(response => {
console.log(response)
let dataTable = []
let res = response.data.data
console.log(res)
// console.log(res)
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
......@@ -141,7 +142,7 @@ export default class BalanceSheet extends Component {
}
createData() {
createData(type) {
let payloadMB = []
this.state.dataTable.map((item,index) => {
payloadMB.push({
......@@ -167,14 +168,13 @@ export default class BalanceSheet extends Component {
"report_id": this.props.data.report_id,
"company_id": this.props.data.company.company_id,
"periode": this.props.data.periode,
"status":"submitted",
"status": type,
"master_budget": payloadMB
}
console.log('=========================')
console.log(JSON.stringify(payload))
api.create().createOpetaingInd(payload).then((response) => {
console.log(response)
})
this.props.saveOperatingInd(payload)
this.props.onClickClose()
}
handleValue(data) {
......@@ -242,15 +242,35 @@ export default class BalanceSheet extends Component {
downloadTemplate = async () => {
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
`https://tia.eksad.com/tia-reporting-dev/public/transaction/operating_indicator/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
)
res = await res.blob()
console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Master Budget Operating Indicator.xlsx';
a.click();
}
}
async downloadAllData() {
console.log('masuk')
// let bram = [this.props.submissionID,this.props.report_id,this.props.company.company_id,this.props.periode,this.props.revision]
// console.log(bram)
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/transaction/operating_indicator/export_master_budget?operating_indicator_id=&&report_id=${this.props.data.operatingIndID}&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
)
res = await res.blob()
console.log(res)
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Template Balance Sheet.xlsx';
a.download = 'Master Budget Operating Indicator.xlsx';
a.click();
}
}
......@@ -270,46 +290,46 @@ export default class BalanceSheet extends Component {
isi.map((i, index) => {
if (i.length > 0) {
payload.push({
item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
total_actual_before: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
january: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
february: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
march: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
april: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
may: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
june: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
july: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
august: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
september: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
october: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
november: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
december: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
total_current_year: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
total_next_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
total_more_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim()
order: i[0] === undefined ? "0" : String(i[0]).trim(),
item_report_id: i[1] === undefined ? "0" : String(i[1]).trim(),
item_report: i[2] === undefined ? "0" : String(i[2]).trim(),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
// total_actual_before: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
})
}
})
let body = {
company_id: this.props.company.company_id,
periode: this.props.periode,
report_id: this.props.report_id,
company_id: this.props.data.company.company_id,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
master_budget: payload
}
// console.log(JSON.stringify(body))
console.log(resp.rows[1][0])
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
}
});
}
checkUpload() {
api.create().checkUploadMB(this.state.payload).then(response => {
console.log(JSON.stringify(this.state.payload));
api.create().checkUploadOperatingInd(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
console.log(response)
if (response.data) {
if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleBalanceSheet: false, loading: true })
this.setState({ visibleUpload: false, visibleOI: false, loading: true })
let dataTable = response.data.data.map((item, index) => {
return [
item.type_report_id,
......@@ -318,6 +338,7 @@ export default class BalanceSheet extends Component {
item.formula,
item.level,
item.item_report,
item.uom,
item.total_actual_before,
item.january,
item.february,
......@@ -343,33 +364,83 @@ export default class BalanceSheet extends Component {
})
}
uploadOI(type) {
let data = []
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
"item_report_id": i[1],
"item_report": String(i[5]),
"total_actual_before": String(i[7]),
"january": String(i[8]),
"february": String(i[9]),
"march": String(i[10]),
"april": String(i[11]),
"may": String(i[12]),
"june": String(i[13]),
"july": String(i[14]),
"august": String(i[15]),
"september": String(i[16]),
"october": String(i[17]),
"november": String(i[18]),
"december": String(i[19]),
"total_current_year": String(i[20])
})
})
let body = {
company_id: this.props.data.company.company_id,
periode: this.props.data.periode,
report_id: this.props.data.report_id,
status: type,
master_budget: data
}
console.log(data);
console.log(JSON.stringify(body))
api.create('UPLOAD').uploadOperatingInd(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
alert(response.data.status)
}
} else {
alert(response.problem)
}
})
}
render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta) => {
let val = String(value).split(",").join("")
// let data = this.state.dataTable2
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
if (indexParent > 0) {
// console.log(indexParent)
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
let jagain = dataTable2[indexParent][tableMeta.columnIndex]
a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
}
let total = 0
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
dataTable2[tableMeta.rowIndex].map((item,index) => {
if (index >= 8 && index <= 19) {
let valItem = item == undefined || item == ""? 0 : item
total += Number(valItem)
}
})
dataTable2[tableMeta.rowIndex][20] = total
console.log(dataTable2[tableMeta.rowIndex])
}
const handleValue = (data) => {
const handleValue = (value, tableMeta) => {
let val = String(value).split(",").join("")
let total = 0
dataTable2.map((item, index) => {
if (data.rowData[1] == item[2]) {
total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
dataTable2[tableMeta.rowIndex].map((item,index) => {
if (index >= 8 && index <= 19) {
let valItem = item == undefined || item == ""? 0 : item
total += Number(valItem)
}
})
let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
// console.log(indexParent);
return a
dataTable2[tableMeta.rowIndex][20] = total
return total
}
const handleFormula = (data, tableMeta) => {
let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
let arrayJumlah = []
......@@ -503,13 +574,27 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
value={value}
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
type="text"
placeholder=""
defaultValue={value}
color={"#5198ea"}
value={value}
disabled={true}
// onBlur={(event) => {
// console.log(event.target.value)
// // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
// }}
/>
}
/>
</div>
)
......@@ -540,7 +625,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Jan 2021",
name: `Jan ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -581,7 +666,7 @@ export default class BalanceSheet extends Component {
}
}
, {
name: "Feb 2021",
name: `Feb ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -621,7 +706,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Mar 2021",
name: `Mar ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -661,7 +746,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Apr 2021",
name: `Apr ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -701,7 +786,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "May 2021",
name: `May ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -741,7 +826,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Jun 2021",
name: `Jun ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -781,7 +866,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Jul 2021",
name: `Jul ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -821,7 +906,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Aug 2021",
name: `Aug ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -861,7 +946,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Sep 2021",
name: `Sep ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -901,7 +986,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Oct 2021",
name: `Oct ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -941,7 +1026,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Nov 2021",
name: `Nov ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -981,7 +1066,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "Dec 2021",
name: `Dec ${this.props.data.periode}`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
......@@ -1021,7 +1106,7 @@ export default class BalanceSheet extends Component {
}
}
}, {
name: "31 Dec 2022 Total",
name: `31 Dec ${this.props.data.periode}\nTotal`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
......@@ -1032,7 +1117,7 @@ export default class BalanceSheet extends Component {
customBodyRender: (value, tableMeta, updateValue) => {
return (
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ?
{tableMeta.rowData[0] === 4 ?
null
:
<div style={{ flex: 1 }}>
......@@ -1045,7 +1130,8 @@ export default class BalanceSheet extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={value}
value={handleValue(value, tableMeta)}
disabled={true}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
......@@ -1082,20 +1168,19 @@ export default class BalanceSheet extends Component {
return (
<div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
<div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography>
<Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
</div>
{this.state.loading && loadingComponent}
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleBalanceSheet === true ?
{this.state.visibleOI === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Operating Indicator</Typography>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Operating Indicator</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.data.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
<div style={{ width: '50%' }}>
......@@ -1136,7 +1221,7 @@ export default class BalanceSheet extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => null}
onClick={() => this.downloadAllData()}
>
<img src={Images.download} />
</button>
......@@ -1147,87 +1232,86 @@ export default class BalanceSheet extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="grid grid-2x">
<div className="col-1">
<button
className="button"
type="button"
onClick={() => this.backToMasterBudget('draft')}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() =>
this.setState({ loading: true, visibleOI: true }, () => {
setTimeout(() => {
this.getDataDetail()
}, 100)
})}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.props.onClickClose()
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
}, 100);
})
}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, disabledSave: false })
}, 100);
})
}}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.createData("draft")
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
// disabled={this.state.disabledSave}
onClick={() => this.createData()}
style={{
backgroundColor: 'transparent',
cursor: this.state.disabledSave === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
// marginRight: 20
}}
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.createData("submitted")
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center'}}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
......@@ -1238,63 +1322,96 @@ export default class BalanceSheet extends Component {
<div>
<div style={{ padding: 25 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
)}
</div>
<div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}>
<button
type="button"
onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960'}}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError == true ? true : false}
onClick={() => null}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() => {
this.setState({ loading: true }, () => {
<div className="grid grid-2x">
<div className="col-1">
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
}}
onClick={() =>
this.setState({ loading: true, visibleOI: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
this.getDataDetail()
}, 100)
})}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
type="button"
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ loading: false, buttonError: false })
}, 100);
})
}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("draft")
}, 100);
})
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadOI("submitted")
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div>
</div>
</Paper>}
......@@ -1329,7 +1446,7 @@ export default class BalanceSheet extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "MASTER BUDGET - OPERATING INDICATOR" ?
this.state.judul === "OPERATING INDICATOR - MASTER BUDGET" ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", 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