import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/taggedTemplateLiteralLoose";

var _templateObject;

import React, { useState } from 'react';
import { companiesApi, useGlobalLabels } from '@sentecacommerce-theme/lib';
import styled from 'styled-components';
import { EditCompanyModal } from '../EditCompanyModal';
import { ProfileElementContainer, ProfileElementWrapper, ProfileElementContentContainer, ProfileElementActionsContainer } from '../../../Common';
import { Label, CTALabel } from '../../../Vouchers/Element';

var Element = (_ref) => {
  var _data$company, _data$company2, _data$company3, _data$company4;

  var {
    data
  } = _ref;
  var [showModal, setShowModal] = useState(false);
  var [handleDelete] = companiesApi.useRemove(() => setShowModal(false));
  var {
    buttons,
    company
  } = useGlobalLabels();
  return /*#__PURE__*/React.createElement(ProfileElementContainer, null, showModal ? /*#__PURE__*/React.createElement(EditCompanyModal, {
    handleClose: () => setShowModal(false),
    queryData: data
  }) : null, /*#__PURE__*/React.createElement(ProfileElementWrapper, null, /*#__PURE__*/React.createElement(ProfileElementContentContainer, null, /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Label, null, company.companyName), " ", (_data$company = data.company) == null ? void 0 : _data$company.companyName), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Label, null, company.vatNumber), " ", (_data$company2 = data.company) == null ? void 0 : _data$company2.vatId), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Label, null, company.companyId), " ", (_data$company3 = data.company) == null ? void 0 : _data$company3.companyId), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Label, null, company.recipient, " "), " ", (_data$company4 = data.company) == null ? void 0 : _data$company4.companyPerson), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(Label, null, company.address, " "), " ", data.additionalAddressInfo)), /*#__PURE__*/React.createElement(ActionsContainer, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CTALabel, {
    onClick: () => setShowModal(true)
  }, buttons.edit), /*#__PURE__*/React.createElement(CTALabel, {
    onClick: () => handleDelete({
      id: data._id
    })
  }, buttons.delete)))));
};

export var ActionsContainer = styled(ProfileElementActionsContainer)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n  @media (max-width: 768px) {\n    width: 34% !important;\n    margin-bottom: 20px;\n  }\n"])));
export { Element };
//# sourceMappingURL=index.js.map