feat(inventory): 開放倉庫編號編輯、優化調撥單條碼搜尋與庫存匯入範本雙分頁說明
This commit is contained in:
@@ -84,7 +84,8 @@ export default function Show({ order }: any) {
|
||||
const toggleSelectAll = () => {
|
||||
const filtered = availableInventory.filter(inv =>
|
||||
inv.product_name.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
inv.product_code.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
inv.product_code.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
(inv.product_barcode && inv.product_barcode.toLowerCase().includes(searchQuery.toLowerCase()))
|
||||
);
|
||||
const filteredKeys = filtered.map(inv => `${inv.product_id}-${inv.batch_number}`);
|
||||
|
||||
@@ -338,10 +339,10 @@ export default function Show({ order }: any) {
|
||||
<DialogContent className="max-w-4xl max-h-[85vh] flex flex-col p-6">
|
||||
<DialogHeader className="flex flex-row items-center justify-between space-y-0 pb-4">
|
||||
<DialogTitle className="text-xl">選擇來源庫存 ({order.from_warehouse_name})</DialogTitle>
|
||||
<div className="relative w-64">
|
||||
<div className="relative w-72">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-grey-3" />
|
||||
<Input
|
||||
placeholder="搜尋品名或代號..."
|
||||
placeholder="搜尋品名、代號或條碼..."
|
||||
className="pl-9 h-9 border-2 border-grey-3 focus:ring-primary-main"
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
@@ -364,7 +365,8 @@ export default function Show({ order }: any) {
|
||||
checked={availableInventory.length > 0 && (() => {
|
||||
const filtered = availableInventory.filter(inv =>
|
||||
inv.product_name.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
inv.product_code.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
inv.product_code.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
(inv.product_barcode && inv.product_barcode.toLowerCase().includes(searchQuery.toLowerCase()))
|
||||
);
|
||||
const filteredKeys = filtered.map(inv => `${inv.product_id}-${inv.batch_number}`);
|
||||
return filteredKeys.length > 0 && filteredKeys.every(k => selectedInventory.includes(k));
|
||||
@@ -383,7 +385,8 @@ export default function Show({ order }: any) {
|
||||
{(() => {
|
||||
const filtered = availableInventory.filter(inv =>
|
||||
inv.product_name.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
inv.product_code.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
inv.product_code.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
(inv.product_barcode && inv.product_barcode.toLowerCase().includes(searchQuery.toLowerCase()))
|
||||
);
|
||||
|
||||
if (filtered.length === 0) {
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user