"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

exports.__esModule = true;
exports.Element = exports.ActionsContainer = void 0;

var _taggedTemplateLiteralLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));

var _react = _interopRequireWildcard(require("react"));

var _lib = require("@sentecacommerce-theme/lib");

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _EditCompanyModal = require("../EditCompanyModal");

var _Common = require("../../../Common");

var _Element = require("../../../Vouchers/Element");

var _templateObject;

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

  var data = _ref.data;

  var _useState = (0, _react.useState)(false),
      showModal = _useState[0],
      setShowModal = _useState[1];

  var _companiesApi$useRemo = _lib.companiesApi.useRemove(function () {
    return setShowModal(false);
  }),
      handleDelete = _companiesApi$useRemo[0];

  var _useGlobalLabels = (0, _lib.useGlobalLabels)(),
      buttons = _useGlobalLabels.buttons,
      company = _useGlobalLabels.company;

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

exports.Element = Element;
var ActionsContainer = (0, _styledComponents["default"])(_Common.ProfileElementActionsContainer)(_templateObject || (_templateObject = (0, _taggedTemplateLiteralLoose2["default"])(["\n  @media (max-width: 768px) {\n    width: 34% !important;\n    margin-bottom: 20px;\n  }\n"])));
exports.ActionsContainer = ActionsContainer;
//# sourceMappingURL=index.js.map