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 {
let index = data.sort((a, b) => a - b).findIndex((val) => val === year)
this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index] }, () => {
this.getRevision()
this.getSubmission()
})
}
}
......@@ -247,8 +246,7 @@ export default class BudgetTahunan extends Component {
getOptionLabel: (option) => option.revision,
};
this.setState({ listRevision: defaultProps, revision: revisionData[0] }, () => {
this.getReport()
this.getReportAttachment()
this.getSubmission()
})
}
}
......@@ -256,6 +254,7 @@ export default class BudgetTahunan extends Component {
}
getSubmission() {
this.setState({ loading: true })
let payload = {
"company_id": this.state.company.company_id,
"periode": this.state.periode.periode,
......@@ -264,20 +263,20 @@ export default class BudgetTahunan extends Component {
api.create().getSubmission(payload).then(response => {
console.log(response)
if (response) {
if (response.data.data) {
if (response.data.status === "success") {
this.setState({
submissionID: response.data.data.submission_id, isSubmit: false,
submitter: response.data.data.submitter,
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.getReport()
this.getReportAttachment()
})
} else {
this.setState({ submissionID: null })
this.setState({ submissionID: null, loading: null })
}
}
})
......@@ -306,7 +305,6 @@ export default class BudgetTahunan extends Component {
}
approvalSubmission(type) {
this.setState({ loading: true })
let body = {
"approval_id": this.props.location.state == undefined ? this.state.approverID : this.state.rawData.approval_id,
"status": type,
......@@ -456,7 +454,7 @@ export default class BudgetTahunan extends Component {
})
}
} else {
this.setState({ loading: false }, ()=> {
this.setState({ loading: false }, () => {
this.getSubmission()
})
}
......@@ -742,9 +740,8 @@ export default class BudgetTahunan extends Component {
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.setState({ visibleTableHistory: false, loading: true })
this.setState({ visibleTableHistory: false })
this.getRevision()
this.getSubmission()
})}
disabled={this.state.intent === 'Home' ? true : false}
disableClearable
......@@ -761,9 +758,8 @@ export default class BudgetTahunan extends Component {
id="company"
disabled={this.state.intent === 'Home' ? true : false}
onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => {
this.setState({ visibleTableHistory: false, loading: true })
this.setState({ visibleTableHistory: false })
this.getRevision()
this.getSubmission()
})}
disableClearable
style={{ width: 250 }}
......
This diff is collapsed.
......@@ -45,7 +45,8 @@ export default class CreateManagementDoc extends Component {
fileType: '',
konfirmasi: false,
docId:'',
sizeUpload: "1"
sizeUpload: "1",
disabledPeriode: false
}
}
......@@ -72,10 +73,12 @@ export default class CreateManagementDoc extends Component {
this.setState({
sizeUpload: "1"
})
} else
} else {
this.setState({
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)
}
}
......@@ -235,7 +238,7 @@ export default class CreateManagementDoc extends Component {
}
validasi() {
if (String(this.props.name).includes('Manual Book TIA')){
if (this.state.disabledPeriode === true){
if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
} else if (R.isNil(this.state.getDocument)) {
......@@ -254,6 +257,12 @@ export default class CreateManagementDoc extends Component {
this.setState({ formData }, ()=> {
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 {
......@@ -341,7 +350,12 @@ export default class CreateManagementDoc extends Component {
// debug
clearOnEscape
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) =>
<TextField {...params}
error={this.state.errorDocument}
......@@ -353,7 +367,8 @@ export default class CreateManagementDoc extends Component {
/>
</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 style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
......@@ -374,8 +389,10 @@ export default class CreateManagementDoc extends Component {
/>
</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 style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
......@@ -396,7 +413,8 @@ export default class CreateManagementDoc extends Component {
/>
</div>
</div>
)}
// )}
: true}
</div>
<div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
<UploadFile
......
......@@ -49,7 +49,8 @@ export default class EditManagementDoc extends Component {
document_size: 0,
loadUpload: false,
sizeUpload: "1",
name: ''
name: '',
disabledPeriode: false
}
}
......@@ -57,6 +58,7 @@ export default class EditManagementDoc extends Component {
this.getFileSize()
if (this.props.type === 'edit') {
this.getDetailDoc()
console.log(this.props)
}
}
......@@ -103,7 +105,8 @@ export default class EditManagementDoc extends Component {
created: data.created,
updated: data.updated === null ? "" : data.updated,
loadUpload: true,
name: data.values
name: data.values,
disabledPeriode: data.values === 'Manual Book TIA 4.0' ? true : false
}, () => {
this.getDataCompany()
this.getDataDocument()
......@@ -379,7 +382,12 @@ export default class EditManagementDoc extends Component {
// debug
clearOnEscape
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) =>
<TextField {...params}
error={this.state.errorDocument}
......@@ -391,7 +399,8 @@ export default class EditManagementDoc extends Component {
/>
</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 style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
......@@ -412,8 +421,10 @@ export default class EditManagementDoc extends Component {
/>
</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 style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
......@@ -434,7 +445,8 @@ export default class EditManagementDoc extends Component {
/>
</div>
</div>
)}
// )}
: true}
</div>
<div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
{this.state.loadUpload && (
......
......@@ -61,7 +61,7 @@ class Upload extends Component {
if (this.props.intent === 'management') {
if (acceptedFiles) {
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({
file: acceptedFiles[0],
typeFile: fileType,
......@@ -74,7 +74,7 @@ class Upload extends Component {
})
this.props.onHandle(acceptedFiles[0])
} 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')
}
} 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