Commit 414d27e9 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'rifka' into 'master'

update managdoc

See merge request !348
parents fcc1a02e 22dc9811
......@@ -196,6 +196,7 @@ const create = (type = "") => {
const checkUploadMB = (body) => api.post('transaction/master_budget/check_import', body)
const uploadMasterBudget = (body) => api.post('transaction/master_budget/import_master_budget', body)
const validateSubmitReport = (body) => api.post('transaction/master_budget/validate_save', body)
const getMonthTransaction = () => api.get('transaction/get_default_month')
const getOpetratingIndID = (body) => api.post('transaction/get_operating_indicator_id', body)
const getAllOperatingInd = (body) => api.post('transaction/get_all_operating_indicator_report', body)
......@@ -315,6 +316,7 @@ const create = (type = "") => {
getMasterBudgetAtt,
uploadAttachment,
getPeriodeTransaction,
getMonthTransaction,
getRevision,
deleteAttachment,
getDetailReportMB,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -63,6 +63,7 @@ export default class getAllDocument extends Component {
item.document_name,
item.description,
item.company_name,
item.document_month,
item.document_periode,
item.document_type,
String(Number(item.document_size) / 1000 + ' KB'),
......@@ -200,7 +201,6 @@ export default class getAllDocument extends Component {
filter: false,
sort: false,
customBodyRender: (val, tableMeta) => {
console.log(tableMeta)
return (
<div style={{ display: 'flex' }}>
{/* {this.state.btnedit && <span> */}
......@@ -258,6 +258,12 @@ export default class getAllDocument extends Component {
}
}
}, "File Name", "Description", "Company Name",
{
name: "Monthly",
options: {
display: String(this.props.data.value).includes('Manual Book TIA') ? false : true
}
},
{
name: "Period",
options: {
......
......@@ -29,6 +29,8 @@ export default class CreateManagementDoc extends Component {
msgErrorDocument: '',
listPeriode: null,
periode: null,
listMonth: null,
monthId: null,
description: '',
errorDesc: false,
msgErrorDesc: '',
......@@ -46,6 +48,7 @@ export default class CreateManagementDoc extends Component {
this.getDataCompany()
this.getDataDocument()
this.getPeriode()
this.getMonth()
}
getDataCompany() {
......@@ -85,13 +88,13 @@ export default class CreateManagementDoc extends Component {
}
getDataDocument() {
let payload = {
"setting_group_id": 7,
"setting_type_id": 167,
"company_id": 0
// let payload = {
// "setting_group_id": 7,
// "setting_type_id": 167,
// "company_id": 0
}
api.create().getDocumentCategory(payload).then(response => {
// }
api.create().getDocumentCategory().then(response => {
console.log(response);
if (response.data) {
if (response.data.status == 'success') {
......@@ -126,6 +129,7 @@ export default class CreateManagementDoc extends Component {
getPeriode() {
api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date
console.log(dateNow)
let year = format(dateNow, 'yyyy')
if (response.data) {
if (response.data.status === "success") {
......@@ -146,6 +150,32 @@ export default class CreateManagementDoc extends Component {
})
}
getMonth(){
api.create().getMonthTransaction().then(response => {
let dateNow = new Date
console.log(dateNow)
// let bulan = format(dateNow, 'MMMM')
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let monthData = data.map((item) => {
return {
month_id: item.month_id,
month_name: item.month_name
}
})
let defaultProps = {
options: monthData,
getOptionLabel: (option) => option.month_name,
};
// let index = data.sort((a, b) => a - b).findIndex((val) => val == bulan)
// this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] })
this.setState({ listMonth: defaultProps })
}
}
})
}
clearMessage() {
this.setState({
errorPerusahaan: false,
......@@ -171,11 +201,18 @@ export default class CreateManagementDoc extends Component {
}
validasi() {
console.log(this.state.monthId.month_id)
if (R.isNil(this.state.getPerusahaan)) {
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' })
} else if (R.isNil(this.state.file)) {
}
// 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' })
// }
else if (R.isNil(this.state.file)) {
this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning' })
} else {
const formData = new FormData();
......@@ -183,6 +220,7 @@ export default class CreateManagementDoc extends Component {
formData.append("companyId", this.state.getPerusahaan.company_id);
formData.append("settingId", this.state.getDocument.document_category_id);
formData.append("documentPeriode", this.state.periode.periode);
formData.append("documentMonth", this.state.monthId.month_id);
formData.append("description", this.state.description);
formData.append("extension", this.state.fileType);
this.setState({ formData }, ()=> {
......@@ -243,20 +281,20 @@ export default class CreateManagementDoc extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.listPeriode}
{...this.state.listMonth}
// debug
clearOnEscape
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
id="month"
onChange={(event, newInputValue) => this.setState({ monthId: newInputValue }, () => {
this.clearMessage()
})}
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }}
<TextField {...params} label="Monthly" margin="normal" style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>}
value={this.state.periode}
value={this.state.monthId}
/>
</div>
</div>
......@@ -278,6 +316,25 @@ export default class CreateManagementDoc extends Component {
value={this.state.getDocument}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.listPeriode}
// debug
clearOnEscape
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.clearMessage()
})}
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>}
value={this.state.periode}
/>
</div>
</div>
</div>
<div style={{ paddingLeft: 30, paddingRight: 30 }}>
......
......@@ -29,6 +29,8 @@ export default class EditManagementDoc extends Component {
msgErrorDocument: '',
listPeriode: null,
periode: null,
listMonth: null,
monthId: null,
description: '',
errorDesc: false,
msgErrorDesc: '',
......@@ -61,6 +63,7 @@ export default class EditManagementDoc extends Component {
categoryId: data.setting_id,
categoryName: data.values,
period: data.document_periode,
getMonthName: data.document_month,
description: data.description,
// id: data.approval_matrix_id,
// status: data.status,
......@@ -69,7 +72,9 @@ export default class EditManagementDoc extends Component {
}, () => {
this.getDataCompany()
this.getDataDocument()
this.getPeriode()})
this.getPeriode()
this.getMonth()
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) {
......@@ -123,13 +128,13 @@ export default class EditManagementDoc extends Component {
}
getDataDocument() {
let payload = {
"setting_group_id": 7,
"setting_type_id": 167,
"company_id": 0
// let payload = {
// "setting_group_id": 7,
// "setting_type_id": 167,
// "company_id": 0
}
api.create().getDocumentCategory(payload).then(response => {
// }
api.create().getDocumentCategory().then(response => {
console.log(response);
if (response.data) {
if (response.data.status == 'success') {
......@@ -185,6 +190,31 @@ export default class EditManagementDoc extends Component {
})
}
getMonth(){
api.create().getMonthTransaction().then(response => {
let dateNow = new Date
// let bulan = format(dateNow, 'MMMM')
if (response.data) {
if (response.data.status === "success") {
let data = response.data.data
let monthData = data.map((item) => {
return {
month_name: item.month_name,
month_id: item.month_id
}
})
let index = monthData.findIndex((val) => val.month_name == this.state.getMonthName)
let defaultProps = {
options: monthData,
getOptionLabel: (option) => option.month_name,
};
// let index = data.sort((a, b) => a - b).findIndex((val) => val.month_name == this.state.getMonth)
this.setState({ listMonth: defaultProps, monthId: index == -1 ? monthData[0] : monthData[index] })
}
}
})
}
clearMessage() {
this.setState({
errorPerusahaan: false,
......@@ -195,6 +225,7 @@ export default class EditManagementDoc extends Component {
}
fileHandler = (event) => {
console.log(event)
let fileObj = event
let length = event.name.split(".").length
let fileType = event.name.split(".")[length - 1]
......@@ -222,6 +253,7 @@ export default class EditManagementDoc extends Component {
formData.append("file", this.state.file);
formData.append("companyId", this.state.getPerusahaan.company_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("extension", this.state.fileType);
......@@ -284,20 +316,20 @@ export default class EditManagementDoc extends Component {
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.listPeriode}
{...this.state.listMonth}
// debug
clearOnEscape
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
id="month"
onChange={(event, newInputValue) => this.setState({ monthId: newInputValue }, () => {
this.clearMessage()
})}
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }}
<TextField {...params} label="Monthly" margin="normal" style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>}
value={this.state.periode}
value={this.state.monthId}
/>
</div>
</div>
......@@ -319,6 +351,25 @@ export default class EditManagementDoc extends Component {
value={this.state.getDocument}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
{...this.state.listPeriode}
// debug
clearOnEscape
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => {
this.clearMessage()
})}
style={{ width: 250 }}
renderInput={(params) =>
<TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>}
value={this.state.periode}
/>
</div>
</div>
</div>
<div style={{ paddingLeft: 30, paddingRight: 30 }}>
......@@ -336,6 +387,7 @@ export default class EditManagementDoc extends Component {
this.deleteFile(e)
}}
onUpload={() => alert('sukses')}
value={this.state.file}
/>
</div>
<div className="margin-top-10px" style={{ paddingLeft: 30, paddingRight: 30, borderRadius: 5, paddingBottom: 20 }}>
......@@ -369,6 +421,37 @@ 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>
......
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