Commit bd3ccc53 authored by Deni Rinaldi's avatar Deni Rinaldi

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

updateBalancesitttt & upload size

See merge request !327
parents babf96c2 e216e637
This diff is collapsed.
...@@ -50,7 +50,8 @@ export default class Parameter extends Component { ...@@ -50,7 +50,8 @@ export default class Parameter extends Component {
delete: false, delete: false,
load: false, load: false,
judul: '', judul: '',
loading: false loading: false,
sizeUpload: "1"
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -58,6 +59,25 @@ export default class Parameter extends Component { ...@@ -58,6 +59,25 @@ export default class Parameter extends Component {
componentDidMount() { componentDidMount() {
this.getAllParameter() this.getAllParameter()
this.getPermission() this.getPermission()
this.getSizeUpload()
}
getSizeUpload(){
let body = {
group: 'MAX_FILE_SIZE',
company_id: 0,
type: 'MAX_FILE_SIZE'
}
api.create().getAllSettingByType(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({
sizeUpload: response.data.data[0].value
})
}
}
})
} }
getPermission() { getPermission() {
...@@ -1047,6 +1067,7 @@ export default class Parameter extends Component { ...@@ -1047,6 +1067,7 @@ export default class Parameter extends Component {
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
result={this.state.result} result={this.state.result}
sizeUpload={Number(this.state.sizeUpload)}
acceptedFiles={["xlsx"]} acceptedFiles={["xlsx"]}
onHandle={(dt) => { onHandle={(dt) => {
this.fileHandler(dt) this.fileHandler(dt)
......
...@@ -62,7 +62,8 @@ export default class UnitBisnis extends Component { ...@@ -62,7 +62,8 @@ export default class UnitBisnis extends Component {
rowData: [], rowData: [],
unitBisnisName: '', unitBisnisName: '',
// visibleLoad: true, // visibleLoad: true,
loading: false loading: false,
sizeUpload: "1"
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -225,6 +226,25 @@ export default class UnitBisnis extends Component { ...@@ -225,6 +226,25 @@ export default class UnitBisnis extends Component {
componentDidMount() { componentDidMount() {
this.getData() this.getData()
this.getPermission() this.getPermission()
this.getSizeUpload()
}
getSizeUpload(){
let body = {
group: 'MAX_FILE_SIZE',
company_id: 0,
type: 'MAX_FILE_SIZE'
}
api.create().getAllSettingByType(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "success") {
this.setState({
sizeUpload: response.data.data[0].value
})
}
}
})
} }
getPermission() { getPermission() {
...@@ -771,6 +791,7 @@ export default class UnitBisnis extends Component { ...@@ -771,6 +791,7 @@ export default class UnitBisnis extends Component {
type={this.state.uploadStatus} type={this.state.uploadStatus}
percentage={this.state.percentage} percentage={this.state.percentage}
result={this.state.result} result={this.state.result}
sizeUpload={Number(this.state.sizeUpload)}
acceptedFiles={["xlsx"]} acceptedFiles={["xlsx"]}
onHandle={(dt) => { onHandle={(dt) => {
this.fileHandler(dt) this.fileHandler(dt)
......
...@@ -25,7 +25,8 @@ class Upload extends Component { ...@@ -25,7 +25,8 @@ class Upload extends Component {
percentage: '0', percentage: '0',
completed: '0', completed: '0',
alert: false, alert: false,
alertMessage: '' alertMessage: '',
sizeUpload: this.props.sizeUpload === undefined ? 0 : this.props.sizeUpload
} }
} }
...@@ -146,7 +147,7 @@ class Upload extends Component { ...@@ -146,7 +147,7 @@ class Upload extends Component {
// alert('File Tidak Boleh Lebih Dari 1MB') // alert('File Tidak Boleh Lebih Dari 1MB')
} }
} else { } else {
if (this.state.sizeFile < 1000) { if (this.state.sizeFile < this.state.sizeUpload * 1000) {
this.props.onUpload() this.props.onUpload()
} else { } else {
this.setState({ alertMessage: 'The file is too large. Allowed maximum size is 1MB', alert: true }) this.setState({ alertMessage: 'The file is too large. Allowed maximum size is 1MB', alert: true })
......
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