import React, { Component } from 'react';

import { AbstractForm } from 'lib/components';
import PaymentMethods from 'components/PaymentMethods';

import form from 'lib/form';
import { injectIntl } from 'react-intl';


class PaymentMethodSettings extends AbstractForm {


    render() {
        let intl = this.props.intl;
        let formProps = { disabled: this.props.disabled };

        return (
            <div className={ `form ${this.props.className}` }>
                <PaymentMethods 
                    disabled={ this.props.disabled }
                    className="table small-list"
                    items={ this.props.valueOf('paymentMethods') }
                    onChange={ this.props.onChangeHandler('paymentMethods', items => items, (taxItems) => { window.cfg.unit.paymentMethods = taxItems }) }
                    sortFunction={ (items) => items.sortBy(p => p.get("name")) }
                    editName
                    />
            </div>
        );
    }

}



export default form(injectIntl(PaymentMethodSettings));