import { FormType } from "@/components/form/interface";
import { UserDataType } from "@/model/userModel";
import { ColumnsType } from "antd/lib/table";
import dayjs from "dayjs";
export const studyColumns: ColumnsType<UserDataType> = [
  {
    title: "姓名",
    dataIndex: "user_name",
    width:100,
  },
  {
    title: "身份证",
    dataIndex: "id_card",
  },
  {
    title: "联系电话",
    dataIndex: "tel",
  },
  {
    title: "上午签到时间",
    dataIndex: "created_at",
    render(leave_start_time) {
      if (!leave_start_time){
        return "未签到";
      }
      return dayjs(leave_start_time).format("YYYY-MM-DD HH:mm");
    },
  },
  {
    title: "下午签到时间",
    render(record) {
      if (record.created_at === record.updated_at){
        return "未签到";
      }
      return dayjs(record.created_at).format("YYYY-MM-DD HH:mm");
    },
  },
  {
    title: "上午签到地址",
    dataIndex: "address",
  },
  {
    title: "下午签到地址",
    dataIndex: "pm_address",
  },
  // {
  //   title: "经度",
  //   dataIndex: "long",
  // },
  // {
  //   title: "纬度",
  //   dataIndex: "lat",
  // },
];

export const serchConfig = [
  {
    type: FormType.input,
    label: "用户名",
    name: "user_name",
    value: "",
    rules: [],
  },
  {
    type: FormType.input,
    label: "身份证号",
    name: "id_card",
    value: "",
    rules: [],
  },
  {
    type: FormType.date,
    label: "开始时间",
    name: "start_time",
    value: "",
    rules: [],
  },
  {
    type: FormType.date,
    label: "结束时间",
    name: "end_time",
    value: "",
    rules: [],
  },
];
