forked from M-Labs/web2019
fix(issue26): Retrieves "pn" code that are unknowns
This commit is contained in:
parent
d97222e4e1
commit
db6abf2909
|
@ -145,6 +145,7 @@ class Layout extends React.PureComponent {
|
|||
RFQBodyType: PropTypes.string,
|
||||
RFQBodyOrder: PropTypes.string,
|
||||
onClickLoadCustomConf: PropTypes.func,
|
||||
items: PropTypes.object,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -165,6 +166,12 @@ class Layout extends React.PureComponent {
|
|||
this.handleCustomConfig = this.handleCustomConfig.bind(this);
|
||||
this.handleClickLoad = this.handleClickLoad.bind(this);
|
||||
this.checkValidation = this.checkValidation.bind(this);
|
||||
|
||||
// retrieve list of available pn
|
||||
const items_keys = Object.keys(props.items);
|
||||
this.list_pn = items_keys.map(function (key) {
|
||||
return props.items[key].name_number;
|
||||
});
|
||||
}
|
||||
|
||||
handleCustomConfig(e) {
|
||||
|
@ -249,6 +256,22 @@ class Layout extends React.PureComponent {
|
|||
};
|
||||
});
|
||||
|
||||
const self = this;
|
||||
const unknow_pn = conf_obj.items.filter(function (item_pn) {
|
||||
return self.list_pn.includes(item_pn.pn) === false;
|
||||
}).map(function (item_pn) {
|
||||
return item_pn.pn;
|
||||
});
|
||||
|
||||
if (unknow_pn.length > 0) {
|
||||
return this.setState({
|
||||
...this.state,
|
||||
customconf: conf,
|
||||
customconf_ready: null,
|
||||
error: `${unknow_pn.join(', ')} unknown${unknow_pn.length > 1 ? 's':''} pn number`,
|
||||
});
|
||||
}
|
||||
|
||||
this.setState({
|
||||
...this.state,
|
||||
customconf: conf,
|
||||
|
@ -2293,6 +2316,7 @@ class Shop extends React.PureComponent {
|
|||
onClickToggleMobileSideMenu={this.handleClickToggleMobileSideMenu}
|
||||
onClickCloseRFQFeedback={this.handleClickCloseRFQFeedback}
|
||||
onClickLoadCustomConf={this.handleLoadCustomConf}
|
||||
items={items}
|
||||
aside={
|
||||
<Backlog
|
||||
currency={currency}
|
||||
|
|
Loading…
Reference in New Issue