Commit 5c7398a4 authored by fahrur huzain's avatar fahrur huzain

pop up information parameter currency

parent 27da6d73
......@@ -58,6 +58,7 @@ const Images = {
zip: require('./zip.png'),
warning: require('./warning.png'),
simulasiUpload: require('./upload-simulasi.png'),
information: require('./information.png'),
}
export default Images
\ No newline at end of file
......@@ -7,6 +7,7 @@ import { format } from 'date-fns';
import * as R from 'ramda'
import Images from '../../../assets/Images';
import Constant from '../../../library/Constant';
import PopUpInformation from '../../../library/PopUpInformation';
export default class CreateParameter extends Component {
constructor(props) {
......@@ -69,6 +70,7 @@ export default class CreateParameter extends Component {
minMaxRegex: "",
minLength: "",
maxLength: "",
visiblePopupInformation: false,
}
}
......@@ -841,7 +843,7 @@ export default class CreateParameter extends Component {
obj = { regexValue: "", valueLength: "" }
}else {
if (this.state.getTypes.setting_group_name === "CURRENCY"){
obj = { regexValue: (/^\d+$/), valueLength: 20 }
obj = { regexValue: (/\d+(\.\d+)?/), valueLength: 20 }
} else if (this.state.getTypes.setting_group_name === "REPORT_SUBMIT_PERIOD"){
if (R.isNil(this.state.getParameter)) {
obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 }
......@@ -969,7 +971,7 @@ export default class CreateParameter extends Component {
validasiValueData(){
let obj = null
if (this.props.type === "edit"){
obj = {value: this.state.tempData.value, minValue: this.state.tempData.min_value, maxValue: this.state.tempData.max_value, endDate: this.state.tempData.end_date, startDate: this.state.tempData.start_date}
obj = {value: this.state.tempData.value.toString(), minValue: this.state.tempData.min_value, maxValue: this.state.tempData.max_value, endDate: this.state.tempData.end_date, startDate: this.state.tempData.start_date}
}else {
obj = {value: this.state.value, minValue: this.state.minValue, maxValue: this.state.maxValue, endDate: this.state.endDate, startDate: this.state.startDate}
}
......@@ -1165,6 +1167,18 @@ export default class CreateParameter extends Component {
this.props.createParameter(body)
}
openPopUp() {
if (!R.isNil(this.state.getTypes)){
if (this.state.getTypes.setting_group_name == "CURRENCY"){
if (!R.isNil(this.state.getReportName)){
this.setState({
visiblePopupInformation: true
})
}
}
}
}
render() {
let { type } = this.props
return type === 'edit' ? this.renderEdit() : this.renderCreate()
......@@ -1387,7 +1401,10 @@ export default class CreateParameter extends Component {
{...this.state.reportName}
debug
id="report"
onChange={(event, newInputValue) => this.setState({ getReportName: newInputValue }, () => this.clearMessage())}
onChange={(event, newInputValue) => this.setState({ getReportName: newInputValue }, () => {
this.clearMessage()
this.openPopUp()
})}
renderInput={(params) =>
<TextField
{...params}
......@@ -1407,7 +1424,8 @@ export default class CreateParameter extends Component {
{...this.state.formatCurrency}
debug
id="report"
onChange={(event, newInputValue) => this.setState({ getFormatData: newInputValue }, () => this.clearMessage())}
onChange={(event, newInputValue) => this.setState({ getFormatData: newInputValue }, () =>
this.clearMessage())}
renderInput={(params) =>
<TextField
{...params}
......@@ -1646,6 +1664,12 @@ export default class CreateParameter extends Component {
</div>
</div>
</div>
{this.state.visiblePopupInformation && (
<PopUpInformation
onClickClose={() => this.setState({ visiblePopupInformation: false })}
reportName={this.state.getReportName.setting_type_name}
/>
)}
</div>
)
}
......@@ -1861,7 +1885,9 @@ export default class CreateParameter extends Component {
{...this.state.reportName}
debug
id="report"
onChange={(event, newInputValue) => this.setState({ getReportName: newInputValue }, () => this.clearMessage())}
onChange={(event, newInputValue) => this.setState({ getReportName: newInputValue }, () => {
this.clearMessage()
this.openPopUp()})}
renderInput={(params) =>
<TextField
{...params}
......@@ -1932,6 +1958,7 @@ export default class CreateParameter extends Component {
}
error={this.state.errorMinValue}
helperText={this.state.msgErrorMinValue}
>
</TextField>
</div>
......@@ -2089,6 +2116,12 @@ export default class CreateParameter extends Component {
</div>
</div>
</div>
{this.state.visiblePopupInformation && (
<PopUpInformation
onClickClose={() => this.setState({ visiblePopupInformation: false })}
reportName={this.state.getReportName.setting_type_name}
/>
)}
</div>
)
}
......
This diff is collapsed.
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