import { Space } from 'antd';
import { useContext } from 'react';
import { VmInfoCollection, VmTag } from "../../../_components";
import { BasicService } from "../../../vtx-cc-cp-modal/api";
import { CcCpContext } from "../../index";
import "./index.less";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
var Rules = function Rules(_ref) {
  var id = _ref.id;
  var carRouteList = BasicService.useGetCarRouteList(id);
  var _useContext = useContext(CcCpContext),
    openCar = _useContext.openCar;
  return /*#__PURE__*/_jsx(_Fragment, {
    children: /*#__PURE__*/_jsx("div", {
      className: "cc-cp-rules",
      children: (carRouteList || []).map(function (item) {
        var data = [{
          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-cc-cp-rule_item",
          children: [/*#__PURE__*/_jsx("div", {
            className: 'vtx-cc-cp-border'
          }), /*#__PURE__*/_jsxs(Space, {
            children: [/*#__PURE__*/_jsx("div", {
              children: item.name
            }), /*#__PURE__*/_jsx(VmTag, {
              title: '路线',
              color: 'blue'
            })]
          }), /*#__PURE__*/_jsx(VmInfoCollection, {
            data: data,
            gap: 8,
            horizontal: true
          })]
        }, item.id);
      })
    })
  });
};
export default Rules;