style: 修正盤點與盤調畫面 Table Padding 並統一 UI 規範
This commit is contained in:
324
resources/js/Pages/Inventory/Count/Index.tsx
Normal file
324
resources/js/Pages/Inventory/Count/Index.tsx
Normal file
@@ -0,0 +1,324 @@
|
||||
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout';
|
||||
import { Head, Link, useForm, router } from '@inertiajs/react';
|
||||
import { useState, useCallback, useEffect } from 'react';
|
||||
import { debounce } from "lodash";
|
||||
import { SearchableSelect } from "@/Components/ui/searchable-select";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/Components/ui/table';
|
||||
import { Button } from '@/Components/ui/button';
|
||||
import { Input } from '@/Components/ui/input';
|
||||
import { Card, CardContent } from '@/Components/ui/card';
|
||||
import { Badge } from '@/Components/ui/badge';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/Components/ui/dialog";
|
||||
import { Label } from '@/Components/ui/label';
|
||||
import {
|
||||
Plus,
|
||||
Search,
|
||||
X,
|
||||
ClipboardCheck,
|
||||
Eye,
|
||||
Pencil
|
||||
} from 'lucide-react';
|
||||
import Pagination from '@/Components/shared/Pagination';
|
||||
import { Can } from '@/Components/Permission/Can';
|
||||
|
||||
export default function Index({ auth, docs, warehouses, filters }: any) {
|
||||
const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false);
|
||||
const { data, setData, post, processing, reset, errors } = useForm({
|
||||
warehouse_id: '',
|
||||
remarks: '',
|
||||
});
|
||||
|
||||
const [searchTerm, setSearchTerm] = useState(filters.search || "");
|
||||
const [warehouseFilter, setWarehouseFilter] = useState(filters.warehouse_id || "all");
|
||||
const [perPage, setPerPage] = useState(filters.per_page || "10");
|
||||
|
||||
// Sync state with props
|
||||
useEffect(() => {
|
||||
setSearchTerm(filters.search || "");
|
||||
setWarehouseFilter(filters.warehouse_id || "all");
|
||||
setPerPage(filters.per_page || "10");
|
||||
}, [filters]);
|
||||
|
||||
// Debounced Search Handler
|
||||
const debouncedSearch = useCallback(
|
||||
debounce((term: string, warehouse: string) => {
|
||||
router.get(
|
||||
route('inventory.count.index'),
|
||||
{ ...filters, search: term, warehouse_id: warehouse === "all" ? "" : warehouse },
|
||||
{ preserveState: true, replace: true, preserveScroll: true }
|
||||
);
|
||||
}, 500),
|
||||
[filters]
|
||||
);
|
||||
|
||||
const handleSearchChange = (term: string) => {
|
||||
setSearchTerm(term);
|
||||
debouncedSearch(term, warehouseFilter);
|
||||
};
|
||||
|
||||
const handleFilterChange = (value: string) => {
|
||||
setWarehouseFilter(value);
|
||||
router.get(
|
||||
route('inventory.count.index'),
|
||||
{ ...filters, warehouse_id: value === "all" ? "" : value },
|
||||
{ preserveState: false, replace: true, preserveScroll: true }
|
||||
);
|
||||
};
|
||||
|
||||
const handleClearSearch = () => {
|
||||
setSearchTerm("");
|
||||
router.get(
|
||||
route('inventory.count.index'),
|
||||
{ ...filters, search: "", warehouse_id: warehouseFilter === "all" ? "" : warehouseFilter },
|
||||
{ preserveState: true, replace: true, preserveScroll: true }
|
||||
);
|
||||
};
|
||||
|
||||
const handlePerPageChange = (value: string) => {
|
||||
setPerPage(value);
|
||||
router.get(
|
||||
route('inventory.count.index'),
|
||||
{ ...filters, per_page: value },
|
||||
{ preserveState: false, replace: true, preserveScroll: true }
|
||||
);
|
||||
};
|
||||
|
||||
const handleCreate = (e) => {
|
||||
e.preventDefault();
|
||||
post(route('inventory.count.store'), {
|
||||
onSuccess: () => {
|
||||
setIsCreateDialogOpen(false);
|
||||
reset();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const getStatusBadge = (status) => {
|
||||
switch (status) {
|
||||
case 'draft':
|
||||
return <Badge variant="secondary">草稿</Badge>;
|
||||
case 'counting':
|
||||
return <Badge className="bg-blue-500 hover:bg-blue-600">盤點中</Badge>;
|
||||
case 'completed':
|
||||
return <Badge className="bg-green-500 hover:bg-green-600">已完成</Badge>;
|
||||
case 'cancelled':
|
||||
return <Badge variant="destructive">已取消</Badge>;
|
||||
default:
|
||||
return <Badge variant="outline">{status}</Badge>;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<AuthenticatedLayout
|
||||
breadcrumbs={[
|
||||
{ label: '商品與庫存與管理', href: '#' },
|
||||
{ label: '庫存盤點', href: route('inventory.count.index'), isPage: true },
|
||||
]}
|
||||
>
|
||||
<Head title="庫存盤點" />
|
||||
|
||||
<div className="container mx-auto p-6 max-w-7xl">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-grey-0 flex items-center gap-2">
|
||||
<ClipboardCheck className="h-6 w-6 text-primary-main" />
|
||||
庫存盤點管理
|
||||
</h1>
|
||||
<p className="text-gray-500 mt-1">
|
||||
建立與管理倉庫盤點單,執行定期庫存核對。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Toolbar */}
|
||||
<div className="bg-white rounded-lg shadow-sm border p-4 mb-6">
|
||||
<div className="flex flex-col md:flex-row gap-4">
|
||||
{/* Search */}
|
||||
<div className="flex-1 relative">
|
||||
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4" />
|
||||
<Input
|
||||
placeholder="搜尋盤點單號、備註..."
|
||||
value={searchTerm}
|
||||
onChange={(e) => handleSearchChange(e.target.value)}
|
||||
className="pl-10 pr-10 h-9"
|
||||
/>
|
||||
{searchTerm && (
|
||||
<button
|
||||
onClick={handleClearSearch}
|
||||
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Warehouse Filter */}
|
||||
<SearchableSelect
|
||||
value={warehouseFilter}
|
||||
onValueChange={handleFilterChange}
|
||||
options={[
|
||||
{ label: "所有倉庫", value: "all" },
|
||||
...warehouses.map((w: any) => ({ label: w.name, value: w.id.toString() }))
|
||||
]}
|
||||
placeholder="選擇倉庫"
|
||||
className="w-full md:w-[200px] h-9"
|
||||
/>
|
||||
|
||||
{/* Action Buttons */}
|
||||
<div className="flex gap-2 w-full md:w-auto">
|
||||
<Can permission="inventory.view">
|
||||
<Dialog open={isCreateDialogOpen} onOpenChange={setIsCreateDialogOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button className="flex-1 md:flex-none button-filled-primary">
|
||||
<Plus className="w-4 h-4 mr-2" />
|
||||
新增盤點單
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="sm:max-w-[425px]">
|
||||
<form onSubmit={handleCreate}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>建立新盤點單</DialogTitle>
|
||||
<DialogDescription>
|
||||
建立後將自動對該倉庫庫存進行快照,請確認倉庫作業已暫停。
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="grid gap-4 py-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="warehouse">選擇倉庫</Label>
|
||||
<SearchableSelect
|
||||
value={data.warehouse_id}
|
||||
onValueChange={(val) => setData('warehouse_id', val)}
|
||||
options={warehouses.map((w: any) => ({ label: w.name, value: w.id.toString() }))}
|
||||
placeholder="請選擇倉庫"
|
||||
className="h-9"
|
||||
/>
|
||||
{errors.warehouse_id && <p className="text-red-500 text-sm">{errors.warehouse_id}</p>}
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="remarks">備註</Label>
|
||||
<Input
|
||||
id="remarks"
|
||||
className="h-9"
|
||||
value={data.remarks}
|
||||
onChange={(e) => setData('remarks', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button type="button" variant="outline" onClick={() => setIsCreateDialogOpen(false)}>
|
||||
取消
|
||||
</Button>
|
||||
<Button type="submit" className="button-filled-primary" disabled={processing || !data.warehouse_id}>
|
||||
確認建立
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</Can>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden">
|
||||
<Table>
|
||||
<TableHeader className="bg-gray-50">
|
||||
<TableRow>
|
||||
<TableHead className="w-[50px] text-center">#</TableHead>
|
||||
<TableHead>單號</TableHead>
|
||||
<TableHead>倉庫</TableHead>
|
||||
<TableHead>狀態</TableHead>
|
||||
<TableHead>快照時間</TableHead>
|
||||
<TableHead>完成時間</TableHead>
|
||||
<TableHead>建立人員</TableHead>
|
||||
<TableHead className="text-center">操作</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{docs.data.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={8} className="text-center h-24 text-gray-500">
|
||||
尚無盤點紀錄
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
docs.data.map((doc, index) => (
|
||||
<TableRow key={doc.id}>
|
||||
<TableCell className="text-gray-500 font-medium text-center">
|
||||
{(docs.current_page - 1) * docs.per_page + index + 1}
|
||||
</TableCell>
|
||||
<TableCell className="font-medium text-primary-main">{doc.doc_no}</TableCell>
|
||||
<TableCell>{doc.warehouse_name}</TableCell>
|
||||
<TableCell>{getStatusBadge(doc.status)}</TableCell>
|
||||
<TableCell className="text-gray-500 text-sm">{doc.snapshot_date}</TableCell>
|
||||
<TableCell className="text-gray-500 text-sm">{doc.completed_at || '-'}</TableCell>
|
||||
<TableCell className="text-sm">{doc.created_by}</TableCell>
|
||||
<TableCell className="text-center">
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<Can permission="inventory.view">
|
||||
<Link href={route('inventory.count.show', [doc.id])}>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="button-outlined-primary"
|
||||
title={doc.status === 'completed' ? '查閱' : '盤點'}
|
||||
>
|
||||
{doc.status === 'completed' ? (
|
||||
<Eye className="w-4 h-4 mr-1" />
|
||||
) : (
|
||||
<Pencil className="w-4 h-4 mr-1" />
|
||||
)}
|
||||
{doc.status === 'completed' ? '查閱' : '盤點'}
|
||||
</Button>
|
||||
</Link>
|
||||
</Can>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 flex flex-col sm:flex-row items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex items-center gap-2 text-sm text-gray-500">
|
||||
<span>每頁顯示</span>
|
||||
<SearchableSelect
|
||||
value={perPage}
|
||||
onValueChange={handlePerPageChange}
|
||||
options={[
|
||||
{ label: "10", value: "10" },
|
||||
{ label: "20", value: "20" },
|
||||
{ label: "50", value: "50" },
|
||||
{ label: "100", value: "100" }
|
||||
]}
|
||||
className="w-[100px] h-8"
|
||||
showSearch={false}
|
||||
/>
|
||||
<span>筆</span>
|
||||
</div>
|
||||
<span className="text-sm text-gray-500">共 {docs.total} 筆紀錄</span>
|
||||
</div>
|
||||
<Pagination links={docs.links} />
|
||||
</div>
|
||||
</div>
|
||||
</AuthenticatedLayout>
|
||||
);
|
||||
}
|
||||
275
resources/js/Pages/Inventory/Count/Show.tsx
Normal file
275
resources/js/Pages/Inventory/Count/Show.tsx
Normal file
@@ -0,0 +1,275 @@
|
||||
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout';
|
||||
import { Head, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/Components/ui/table';
|
||||
import { Button } from '@/Components/ui/button';
|
||||
import { Input } from '@/Components/ui/input';
|
||||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/Components/ui/card';
|
||||
import { Badge } from '@/Components/ui/badge';
|
||||
import { Save, CheckCircle, Printer, Trash2, ClipboardCheck, Eye, Pencil } from 'lucide-react';
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@/Components/ui/alert-dialog"
|
||||
import { Can } from '@/Components/Permission/Can';
|
||||
import { Link } from '@inertiajs/react';
|
||||
|
||||
export default function Show({ doc }: any) {
|
||||
// Transform items to form data structure
|
||||
const { data, setData, put, delete: destroy, processing } = useForm({
|
||||
items: doc.items.map((item: any) => ({
|
||||
id: item.id,
|
||||
counted_qty: item.counted_qty,
|
||||
notes: item.notes || '',
|
||||
})),
|
||||
action: 'save', // 'save' or 'complete'
|
||||
});
|
||||
|
||||
// Helper to update local form data
|
||||
const updateItem = (index: number, field: string, value: any) => {
|
||||
const newItems = [...data.items];
|
||||
newItems[index][field] = value;
|
||||
setData('items', newItems);
|
||||
};
|
||||
|
||||
const handleSubmit = (action: string) => {
|
||||
setData('action', action);
|
||||
put(route('inventory.count.update', [doc.id]), {
|
||||
onSuccess: () => {
|
||||
// Handle success if needed
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
destroy(route('inventory.count.destroy', [doc.id]));
|
||||
};
|
||||
|
||||
const isCompleted = doc.status === 'completed';
|
||||
|
||||
// Calculate progress
|
||||
const totalItems = doc.items.length;
|
||||
const countedItems = data.items.filter((i: any) => i.counted_qty !== '' && i.counted_qty !== null).length;
|
||||
const progress = Math.round((countedItems / totalItems) * 100) || 0;
|
||||
|
||||
return (
|
||||
<AuthenticatedLayout
|
||||
breadcrumbs={[
|
||||
{ label: '商品與庫存管理', href: '#' },
|
||||
{ label: '庫存盤點', href: route('inventory.count.index') },
|
||||
{ label: `盤點單: ${doc.doc_no}`, href: route('inventory.count.show', [doc.id]), isPage: true },
|
||||
]}
|
||||
>
|
||||
<Head title={`盤點單 ${doc.doc_no}`} />
|
||||
|
||||
<div className="container mx-auto p-6 max-w-7xl">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<div className="flex items-center gap-4">
|
||||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
<h1 className="text-2xl font-bold text-grey-0 flex items-center gap-2">
|
||||
<ClipboardCheck className="h-6 w-6 text-primary-main" />
|
||||
盤點單: {doc.doc_no}
|
||||
</h1>
|
||||
{doc.status === 'completed' ? (
|
||||
<Badge className="bg-green-500 hover:bg-green-600">已完成</Badge>
|
||||
) : (
|
||||
<Badge className="bg-blue-500 hover:bg-blue-600">盤點中</Badge>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
倉庫: {doc.warehouse_name} | 建立人: {doc.created_by} | 快照時間: {doc.snapshot_date}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
{!isCompleted && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Can permission="inventory.view">
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button variant="outline" size="sm" disabled={processing} className="button-outlined-error">
|
||||
<Trash2 className="w-4 h-4 mr-2" />
|
||||
作廢盤點單
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>確定要作廢此盤點單嗎?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
此動作無法復原。作廢後請重新建立盤點單。
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>取消</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={handleDelete} className="bg-red-600 hover:bg-red-700">確認作廢</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="button-outlined-primary"
|
||||
onClick={() => handleSubmit('save')}
|
||||
disabled={processing}
|
||||
>
|
||||
<Save className="w-4 h-4 mr-2" />
|
||||
暫存進度
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
className="button-filled-primary"
|
||||
onClick={() => handleSubmit('complete')}
|
||||
disabled={processing}
|
||||
>
|
||||
<CheckCircle className="w-4 h-4 mr-2" />
|
||||
完成盤點並過帳
|
||||
</Button>
|
||||
</Can>
|
||||
</div>
|
||||
)}
|
||||
{isCompleted && (
|
||||
<Button variant="outline" size="sm" onClick={() => window.print()}>
|
||||
<Printer className="w-4 h-4 mr-2" />
|
||||
列印報表
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="max-w-7xl mx-auto space-y-6">
|
||||
{!isCompleted && (
|
||||
<Card className="border-none shadow-sm overflow-hidden">
|
||||
<CardContent className="py-4">
|
||||
<div className="flex items-center justify-between text-sm mb-2">
|
||||
<span className="text-gray-500">盤點進度: {countedItems} / {totalItems} 項目</span>
|
||||
<span className="font-semibold text-primary-main">{progress}%</span>
|
||||
</div>
|
||||
<div className="w-full bg-gray-200 rounded-full h-2">
|
||||
<div className="bg-primary-main h-2 rounded-full transition-all duration-300" style={{ width: `${progress}%` }}></div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<Card className="border border-gray-200 shadow-sm overflow-hidden gap-0">
|
||||
<CardHeader className="bg-white border-b px-6 py-4">
|
||||
<CardTitle className="text-lg font-medium">盤點明細</CardTitle>
|
||||
<CardDescription>
|
||||
請輸入每個項目的「實盤數量」。若有差異系統將自動計算。
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<Table>
|
||||
<TableHeader className="bg-gray-50">
|
||||
<TableRow>
|
||||
<TableHead className="w-[50px] text-center">#</TableHead>
|
||||
<TableHead>商品代號 / 名稱</TableHead>
|
||||
<TableHead>批號</TableHead>
|
||||
<TableHead className="text-right">系統庫存</TableHead>
|
||||
<TableHead className="text-right w-32">實盤數量</TableHead>
|
||||
<TableHead className="text-right">差異</TableHead>
|
||||
<TableHead>單位</TableHead>
|
||||
<TableHead>備註</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{doc.items.map((item: any, index: number) => {
|
||||
const formItem = data.items[index];
|
||||
const diff = formItem.counted_qty !== '' && formItem.counted_qty !== null
|
||||
? (parseFloat(formItem.counted_qty) - item.system_qty)
|
||||
: 0;
|
||||
const hasDiff = Math.abs(diff) > 0.0001;
|
||||
|
||||
return (
|
||||
<TableRow key={item.id} className={hasDiff && formItem.counted_qty !== '' ? "bg-red-50/30" : ""}>
|
||||
<TableCell className="text-gray-500 font-medium text-center">
|
||||
{index + 1}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="flex flex-col">
|
||||
<span className="font-medium text-gray-900">{item.product_code}</span>
|
||||
<span className="text-xs text-gray-500">{item.product_name}</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="text-sm font-mono">{item.batch_number || '-'}</TableCell>
|
||||
<TableCell className="text-right font-medium">{item.system_qty.toFixed(2)}</TableCell>
|
||||
<TableCell className="text-right px-1">
|
||||
{isCompleted ? (
|
||||
<span className="font-medium mr-2">{item.counted_qty}</span>
|
||||
) : (
|
||||
<Input
|
||||
type="number"
|
||||
step="0.01"
|
||||
value={formItem.counted_qty ?? ''}
|
||||
onChange={(e) => updateItem(index, 'counted_qty', e.target.value)}
|
||||
onWheel={(e: any) => e.target.blur()}
|
||||
disabled={processing}
|
||||
className="h-9 text-right font-medium focus:ring-primary-main"
|
||||
placeholder="盤點..."
|
||||
/>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className="text-right">
|
||||
<span className={`font-bold ${!hasDiff
|
||||
? 'text-gray-400'
|
||||
: diff > 0
|
||||
? 'text-green-600'
|
||||
: 'text-red-600'
|
||||
}`}>
|
||||
{formItem.counted_qty !== '' && formItem.counted_qty !== null
|
||||
? diff.toFixed(2)
|
||||
: '-'}
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell className="text-sm text-gray-500">{item.unit || item.unit_name}</TableCell>
|
||||
<TableCell className="px-1">
|
||||
{isCompleted ? (
|
||||
<span className="text-sm text-gray-600">{item.notes}</span>
|
||||
) : (
|
||||
<Input
|
||||
value={formItem.notes}
|
||||
onChange={(e) => updateItem(index, 'notes', e.target.value)}
|
||||
disabled={processing}
|
||||
className="h-9 text-sm"
|
||||
placeholder="備註..."
|
||||
/>
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</Card>
|
||||
|
||||
<div className="bg-gray-50/80 border border-dashed border-grey-200 rounded-lg p-4 flex items-start gap-3">
|
||||
<div className="bg-blue-100 p-2 rounded-lg">
|
||||
<Save className="w-5 h-5 text-blue-600" />
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="font-semibold text-gray-900 mb-1 text-sm">操作導引</h4>
|
||||
<p className="text-xs text-gray-500 leading-relaxed">
|
||||
資料會自動保存盤點人與時間。若尚未盤點完,您可以點擊「暫存進度」稍後繼續。
|
||||
確認所有項目資料正確後,請點擊「完成盤點並過帳」正式生效庫存調整。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</AuthenticatedLayout>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user