Commit e216e637 authored by Deni Rinaldi's avatar Deni Rinaldi

updateBalancesitttt & upload size

parent 24f6eb8f
This diff is collapsed.
......@@ -50,7 +50,8 @@ export default class Parameter extends Component {
delete: false,
load: false,
judul: '',
loading: false
loading: false,
sizeUpload: "1"
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -58,6 +59,25 @@ export default class Parameter extends Component {
componentDidMount() {
this.getAllParameter()
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() {
......@@ -1047,6 +1067,7 @@ export default class Parameter extends Component {
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
sizeUpload={Number(this.state.sizeUpload)}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
......
......@@ -62,7 +62,8 @@ export default class UnitBisnis extends Component {
rowData: [],
unitBisnisName: '',
// visibleLoad: true,
loading: false
loading: false,
sizeUpload: "1"
}
this.fileHandler = this.fileHandler.bind(this);
}
......@@ -225,6 +226,25 @@ export default class UnitBisnis extends Component {
componentDidMount() {
this.getData()
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() {
......@@ -771,6 +791,7 @@ export default class UnitBisnis extends Component {
type={this.state.uploadStatus}
percentage={this.state.percentage}
result={this.state.result}
sizeUpload={Number(this.state.sizeUpload)}
acceptedFiles={["xlsx"]}
onHandle={(dt) => {
this.fileHandler(dt)
......
......@@ -25,7 +25,8 @@ class Upload extends Component {
percentage: '0',
completed: '0',
alert: false,
alertMessage: ''
alertMessage: '',
sizeUpload: this.props.sizeUpload === undefined ? 0 : this.props.sizeUpload
}
}
......@@ -146,7 +147,7 @@ class Upload extends Component {
// alert('File Tidak Boleh Lebih Dari 1MB')
}
} else {
if (this.state.sizeFile < 1000) {
if (this.state.sizeFile < this.state.sizeUpload * 1000) {
this.props.onUpload()
} else {
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