Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react'
  2. import {
  3.     Header,
  4.     Table,
  5.     Button,
  6.     Confirm
  7. } from 'semantic-ui-react'
  8. import {getConfirmedDeals} from '../../services/itemService'
  9. class Page extends React.Component {
  10.     constructor(props) {
  11.         super(props);
  12.         this.state = {
  13.             open : false,
  14.             deals: []
  15.         }
  16.         this.handleShow = this.handleShow.bind(this);
  17.         this.handleConfirm = this.handleConfirm.bind(this);
  18.         this.handleCancel = this.handleCancel.bind(this);
  19.     }
  20.  
  21.     handleShow(){
  22.         this.setState({open:true})
  23.     }
  24.  
  25.     handleConfirm(){
  26.         this.setState({open:false})
  27.     }
  28.  
  29.     handleCancel(){
  30.         this.setState({open:false})
  31.     }
  32.     componentDidMount(){
  33.         this.props.dispatch(getConfirmedDeals())
  34.             .then((res)=>{
  35.                 this.setState({deals:res.deals})
  36.                 console.log(res.deals)
  37.             })
  38.     }
  39.     render() {
  40.         const {open,deals} = this.state
  41.         return (
  42.             <div>
  43.                 <Header>Item List</Header>
  44.                 <Table selectable>
  45.                     <Table.Body>
  46.                     {deals.map(function(i, k) {
  47.                         return(
  48.                             <Table.Row>
  49.                                     <Table.Cell>{i.post.title}</Table.Cell>
  50.                                     <Table.Cell>{i.qty}</Table.Cell>
  51.                                     <Table.Cell>{i.tracking_no}</Table.Cell>
  52.                                     <Table.Cell>{i.status}</Table.Cell>
  53.                                     <Table.Cell>{i.post.estimate_shipping}</Table.Cell>
  54.                                     <Button onClick={this.handleShow}>Received</Button>
  55.                                     <Confirm
  56.                                         open={open}
  57.                                         onCancel ={this.handleCancel}
  58.                                         onConfirm ={this.handleConfirm}
  59.                                     >
  60.  
  61.                                     </Confirm>
  62.                                 </Table.Row>
  63.                         )
  64.                     })}
  65.                     </Table.Body>
  66.                 </Table>
  67.             </div>
  68.         );
  69.     }
  70. }
  71.  
  72. export default Page;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement