|
|
|
@@ -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")} |
|
|
|
|