Commit 439e54c1 authored by Riri Novita's avatar Riri Novita

update banyak banget (currency)

parent 5d3d6aea
...@@ -186,7 +186,7 @@ const create = (type = "") => { ...@@ -186,7 +186,7 @@ const create = (type = "") => {
const uploadParameter = (body) => api.post('/setting/import_setting', body) const uploadParameter = (body) => api.post('/setting/import_setting', body)
const searchParameter = (body) => api.post('setting/search_setting', body) const searchParameter = (body) => api.post('setting/search_setting', body)
const deleteParameter = (id) => api.post(`setting/delete_setting/${id}`) 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 // MASTER DATA - CAT
const getAllMasterDataCat = () => api.get('item_report_company/get_all_item_report_company') const getAllMasterDataCat = () => api.get('item_report_company/get_all_item_report_company')
......
...@@ -72,7 +72,7 @@ export default class ProfitLoss extends Component { ...@@ -72,7 +72,7 @@ export default class ProfitLoss extends Component {
componentDidMount() { componentDidMount() {
this.getItemHierarki() this.getItemHierarki()
this.getLatestUpdate() this.getLatestUpdate()
// console.log(this.props); console.log(this.props);
} }
getLatestUpdate() { getLatestUpdate() {
......
...@@ -415,6 +415,7 @@ export default class Perusahaan extends Component { ...@@ -415,6 +415,7 @@ export default class Perusahaan extends Component {
createPerusahaan = (payload) => { createPerusahaan = (payload) => {
this.setState({ visibleCreate: false }) this.setState({ visibleCreate: false })
api.create().createPerusahaan(payload).then(response => { api.create().createPerusahaan(payload).then(response => {
console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
......
...@@ -89,8 +89,8 @@ export default class CreateParameter extends Component { ...@@ -89,8 +89,8 @@ export default class CreateParameter extends Component {
getCompanyID: data.company_id, getCompanyID: data.company_id,
settingType: data.setting_type, settingType: data.setting_type,
getSettingTypeID: data.setting_type_id, getSettingTypeID: data.setting_type_id,
typeReport: data.type_report_name, typeReport: data.setting_type_name,
getTypeReportID: data.type_report_id, getTypeReportID: data.setting_type_id,
enableReportName: data.setting_group === "CURRENCY" ? true : false enableReportName: data.setting_group === "CURRENCY" ? true : false
}, () => { }, () => {
...@@ -205,14 +205,14 @@ export default class CreateParameter extends Component { ...@@ -205,14 +205,14 @@ export default class CreateParameter extends Component {
let data = response.data.data let data = response.data.data
let reportData = data.map((item) => { let reportData = data.map((item) => {
return { return {
type_report_id: item.type_report_id, setting_type_id: item.setting_type_id,
type_report_name: item.type_report_name 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 = { let reportProps = {
options: reportData, 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] }) this.setState({ reportName: reportProps, reportData: response.data.data, getReportName: index == -1 ? reportData[0] : reportData[index] })
} else { } else {
...@@ -362,13 +362,13 @@ export default class CreateParameter extends Component { ...@@ -362,13 +362,13 @@ export default class CreateParameter extends Component {
let data = response.data.data let data = response.data.data
let reportData = data.map((item) => { let reportData = data.map((item) => {
return { return {
type_report_id: item.type_report_id, setting_type_id: item.setting_type_id,
type_report_name: item.type_report_name setting_type_name: item.setting_type_name
} }
}) })
let reportProps = { let reportProps = {
options: reportData, options: reportData,
getOptionLabel: (option) => option.type_report_name, getOptionLabel: (option) => option.setting_type_name,
}; };
this.setState({ reportName: reportProps, reportData: response.data.data }) this.setState({ reportName: reportProps, reportData: response.data.data })
} else { } else {
...@@ -609,7 +609,7 @@ export default class CreateParameter extends Component { ...@@ -609,7 +609,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id, "setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id, "setting_type_id": this.state.getParameter.setting_type_id,
"company_id": this.state.getPerusahaan.company_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, "description": this.state.tempData.description,
"orders": this.state.tempData.order, "orders": this.state.tempData.order,
"value": this.state.tempData.value, "value": this.state.tempData.value,
...@@ -627,7 +627,7 @@ export default class CreateParameter extends Component { ...@@ -627,7 +627,7 @@ export default class CreateParameter extends Component {
"setting_group_id": this.state.getTypes.setting_group_id, "setting_group_id": this.state.getTypes.setting_group_id,
"setting_type_id": this.state.getParameter.setting_type_id, "setting_type_id": this.state.getParameter.setting_type_id,
"company_id": this.state.getPerusahaan.company_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, "description": this.state.description,
"orders": this.state.order, "orders": this.state.order,
"value": this.state.value, "value": this.state.value,
......
...@@ -317,7 +317,7 @@ export default class Parameter extends Component { ...@@ -317,7 +317,7 @@ export default class Parameter extends Component {
group: item[0] === undefined ? "" : item[0], group: item[0] === undefined ? "" : item[0],
parameter: item[1] === undefined ? "" : item[1], parameter: item[1] === undefined ? "" : item[1],
company: item[2] === undefined ? "" : item[2], 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], description: item[4] === undefined ? "" : item[4],
orders: item[5] === undefined ? "" : item[5], orders: item[5] === undefined ? "" : item[5],
value: item[6] === undefined ? "" : item[6], value: item[6] === undefined ? "" : item[6],
...@@ -349,7 +349,7 @@ export default class Parameter extends Component { ...@@ -349,7 +349,7 @@ export default class Parameter extends Component {
item.group, item.group,
item.parameter, item.parameter,
item.company, item.company,
item.type_report, item.reference,
item.description, item.description,
item.orders, item.orders,
item.value, item.value,
...@@ -674,6 +674,7 @@ export default class Parameter extends Component { ...@@ -674,6 +674,7 @@ export default class Parameter extends Component {
} }
uploadParameter() { uploadParameter() {
console.log(this.state.payload);
api.create().uploadParameter(this.state.payload).then(response => { api.create().uploadParameter(this.state.payload).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
......
...@@ -72,7 +72,18 @@ export default class CreateReportItems extends Component { ...@@ -72,7 +72,18 @@ export default class CreateReportItems extends Component {
maxAchValue: null, maxAchValue: null,
formulaYTDValue: null, formulaYTDValue: null,
kpiDisable: true, 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 { ...@@ -209,7 +220,8 @@ export default class CreateReportItems extends Component {
"max_ach": this.state.maxAchValue ? this.state.maxAchValue.value : null, "max_ach": this.state.maxAchValue ? this.state.maxAchValue.value : null,
"formula_ytd": this.state.formulaYTDValue, "formula_ytd": this.state.formulaYTDValue,
"start_date": this.state.startDate, "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) // console.log(payload)
this.props.createReportItems(payload) this.props.createReportItems(payload)
...@@ -1047,6 +1059,28 @@ export default class CreateReportItems extends Component { ...@@ -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="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <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 }}> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
......
...@@ -72,7 +72,18 @@ export default class EditReportItems extends Component { ...@@ -72,7 +72,18 @@ export default class EditReportItems extends Component {
formulaYtd: ['SUM', 'AVG', 'LAST', 'FORMULA'], formulaYtd: ['SUM', 'AVG', 'LAST', 'FORMULA'],
kpiTypeValue: null, kpiTypeValue: null,
maxAchValue: 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 { ...@@ -183,7 +194,8 @@ export default class EditReportItems extends Component {
"max_ach": this.state.tempData.max_ach, "max_ach": this.state.tempData.max_ach,
"formula_ytd": this.state.tempData.formula_ytd, "formula_ytd": this.state.tempData.formula_ytd,
"start_date": this.state.tempData.start_date, "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) // console.log(payload)
this.props.updateReportItems(payload) this.props.updateReportItems(payload)
...@@ -191,17 +203,20 @@ export default class EditReportItems extends Component { ...@@ -191,17 +203,20 @@ export default class EditReportItems extends Component {
getDetailReportItems() { getDetailReportItems() {
api.create().getDetailReportItems(this.props.data[1]).then((response) => { api.create().getDetailReportItems(this.props.data[1]).then((response) => {
console.log(response);
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
let data = response.data.data let data = response.data.data
let index = this.state.listConvert.findIndex((val) => val.id === data.is_can_convert_value)
this.setState({ this.setState({
tempData: response.data.data, tempData: response.data.data,
getCompanyID: data.company_id getCompanyID: data.company_id,
convertible: index === -1 ? null : this.state.listConvert[index]
}, () => this.getInputType(), }, () => this.getInputType(),
this.getPerusahaan(), this.getPerusahaan(),
this.getReportType()) this.getReportType())
// console.log(response.data.data) // console.log(this.state.convertible)
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
...@@ -328,7 +343,7 @@ export default class EditReportItems extends Component { ...@@ -328,7 +343,7 @@ export default class EditReportItems extends Component {
getOptionLabel: (option) => titleCase(option.value), getOptionLabel: (option) => titleCase(option.value),
}; };
let index = inputKPI.findIndex((val) => val.value === this.state.tempData.kpi_type) 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 { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) { if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
...@@ -1017,6 +1032,29 @@ export default class EditReportItems extends Component { ...@@ -1017,6 +1032,29 @@ export default class EditReportItems extends Component {
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <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 }}> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} 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