import React, { useEffect, useContext, useMemo } from 'react';
import AddService from "./addService";
import { Context } from "../../info/model";
import EditService from "./editService";
import "../../info/service/index.less";
import AddTimeModal from "./addTimeModal";
import useInfoHolder from "../../info/hooks/useInfoHolder";
import Lists from "../../info/service/Lists";
import useClearCart from "../../hooks/useClearCart";
import useQuotation from "../../hooks/useQuotation";
var Service = function Service() {
  var _useContext = useContext(Context),
    state = _useContext.state,
    dispatch = _useContext.dispatch;
  var _useInfoHolder = useInfoHolder(state, dispatch),
    detailRef = _useInfoHolder.detailRef,
    handleEdit = _useInfoHolder.handleEdit,
    handleAction = _useInfoHolder.handleAction,
    dispatchService = _useInfoHolder.dispatchService,
    showAddTimeModal = _useInfoHolder.showAddTimeModal;
  useEffect(function () {
    document.body.id = 'body';
  }, []);
  var clearCart = useClearCart(state, dispatch);
  var _useQuotation = useQuotation(state, dispatch),
    dom = _useQuotation.dom;
  var renderMemo = useMemo(function () {
    console.log('render info22222');
    return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
      className: "pisell-lowcode__booking-service-wrap"
    }, clearCart, /*#__PURE__*/React.createElement(Lists, {
      isParallelResource: true,
      onEdit: handleEdit,
      onAction: handleAction,
      onChange: function onChange(e, type) {
        return dispatchService(type || 'setService', e);
      }
    }), !state.isBookingCreatePage ? /*#__PURE__*/React.createElement(AddService, {
      onEdit: handleEdit
    }) : null), /*#__PURE__*/React.createElement(EditService, {
      ref: detailRef
    }), showAddTimeModal && /*#__PURE__*/React.createElement(AddTimeModal, null), dom);
  }, [clearCart, dom, showAddTimeModal, clearCart]);
  return /*#__PURE__*/React.createElement(React.Fragment, null, renderMemo);
};
export default /*#__PURE__*/React.memo(Service);