"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _inputTextWithTitle = _interopRequireDefault(require("../../atom/input-text-with-title"));
var _courseSection = _interopRequireDefault(require("../course-section"));
var _draggableList = _interopRequireDefault(require("../draggable-list"));
var _loader = _interopRequireDefault(require("../../atom/loader"));
var _title = _interopRequireDefault(require("../../atom/title"));
var _titleAndCheckboxWrapper = _interopRequireDefault(require("../title-and-checkbox-wrapper"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const Loading = () => /*#__PURE__*/_react.default.createElement("div", {
  className: _style.default.loaderContainer
}, /*#__PURE__*/_react.default.createElement(_loader.default, {
  className: _style.default.loader,
  theme: "coorpmanager"
}));
const CourseSections = ({
  sections,
  onDrop,
  isLoading,
  title,
  mandatoryCoursesInput,
  inputTitle,
  totalCourses
}) => {
  if (isLoading) return /*#__PURE__*/_react.default.createElement(Loading, null);
  const child = {
    ...mandatoryCoursesInput,
    childType: 'input-text'
  };
  const sectionTitle = {
    title: inputTitle,
    'data-name': 'mandatory-courses-input-title'
  };
  return /*#__PURE__*/_react.default.createElement("div", null, mandatoryCoursesInput && sectionTitle ? /*#__PURE__*/_react.default.createElement(_titleAndCheckboxWrapper.default, {
    child: child,
    sectionTitle: sectionTitle
  }) : null, title ? /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.title
  }, /*#__PURE__*/_react.default.createElement(_title.default, {
    title: title,
    type: 'form-group',
    "data-name": 'course-sections-title'
  }), totalCourses ? /*#__PURE__*/_react.default.createElement(_title.default, {
    title: totalCourses,
    type: 'form-group',
    "data-name": 'course-sections-total-courses'
  }) : null) : null, /*#__PURE__*/_react.default.createElement(_draggableList.default, {
    itemType: "course-section",
    items: sections,
    onDrop: onDrop
  }));
};
CourseSections.propTypes = process.env.NODE_ENV !== "production" ? {
  inputTitle: _propTypes.default.string,
  title: _propTypes.default.string,
  totalCourses: _propTypes.default.string,
  sections: _propTypes.default.arrayOf(_propTypes.default.shape(_courseSection.default.propTypes)),
  onDrop: _propTypes.default.func,
  isLoading: _propTypes.default.bool,
  mandatoryCoursesInput: _propTypes.default.shape(_inputTextWithTitle.default.propTypes)
} : {};
var _default = exports.default = CourseSections;
//# sourceMappingURL=index.js.map