import { Button } from "@mui/material";
import { useDispatch } from "react-redux";
import { OPEN_MODAL } from "../../../../lib/redux/slices/appSlice";
import { SlaughterAddSteward } from "../slaughter-add-steward/SlaughterAddSteward";

export const SlaughterAllocateSelfSteward = ({
  stewardKey,
  guildKey,
  isGuild,
  finalSubmitDisabled,
  slaughterUpdatedInventoryStock,
}) => {
  const dispatch = useDispatch();
  return (
    <Button
      disabled={finalSubmitDisabled}
      onClick={() => {
        dispatch(
          OPEN_MODAL({
            title: "تخصیص به مباشر",
            content: (
              <SlaughterAddSteward
                sellType={"exclusive"}
                stewardKey={stewardKey}
                guildKey={guildKey}
                isGuild={isGuild}
                totalAverageWeightOfCarcasses={
                  slaughterUpdatedInventoryStock?.totalAverageWeightOfCarcasses
                }
              />
            ),
          })
        );
      }}
    >
      تخصیص
    </Button>
  );
};
