feat(inventory): 販賣機視覺優化、修復匯入日期缺失與倉庫刪除權限錯誤
This commit is contained in:
@@ -20,9 +20,10 @@ interface Props {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
warehouseId: string;
|
||||
warehouseName: string;
|
||||
}
|
||||
|
||||
export default function InventoryImportDialog({ open, onOpenChange, warehouseId }: Props) {
|
||||
export default function InventoryImportDialog({ open, onOpenChange, warehouseId, warehouseName }: Props) {
|
||||
const { data, setData, post, processing, errors, reset, clearErrors } = useForm({
|
||||
file: null as File | null,
|
||||
inboundDate: new Date().toISOString().split('T')[0],
|
||||
@@ -63,6 +64,9 @@ export default function InventoryImportDialog({ open, onOpenChange, warehouseId
|
||||
<DialogTitle>匯入庫存資料</DialogTitle>
|
||||
<DialogDescription>
|
||||
請先下載範本,填寫完畢後上傳檔案進行批次入庫。
|
||||
<div className="mt-2 p-2 bg-primary-main/5 border border-primary-main/20 rounded text-primary-main font-medium">
|
||||
目標倉庫:{warehouseName}
|
||||
</div>
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
|
||||
@@ -135,9 +135,19 @@ export default function InventoryTable({
|
||||
) : (
|
||||
<ChevronRight className="h-5 w-5 text-gray-600" />
|
||||
)}
|
||||
<h3 className="font-semibold text-gray-900">{group.productName}</h3>
|
||||
<h3 className="font-semibold text-gray-900">
|
||||
{group.productName}
|
||||
{isVending && group.batches.length > 0 && (() => {
|
||||
const locations = Array.from(new Set(group.batches.map(b => b.location).filter(Boolean)));
|
||||
return locations.length > 0 ? (
|
||||
<span className="ml-2 text-primary-main font-bold">
|
||||
{locations.map(loc => `[${loc}]`).join('')}
|
||||
</span>
|
||||
) : null;
|
||||
})()}
|
||||
</h3>
|
||||
<span className="text-sm text-gray-500">
|
||||
{hasInventory ? `${group.batches.length} 個批號` : '無庫存'}
|
||||
{isVending ? '' : (hasInventory ? `${group.batches.length} 個批號` : '無庫存')}
|
||||
</span>
|
||||
{group.batches.some(b => b.expiryDate && new Date(b.expiryDate) < new Date()) && (
|
||||
<Badge className="bg-red-50 text-red-600 border-red-200">
|
||||
@@ -220,7 +230,7 @@ export default function InventoryTable({
|
||||
<TableRow key={batch.id}>
|
||||
<TableCell className="text-grey-2">{index + 1}</TableCell>
|
||||
<TableCell>{batch.batchNumber || "-"}</TableCell>
|
||||
<TableCell>{batch.location || "-"}</TableCell>
|
||||
<TableCell className="font-medium text-primary-main">{batch.location || "-"}</TableCell>
|
||||
<TableCell>
|
||||
<span>{batch.quantity} {batch.unit}</span>
|
||||
</TableCell>
|
||||
|
||||
Reference in New Issue
Block a user