feat(inventory): 重構庫存盤點流程與優化操作日誌
1. 重構盤點流程:實作自動狀態轉換(盤點中/盤點完成)、整合按鈕為「儲存盤點結果」、更名 UI 狀態標籤。 2. 優化操作日誌: - 實作全域 ID 轉名稱邏輯(倉庫、使用者)。 - 合併單次操作的日誌記錄,避免重複產生。 - 修復日誌產生過程中的 Collection 修改錯誤。 3. 修正 TypeScript lint 錯誤(Index, Show 頁面)。
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
import { Button } from '@/Components/ui/button';
|
||||
import { Input } from '@/Components/ui/input';
|
||||
import { Badge } from '@/Components/ui/badge';
|
||||
import { Save, CheckCircle, Printer, Trash2, ClipboardCheck, ArrowLeft, RotateCcw } from 'lucide-react'; // Added ArrowLeft
|
||||
import { Save, Printer, Trash2, ClipboardCheck, ArrowLeft, RotateCcw } from 'lucide-react'; // Added ArrowLeft
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
} from "@/Components/ui/alert-dialog"
|
||||
import { Can } from '@/Components/Permission/Can';
|
||||
|
||||
|
||||
export default function Show({ doc }: any) {
|
||||
// Transform items to form data structure
|
||||
const { data, setData, put, delete: destroy, processing, transform } = useForm({
|
||||
@@ -102,7 +103,7 @@ export default function Show({ doc }: any) {
|
||||
盤點單: {doc.doc_no}
|
||||
</h1>
|
||||
{doc.status === 'completed' && (
|
||||
<Badge className="bg-green-500 hover:bg-green-600">已核准</Badge>
|
||||
<Badge className="bg-green-500 hover:bg-green-600">盤點完成</Badge>
|
||||
)}
|
||||
{doc.status === 'adjusted' && (
|
||||
<Badge className="bg-purple-500 hover:bg-purple-600">已盤調庫存</Badge>
|
||||
@@ -138,19 +139,19 @@ export default function Show({ doc }: any) {
|
||||
disabled={processing}
|
||||
>
|
||||
<RotateCcw className="w-4 h-4 mr-2" />
|
||||
取消核准
|
||||
重新開啟盤點
|
||||
</Button>
|
||||
</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>確定要取消核准嗎?</AlertDialogTitle>
|
||||
<AlertDialogTitle>確定要重新開啟盤點嗎?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
單據將回復為「盤點中」狀態,若已產生庫存異動將被撤回。此動作可讓您重新編輯盤點數量。
|
||||
單據將回復為「盤點中」狀態。此動作可讓您重新編輯盤點數量。
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>取消</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={handleReopen} className="bg-red-600 hover:bg-red-700">確認取消核准</AlertDialogAction>
|
||||
<AlertDialogAction onClick={handleReopen} className="bg-red-600 hover:bg-red-700">確認重新開啟</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
@@ -184,23 +185,13 @@ export default function Show({ doc }: any) {
|
||||
|
||||
<Can permission="inventory_count.edit">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="button-outlined-primary"
|
||||
className="button-filled-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>
|
||||
@@ -318,6 +309,7 @@ export default function Show({ doc }: any) {
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</AuthenticatedLayout >
|
||||
|
||||
Reference in New Issue
Block a user