"use strict";

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

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

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

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

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

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

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

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));

var _Button = _interopRequireDefault(require("@instructure/ui-buttons/lib/components/Button"));

var _CloseButton = _interopRequireDefault(require("@instructure/ui-buttons/lib/components/CloseButton"));

var _Heading = _interopRequireDefault(require("@instructure/ui-elements/lib/components/Heading"));

var _Text = _interopRequireDefault(require("@instructure/ui-elements/lib/components/Text"));

var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/lib/format-message"));

var _constants = require("@instructure/quiz-common/lib/constants");

var _Modal = _interopRequireWildcard(require("@instructure/quiz-common/lib/components/Modal"));

var MoveImmutableModal =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(MoveImmutableModal, _Component);

  function MoveImmutableModal() {
    var _getPrototypeOf2;

    var _this;

    (0, _classCallCheck2.default)(this, MoveImmutableModal);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = (0, _possibleConstructorReturn2.default)(this, (_getPrototypeOf2 = (0, _getPrototypeOf3.default)(MoveImmutableModal)).call.apply(_getPrototypeOf2, [this].concat(args)));

    _this.handleSubmit = function (e) {
      var _this$props = _this.props,
          quizId = _this$props.quizId,
          position = _this$props.position,
          stimulusQuizEntryId = _this$props.stimulusQuizEntryId,
          quizEntry = _this$props.quizEntry;

      _this.props.closeModal();

      _this.props.setUI(_constants.MOVED_IN_SIDEBAR, _this.props.movedInSidebar);

      _this.props.moveImmutableQuizEntry(quizId, position, stimulusQuizEntryId, quizEntry.id);
    };

    _this.closeAction = function () {
      _this.props.closeModal();
    };

    return _this;
  }

  (0, _createClass2.default)(MoveImmutableModal, [{
    key: "cancelButton",
    value: function cancelButton() {
      return _react.default.createElement(_Button.default, {
        onClick: this.closeAction,
        margin: _constants.XSMALL_SIDE_MARGIN
      }, "Anile");
    }
  }, {
    key: "doneButton",
    value: function doneButton() {
      return _react.default.createElement(_Button.default, {
        variant: "primary",
        onClick: this.handleSubmit,
        margin: _constants.XSMALL_SIDE_MARGIN
      }, "Klone epi Deplase");
    }
  }, {
    key: "renderBody",
    value: function renderBody() {
      return _react.default.createElement("div", null, "Deplase nan pozisyon sa a ap klone kesyon an epi chanje stimulus ki asosye av\xE8k li yo pliske el\xE8v yo te k\xF2manse reponn li.");
    }
  }, {
    key: "render",
    value: function render() {
      return _react.default.createElement(_Modal.default, {
        open: this.props.modalOpen,
        onDismiss: this.closeAction,
        size: "small",
        label: "Konfime Klon epi Deplase"
      }, _react.default.createElement(_Modal.ModalHeader, null, _react.default.createElement(_Heading.default, {
        level: "reset",
        as: "h2"
      }, "Konfime Klon epi Deplase"), _react.default.createElement(_CloseButton.default, {
        onClick: this.closeAction,
        placement: "end",
        offset: "medium",
        variant: "icon"
      }, "F\xE8men")), _react.default.createElement(_Modal.ModalBody, null, _react.default.createElement(_Text.default, null, this.renderBody())), _react.default.createElement(_Modal.ModalFooter, null, this.cancelButton(), this.doneButton()));
    }
  }]);
  MoveImmutableModal.displayName = "MoveImmutableModal";
  return MoveImmutableModal;
}(_react.Component);

exports.default = MoveImmutableModal;
MoveImmutableModal.propTypes = {
  closeModal: _propTypes.default.func.isRequired,
  modalOpen: _propTypes.default.bool.isRequired,
  moveImmutableQuizEntry: _propTypes.default.func.isRequired,
  movedInSidebar: _propTypes.default.bool,
  position: _propTypes.default.number,
  quizEntry: _reactImmutableProptypes.default.record,
  quizId: _propTypes.default.string,
  setUI: _propTypes.default.func.isRequired,
  stimulusQuizEntryId: _propTypes.default.string
};
MoveImmutableModal.defaultProps = {
  movedInSidebar: false,
  position: void 0,
  quizEntry: void 0,
  quizId: void 0,
  stimulusQuizEntryId: void 0
};