import React from 'react';
import { Field } from 'react-final-form';

// Redux part
import { useSelector, useDispatch } from 'react-redux';
import { StoreState } from 'store/rootReducer';

// Import actions here

import classNames from 'classnames/bind';
import Input from 'components/formItems/Input';
import Button from 'components/items/Button';
import ProjectInput from 'components/formItems/ProjectInput';
import ProjectButton from 'components/items/ProjectButton';
import { required, email, composeValidators } from 'store/utils/validation';
import BillingFields from 'components/formItems/BillingFields';
import styleIdentifiers from './editInvoicingInfoForm.scss';

const styles = classNames.bind(styleIdentifiers);

export interface StateProps {}

export interface DispatchProps {}

export interface OwnProps {
  onSubmit: Function;
}

export type EditInvoicingInfoFormProps = StateProps & DispatchProps & OwnProps;

const EditInvoicingInfoForm = (props: EditInvoicingInfoFormProps) => {
  const { handleSubmit, submitting, valid, values } = props;

  // mapStateToProps

  return (
    <form className={styles('EditInvoicingInfoForm')} onSubmit={handleSubmit}>
      <BillingFields values={values} />

      <ProjectButton
        disabled={submitting || !valid}
        label="forms.billing.save"
        type="submit"
        color="primary"
      />
    </form>
  );
};

export default EditInvoicingInfoForm;
