import React from "react";
import { useStyles } from "../dashboardStyles";
import { Grid, useTheme } from "@mui/material";
import ProtectedComponent from "../../../components/ProtectedComponent";
import TotalNumber from "../components/TotalNumber";

const SuperAdminTotals = ({ isLoading, data }) => {
  const classes = useStyles();
  const theme = useTheme();

  const viewAllClick = (tab) => {
    if (false) return;
    // if (!user?.permission?.includes("STATISTIC_DASHBOARD")) return;
    let path = "/";
    // navigate(path, { state: { tab } });
  };

  const { totalAccounts, registrationRequest, rejected, registered, paymentDue } = data;

  return (
    <ProtectedComponent>
      <Grid container className={classes.numbers} spacing={2}>
        <Grid item>
          <TotalNumber
            heading={`Pending Requests`}
            isLoading={isLoading}
            viewAllClick={() => viewAllClick(true)}
            value={registrationRequest}
          />
        </Grid>
        <Grid item>
          <TotalNumber
            heading={`Approved Requests`}
            isLoading={isLoading}
            viewAllClick={() => viewAllClick(false)}
            value={registered}
            color={theme.palette.grey[52]}
          />
        </Grid>
        <Grid item>
          <TotalNumber
            heading={`Rejected Requests`}
            isLoading={isLoading}
            viewAllClick={() => viewAllClick(false)}
            value={rejected}
            color={theme.palette.grey[57]}
          />
        </Grid>
        <Grid item>
          <TotalNumber
            heading={`Payment Due`}
            isLoading={isLoading}
            viewAllClick={() => viewAllClick(false)}
            value={paymentDue}
            color={theme.palette.grey[57]}
          />
        </Grid>
        <Grid item>
          <TotalNumber
            heading={"Total Requests"}
            isLoading={isLoading}
            value={totalAccounts}
          />
        </Grid>
      </Grid>
    </ProtectedComponent>
  );
};

export default SuperAdminTotals;
