"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* @flow */
const React = __importStar(require("react"));
{
    CustomerFormProps;
}
from;
'./types';
// import cx from 'classnames';
const Grid_1 = __importDefault(require("@material-ui/core/Grid"));
const prop_types_1 = __importDefault(require("prop-types"));
const withStyles_1 = __importDefault(require("components/hoc/withStyles"));
const ErrorBoundary_1 = __importDefault(require("components/hoc/ErrorBoundary"));
const TextField_1 = __importDefault(require("components/bosons/TextField"));
const styles_1 = __importDefault(require("./styles"));
class CustomerForm extends React.Component {
    render() {
        const { classes, keys, labels, values, handleChange, handleBlur, errors, touched, } = this.props;
        return (React.createElement(ErrorBoundary_1.default, null,
            React.createElement("div", { className: classes.component },
                React.createElement(Grid_1.default, { container: true, spacing: 16 },
                    React.createElement(Grid_1.default, { item: true, xs: 12 },
                        React.createElement(TextField_1.default, { label: labels.customer_name, placeholder: 'E.g: Google', name: keys.customer_name, id: keys.customer_name, value: values[keys.customer_name], onChange: handleChange, onBlur: handleBlur, error: touched[keys.customer_name] && errors[keys.customer_name], showClearIcon: false })),
                    React.createElement(Grid_1.default, { item: true, xs: 12, sm: 6 },
                        React.createElement(TextField_1.default, { label: labels.contact_name, placeholder: 'E.g: John', name: keys.contact_name, id: keys.contact_name, value: values[keys.contact_name], onChange: handleChange, onBlur: handleBlur, error: touched[keys.contact_name] && errors[keys.contact_name], showClearIcon: false })),
                    React.createElement(Grid_1.default, { item: true, xs: 12, sm: 6 },
                        React.createElement(TextField_1.default, { label: labels.contact_surname, placeholder: 'E.g: Doe', name: keys.contact_surname, id: keys.contact_surname, value: values[keys.contact_surname], onChange: handleChange, onBlur: handleBlur, error: touched[keys.contact_surname] && errors[keys.contact_surname], showClearIcon: false })),
                    React.createElement(Grid_1.default, { item: true, xs: 12, sm: 6 },
                        React.createElement(TextField_1.default, { label: labels.abn, placeholder: 'E.g: 123456789', name: keys.abn, id: keys.abn, value: (values[keys.abn] || '').replace(/ /g, ''), onChange: handleChange, onBlur: handleBlur, error: touched[keys.abn] && errors[keys.abn], showClearIcon: false })),
                    React.createElement(Grid_1.default, { item: true, xs: 12, sm: 6 },
                        React.createElement(TextField_1.default, { label: labels.email, placeholder: 'E.g: abc@google.com', name: keys.email, id: keys.email, value: values[keys.email], onChange: handleChange, onBlur: handleBlur, error: touched[keys.email] && errors[keys.email], showClearIcon: false }))))));
    }
}
CustomerForm.propTypes = {
    keys: prop_types_1.default.shape({
        customer_name: prop_types_1.default.string,
        contact_name: prop_types_1.default.string,
        contact_surname: prop_types_1.default.string,
        abn: prop_types_1.default.string,
        email: prop_types_1.default.string,
    }),
    labels: prop_types_1.default.shape({
        customer_name: prop_types_1.default.string,
        contact_name: prop_types_1.default.string,
        contact_surname: prop_types_1.default.string,
        abn: prop_types_1.default.string,
        email: prop_types_1.default.string,
    }),
    values: prop_types_1.default.object,
    errors: prop_types_1.default.object,
    touched: prop_types_1.default.object,
    handleChange: prop_types_1.default.func,
    handleBlur: prop_types_1.default.func,
    classes: prop_types_1.default.object,
};
CustomerForm.defaultProps = {
    keys: {
        customer_name: 'customer_name',
        contact_name: 'contact_name',
        contact_surname: 'contact_surname',
        abn: 'abn',
        email: 'email',
    },
    labels: {
        customer_name: 'Customer Name',
        contact_name: 'Contact Name',
        contact_surname: 'Contact Surname',
        abn: 'ABN',
        email: 'Email',
    },
};
exports.default = withStyles_1.default(styles_1.default)(CustomerForm);
//# sourceMappingURL=index.js.map