import React, { Component } from 'react';

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

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


class InvoiceSettings extends AbstractForm {


    render() {
        let { intl, valueOf, onChangeHandler, data } = this.props;
        let formProps = { disabled: this.props.disabled };

        return (
            <div className={ `form ${this.props.className}` }>
                <TemplateSelector 
                    unit={ data } 
                    template={ valueOf("invoiceTemplate") } 
                    onChangeTemplate={ onChangeHandler("invoiceTemplate", v => v) }
                    templateLang={ valueOf("invoiceLang") || valueOf("locale") }
                    defaultLang={ valueOf("locale") }
                    onChangeLanguage={ onChangeHandler("invoiceLang", v => v) }
                    unitId={ data.id }
                    />
            </div>
        );
    }

}



export default form(injectIntl(InvoiceSettings));