import React from "react";
import Table from "../../component/Table.jsx";
import Button from "../../component/Button.jsx";
import { useNavigate } from "react-router";
import DetailSearch from "../../component/AgencySearch.jsx";
import ContentTitle from "../../component/ContentTitle.jsx";
import SubTitle from "../../component/SubTitle.jsx";

export default function ProtectorSelect() {
  const navigate = useNavigate();

  //게시판
  const thead = [
    "No",
    "소속기관명",
    "이름",
    "성별",
    "생년월일",
    "연락처",
    "ID",
    "담당 대상자(어르신) (명)",
  ];
  const key = [
    "No",
    "center",
    "name",
    "gender",
    "birth",
    "phone",
    "ID",
    "worker",
  ];
  const content = [
    {
      No: 1,
      center: "A복지관",
      name: "홍길동",
      gender: "여",
      birth: "920516",
      phone: "010-1234-1234",
      ID: "a123",
      worker: "5명"
    },
    {
      No: 2,
      center: "A복지관",
      name: "홍길동",
      gender: "여",
      birth: "920506",
      phone: "010-1234-1234",
      ID: "b123",
      worker: "5명"
    },
    {
      No: 3,
      center: "A복지관",
      name: "홍길동",
      gender: "여",
      birth: "920519",
      phone: "010-1234-1234",
      ID: "c123",
      worker: "8명"
    },

  ];

  //select option 동적 생성
  // const optionList = () => {
  //   let year = [];
  //   let month = [];
  //   let days = [];
  //   let currentDate = new Date();
  //   let currentYear = currentDate.getFullYear();

  //   for (let i = 1910; i < currentYear.length; i++) {
  //     year.push(i);
  //   }

  //   for (let j = 1; i < 13; j++) {
  //     month.push(j);
  //   }

  //   for (let k = 1; i < 32; k++) {
  //     days.push(k);
  //   }
  //   return year, month, days;
  // };

  // React.useEffect(() => {
  //   optionList();
  // }, []);

  return (
    <main>
      <div className="content-wrap">
        <ContentTitle contentTitle={"사용자 조회"} />
        <div>
          <div className="board-wrap">
            <div className="flex">
              <SubTitle className="margin-bottom" explanation={"해당 시행기관의 사용자를 관리할 수 있습니다."} />
              <div className="btn-wrap flex-end margin-bottom ">
                <Button
                  className={"btn-small green-btn"}
                  btnName={"등록"}
                  onClick={() => {
                    navigate("/SeniorInsert");
                  }}
                />
                <Button className={"btn-small green-btn"} btnName={"삭제"} />
              </div>
            </div >
            <Table
              className={"senior-table"}
              head={thead}
              contents={content}
              contentKey={key}
              onClick={() => {
                navigate("/SeniorSelectOne");
              }}
            />

          </div>
        </div>
      </div>
    </main>
  );
}
