feat(inventory): 重構庫存盤點流程與優化操作日誌
1. 重構盤點流程:實作自動狀態轉換(盤點中/盤點完成)、整合按鈕為「儲存盤點結果」、更名 UI 狀態標籤。 2. 優化操作日誌: - 實作全域 ID 轉名稱邏輯(倉庫、使用者)。 - 合併單次操作的日誌記錄,避免重複產生。 - 修復日誌產生過程中的 Collection 修改錯誤。 3. 修正 TypeScript lint 錯誤(Index, Show 頁面)。
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout';
|
||||
import { Head, Link, useForm, router, usePage } from '@inertiajs/react';
|
||||
import { Head, Link, useForm, router } from '@inertiajs/react';
|
||||
import { useState, useCallback, useEffect } from 'react';
|
||||
import { usePermission } from '@/hooks/usePermission';
|
||||
import { debounce } from "lodash";
|
||||
@@ -47,7 +47,7 @@ import {
|
||||
import Pagination from '@/Components/shared/Pagination';
|
||||
import { Can } from '@/Components/Permission/Can';
|
||||
|
||||
export default function Index({ auth, docs, warehouses, filters }: any) {
|
||||
export default function Index({ docs, warehouses, filters }: any) {
|
||||
const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false);
|
||||
const [deleteId, setDeleteId] = useState<string | null>(null);
|
||||
const { data, setData, post, processing, reset, errors, delete: destroy } = useForm({
|
||||
@@ -112,7 +112,7 @@ export default function Index({ auth, docs, warehouses, filters }: any) {
|
||||
);
|
||||
};
|
||||
|
||||
const handleCreate = (e) => {
|
||||
const handleCreate = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
post(route('inventory.count.store'), {
|
||||
onSuccess: () => {
|
||||
@@ -135,14 +135,14 @@ export default function Index({ auth, docs, warehouses, filters }: any) {
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusBadge = (status) => {
|
||||
const getStatusBadge = (status: string) => {
|
||||
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>;
|
||||
return <Badge className="bg-green-500 hover:bg-green-600">盤點完成</Badge>;
|
||||
case 'adjusted':
|
||||
return <Badge className="bg-purple-500 hover:bg-purple-600">已盤調庫存</Badge>;
|
||||
case 'cancelled':
|
||||
@@ -287,7 +287,7 @@ export default function Index({ auth, docs, warehouses, filters }: any) {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
docs.data.map((doc, index) => (
|
||||
docs.data.map((doc: any, index: number) => (
|
||||
<TableRow key={doc.id}>
|
||||
<TableCell className="text-gray-500 font-medium text-center">
|
||||
{(docs.current_page - 1) * docs.per_page + index + 1}
|
||||
|
||||
Reference in New Issue
Block a user