import React from "react";
import { PropTypes } from "prop-types";
// import style from "./style.css";
const style = null;
export const FactorToPrint = ({ process }) => {
  return (
    <>
      <h4>مشخصات شهرستان</h4>
      <table className={style}>
        <tr>
          <th>نام اپراتور</th>
          <th>استان</th>
          <th>کدملی</th>
          <th>تلفن</th>
          <th>شهرستان</th>
          <th>نشانی</th>
        </tr>
        <tr>
          <td>{process.city?.cityOperatorName}</td>
          <td>{process.city?.cityOperatorProvince}</td>
          <td>{process.city?.cityOperatorNationalId}</td>
          <td>{process.city?.cityOperatorMobile}</td>
          <td>{process.city?.cityOperatorCity}</td>
          <td>{process.city?.cityOperatorAddress}</td>
        </tr>
      </table>

      <h4>مشخصات استان</h4>
      <table className={style}>
        <tr>
          <th>نام اپراتور</th>
          <th>استان</th>
          <th>شهرستان</th>
          <th>کدملی</th>
          <th>تلفن</th>
          <th>نشانی</th>
        </tr>
        <tr>
          <td>{process.province?.provinceOperatorName}</td>
          <td>{process.province?.provinceOperatorProvinc}</td>
          <td>{process.province?.provinceOperatorCity}</td>
          <td>{process.province?.provinceOperatorNationalId}</td>
          <td>{process.province?.provinceOperatorMobile}</td>
          <td>{process.province?.provinceOperatorAddress}</td>
        </tr>
      </table>

      {process.provinceKillRequests?.map((item, i) => {
        return [
          <>
            <h4>مشخصات کشتارگاه</h4>

            <table className={style}>
              <tr>
                <th>نام کشتارگاه</th>
                <th>نشانی</th>
                <th>استان</th>
                <th>شهرستان</th>
                <th>کدملی</th>
                <th>تلفن</th>
              </tr>
              <tr>
                <td>{item.killHouseName}</td>
                <td>{item.killHouseUserAddress}</td>
                <td>{item.killHouseUserProvince}</td>
                <td>{item.killHouseUserCity}</td>
                <td>{item.killHouseName}</td>
                <td>{item.killHouseMobile}</td>
              </tr>
            </table>

            {process.provinceKillRequests[i].killHouseRequests?.map(
              (item, i) => {
                return [
                  <>
                    <table className={style}>
                      <tr>
                        <th>کد بار</th>
                        <th>وزن</th>
                        <th>مقدار</th>
                        <th>مبلغ واحد</th>
                        <th>مبلغ کل</th>
                      </tr>
                      <tr>
                        <td>{item.barcod}</td>
                        <td>{item.provinceFactorToKillHouse?.weight}</td>
                        <td>{item.quantity}</td>
                        <td>{item.fee + " ریال "}</td>
                        <td>
                          {item.provinceFactorToKillHouse?.cost + " ریال "}
                        </td>
                      </tr>
                    </table>
                  </>,
                ];
              }
            )}

            <h4>مشخصات کالا یا خدمات مورد معامله</h4>

            <table className={style}>
              <tr>
                <th>کالا</th>
                <th>تعداد</th>
                <th>واحد</th>
                <th>بهای واحد</th>
                <th>بهای کل</th>
              </tr>
              <tr>
                <td>مرغ</td>
                <td>{process.poultry?.poultryQuantity}</td>
                <td>قطعه</td>
                <td>
                  {process.allocation.fee
                    ? process.allocation?.fee + " ریال "
                    : "-"}
                </td>
                <td>
                  {process.allocation.totalMoney
                    ? process.allocation.totalMoney + " ریال "
                    : "-"}
                </td>
              </tr>
            </table>
          </>,
        ];
      })}

      <ul>
        {process.allocation?.provinceShareChar && (
          <li>
            سهم اتحادیه:{" "}
            {process.allocation?.provinceShareDigit.toLocaleString() + " ریال"}{" "}
            ({process.allocation?.provinceShareChar})
          </li>
        )}

        {process.allocation?.cityShareChar && (
          <li>
            سهم شهرستان:{" "}
            {process.allocation?.cityShareDigit.toLocaleString() + " ریال"} (
            {process.allocation?.cityShareChar})
          </li>
        )}

        {process.allocation?.fanavaShareShareChar && (
          <li>
            سهم فن آوا:{" "}
            {process.allocation?.fanavaShareDigit.toLocaleString() + " ریال"} (
            {process.allocation?.fanavaShareShareChar})
          </li>
        )}

        {process.allocation?.companyShareChar && (
          <li>
            سهم شرکت:{" "}
            {process.allocation?.companyShareDigit.toLocaleString() + " ریال"} (
            {process.allocation?.companyShareChar})
          </li>
        )}

        {process.allocation?.centralUnionShareChar && (
          <li>
            سهم اتحادیه مرکزی:{" "}
            {process.allocation?.centralUnionShareDigit.toLocaleString() +
              " ریال"}{" "}
            ({process.allocation?.centralUnionShareChar})
          </li>
        )}

        {process.allocation?.poultryShareChar && (
          <li>
            پرداختی مرغدار:{" "}
            {process.allocation?.poultryShareDigit.toLocaleString() + " ریال"} (
            {process.allocation?.poultryShareChar})
          </li>
        )}

        {process.allocation?.totalMoneyChar && (
          <li>
            مبلغ کل: {process.allocation?.totalMoney.toLocaleString() + " ریال"}{" "}
            ({process.allocation?.totalMoneyChar})
          </li>
        )}
      </ul>
    </>
  );
};

FactorToPrint.propTypes = {
  process: PropTypes.any,
};
