diff options
| author | Jules Laplace <jules@okfoc.us> | 2017-04-21 16:03:11 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2017-04-21 16:03:11 -0400 |
| commit | ef83dba4a83e23e38b67ee31b79e79c9e25a003d (patch) | |
| tree | be0e65ee556d215796f6c64e3df7d8adb5c51554 /client/components/ProductList.jsx | |
| parent | 5028ad81845308f3b1954dcc1fde664077fa0fa9 (diff) | |
display orders per product, download as csv
Diffstat (limited to 'client/components/ProductList.jsx')
| -rw-r--r-- | client/components/ProductList.jsx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/client/components/ProductList.jsx b/client/components/ProductList.jsx new file mode 100644 index 0000000..ab00e9f --- /dev/null +++ b/client/components/ProductList.jsx @@ -0,0 +1,31 @@ +import React from 'react' + +export default class ProductList extends React.Component { + constructor(props) { + super() + this.state = { value: -1 } + this.pick = this.pick.bind(this) + } + pick(event) { + const value = Number(event.target.value) + this.setState({ value: value }) + if (value === -1) return + const product = this.props.products[value] + this.props.handleSelect(product) + } + render() { + const items = this.props.products.map((product, i) => { + return ( + <option key={i} value={i}> + {product.product_name} ({product.product_merchant_product_id}) + </option> + ) + }) + items.unshift(<option key={-1} value={-1}>Select a product...</option>) + return ( + <select value={this.state.value} onChange={this.pick}> + {items} + </select> + ) + } +}
\ No newline at end of file |
