﻿//TODO

import React from 'react';
import Cart from '../cart/cart.jsx';
import Totals from '../total/total.jsx';

const propTypes = {
    enabled: React.PropTypes.bool,
    orderId: React.PropTypes.string,
    orderDate: React.PropTypes.string,
    language: React.PropTypes.object.isRequired,
    cartItemLanguage: React.PropTypes.object.isRequired,
    cartItems: React.PropTypes.array,
    customerInfo: React.PropTypes.object,
    selectedShipment: React.PropTypes.object,
    selectedPayment: React.PropTypes.object,
    totals: React.PropTypes.object
};

export default class Order extends React.Component {

    render() {
        return(
            <div className="order">
                <Cart
                    language={this.props.language}
                    cartItemLanguage={this.props.cartItemLanguage}
                    items={this.props.cartItems}
                    enabled={this.props.enabled}/>

                <Totals {...this.props.totals}/>

                <div className="order__section">
                    <h2 className="order__section__heading">Your order info</h2>
                    <div className="order__section__content order__section__content--half">
                        <p>{this.props.customerInfo.firstName}</p>
                        <p>{this.props.customerInfo.lastName}</p>
                        <p>{this.props.customerInfo.email}</p>
                        <p>{this.props.customerInfo.address.address}</p>
                        <p>{this.props.customerInfo.address.zipcode} {this.props.customerInfo.address.city}</p>
                        <p>{this.props.customerInfo.address.state} {this.props.customerInfo.address.country}</p>
                    </div>
                    <div className="order__section__content order__section__content--half">
                        <p className="order__number">Order number: {this.props.orderId}</p>
                        <p className="order__date">Order date: {this.props.orderDate}</p>
                    </div>
                </div>

                <div className="order__section">
                    <h2 className="order__section__heading">Shipment info</h2>
                    <div className="order__section__content">
                        <p>{this.props.selectedShipment.name}</p>
                        <p>{this.props.selectedShipment.price}</p>
                    </div>
                </div>

                <div className="order__section">
                    <h2 className="order__section__heading">Payment info</h2>
                    <div className="order__section__content">
                        <p>{this.props.selectedPayment.name}</p>
                        <p>{this.props.selectedPayment.description}</p>
                    </div>
                </div>
            </div>
        );
    }
}

Order.propTypes = propTypes;