import React from "react";
import { Tooltip, Button, Modal } from "antd";
import { Link } from "react-router-dom";

const oncell = () => {
  return {
    style: {
      maxWidth: 150,
      overflow: "hidden",
      whiteSpace: "nowrap",
      textOverflow: "ellipsis",
    },
  };
};

export const columnsConfig = {
  "0": [
    {
      title: "职位名称",
      dataIndex: "name",
      key: "name",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
    {
      title: "发布者单位",
      dataIndex: "department",
      key: "department",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
    {
      title: "工作地点",
      dataIndex: "city",
      key: "city",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
    {
      title: "薪资范围",
      dataIndex: "salary",
      key: "salary",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          <span style={{ color: "#FB4848" }}>{text}</span>
        </Tooltip>
      ),
    },
    {
      title: "发布时间",
      dataIndex: "updated_at",
      key: "updated_at",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
  ],
  "1": {
    drafted: [
      {
        title: "职位名称",
        dataIndex: "name",
        key: "name",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "发布者",
        dataIndex: "user_name",
        key: "user_name",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "创建时间",
        dataIndex: "created_at",
        key: "created_at",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
    ],
    published: [
      {
        title: "职位名称",
        dataIndex: "name",
        key: "name",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "发布者",
        dataIndex: "user_name",
        key: "user_name",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "更新时间",
        dataIndex: "updated_at",
        key: "updated_at",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "投递人数",
        dataIndex: "apply_count",
        key: "apply_count",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            <Link
              to={`/recruitment/applier/${record.id}`}
              style={{ color: "#4CADFF" }}
            >
              {text}
            </Link>
          </Tooltip>
        ),
      },
    ],
    rejected: [
      {
        title: "职位名称",
        dataIndex: "name",
        key: "name",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "发布者",
        dataIndex: "user_name",
        key: "user_name",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "创建时间",
        dataIndex: "created_at",
        key: "created_at",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "未通过原因",
        dataIndex: "reject_reason",
        key: "reject_reason",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
    ],
    offline: [
      {
        title: "职位名称",
        dataIndex: "name",
        key: "name",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "发布者",
        dataIndex: "user_name",
        key: "user_name",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "创建时间",
        dataIndex: "created_at",
        key: "created_at",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "下线时间",
        dataIndex: "updated_at",
        key: "updated_at",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            {text}
          </Tooltip>
        ),
      },
      {
        title: "投递人数",
        dataIndex: "apply_count",
        key: "apply_count",
        align: "center",
        className: "edu-txt-center font-14",
        onCell: oncell,
        render: (text, record) => (
          <Tooltip placement="topLeft" title={text}>
            <Link
              to={`/recruitment/applier/${record.id}`}
              style={{ color: "#4CADFF" }}
            >
              {text}
            </Link>
          </Tooltip>
        ),
      },
    ],
  },
  "2": [
    {
      title: "职位名称",
      dataIndex: "name",
      key: "name",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
    {
      title: "发布者单位",
      dataIndex: "company",
      key: "company",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
    {
      title: "工作地点",
      dataIndex: "city",
      key: "city",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
    {
      title: "薪资范围",
      dataIndex: "salary",
      key: "salary",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          <span style={{ color: "#FB4848" }}>{text}</span>
        </Tooltip>
      ),
    },
    {
      title: "发布时间",
      dataIndex: "publish_at",
      key: "publish_at",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
    {
      title: "投递时间",
      dataIndex: "apply_at",
      key: "apply_at",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text}>
          {text}
        </Tooltip>
      ),
    },
    {
      title: "是否看简历",
      dataIndex: "is_viewd",
      key: "is_viewd",
      align: "center",
      className: "edu-txt-center font-14",
      onCell: oncell,
      render: (text, record) => (
        <Tooltip placement="topLeft" title={text ? "是" : "否"}>
          {text ? "是" : "否"}
        </Tooltip>
      ),
    },
  ],
};
export default columnsConfig;
