import React, { Component } from 'react';

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

import form from 'lib/form';
import { injectIntl } from 'react-intl';
import { updateIntl } from 'lib/i18n';
import { appLocales } from '../../config.js';


class TaxSettings extends AbstractForm {


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

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

}



export default form(injectIntl(TaxSettings));