feat: 新增採購單發票欄位、更新 SearchableSelect 樣式與搜尋門檻至 10 個項目
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 1m17s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-09 10:18:52 +08:00
parent d60367ac57
commit 24ae6f3eee
13 changed files with 451 additions and 268 deletions

View File

@@ -8,13 +8,7 @@ import { Button } from "@/Components/ui/button";
import { Input } from "@/Components/ui/input";
import { Label } from "@/Components/ui/label";
import { Textarea } from "@/Components/ui/textarea";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/Components/ui/select";
import { SearchableSelect } from "@/Components/ui/searchable-select";
import {
Table,
TableBody,
@@ -242,18 +236,13 @@ export default function AddInventoryPage({ warehouse, products }: Props) {
<Label htmlFor="reason" className="text-gray-700">
<span className="text-red-500">*</span>
</Label>
<Select value={reason} onValueChange={(value) => setReason(value as InboundReason)}>
<SelectTrigger id="reason" className="border-gray-300">
<SelectValue />
</SelectTrigger>
<SelectContent>
{INBOUND_REASONS.map((r) => (
<SelectItem key={r} value={r}>
{r}
</SelectItem>
))}
</SelectContent>
</Select>
<SearchableSelect
value={reason}
onValueChange={(value) => setReason(value as InboundReason)}
options={INBOUND_REASONS.map((r) => ({ label: r, value: r }))}
placeholder="選擇入庫原因"
className="border-gray-300"
/>
{errors.reason && (
<p className="text-sm text-red-500">{errors.reason}</p>
)}
@@ -331,23 +320,16 @@ export default function AddInventoryPage({ warehouse, products }: Props) {
<TableRow key={item.tempId}>
{/* 商品 */}
<TableCell>
<Select
<SearchableSelect
value={item.productId}
onValueChange={(value) =>
handleProductChange(item.tempId, value)
}
>
<SelectTrigger className="border-gray-300">
<SelectValue />
</SelectTrigger>
<SelectContent className="z-[9999]">
{products.map((product) => (
<SelectItem key={product.id} value={product.id}>
{product.name}
</SelectItem>
))}
</SelectContent>
</Select>
options={products.map((p) => ({ label: p.name, value: p.id }))}
placeholder="選擇商品"
searchPlaceholder="搜尋商品..."
className="border-gray-300"
/>
{errors[`item-${index}-product`] && (
<p className="text-xs text-red-500 mt-1">
{errors[`item-${index}-product`]}
@@ -378,23 +360,20 @@ export default function AddInventoryPage({ warehouse, products }: Props) {
{/* 單位 */}
<TableCell>
{item.largeUnit ? (
<Select
value={item.selectedUnit}
<SearchableSelect
value={item.selectedUnit || ""}
onValueChange={(value) =>
handleUpdateItem(item.tempId, {
selectedUnit: value as 'base' | 'large',
unit: value === 'base' ? item.baseUnit : item.largeUnit
})
}
>
<SelectTrigger className="border-gray-300">
<SelectValue />
</SelectTrigger>
<SelectContent className="z-[9999]">
<SelectItem value="base">{item.baseUnit}</SelectItem>
<SelectItem value="large">{item.largeUnit}</SelectItem>
</SelectContent>
</Select>
options={[
{ label: item.baseUnit || "個", value: "base" },
{ label: item.largeUnit || "", value: "large" }
]}
className="border-gray-300"
/>
) : (
<Input
value={item.baseUnit || "個"}