import { useState } from "react";
import { Tab, Tabs } from "@mui/material";
import { Grid } from "../../../../components/grid/Grid";
import { MaangeGuilds } from "../manage-guilds/ManageGuilds";
import { PspActiveSession } from "../../../psp-company/components/psp-active-session/PspActiveSession";
import { getRoleFromUrl } from "../../../../utils/getRoleFromUrl";

export const ManageTab = () => {
  const [value, setValue] = useState(0);

  const handleChange = (event, newValue) => {
    setValue(newValue);
  };
  return (
    <Grid container alignItems="center" justifyContent="center">
      <Grid xs={12} container alignItems="center" justifyContent="center">
        <Tabs
          scrollButtons="auto"
          variant="scrollable"
          allowScrollButtonsMobile
          value={value}
          onChange={handleChange}
          mt={2}
        >
          <Tab label="اصناف" value={0} />
          {getRoleFromUrl() !== "KillHouse" && (
            <Tab label="نشست ها" value={1} />
          )}
        </Tabs>
      </Grid>

      {value === 0 && <MaangeGuilds readOnly={true} />}
      {value === 1 && <PspActiveSession readOnly={true} />}
    </Grid>
  );
};
