feat(inventory): 開放倉庫編號編輯、優化調撥單條碼搜尋與庫存匯入範本雙分頁說明

This commit is contained in:
2026-02-06 16:36:14 +08:00
parent 200d1989bd
commit e018b75783
11 changed files with 555 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import { useState, useMemo } from "react";
import { ArrowLeft, PackagePlus, AlertTriangle, Shield, Boxes } from "lucide-react";
import { ArrowLeft, PackagePlus, AlertTriangle, Shield, Boxes, FileUp } from "lucide-react";
import { Button } from "@/Components/ui/button";
import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout";
import { Head, Link, router } from "@inertiajs/react";
@@ -20,6 +20,7 @@ import {
AlertDialogTitle,
} from "@/Components/ui/alert-dialog";
import { Can } from "@/Components/Permission/Can";
import InventoryImportDialog from "@/Components/Warehouse/Inventory/InventoryImportDialog";
// 庫存頁面 Props
interface Props {
@@ -38,6 +39,7 @@ export default function WarehouseInventoryPage({
const [searchTerm, setSearchTerm] = useState("");
const [typeFilter, setTypeFilter] = useState<string>("all");
const [deleteId, setDeleteId] = useState<string | null>(null);
const [importDialogOpen, setImportDialogOpen] = useState(false);
// 篩選庫存列表
const filteredInventories = useMemo(() => {
@@ -157,6 +159,18 @@ export default function WarehouseInventoryPage({
{lowStockItems}
</Button>
{/* 匯入入庫按鈕 */}
<Can permission="inventory.adjust">
<Button
variant="outline"
className="button-outlined-primary"
onClick={() => setImportDialogOpen(true)}
>
<FileUp className="mr-2 h-4 w-4" />
</Button>
</Can>
{/* 新增庫存按鈕 */}
<Can permission="inventory.adjust">
<Link href={route('warehouses.inventory.create', warehouse.id)}>
@@ -210,6 +224,13 @@ export default function WarehouseInventoryPage({
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
{/* 匯入對話框 */}
<InventoryImportDialog
open={importDialogOpen}
onOpenChange={setImportDialogOpen}
warehouseId={warehouse.id}
/>
</div>
</AuthenticatedLayout>
);