Commit 13eca502 authored by EKSAD's avatar EKSAD

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents a2c5b3cc f24d29c1
...@@ -220,7 +220,6 @@ export default class BudgetTahunan extends Component { ...@@ -220,7 +220,6 @@ export default class BudgetTahunan extends Component {
let index = data.sort((a, b) => a - b).findIndex((val) => val === year) let index = data.sort((a, b) => a - b).findIndex((val) => val === year)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => { this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
this.getRevision() this.getRevision()
this.getSubmission()
}) })
} }
} }
...@@ -247,8 +246,7 @@ export default class BudgetTahunan extends Component { ...@@ -247,8 +246,7 @@ export default class BudgetTahunan extends Component {
getOptionLabel: (option) => option.revision, getOptionLabel: (option) => option.revision,
}; };
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => { this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getReport() this.getSubmission()
this.getReportAttachment()
}) })
} }
} }
...@@ -256,6 +254,7 @@ export default class BudgetTahunan extends Component { ...@@ -256,6 +254,7 @@ export default class BudgetTahunan extends Component {
} }
getSubmission() { getSubmission() {
this.setState({ loading: true })
let payload = { let payload = {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"periode": this.state.periode.periode, "periode": this.state.periode.periode,
...@@ -264,20 +263,20 @@ export default class BudgetTahunan extends Component { ...@@ -264,20 +263,20 @@ export default class BudgetTahunan extends Component {
api.create().getSubmission(payload).then(response => { api.create().getSubmission(payload).then(response => {
console.log(response) console.log(response)
if (response) { if (response) {
if (response.data.data) { if (response.data.status === "success") {
this.setState({ this.setState({
submissionID: response.data.data.submission_id, isSubmit: false, submissionID: response.data.data.submission_id, isSubmit: false,
submitter: response.data.data.submitter, submitter: response.data.data.submitter,
approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver, approverID: response.data.data.approve_id, pic: response.data.data.approver == null ? '' : response.data.data.approver,
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
loading: false
}, () => { }, () => {
this.setState({ loading: false })
this.historyApproval() this.historyApproval()
this.getReport() this.getReport()
this.getReportAttachment() this.getReportAttachment()
}) })
} else { } else {
this.setState({ submissionID: null }) this.setState({ submissionID: null, loading: null })
} }
} }
}) })
...@@ -306,7 +305,6 @@ export default class BudgetTahunan extends Component { ...@@ -306,7 +305,6 @@ export default class BudgetTahunan extends Component {
} }
approvalSubmission(type) { approvalSubmission(type) {
this.setState({ loading: true })
let body = { let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id, "approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
"status": type, "status": type,
...@@ -456,7 +454,7 @@ export default class BudgetTahunan extends Component { ...@@ -456,7 +454,7 @@ export default class BudgetTahunan extends Component {
}) })
} }
} else { } else {
this.setState({ loading: false }, ()=> { this.setState({ loading: false }, () => {
this.getSubmission() this.getSubmission()
}) })
} }
...@@ -576,9 +574,9 @@ export default class BudgetTahunan extends Component { ...@@ -576,9 +574,9 @@ export default class BudgetTahunan extends Component {
borderColor: 'transparent' borderColor: 'transparent'
}} }}
onClick={() => onClick={() =>
tableMeta.rowData[5] == true ? tableMeta.rowData[5] == true ?
this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3]) this.clickDetail(tableMeta.rowData[1], tableMeta.rowData[4], tableMeta.rowData[2], tableMeta.rowData[3])
: null : null
} }
> >
<Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography> <Typography style={{ color: tableMeta.rowData[5] ? '#5198ea' : 'GrayText', fontSize: 12, }}>Detail</Typography>
...@@ -742,9 +740,8 @@ export default class BudgetTahunan extends Component { ...@@ -742,9 +740,8 @@ export default class BudgetTahunan extends Component {
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.setState({ visibleTableHistory: false, loading: true }) this.setState({ visibleTableHistory: false })
this.getRevision() this.getRevision()
this.getSubmission()
})} })}
disabled={this.state.intent === 'Home' ? true : false} disabled={this.state.intent === 'Home' ? true : false}
disableClearable disableClearable
...@@ -761,9 +758,8 @@ export default class BudgetTahunan extends Component { ...@@ -761,9 +758,8 @@ export default class BudgetTahunan extends Component {
id="company" id="company"
disabled={this.state.intent === 'Home' ? true : false} disabled={this.state.intent === 'Home' ? true : false}
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.setState({ visibleTableHistory: false, loading: true }) this.setState({ visibleTableHistory: false })
this.getRevision() this.getRevision()
this.getSubmission()
})} })}
disableClearable disableClearable
style={{ width: 250 }} style={{ width: 250 }}
......
...@@ -117,7 +117,9 @@ export default class BalanceSheet extends Component { ...@@ -117,7 +117,9 @@ export default class BalanceSheet extends Component {
item.balance_sheet.total_current_year, item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year, item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year, item.balance_sheet.total_more_year,
item.order item.order,
item.condition_it_should_be,
item.condition_if_wrong
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -152,7 +154,9 @@ export default class BalanceSheet extends Component { ...@@ -152,7 +154,9 @@ export default class BalanceSheet extends Component {
item.balance_sheet.total_current_year, item.balance_sheet.total_current_year,
item.balance_sheet.total_next_year, item.balance_sheet.total_next_year,
item.balance_sheet.total_more_year, item.balance_sheet.total_more_year,
item.order item.order,
item.condition_it_should_be,
item.condition_if_wrong
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -328,12 +332,14 @@ export default class BalanceSheet extends Component { ...@@ -328,12 +332,14 @@ export default class BalanceSheet extends Component {
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
item.orders, item.orders,
item.condition_it_should_be,
item.condition_if_wrong,
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[23].length > 0) { if (item[25].length > 0) {
console.log('masuk') console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
...@@ -537,6 +543,50 @@ export default class BalanceSheet extends Component { ...@@ -537,6 +543,50 @@ export default class BalanceSheet extends Component {
} }
const handleValidation = (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[22] == 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
}
const columns = [{ const columns = [{
name: "", name: "",
options: { options: {
...@@ -574,8 +624,8 @@ export default class BalanceSheet extends Component { ...@@ -574,8 +624,8 @@ export default class BalanceSheet extends Component {
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[23] ? {tableMeta.rowData[25] ?
tableMeta.rowData[23].length > 0 ? tableMeta.rowData[25].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow> <LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
...@@ -718,7 +768,62 @@ export default class BalanceSheet extends Component { ...@@ -718,7 +768,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -806,7 +911,62 @@ export default class BalanceSheet extends Component { ...@@ -806,7 +911,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -894,7 +1054,62 @@ export default class BalanceSheet extends Component { ...@@ -894,7 +1054,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -982,7 +1197,62 @@ export default class BalanceSheet extends Component { ...@@ -982,7 +1197,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1070,7 +1340,62 @@ export default class BalanceSheet extends Component { ...@@ -1070,7 +1340,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1158,7 +1483,62 @@ export default class BalanceSheet extends Component { ...@@ -1158,7 +1483,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1246,7 +1626,62 @@ export default class BalanceSheet extends Component { ...@@ -1246,7 +1626,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1334,7 +1769,62 @@ export default class BalanceSheet extends Component { ...@@ -1334,7 +1769,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1422,7 +1912,62 @@ export default class BalanceSheet extends Component { ...@@ -1422,7 +1912,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1510,7 +2055,62 @@ export default class BalanceSheet extends Component { ...@@ -1510,7 +2055,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1598,7 +2198,62 @@ export default class BalanceSheet extends Component { ...@@ -1598,7 +2198,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1686,7 +2341,62 @@ export default class BalanceSheet extends Component { ...@@ -1686,7 +2341,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1774,7 +2484,62 @@ export default class BalanceSheet extends Component { ...@@ -1774,7 +2484,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1862,7 +2627,62 @@ export default class BalanceSheet extends Component { ...@@ -1862,7 +2627,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -1950,7 +2770,62 @@ export default class BalanceSheet extends Component { ...@@ -1950,7 +2770,62 @@ export default class BalanceSheet extends Component {
// /> // />
null null
: :
null tableMeta.rowData[0] === 7 ?
Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'black'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/> : tableMeta.rowData[24] === "STOPPER" ?
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'red'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip> :
<LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
<NumberFormat
thousandSeparator={true}
style={{
fontSize: 12,
textAlign: 'right',
borderColor: 'transparent',
margin: 0,
width: 96,
backgroundColor: 'transparent',
color: 'yellow'
}}
type="text"
placeholder=""
disabled={true}
value={Number(handleValidation(value, tableMeta)).toFixed(1)}
/>
</LightTooltip>
:
null
} }
</div> </div>
) )
...@@ -2238,7 +3113,7 @@ export default class BalanceSheet extends Component { ...@@ -2238,7 +3113,7 @@ export default class BalanceSheet extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : null :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
...@@ -2261,7 +3136,7 @@ export default class BalanceSheet extends Component { ...@@ -2261,7 +3136,7 @@ export default class BalanceSheet extends Component {
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} }}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
null : null :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
......
...@@ -45,7 +45,8 @@ export default class CreateManagementDoc extends Component { ...@@ -45,7 +45,8 @@ export default class CreateManagementDoc extends Component {
fileType: '', fileType: '',
konfirmasi: false, konfirmasi: false,
docId:'', docId:'',
sizeUpload: "1" sizeUpload: "1",
disabledPeriode: false
} }
} }
...@@ -72,10 +73,12 @@ export default class CreateManagementDoc extends Component { ...@@ -72,10 +73,12 @@ export default class CreateManagementDoc extends Component {
this.setState({ this.setState({
sizeUpload: "1" sizeUpload: "1"
}) })
} else } else {
this.setState({ this.setState({
sizeUpload: response.data.data[0].value sizeUpload: response.data.data[0].value
}) })
}
// sizeUpload: response.data.data[0] ? response.data.data[0].value === undefined ? "1" : response.data.data[0].value : "1"
console.log(this.state.sizeUpload) console.log(this.state.sizeUpload)
} }
} }
...@@ -235,7 +238,7 @@ export default class CreateManagementDoc extends Component { ...@@ -235,7 +238,7 @@ export default class CreateManagementDoc extends Component {
} }
validasi() { validasi() {
if (String(this.props.name).includes('Manual Book TIA')){ if (this.state.disabledPeriode === true){
if (R.isNil(this.state.getPerusahaan)) { if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
} else if (R.isNil(this.state.getDocument)) { } else if (R.isNil(this.state.getDocument)) {
...@@ -254,6 +257,12 @@ export default class CreateManagementDoc extends Component { ...@@ -254,6 +257,12 @@ export default class CreateManagementDoc extends Component {
this.setState({ formData }, ()=> { this.setState({ formData }, ()=> {
this.props.createDocument(this.state.formData, this.props.setting_id, this.props.name) this.props.createDocument(this.state.formData, this.props.setting_id, this.props.name)
}) })
var object = {};
formData.forEach(function(value, key){
object[key] = value;
});
var json = JSON.stringify(object);
console.log(object)
} }
} else { } else {
...@@ -341,7 +350,12 @@ export default class CreateManagementDoc extends Component { ...@@ -341,7 +350,12 @@ export default class CreateManagementDoc extends Component {
// debug // debug
clearOnEscape clearOnEscape
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getDocument: newInputValue }, () => this.clearMessage())} onChange={(event, newInputValue) => this.setState({ getDocument: newInputValue },
() => newInputValue === null ? this.setState({ disabledPeriode: false })
: newInputValue.document_category_name === 'Manual Book TIA 4.0' ?
this.setState({ disabledPeriode: true }, () => this.clearMessage())
: this.setState({ disabledPeriode: false }, () => this.clearMessage())
)}
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
error={this.state.errorDocument} error={this.state.errorDocument}
...@@ -353,7 +367,8 @@ export default class CreateManagementDoc extends Component { ...@@ -353,7 +367,8 @@ export default class CreateManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
{String(this.props.name).includes('Manual Book TIA') ? false : ( {/* {String(this.props.name).includes('Manual Book TIA') ? false : ( */}
{this.state.disabledPeriode === false ?
<div className="column-1"> <div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
...@@ -374,8 +389,10 @@ export default class CreateManagementDoc extends Component { ...@@ -374,8 +389,10 @@ export default class CreateManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
)} // )}
{String(this.props.name).includes('Manual Book TIA') ? false : ( // {String(this.props.name).includes('Manual Book TIA') ? false : (
: true }
{this.state.disabledPeriode === false ?
<div className="column-2"> <div className="column-2">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
...@@ -396,7 +413,8 @@ export default class CreateManagementDoc extends Component { ...@@ -396,7 +413,8 @@ export default class CreateManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
)} // )}
: true}
</div> </div>
<div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}> <div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
<UploadFile <UploadFile
......
...@@ -49,7 +49,8 @@ export default class EditManagementDoc extends Component { ...@@ -49,7 +49,8 @@ export default class EditManagementDoc extends Component {
document_size: 0, document_size: 0,
loadUpload: false, loadUpload: false,
sizeUpload: "1", sizeUpload: "1",
name: '' name: '',
disabledPeriode: false
} }
} }
...@@ -57,6 +58,7 @@ export default class EditManagementDoc extends Component { ...@@ -57,6 +58,7 @@ export default class EditManagementDoc extends Component {
this.getFileSize() this.getFileSize()
if (this.props.type === 'edit') { if (this.props.type === 'edit') {
this.getDetailDoc() this.getDetailDoc()
console.log(this.props)
} }
} }
...@@ -103,7 +105,8 @@ export default class EditManagementDoc extends Component { ...@@ -103,7 +105,8 @@ export default class EditManagementDoc extends Component {
created: data.created, created: data.created,
updated: data.updated === null ? "" : data.updated, updated: data.updated === null ? "" : data.updated,
loadUpload: true, loadUpload: true,
name: data.values name: data.values,
disabledPeriode: data.values === 'Manual Book TIA 4.0' ? true : false
}, () => { }, () => {
this.getDataCompany() this.getDataCompany()
this.getDataDocument() this.getDataDocument()
...@@ -379,7 +382,12 @@ export default class EditManagementDoc extends Component { ...@@ -379,7 +382,12 @@ export default class EditManagementDoc extends Component {
// debug // debug
clearOnEscape clearOnEscape
id="tipe" id="tipe"
onChange={(event, newInputValue) => this.setState({ getDocument: newInputValue }, () => this.clearMessage())} onChange={(event, newInputValue) => this.setState({ getDocument: newInputValue },
() => newInputValue === null ? this.setState({ disabledPeriode: false })
: newInputValue.document_category_name === 'Manual Book TIA 4.0' ?
this.setState({ disabledPeriode: true }, () => this.clearMessage())
: this.setState({ disabledPeriode: false }, () => this.clearMessage())
)}
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
error={this.state.errorDocument} error={this.state.errorDocument}
...@@ -391,7 +399,8 @@ export default class EditManagementDoc extends Component { ...@@ -391,7 +399,8 @@ export default class EditManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
{String(this.state.name).includes('Manual Book TIA') ? false : ( {this.state.disabledPeriode === false ?
// {String(this.state.name).includes('Manual Book TIA') ? false : (
<div className="column-1"> <div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
...@@ -412,8 +421,10 @@ export default class EditManagementDoc extends Component { ...@@ -412,8 +421,10 @@ export default class EditManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
)} // )}
{String(this.state.name).includes('Manual Book TIA') ? false : ( : true }
{this.state.disabledPeriode === false ?
// {String(this.state.name).includes('Manual Book TIA') ? false : (
<div className="column-2"> <div className="column-2">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
...@@ -434,7 +445,8 @@ export default class EditManagementDoc extends Component { ...@@ -434,7 +445,8 @@ export default class EditManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
)} // )}
: true}
</div> </div>
<div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}> <div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
{this.state.loadUpload && ( {this.state.loadUpload && (
......
...@@ -61,7 +61,7 @@ class Upload extends Component { ...@@ -61,7 +61,7 @@ class Upload extends Component {
if (this.props.intent === 'management') { if (this.props.intent === 'management') {
if (acceptedFiles) { if (acceptedFiles) {
if (this.props.acceptedFiles.includes(fileType)) { if (this.props.acceptedFiles.includes(fileType)) {
if ((acceptedFiles[0].size / 1000).toFixed(0) < (this.state.sizeUpload * 1000)) { if ((acceptedFiles[0].size / 1000).toFixed(0) < (this.props.sizeUpload * 1000)) {
this.setState({ this.setState({
file: acceptedFiles[0], file: acceptedFiles[0],
typeFile: fileType, typeFile: fileType,
...@@ -74,7 +74,7 @@ class Upload extends Component { ...@@ -74,7 +74,7 @@ class Upload extends Component {
}) })
this.props.onHandle(acceptedFiles[0]) this.props.onHandle(acceptedFiles[0])
} else { } else {
this.setState({ alertMessage: `The file is too large. Allowed maximum size is ${this.state.sizeUpload}MB`, alert: true }) this.setState({ alertMessage: `The file is too large. Allowed maximum size is ${this.props.sizeUpload} MB`, alert: true })
// alert('File Tidak Boleh Lebih Dari 1MB') // alert('File Tidak Boleh Lebih Dari 1MB')
} }
} else { } else {
......
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