import { Badge, Col, Row, Space } from 'antd';
import { useContext } from 'react';
import { VmInfoCollection, VmTitle, VmWrapper } from "../../../_components";
import { signColorMap } from "../../config";
import { RestaurantContext } from "../../index";
import CollectRule from "./CollectRule";
import Info from "./Info";
import SummaryStatistics from "./SummaryStatistics";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var Basic = function Basic() {
  var _data$contract;
  var _useContext = useContext(RestaurantContext),
    data = _useContext.info,
    openUnit = _useContext.openUnit;
  var contractItem = (data === null || data === void 0 || (_data$contract = data.contract) === null || _data$contract === void 0 ? void 0 : _data$contract[0]) || {};
  var dataSource = [{
    key: '',
    label: '服务状态',
    value: /*#__PURE__*/_jsxs(Space, {
      children: [contractItem.status && /*#__PURE__*/_jsx(Badge, {
        color: signColorMap[contractItem.status]
      }), contractItem.statusStr || '--']
    })
  }, {
    key: '',
    label: '签约企业',
    value: contractItem.signTransUnitName,
    render: function render() {
      return /*#__PURE__*/_jsx("a", {
        onClick: function onClick() {
          return openUnit && openUnit({
            id: contractItem.signTransUnitId,
            title: contractItem.signTransUnitName
          });
        },
        children: contractItem.signTransUnitName
      });
    }
  }];
  return /*#__PURE__*/_jsxs(Row, {
    gutter: [16, 16],
    style: {
      height: '100%'
    },
    children: [/*#__PURE__*/_jsx(Col, {
      flex: '400px',
      style: {
        height: '100%'
      },
      children: /*#__PURE__*/_jsx(VmWrapper, {
        title: '基本信息',
        children: /*#__PURE__*/_jsxs("div", {
          children: [/*#__PURE__*/_jsx(Info, {}), /*#__PURE__*/_jsx(VmTitle, {
            title: '签约与信息'
          }), /*#__PURE__*/_jsx(VmInfoCollection, {
            data: dataSource,
            horizontal: true,
            ellipsis: true
          }), /*#__PURE__*/_jsx(VmTitle, {
            title: '收运规则'
          }), /*#__PURE__*/_jsx(CollectRule, {})]
        })
      })
    }), /*#__PURE__*/_jsx(Col, {
      flex: '1',
      style: {
        height: '100%',
        minWidth: 0
      },
      children: /*#__PURE__*/_jsx(SummaryStatistics, {})
    })]
  });
};
export default Basic;