Przeglądaj źródła

調整庫存權限

production
tommy 3 godzin temu
rodzic
commit
03ddd22ead
2 zmienionych plików z 8 dodań i 1 usunięć
  1. +1
    -0
      src/authorities.ts
  2. +7
    -1
      src/components/InventorySearch/InventoryLotLineTable.tsx

+ 1
- 0
src/authorities.ts Wyświetl plik

@@ -8,6 +8,7 @@ export const AUTH = {
PACK: "PACK",
ADMIN: "ADMIN",
STOCK: "STOCK",
INVENTORY_ADJUST: "INVENTORY_ADJUST",
PURCHASE: "PURCHASE",
STOCK_TAKE: "STOCK_TAKE",
STOCK_IN_BIND: "STOCK_IN_BIND",


+ 7
- 1
src/components/InventorySearch/InventoryLotLineTable.tsx Wyświetl plik

@@ -33,6 +33,8 @@ import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import dayjs from "dayjs";
import CheckIcon from "@mui/icons-material/Check";
import { submitStockAdjustment, StockAdjustmentLineRequest } from "@/app/api/stockAdjustment/actions";
import { useSession } from "next-auth/react";
import { AUTH } from "@/authorities";

type AdjustmentEntry = InventoryLotLineResult & {
adjustedQty: number;
@@ -64,6 +66,10 @@ const InventoryLotLineTable: React.FC<Props> = ({
onStockAdjustmentSuccess,
}) => {
const { t } = useTranslation(["inventory"]);
const { data: session } = useSession();
const abilities = session?.user?.abilities ?? [];
const canStockAdjust =
abilities.includes(AUTH.ADMIN) || abilities.includes(AUTH.INVENTORY_ADJUST);
const PRINT_PRINTER_ID_KEY = 'inventoryLotLinePrintPrinterId';
const { setIsUploading } = useUploadContext();
const [stockTransferModalOpen, setStockTransferModalOpen] = useState(false);
@@ -529,7 +535,7 @@ const prevAdjustmentModalOpenRef = useRef(false);
<Typography variant="h6">
{inventory ? `${t("Item selected")}: ${inventory.itemCode} | ${inventory.itemName} (${t(inventory.itemType)})` : t("No items are selected yet.")}
</Typography>
{inventory && (
{inventory && canStockAdjust && (
<Chip
icon={<TuneIcon />}
label={t("Stock Adjustment")}


Ładowanie…
Anuluj
Zapisz