統一庫存盤點與盤調 UI 及邏輯:修正狀態顯示、操作權限與列表樣式
This commit is contained in:
@@ -23,8 +23,7 @@ import {
|
||||
AlertDialogTrigger,
|
||||
} from "@/Components/ui/alert-dialog";
|
||||
import { Label } from "@/Components/ui/label";
|
||||
import { Textarea } from "@/Components/ui/textarea";
|
||||
import { Save, CheckCircle, Trash2, ArrowLeft, Plus, X, Search, FileText, ClipboardCheck } from "lucide-react";
|
||||
import { Save, CheckCircle, Trash2, ArrowLeft, Plus, X, Search, ClipboardCheck } from "lucide-react";
|
||||
import { useState, useEffect } from 'react';
|
||||
import {
|
||||
Dialog,
|
||||
@@ -122,23 +121,15 @@ export default function Show({ doc }: { auth: any, doc: AdjDoc }) {
|
||||
};
|
||||
|
||||
const handlePost = () => {
|
||||
// Validate
|
||||
if (data.items.length === 0) {
|
||||
alert('請至少加入一個調整項目');
|
||||
return;
|
||||
}
|
||||
|
||||
const hasZero = data.items.some(i => Number(i.adjust_qty) === 0);
|
||||
if (hasZero && !confirm('部分項目的調整數量為 0,確定要繼續嗎?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm('確定要過帳嗎?過帳後將無法修改,並直接影響庫存。')) {
|
||||
router.visit(route('inventory.adjust.update', [doc.id]), {
|
||||
method: 'put',
|
||||
data: { ...data, action: 'post' } as any,
|
||||
});
|
||||
}
|
||||
router.visit(route('inventory.adjust.update', [doc.id]), {
|
||||
method: 'put',
|
||||
data: { ...data, action: 'post' } as any,
|
||||
});
|
||||
};
|
||||
|
||||
const handleDelete = () => {
|
||||
@@ -282,7 +273,7 @@ export default function Show({ doc }: { auth: any, doc: AdjDoc }) {
|
||||
|
||||
<div className="flex flex-row items-center justify-between mb-2">
|
||||
<h3 className="text-lg font-medium text-grey-900">調整項目</h3>
|
||||
{isDraft && (
|
||||
{isDraft && !doc.count_doc_id && (
|
||||
<ProductSearchDialog
|
||||
warehouseId={doc.warehouse_id}
|
||||
onSelect={(product, batch) => addItem(product, batch)}
|
||||
@@ -353,7 +344,7 @@ export default function Show({ doc }: { auth: any, doc: AdjDoc }) {
|
||||
<span className="text-grey-600 text-sm">{item.notes || '-'}</span>
|
||||
)}
|
||||
</TableCell>
|
||||
{isDraft && (
|
||||
{isDraft && !doc.count_doc_id && (
|
||||
<TableCell className="text-center">
|
||||
<Button
|
||||
variant="ghost"
|
||||
|
||||
Reference in New Issue
Block a user