import React, {Component} from 'react';
import {Input} from 'reactstrap';
import {orderTexts} from '../../../../constants/ordersConstants';

class AcceptanceDeclineReason extends Component {
    handleEditorChange = (e) => {
        const reason = e.target.value;
        this.props.params.onEditorChange(reason);
    }

    render() {
        const {actionType} = this.props.params;

        return (
            <div>
                {
                    actionType === 'accept'
                    ? <div>{orderTexts.labels.ACCEPT_INSTALLATION_TEXT}</div>
                    : <div>
                        <div>{orderTexts.labels.DECLINE_REASON_TEXT}</div>
                        <Input onChange={this.handleEditorChange} type="textarea" name="acceptance-decline-reason" id="installation-declined-reason" />
                    </div>
                }

            </div>
        );
    }
}

export default AcceptanceDeclineReason;
