import { Box } from "@mui/material";
import { Grid } from "../components/grid/Grid";
import { SPACING } from "../data/spacing";
import { useLocation } from "react-router-dom";
import {
  ROUTE_SLAUGHTER_ADD_CAR,
  ROUTE_SLAUGHTER_CAR_MANAGEMENT,
} from "../routes/routes";
import { SlaughterNewCar } from "../features/slaughter-house/components/slaughter-new-car/SlaughterNewCar";
import { SlaughterManageCars } from "../features/slaughter-house/components/slaughter-manage-cars/SlaughterManageCars";

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

  return (
    <>
      <Box display={"flex"} justifyContent="center">
        <Grid
          container
          direction="column"
          justifyContent="center"
          xs={12}
          sm={12}
          md={10}
          lg={10}
          my={SPACING.MEDIUM}
        >
          {/* <Grid justifyContent="center" my={SPACING.MEDIUM}>
            <Card>
              <SlaughterOperations />
            </Card>
          </Grid> */}
          <Grid container justifyContent="space-between" gap={SPACING.SMALL}>
            <Grid xs={12}>
              {pathname === ROUTE_SLAUGHTER_ADD_CAR && <SlaughterNewCar />}
              {pathname === ROUTE_SLAUGHTER_CAR_MANAGEMENT && (
                <SlaughterManageCars />
              )}
            </Grid>
          </Grid>
        </Grid>
      </Box>
    </>
  );
};

export default Cars;
