feat: 新增採購單發票欄位、更新 SearchableSelect 樣式與搜尋門檻至 10 個項目
This commit is contained in:
@@ -5,13 +5,7 @@
|
||||
import { Trash2 } from "lucide-react";
|
||||
import { Button } from "@/Components/ui/button";
|
||||
import { Input } from "@/Components/ui/input";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/Components/ui/select";
|
||||
import { SearchableSelect } from "@/Components/ui/searchable-select";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -82,27 +76,18 @@ export function PurchaseOrderItemsTable({
|
||||
{isReadOnly ? (
|
||||
<span className="font-medium">{item.productName}</span>
|
||||
) : (
|
||||
<Select
|
||||
<SearchableSelect
|
||||
value={item.productId}
|
||||
onValueChange={(value) =>
|
||||
onItemChange?.(index, "productId", value)
|
||||
}
|
||||
disabled={isDisabled}
|
||||
>
|
||||
<SelectTrigger className="h-10 border-gray-200">
|
||||
<SelectValue placeholder="選擇商品" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{supplier?.commonProducts.map((product) => (
|
||||
<SelectItem key={product.productId} value={product.productId}>
|
||||
{product.productName}
|
||||
</SelectItem>
|
||||
))}
|
||||
{(!supplier || supplier.commonProducts.length === 0) && (
|
||||
<div className="p-2 text-sm text-gray-400 text-center">無可用商品</div>
|
||||
)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
options={supplier?.commonProducts.map((p) => ({ label: p.productName, value: p.productId })) || []}
|
||||
placeholder="選擇商品"
|
||||
searchPlaceholder="搜尋商品..."
|
||||
emptyText="無可用商品"
|
||||
className="w-full"
|
||||
/>
|
||||
)}
|
||||
</TableCell>
|
||||
|
||||
@@ -128,21 +113,18 @@ export function PurchaseOrderItemsTable({
|
||||
{/* 單位選擇 */}
|
||||
<TableCell>
|
||||
{!isReadOnly && item.large_unit_id ? (
|
||||
<Select
|
||||
<SearchableSelect
|
||||
value={item.selectedUnit || 'base'}
|
||||
onValueChange={(value) =>
|
||||
onItemChange?.(index, "selectedUnit", value)
|
||||
}
|
||||
disabled={isDisabled}
|
||||
>
|
||||
<SelectTrigger className="h-10 border-gray-200 w-24">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent className="z-[9999]">
|
||||
<SelectItem value="base">{item.base_unit_name || "個"}</SelectItem>
|
||||
<SelectItem value="large">{item.large_unit_name}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
options={[
|
||||
{ label: item.base_unit_name || "個", value: "base" },
|
||||
{ label: item.large_unit_name || "", value: "large" }
|
||||
]}
|
||||
className="w-24"
|
||||
/>
|
||||
) : (
|
||||
<span className="text-gray-500 font-medium">
|
||||
{item.selectedUnit === 'large' && item.large_unit_name
|
||||
|
||||
Reference in New Issue
Block a user