Commit 3d99476e authored by Deni Rinaldi's avatar Deni Rinaldi

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

push

See merge request !351
parents 9aa6dd57 636ef873
import React, { Component } from 'react';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, Snackbar, withStyles } from '@material-ui/core';
import { Typography, Paper, TextField, MenuItem, Select, FormControlLabel, Snackbar, withStyles, createMuiTheme, MuiThemeProvider } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import Images from '../assets/Images';
import BalanceSheet from './BudgetTahunan/BalanceSheet';
......@@ -17,6 +17,9 @@ import { format } from 'date-fns';
import Constant from '../library/Constant';
import PropagateLoader from "react-spinners/PropagateLoader"
var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
......@@ -500,11 +503,13 @@ export default class BudgetTahunan extends Component {
</div>
<div style={{ marginTop: 20 }}>
<MUIDataTable
data={this.state.dataTable}
columns={columns}
options={options}
/>
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTable}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
<div style={{ display: 'flex', marginTop: 20 }}>
<div style={{ width: '50%' }}>
......
......@@ -40,7 +40,8 @@ export default class CreateManagementDoc extends Component {
messageAlert: '',
fileType: '',
konfirmasi: false,
docId:''
docId:'',
sizeUpload: "1"
}
}
......@@ -49,6 +50,25 @@ export default class CreateManagementDoc extends Component {
this.getDataDocument()
this.getPeriode()
this.getMonth()
this.getFileSize()
}
getFileSize(){
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
})
}
}
})
}
getDataCompany() {
......@@ -352,6 +372,7 @@ export default class CreateManagementDoc extends Component {
this.deleteFile(e)
}}
onUpload={() => alert('sukses')}
sizeUpload={Number(this.state.sizeUpload)}
/>
</div>
<div className="margin-top-10px" style={{ paddingLeft: 30, paddingRight: 30, borderRadius: 5, paddingBottom: 20 }}>
......
......@@ -43,16 +43,36 @@ export default class EditManagementDoc extends Component {
docId: '',
document_name: "",
document_size: 0,
loadUpload: false
loadUpload: false,
sizeUpload: "1"
}
}
componentDidMount() {
this.getFileSize()
if (this.props.type === 'edit') {
this.getDetailDoc()
}
}
getFileSize(){
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
})
}
}
})
}
getDetailDoc() {
api.create().getDetailDocument(this.props.idoc).then(response => {
console.log(response)
......@@ -68,10 +88,12 @@ export default class EditManagementDoc extends Component {
period: data.document_periode,
getMonthName: data.document_month,
description: data.description,
file: data.document_filepath,
document_name: data.document_name,
document_size: data.document_size,
// id: data.approval_matrix_id,
// status: data.status,
fileType: data.document_type,
created: data.created,
updated: data.updated === null ? "" : data.updated,
loadUpload: true
......@@ -247,6 +269,7 @@ export default class EditManagementDoc extends Component {
}
validasi() {
console.log(this.state.file);
if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
} else if (R.isNil(this.state.getDocument)) {
......@@ -397,6 +420,7 @@ export default class EditManagementDoc extends Component {
value={this.state.file}
docSize={this.state.document_size}
docName={this.state.document_name}
sizeUpload={Number(this.state.sizeUpload)}
/>
)}
</div>
......@@ -431,37 +455,6 @@ export default class EditManagementDoc extends Component {
>
</TextField>
</div>
<div className="margin-top-10px" style={{ paddingLeft: 30, paddingRight: 30, borderRadius: 5, paddingBottom: 20 }}>
<TextField
style={{ width: '100%' }}
id="description"
label="Description"
value={this.state.description}
inputProps={{
min: 0,
style: {
fontSize: 11
}
}}
InputLabelProps={{
style: {
fontSize: 11,
color: '#7e8085'
}
}}
name="Description"
onChange={(e) => {
this.setState({
description: e.target.value
})
this.clearMessage()
}}
error={this.state.errorDesc}
helperText={this.state.msgErrorDesc}
>
</TextField>
</div>
<div className="margin-top-10px" style={{ paddingLeft: 30, paddingRight: 30, borderRadius: 5, paddingBottom: 20 }}>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: 11, width: '12%' }}>Created By</Typography>
......
......@@ -57,11 +57,11 @@ class Upload extends Component {
let length = acceptedFiles[0].name.split(".").length
let fileType = acceptedFiles[0].name.split(".")[length - 1]
formData.append('file', acceptedFiles[0])
console.log(fileType);
// console.log(sizeFile);
if (this.props.intent === 'management') {
if (acceptedFiles) {
if (this.props.acceptedFiles.includes(fileType)) {
if (this.state.sizeFile < 10000) {
if ((acceptedFiles[0].size / 1000).toFixed(0) < (this.state.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 10MB', alert: true })
this.setState({ alertMessage: `The file is too large. Allowed maximum size is ${this.state.sizeUpload}MB`, alert: true })
// alert('File Tidak Boleh Lebih Dari 1MB')
}
} else {
......@@ -149,10 +149,10 @@ class Upload extends Component {
if (strProps.includes(strState)) {
if (this.props.intent === 'management') {
if (this.state.sizeFile < 10000) {
if (this.state.sizeFile < this.state.sizeUpload * 1000) {
this.props.onUpload()
} else {
this.setState({ alertMessage: 'The file is too large. Allowed maximum size is 10MB', alert: true })
this.setState({ alertMessage: 'The file is too large. Allowed maximum size is 1MB', alert: true })
// alert('File Tidak Boleh Lebih Dari 1MB')
}
} else {
......@@ -213,7 +213,7 @@ class Upload extends Component {
{this.state.docName}
</div>
<div className="txt-site txt-11 txt-white txt-thin">
{this.state.docSize} KB
{this.state.docSize/1000} KB
</div>
</div>
</div>
......
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