import { Box, Typography } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import {
  ROUTE_COMMERCE_REQUESTS,
  ROUTE_PROVINCE_SUPERVISOR_REQUESTS,
} from "../routes/routes";
import { useLocation } from "react-router-dom";

import { BackButton } from "../components/back-button/BackButton";
import { CommerceOperations } from "../features/commerce/components/commerce-operations/CommerceOperations";

const Commerce = () => {
  const { pathname } = useLocation();

  return (
    <>
      <Box display={"flex"} justifyContent="center">
        <Grid
          container
          direction="column"
          justifyContent="center"
          xs={12}
          sm={12}
          md={10}
          lg={10}
        >
          {pathname === ROUTE_COMMERCE_REQUESTS ||
          pathname === ROUTE_PROVINCE_SUPERVISOR_REQUESTS ? (
            <Grid justifyContent="center" my={SPACING.MEDIUM}>
              <Grid>
                <Typography variant="h6">
                  صفحه مدیریت درخواست ها (معاونت بازرگانی)
                </Typography>
              </Grid>
              <CommerceOperations />
            </Grid>
          ) : (
            <BackButton />
          )}

          <Grid container justifyContent="space-between" gap={SPACING.SMALL}>
            <Grid xs={12}></Grid>
          </Grid>
        </Grid>
      </Box>
    </>
  );
};
export default Commerce;
