import React, {Component} from 'react'; import {connect} from 'react-redux'; import {Row, Col, FormGroup, Label, Input} from 'reactstrap'; import {setSupportMessage} from '../../../actions/orders/processActions'; import {orderTexts} from '../../../constants/ordersConstants'; class SupportMail extends Component { constructor(props) { super(props); this.state = { supportText: '' }; this.setSupportMessage = this.setSupportMessage.bind(this); } calculateFixedPrice(quantity, price) { return quantity*price; } calculateRecurrentPrice(orderPackage) { return orderPackage.units*(orderPackage.packageRecuringPrice + orderPackage.packageServicePrice); } handleInputChange(event) { this.setState({supportText: event.target.value}); event.preventDefault(); } setSupportMessage() { this.props.dispatch(setSupportMessage(this.state.supportText)); } render() { const {orderInfo, orderPackages} = this.props.params; return ( {orderInfo && orderPackages &&
{orderTexts.labels.ORDER_DETAILS}
{orderTexts.labels.ORDER_NUMBER}: {orderInfo.number} {orderTexts.labels.LOCATION_DETAILS}: {orderInfo.reference || '-'}
{orderTexts.labels.ORDER_ITEMS}
{ orderPackages.map((orderPackage, mapKey) =>
{orderPackage.quantity} x {orderPackage.name} {orderInfo.date_modified && {orderTexts.labels.END_OF_LIFE}: {orderPackage.date_completed} } {orderTexts.labels.STATUS}: {orderPackage.status}
)}
this.handleInputChange(e)} onBlur={this.setSupportMessage}/>
}
); } } export default connect()(SupportMail);