Commit d7116481 authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/riri' into 'ENV-DEV'

update banyak banget (currency)

See merge request !1786
parents 826e2f22 cf7fe1f8
......@@ -127,6 +127,8 @@ const create = (type = "") => {
const uploadPerusahaan = (body) => api.post('company/import_company', body)
const searchPerusahaan = (body) => api.post('company/search_company', body)
const deletePerusahaan = (id) => api.post(`company/delete_company/${id}`)
const getDataCurrency = () => api.get('multi_currency/get_all_currency')
// APPROVAL MATRIX
const getAM = () => api.get('approval_matrix/get_all_approval_matrix')
......@@ -184,7 +186,7 @@ const create = (type = "") => {
const uploadParameter = (body) => api.post('/setting/import_setting', body)
const searchParameter = (body) => api.post('setting/search_setting', body)
const deleteParameter = (id) => api.post(`setting/delete_setting/${id}`)
const getDataReport = () => api.get('type_report/get_all_type_report')
const getDataReport = () => api.get('setting_type/get_all_setting_type_by_report_submit_period_group')
// MASTER DATA - CAT
const getAllMasterDataCat = () => api.get('item_report_company/get_all_item_report_company')
......@@ -611,6 +613,7 @@ const create = (type = "") => {
deleteParameter,
getDataReport,
deletePerusahaan,
getDataCurrency,
deleteReportItems,
getCarfmDocumentBySubmenu,
getDocumentCategory,
......
......@@ -72,7 +72,7 @@ export default class ProfitLoss extends Component {
componentDidMount() {
this.getItemHierarki()
this.getLatestUpdate()
// console.log(this.props);
console.log(this.props);
}
getLatestUpdate() {
......
......@@ -415,6 +415,7 @@ export default class Perusahaan extends Component {
createPerusahaan = (payload) => {
this.setState({ visibleCreate: false })
api.create().createPerusahaan(payload).then(response => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......
......@@ -89,8 +89,8 @@ export default class CreateParameter extends Component {
getCompanyID: data.company_id,
settingType: data.setting_type,
getSettingTypeID: data.setting_type_id,
typeReport: data.type_report_name,
getTypeReportID: data.type_report_id,
typeReport: data.setting_type_name,
getTypeReportID: data.setting_type_id,
enableReportName: data.setting_group === "CURRENCY" ? true : false
}, () => {
......@@ -205,14 +205,14 @@ export default class CreateParameter extends Component {
let data = response.data.data
let reportData = data.map((item) => {
return {
type_report_id: item.type_report_id,
type_report_name: item.type_report_name
setting_type_id: item.setting_type_id,
setting_type_name: item.setting_type_name
}
})
let index = reportData.findIndex((val) => val.type_report_id == this.state.getTypeReportID)
let index = reportData.findIndex((val) => val.setting_type_id == this.state.getTypeReportID)
let reportProps = {
options: reportData,
getOptionLabel: (option) => option.type_report_name,
getOptionLabel: (option) => option.setting_type_name,
};
this.setState({ reportName: reportProps, reportData: response.data.data, getReportName: index == -1 ? reportData[0] : reportData[index] })
} else {
......@@ -362,13 +362,13 @@ export default class CreateParameter extends Component {
let data = response.data.data
let reportData = data.map((item) => {
return {
type_report_id: item.type_report_id,
type_report_name: item.type_report_name
setting_type_id: item.setting_type_id,
setting_type_name: item.setting_type_name
}
})
let reportProps = {
options: reportData,
getOptionLabel: (option) => option.type_report_name,
getOptionLabel: (option) => option.setting_type_name,
};
this.setState({ reportName: reportProps, reportData: response.data.data })
} else {
......@@ -609,7 +609,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id,
"company_id": this.state.getPerusahaan.company_id,
"type_report_id": this.state.getReportName.type_report_id,
"reference_id": this.state.getReportName.setting_type_id,
"description": this.state.tempData.description,
"orders": this.state.tempData.order,
"value": this.state.tempData.value,
......@@ -627,7 +627,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id,
"company_id": this.state.getPerusahaan.company_id,
"type_report_id": this.state.getReportName.type_report_id,
"reference_id": this.state.getReportName.setting_type_id,
"description": this.state.description,
"orders": this.state.order,
"value": this.state.value,
......
......@@ -317,7 +317,7 @@ export default class Parameter extends Component {
group: item[0] === undefined ? "" : item[0],
parameter: item[1] === undefined ? "" : item[1],
company: item[2] === undefined ? "" : item[2],
type_report: item[3] === undefined ? "" : item[3],
reference: item[3] === undefined ? "" : item[3],
description: item[4] === undefined ? "" : item[4],
orders: item[5] === undefined ? "" : item[5],
value: item[6] === undefined ? "" : item[6],
......@@ -349,7 +349,7 @@ export default class Parameter extends Component {
item.group,
item.parameter,
item.company,
item.type_report,
item.reference,
item.description,
item.orders,
item.value,
......@@ -674,6 +674,7 @@ export default class Parameter extends Component {
}
uploadParameter() {
console.log(this.state.payload);
api.create().uploadParameter(this.state.payload).then(response => {
console.log(response)
if (response.data) {
......
......@@ -72,7 +72,18 @@ export default class CreateReportItems extends Component {
maxAchValue: null,
formulaYTDValue: null,
kpiDisable: true,
maxAchDisable: true
maxAchDisable: true,
convertible: null,
listConvert: [
{
"id": 0,
"value": "No"
},
{
"id": 1,
"value": "Yes"
}
],
}
}
......@@ -209,7 +220,8 @@ export default class CreateReportItems extends Component {
"max_ach": this.state.maxAchValue ? this.state.maxAchValue.value : null,
"formula_ytd": this.state.formulaYTDValue,
"start_date": this.state.startDate,
"end_date": this.state.endDate
"end_date": this.state.endDate,
"is_can_convert_value": this.state.convertible.id
}
// console.log(payload)
this.props.createReportItems(payload)
......@@ -1047,6 +1059,28 @@ export default class CreateReportItems extends Component {
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
debug
id="tipe"
options={this.state.listConvert}
getOptionLabel={(option) => option.value}
onChange={(event, newInputValue) => this.setState({ convertible: newInputValue }, () => this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
label="Convertible"
margin="normal"
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
</div>
<div className="column-2" style={{ marginTop: 7}}>
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
......
......@@ -72,7 +72,18 @@ export default class EditReportItems extends Component {
formulaYtd: ['SUM', 'AVG', 'LAST', 'FORMULA'],
kpiTypeValue: null,
maxAchValue: null,
formulaYTDValue: null
formulaYTDValue: null,
convertible: null,
listConvert: [
{
"id": 0,
"value": "No"
},
{
"id": 1,
"value": "Yes"
}
],
}
}
......@@ -183,7 +194,8 @@ export default class EditReportItems extends Component {
"max_ach": this.state.tempData.max_ach,
"formula_ytd": this.state.tempData.formula_ytd,
"start_date": this.state.tempData.start_date,
"end_date": this.state.tempData.end_date
"end_date": this.state.tempData.end_date,
"is_can_convert_value": this.state.convertible.id
}
// console.log(payload)
this.props.updateReportItems(payload)
......@@ -191,17 +203,20 @@ export default class EditReportItems extends Component {
getDetailReportItems() {
api.create().getDetailReportItems(this.props.data[1]).then((response) => {
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
let index = this.state.listConvert.findIndex((val) => val.id === data.is_can_convert_value)
this.setState({
tempData: response.data.data,
getCompanyID: data.company_id
getCompanyID: data.company_id,
convertible: index === -1 ? null : this.state.listConvert[index]
}, () => this.getInputType(),
this.getPerusahaan(),
this.getReportType())
// console.log(response.data.data)
// console.log(this.state.convertible)
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -328,7 +343,7 @@ export default class EditReportItems extends Component {
getOptionLabel: (option) => titleCase(option.value),
};
let index = inputKPI.findIndex((val) => val.value === this.state.tempData.kpi_type)
this.setState({ listKPI: defaultProps, inputKPI: response.data.data, KPIValue: index === -1 ? null : inputKPI[index]})
this.setState({ listKPI: defaultProps, inputKPI: response.data.data, KPIValue: index === -1 ? null : inputKPI[index] })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
......@@ -1017,6 +1032,29 @@ export default class EditReportItems extends Component {
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<Autocomplete
debug
id="tipe"
options={this.state.listConvert}
getOptionLabel={(option) => option.value}
value={this.state.convertible}
onChange={(event, newInputValue) => this.setState({ convertible: newInputValue }, () => this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
label="Convertible"
margin="normal"
style={{ marginTop: 7 }}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
/>
}
/>
</div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
......
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