import React, {Component} from 'react';
import BidItem from './BidItem.jsx';
import {cartTexts} from '../../../constants/cartConstants';
import {WiaasTable, WiaasTableHeader, WiaasTableBody} from '../../../mainComponents/table/WiaasTable.jsx';

class BidsList extends Component {
    getHeaders(){
        return [
            cartTexts.labels.BID_NUMBER,
            cartTexts.labels.START_DATE,
            cartTexts.labels.END_DATE,
            cartTexts.labels.FIXED,
            cartTexts.labels.RECURRENT,
            cartTexts.labels.SERVICES,
            cartTexts.labels.ACTIONS
        ];
    }

    render() {
        const {bids, idCart, idSelectedBid} = this.props.params;
        return (
            <WiaasTable id="bids-list">
                <WiaasTableHeader headers={this.getHeaders()}/>
                <WiaasTableBody>
                {
                    bids.map(bid => <BidItem key={'bid-' + bid.idBid} idSelectedBid={idSelectedBid} idCart={idCart} bid={bid}/>)
                }
            </WiaasTableBody>
            </WiaasTable>
        );
    }
}

export default BidsList;
