import React from 'react';
import { RadioStack } from '../RadioStack/component';
import { Abode } from '../Abode'; // @ts-ignore

import { Accordion, Card } from 'react-bootstrap';
import { Checkbox } from '../../forms/Checkbox';
import { Button, Variants } from '../Button';
export var Shipping = function Shipping(_ref) {
  var distribution = _ref.distribution,
      invoicing = _ref.invoicing,
      delivery = _ref.delivery,
      terms = _ref.terms,
      data = _ref.data,
      handleSubmit = _ref.onSubmit,
      handleGroupChange = _ref.onGroupChange,
      handleFieldChange = _ref.onFieldChange,
      handleValidGroupFieldChange = _ref.onValidGroupFieldChange,
      valid = _ref.valid;
  return React.createElement(React.Fragment, null, React.createElement(RadioStack, Object.assign({}, distribution, {
    onChange: handleFieldChange('distribution')
  })), React.createElement(Accordion, null, React.createElement(Card, null, React.createElement(Card.Header, null, React.createElement(Accordion.Toggle, {
    as: Button,
    variant: Variants.LINK,
    eventKey: "0"
  }, "Invoicing Address")), React.createElement(Accordion.Collapse, {
    eventKey: "0"
  }, React.createElement(Card.Body, null, React.createElement(Abode, Object.assign({}, invoicing, {
    onFieldChange: handleGroupChange('invoicing'),
    onValidFieldChange: handleValidGroupFieldChange('invoicing')
  }))))), React.createElement(Card, null, React.createElement(Card.Header, null, React.createElement(Accordion.Toggle, {
    as: Button,
    variant: Variants.LINK,
    eventKey: "1"
  }, "Delivery Address"), React.createElement("small", null, "Fill only if delivery address is different than invoicing address.")), React.createElement(Accordion.Collapse, {
    eventKey: "1"
  }, React.createElement(Card.Body, null, React.createElement(Abode, Object.assign({}, delivery, {
    onFieldChange: handleGroupChange('delivery'),
    onValidFieldChange: handleValidGroupFieldChange('delivery')
  })))))), React.createElement(Checkbox, Object.assign({}, terms, {
    onChange: handleFieldChange('terms')
  })), React.createElement(Checkbox, Object.assign({}, data, {
    onChange: handleFieldChange('data')
  })), React.createElement(Button, {
    onClick: handleSubmit,
    disabled: !valid
  }, "Next"));
};