import Table from "./TablePage";
import { useParams } from "react-router-dom";
import CustomSelect from "./Select/CustomSelect";
import EditHomeWorkModel from "./Model/EditModel";
import AddHomeWorkModel from "./Model/AddModel";
import DeleteHomeWorkModel from "./Model/Delete";
import { Payments } from "../../../types/App";
import { useGetStudent } from "../../../api/student";
import { Student } from "../../../types/Item";
// import useSetPage_title from "../../../Hooks/useSetPageTitle";
// import { ABILITIES_ENUM } from "../../../enums/abilities";
import { useTranslation } from "react-i18next";
import { translateOptions } from "../../../utils/translatedOptions";

const TableHeader = () => {
  const { student_id } = useParams();
  const { data } = useGetStudent({
    show: student_id,
  });
  const student = data?.data as Student;

  const full_name = student?.full_name ?? "";
  const [t] = useTranslation();
  // useSetPage_title(
  //   `${t(ABILITIES_ENUM?.MAIN_PAGE)}  / ${t(`models.${ABILITIES_ENUM.PAYMENT}`)}`,
  // );
  const translateArray = translateOptions(
    [...Payments, { label: t("select.Payments.all_payment"), value: "" }],
    t,
  );

  return (
    <div className="TableWithHeader">
      <header>
        <h6>
          {t("header.student_payment")}
          {" " + full_name}
        </h6>
        <div className="Selects">
          <CustomSelect
            options={translateArray}
            placeholder={t("select.Payments.all_payment")}
            searchBy="type"
          />
        </div>
      </header>

      <Table />

      <AddHomeWorkModel />
      <EditHomeWorkModel />
      <DeleteHomeWorkModel />
    </div>
  );
};

export default TableHeader;
