import * as React from "react";

import { PropTypes } from "prop-types";
import { SimpleTable } from "../../../../components/simple-table/SimpleTable";
import { format } from "date-fns-jalali";

export const FileInformation = ({ file }) => {
  const requestedSellTypeCash = file.poultry?.sellType?.cash ? "نقدی" : null;
  const requestedSellTypeCredit = file.poultry?.sellType?.credit
    ? "زمان دار"
    : null;
  const requestedSellType = [requestedSellTypeCash, requestedSellTypeCredit]
    .filter((item) => item)
    .join(" یا ");
  return (
    <SimpleTable
      columns={[
        "کدسفارش",
        "نام مرغدار",
        "تلفن",
        "تاریخ درخواست کشتار",
        "استان",
        "شهرستان",
        "تاریخ جوجه ریزی",
        "تعداد",
        "جمع تلفات",
        "وزن تقریبی هر مرغ",
        "سن مرغ",
        "نژاد",
        "نحوه فروش",
        // "فروشنده",
      ]}
      data={[
        [
          file.poultry.poultryOrderCode,
          file.poultry.poultryName,
          file.poultry.poultryMobile,
          format(new Date(file.poultry.poultrySendDate), "yyyy/MM/dd"),
          file.poultry.poultryProvince,
          file.poultry.poultryCity,
          format(new Date(file.poultryHatching.date), "yyyy/MM/dd"),
          file.poultry.poultryQuantity,
          file.poultryHatching.losses,
          file.poultry.poultryIndexWeight,
          file.poultry.age,
          file.poultry.poultryChickenBreed,
          requestedSellType,
          // file.provinceRequestAuctionList ? "استان" : "مرغدار",
        ],
      ]}
    />
  );
};

FileInformation.propTypes = {
  file: PropTypes.any,
};
