Commit 121ed3fc authored by fahrur huzain's avatar fahrur huzain

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

pop up information parameter currency

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