import React, { Component } from 'react';

import { AbstractForm, ButtonBar, Button } from 'lib/components';
import TaxItems from 'components/TaxItems';
import Attachments from 'lib/attachment';
import Toast from 'components/Toast';

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



/*

	@Column(name = "CUFO")
	private Integer cufo;
	@Column(name = "CPRACUFO")
	private Integer cpracufo;
	@Column(name = "COKEC")
	private String cokec;
	@Column(name = "SIGNUP_TYPE")
	@JsonProperty("signupType")
	@JsonProperty("payerType")
*/

class DphSettingsForm extends AbstractForm {


	render() {
		let { attachments, intl, disabled } = this.props;
		let fieldProps = { disabled };

		let periodTypes = [
			{ value: "MONTH", label: "Měsíčně" },
			{ value: "QUARTER", label: "Čtvrtletně" }
		];

		let signupTypes = [
			{ value: "F", label: "Fyzická osoba" }
		];

		let taxPayerTypes = [
			{ value: "P", label: "TODO" }
		];

		return (
			<div className="form">
				<div className="row row-margin-10">
					<div className="col-xs-12">
						<div className="row row-margin-10">
							<div className="form-field">
								{ this.renderToggleButtons("periodType", "Period type", periodTypes, fieldProps) }
							</div>
							{ this.renderField("title", "Titul", fieldProps) }
							{ this.renderField("firstName", "Jméno", fieldProps) }
							{ this.renderField("lastName", "Příjmení", fieldProps) }
							{ this.renderField("email", "E-Mail", fieldProps) }
							{ this.renderField("phoneNumber", "Telefon", fieldProps) }
							{ this.renderField("street", "Ulice", fieldProps) }
							{ this.renderField("streetNum", "Číslo popisné", fieldProps) }
							{ this.renderField("city", "Město", fieldProps) }
							{ this.renderField("zipCode", "PSČ", fieldProps) }
							{ this.renderField("country", "Země", fieldProps) }
							{ this.renderField("tax_idNumber", "DIČ", fieldProps) }

							{ this.renderNumericField("cufo", "CUFO", fieldProps) }
							{ this.renderNumericField("cpracufo", "CPRACUFO", fieldProps) }
							{ this.renderField("cokec", "COKEC", fieldProps) }

							<div className="form-field">
								{ this.renderToggleButtons("signupType", "Signup type", signupTypes, fieldProps) }
							</div>
							<div className="form-field">
								{ this.renderToggleButtons("payerType", "Payer type", taxPayerTypes, fieldProps) }
							</div>
						</div>

					</div>
				</div>
			</div>
		);
	}

}


export default form(injectIntl(DphSettingsForm), {
	onValidationFailed: Toast.validationFailed,
	validate: (email, error) => {
		let valid = true;
		return valid;
	}
});

