Commit a154ac1b authored by Rifka Kurnia Irfiana's avatar Rifka Kurnia Irfiana

issue managdoc

parent 32d31217
...@@ -10,6 +10,7 @@ import PopUpDelete from "./PopUpDelete"; ...@@ -10,6 +10,7 @@ import PopUpDelete from "./PopUpDelete";
import api from '../../api'; import api from '../../api';
import CreateManagementDoc from './CreateManagementDoc'; import CreateManagementDoc from './CreateManagementDoc';
import EditManagementDoc from './EditManagementDoc'; import EditManagementDoc from './EditManagementDoc';
import PropagateLoader from "react-spinners/PropagateLoader"
var ct = require("../../library/CustomTable"); var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable()); const getMuiTheme = () => createMuiTheme(ct.customTable());
...@@ -168,7 +169,7 @@ export default class getAllDocument extends Component { ...@@ -168,7 +169,7 @@ export default class getAllDocument extends Component {
} }
updateDocument(payload) { updateDocument(payload) {
this.setState({ loading: true }) this.setState({ visibleEdit: false, loading: true })
api.create().updateDocument(payload).then(response => { api.create().updateDocument(payload).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -282,7 +283,16 @@ export default class getAllDocument extends Component { ...@@ -282,7 +283,16 @@ export default class getAllDocument extends Component {
"Type", "File Size", "Created By", "Created Date" "Type", "File Size", "Created By", "Created Date"
] ]
const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
<PropagateLoader
// css={override}
size={20}
color={"#274B80"}
loading={this.state.loading}
/>
</div>
);
return ( return (
<div style={{ width: '100%' }}> <div style={{ width: '100%' }}>
...@@ -293,7 +303,7 @@ export default class getAllDocument extends Component { ...@@ -293,7 +303,7 @@ export default class getAllDocument extends Component {
{this.state.messageAlert} {this.state.messageAlert}
</Alert> </Alert>
</Snackbar> </Snackbar>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
// theme={getMuiTheme()} // theme={getMuiTheme()}
......
...@@ -347,6 +347,7 @@ export default class CreateManagementDoc extends Component { ...@@ -347,6 +347,7 @@ export default class CreateManagementDoc extends Component {
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20, paddingTop: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20, paddingTop: 20 }}>
{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
...@@ -366,6 +367,8 @@ export default class CreateManagementDoc extends Component { ...@@ -366,6 +367,8 @@ export default class CreateManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
: 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
...@@ -390,6 +393,32 @@ export default class CreateManagementDoc extends Component { ...@@ -390,6 +393,32 @@ export default class CreateManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
:
<div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.document}
// debug
clearOnEscape
id="tipe"
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}
helperText={this.state.msgErrorDocument}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Category" />}
value={this.state.getDocument}
/>
</div>
</div>
}
{this.state.disabledPeriode === 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 }}>
...@@ -433,7 +462,6 @@ export default class CreateManagementDoc extends Component { ...@@ -433,7 +462,6 @@ export default class CreateManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
// )}
: true} : true}
</div> </div>
<div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}> <div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
......
...@@ -297,6 +297,7 @@ export default class DocumentManagement extends Component { ...@@ -297,6 +297,7 @@ export default class DocumentManagement extends Component {
setId={this.state.id} setId={this.state.id}
userCompActive={this.state.userCompActive} userCompActive={this.state.userCompActive}
allsubcoEdit={this.state.btnadd} allsubcoEdit={this.state.btnadd}
handleLoading={this.handleLoading.bind(this)}
/> />
// this.state.id === 68542 ? // this.state.id === 68542 ?
// <AuditTahunan // <AuditTahunan
......
...@@ -291,11 +291,11 @@ export default class EditManagementDoc extends Component { ...@@ -291,11 +291,11 @@ export default class EditManagementDoc extends Component {
this.setState({ errorPeriode: true, msgErrorPeriode: 'Period Cannot be Empty' }) this.setState({ errorPeriode: true, msgErrorPeriode: 'Period Cannot be Empty' })
} else if (R.isNil(this.state.monthId)) { } else if (R.isNil(this.state.monthId)) {
this.setState({ errorMonth: true, msgErrorMonth: 'Month Cannot be Empty' }) this.setState({ errorMonth: true, msgErrorMonth: 'Month Cannot be Empty' })
} else if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
} }
} }
if (R.isNil(this.state.getPerusahaan)) { if (R.isNil(this.state.getDocument)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
} else if (R.isNil(this.state.getDocument)) {
this.setState({ errorDocument: true, msgErrorDocument: 'Category Cannot be Empty' }) this.setState({ errorDocument: true, msgErrorDocument: 'Category Cannot be Empty' })
} else if (R.isNil(this.state.file)) { } else if (R.isNil(this.state.file)) {
this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning' })
...@@ -313,11 +313,13 @@ export default class EditManagementDoc extends Component { ...@@ -313,11 +313,13 @@ export default class EditManagementDoc extends Component {
if (String(this.props.name).includes('Manual Book TIA')){ if (String(this.props.name).includes('Manual Book TIA')){
formData.append("documentMonth", null); formData.append("documentMonth", null);
formData.append("documentPeriode", null); formData.append("documentPeriode", null);
formData.append("companyId", 1);
} else { } else {
formData.append("documentMonth", this.state.monthId.month_id); formData.append("documentMonth", this.state.monthId.month_id);
formData.append("documentPeriode", this.state.periode.periode); formData.append("documentPeriode", this.state.periode.periode);
}
formData.append("companyId", this.state.getPerusahaan.company_id); formData.append("companyId", this.state.getPerusahaan.company_id);
}
formData.append("settingId", this.state.getDocument.document_category_id); formData.append("settingId", this.state.getDocument.document_category_id);
formData.append("description", this.state.description); formData.append("description", this.state.description);
formData.append("extension", this.state.fileType); formData.append("extension", this.state.fileType);
...@@ -359,6 +361,7 @@ export default class EditManagementDoc extends Component { ...@@ -359,6 +361,7 @@ export default class EditManagementDoc extends Component {
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20, paddingTop: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20, paddingTop: 20 }}>
{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
...@@ -378,6 +381,8 @@ export default class EditManagementDoc extends Component { ...@@ -378,6 +381,8 @@ export default class EditManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
: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
...@@ -402,8 +407,33 @@ export default class EditManagementDoc extends Component { ...@@ -402,8 +407,33 @@ export default class EditManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
:
<div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.document}
// debug
clearOnEscape
id="tipe"
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}
helperText={this.state.msgErrorDocument}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Category" />}
value={this.state.getDocument}
/>
</div>
</div>
}
{this.state.disabledPeriode === 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
...@@ -424,10 +454,8 @@ export default class EditManagementDoc extends Component { ...@@ -424,10 +454,8 @@ export default class EditManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
// )}
: true } : true }
{this.state.disabledPeriode === false ? {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
...@@ -448,7 +476,6 @@ export default class EditManagementDoc extends Component { ...@@ -448,7 +476,6 @@ export default class EditManagementDoc extends Component {
/> />
</div> </div>
</div> </div>
// )}
: true} : true}
</div> </div>
<div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}> <div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
......
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