import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { SimpleTable } from "../../../../components/simple-table/SimpleTable";
import { getProvinceFeeTotalOverviewService } from "../../services/get-province-fee-total-overview";

export const ProvinceFeesTotalOverview = () => {
  const dispatch = useDispatch();
  const { getProvinceFeeTotalOverview } = useSelector(
    (state) => state.provinceSlice
  );

  useEffect(() => {
    dispatch(getProvinceFeeTotalOverviewService());
  }, []);

  return (
    <SimpleTable
      name={"گزارش تعرفه  ها"}
      columns={[
        "تعداد خریداران",
        "تعداد کل سفارشات",
        "تعداد کل قطعه",
        "وزن کل سفارشات (کیلوگرم)",
        "مبلغ کل سفارشات (﷼)",
        "تعداد سفارش پرداخت شده",
        "حجم پرداخت شده",
        "وزن سفارشات پرداخت شده (کیلوگرم)",
        "مبلغ سفارشات پرداخت شده (﷼)",
        "تعداد سفارش پرداخت نشده",
        "حجم پرداخت نشده",
        "وزن سفارشات پرداخت نشده (کیلوگرم)",
        "مبلغ سفارشات پرداخت نشده (﷼)",
        "تعداد سفارش معوقه",
        "حجم معوقه",
        "وزن سفارشات معوقه (کیلوگرم)",
        "مبلغ سفارشات معوقه (﷼)",
      ]}
      data={[
        [
          getProvinceFeeTotalOverview?.totalRequestsBuyers?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalRequests?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalRequestsQuantity?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalRequestsWeight?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalRequestsAmount?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalPaidRequests?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalPaidRequestsQuantity?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalPaidRequestsWeight?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalPaidRequestsAmount?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalUnpaidRequests?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalUnpaidRequestsQuantity?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalUnpaidRequestsWeight?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalUnpaidRequestsAmount?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalArchiveRequests?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalArchiveRequestsQuantity?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalArchiveRequestsWeight?.toLocaleString(),
          getProvinceFeeTotalOverview?.totalArchiveRequestsAmount?.toLocaleString(),
        ],
      ]}
    />
  );
};
