import { Space } from 'antd';
import { useContext } from 'react';
import { VmInfoCollection, VmTag } from "../../../_components";
import { BasicService } from "../../api";
import { RestaurantContext } from "../../index";
import "./index.less";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var CollectRule = function CollectRule() {
  var _useContext = useContext(RestaurantContext),
    data = _useContext.info,
    openCar = _useContext.openCar,
    openSyPoint = _useContext.openSyPoint;
  var carRouteList = BasicService.useGetCarRouteList(data.syPointId);
  return /*#__PURE__*/_jsxs("div", {
    children: [/*#__PURE__*/_jsxs(Space, {
      children: [/*#__PURE__*/_jsx("span", {
        style: {
          fontWeight: 600
        },
        children: data.syPointName
      }), /*#__PURE__*/_jsx(VmTag, {
        text: '收集点',
        color: 'blue'
      })]
    }), carRouteList.map(function (item) {
      var data = [{
        key: 'name',
        label: '路线名称',
        value: item.name,
        width: '100%',
        isAddress: true
      }, {
        key: 'carCode',
        label: '车牌号',
        value: item.carCode,
        render: function render() {
          return /*#__PURE__*/_jsx("a", {
            onClick: function onClick() {
              return openCar && openCar({
                id: item.carId,
                title: item.carCode
              });
            },
            children: item.carCode
          });
        }
      }, {
        key: 'periodNames',
        label: '班次',
        value: item.periodNames
      }];
      return /*#__PURE__*/_jsxs("div", {
        className: 'vtx-restaurant-rule_item',
        children: [/*#__PURE__*/_jsx("div", {
          className: 'vtx-restaurant-border'
        }), /*#__PURE__*/_jsx(VmInfoCollection, {
          data: data,
          horizontal: true
        })]
      }, item.id);
    })]
  });
};
export default CollectRule;