Commit bc7aa7ec authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'rifka' into 'master'

update issue managdoc

See merge request !388
parents 6590125a f3ba480d
...@@ -259,13 +259,13 @@ export default class getAllDocument extends Component { ...@@ -259,13 +259,13 @@ export default class getAllDocument extends Component {
} }
}, "File Name", "Description", "Company Name", }, "File Name", "Description", "Company Name",
{ {
name: "Monthly", name: "Period Month",
options: { options: {
display: String(this.props.data.value).includes('Manual Book TIA') ? false : true display: String(this.props.data.value).includes('Manual Book TIA') ? false : true
} }
}, },
{ {
name: "Period", name: "Period Year",
options: { options: {
display: String(this.props.data.value).includes('Manual Book TIA') ? false : true display: String(this.props.data.value).includes('Manual Book TIA') ? false : true
} }
......
...@@ -28,6 +28,7 @@ export default class DocumentManagement extends Component { ...@@ -28,6 +28,7 @@ export default class DocumentManagement extends Component {
btnedit: false, btnedit: false,
btndelete: false, btndelete: false,
load: false, load: false,
name: ''
} }
} }
...@@ -66,7 +67,7 @@ export default class DocumentManagement extends Component { ...@@ -66,7 +67,7 @@ export default class DocumentManagement extends Component {
this.getPermission() this.getPermission()
} }
getDataDocument(id) { getDataDocument(id, name) {
// let payload = { // let payload = {
// "setting_group_id": 7, // "setting_group_id": 7,
// "setting_type_id": 167, // "setting_type_id": 167,
...@@ -80,6 +81,7 @@ export default class DocumentManagement extends Component { ...@@ -80,6 +81,7 @@ export default class DocumentManagement extends Component {
this.setState({ this.setState({
listData: response.data.data, listData: response.data.data,
id: id === undefined ? response.data.data[0].setting_id : id, id: id === undefined ? response.data.data[0].setting_id : id,
name: name === undefined ? response.data.data[0].value : name,
loadTable: true, loadTable: true,
refresh: id === undefined ? '' : 'create' refresh: id === undefined ? '' : 'create'
}) })
...@@ -184,7 +186,7 @@ export default class DocumentManagement extends Component { ...@@ -184,7 +186,7 @@ export default class DocumentManagement extends Component {
</Alert> </Alert>
</Snackbar> </Snackbar>
<div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <div className={"main-color"} style={{ height: 78, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
<Typography style={{ fontSize: '16px', color: 'white' }}>Management Document</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Document Management</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<Paper style={{ padding: 20 }}> <Paper style={{ padding: 20 }}>
...@@ -216,7 +218,7 @@ export default class DocumentManagement extends Component { ...@@ -216,7 +218,7 @@ export default class DocumentManagement extends Component {
{this.state.listData.map((item, index) => { {this.state.listData.map((item, index) => {
return ( return (
<Tab <Tab
onClick={() => this.setState({ id: item.setting_id, refresh: '', loadTable : false }, () => this.setState({loadTable: true}))} onClick={() => this.setState({ name: item.value, id: item.setting_id, refresh: '', loadTable : false }, () => this.setState({loadTable: true}))}
label={item.value} label={item.value}
/> />
) )
...@@ -292,6 +294,7 @@ export default class DocumentManagement extends Component { ...@@ -292,6 +294,7 @@ export default class DocumentManagement extends Component {
// getDataDocument={this.getDataDocument.bind(this)} // getDataDocument={this.getDataDocument.bind(this)}
createDocument={this.createDocument.bind(this)} createDocument={this.createDocument.bind(this)}
setting_id={this.state.id} setting_id={this.state.id}
name={this.state.name}
/> />
)} )}
</div> </div>
......
...@@ -34,6 +34,10 @@ export default class EditManagementDoc extends Component { ...@@ -34,6 +34,10 @@ export default class EditManagementDoc extends Component {
description: '', description: '',
errorDesc: false, errorDesc: false,
msgErrorDesc: '', msgErrorDesc: '',
errorMonth: false,
msgErrorMonth: '',
errorPeriode: false,
msgErrorPeriode: '',
file: null, file: null,
alert: false, alert: false,
tipeAlert: '', tipeAlert: '',
...@@ -44,7 +48,8 @@ export default class EditManagementDoc extends Component { ...@@ -44,7 +48,8 @@ export default class EditManagementDoc extends Component {
document_name: "", document_name: "",
document_size: 0, document_size: 0,
loadUpload: false, loadUpload: false,
sizeUpload: "1" sizeUpload: "1",
name: ''
} }
} }
...@@ -52,6 +57,7 @@ export default class EditManagementDoc extends Component { ...@@ -52,6 +57,7 @@ export default class EditManagementDoc extends Component {
this.getFileSize() this.getFileSize()
if (this.props.type === 'edit') { if (this.props.type === 'edit') {
this.getDetailDoc() this.getDetailDoc()
console.log(this.props.data)
} }
} }
...@@ -97,7 +103,8 @@ export default class EditManagementDoc extends Component { ...@@ -97,7 +103,8 @@ export default class EditManagementDoc extends Component {
fileType: data.document_type, fileType: data.document_type,
created: data.created, created: data.created,
updated: data.updated === null ? "" : data.updated, updated: data.updated === null ? "" : data.updated,
loadUpload: true loadUpload: true,
name: data.values
}, () => { }, () => {
this.getDataCompany() this.getDataCompany()
this.getDataDocument() this.getDataDocument()
...@@ -250,6 +257,10 @@ export default class EditManagementDoc extends Component { ...@@ -250,6 +257,10 @@ export default class EditManagementDoc extends Component {
msgErrorPerusahaan: '', msgErrorPerusahaan: '',
errorDocument: false, errorDocument: false,
msgErrorDocument: '', msgErrorDocument: '',
errorMonth: false,
msgErrorMonth: '',
errorPeriode: false,
msgErrorPeriode: '',
}) })
} }
...@@ -270,15 +281,23 @@ export default class EditManagementDoc extends Component { ...@@ -270,15 +281,23 @@ export default class EditManagementDoc extends Component {
} }
validasi() { validasi() {
console.log(this.state.file); if (String(this.props.name).includes('Manual Book TIA')){
} else {
if (R.isNil(this.state.periode)) {
this.setState({ errorPeriode: true, msgErrorPeriode: 'Period Cannot be Empty' })
} else if (R.isNil(this.state.monthId)) {
this.setState({ errorMonth: true, msgErrorMonth: 'Month Cannot be Empty' })
}
}
if (R.isNil(this.state.getPerusahaan)) { if (R.isNil(this.state.getPerusahaan)) {
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' }) this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
} else if (R.isNil(this.state.getDocument)) { } 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' })
// this.setState({ errorDocument: true, msgErrorDocument: 'File Cannot be Empty' }) }
} else {
else {
const formData = new FormData(); const formData = new FormData();
if (this.state.file == this.state.filePath){ if (this.state.file == this.state.filePath){
formData.append("updated", 0); formData.append("updated", 0);
...@@ -287,10 +306,15 @@ export default class EditManagementDoc extends Component { ...@@ -287,10 +306,15 @@ export default class EditManagementDoc extends Component {
formData.append("updated", 1); formData.append("updated", 1);
formData.append("file", this.state.file); formData.append("file", this.state.file);
} }
if (String(this.props.name).includes('Manual Book TIA')){
formData.append("documentMonth", null);
formData.append("documentPeriode", null);
} else {
formData.append("documentMonth", this.state.monthId.month_id);
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("documentMonth", this.state.monthId.month_id);
formData.append("documentPeriode", this.state.periode.periode);
formData.append("description", this.state.description); formData.append("description", this.state.description);
formData.append("extension", this.state.fileType); formData.append("extension", this.state.fileType);
formData.append("documentId", this.props.idoc); formData.append("documentId", this.props.idoc);
...@@ -355,25 +379,6 @@ export default class EditManagementDoc extends Component { ...@@ -355,25 +379,6 @@ export default class EditManagementDoc extends Component {
value={this.state.getPerusahaan} value={this.state.getPerusahaan}
/> />
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.listMonth}
// debug
clearOnEscape
id="month"
onChange={(event, newInputValue) => this.setState({ monthId: newInputValue }, () => {
this.clearMessage()
})}
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Monthly" margin="normal" style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>}
value={this.state.monthId}
/>
</div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div style={{ padding: 10, borderRadius: 5 }}> <div style={{ padding: 10, borderRadius: 5 }}>
...@@ -393,28 +398,53 @@ export default class EditManagementDoc extends Component { ...@@ -393,28 +398,53 @@ export default class EditManagementDoc extends Component {
value={this.state.getDocument} value={this.state.getDocument}
/> />
</div> </div>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> {String(this.state.name).includes('Manual Book TIA') ? false : (
<div className="column-1">
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.listMonth}
// debug
clearOnEscape
id="month"
onChange={(event, newInputValue) => this.setState({ monthId: newInputValue }, () => this.clearMessage())}
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Period Month" margin="normal" style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
error={this.state.errorMonth}
helperText={this.state.msgErrorMonth}
/>}
value={this.state.monthId}
/>
</div>
</div>
)}
{String(this.state.name).includes('Manual Book TIA') ? false : (
<div className="column-2">
<div style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete <Autocomplete
{...this.state.listPeriode} {...this.state.listPeriode}
// debug // debug
clearOnEscape clearOnEscape
id="periode" id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => { onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => this.clearMessage())}
this.clearMessage()
})}
style={{ width: 250 }} style={{ width: 250 }}
renderInput={(params) => renderInput={(params) =>
<TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }} <TextField {...params} label="Period Year" margin="normal" style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }} InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }} InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
error={this.state.errorPeriode}
helperText={this.state.msgErrorPeriode}
/>} />}
value={this.state.periode} value={this.state.periode}
/> />
</div> </div>
</div> </div>
)}
</div> </div>
<div style={{ paddingLeft: 30, paddingRight: 30 }}> <div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
{this.state.loadUpload && ( {this.state.loadUpload && (
<UploadFile <UploadFile
type={this.state.uploadStatus} type={this.state.uploadStatus}
......
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