feat: add void action to inventory count index
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 1m9s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-29 13:12:02 +08:00
parent 56e30a85bb
commit a31c8d6052
2 changed files with 85 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout';
import { Head, useForm, Link } from '@inertiajs/react'; // Added Link
import { Head, useForm, Link, router } from '@inertiajs/react'; // Added Link
import {
Table,
TableBody,
@@ -56,11 +56,9 @@ export default function Show({ doc }: any) {
};
const handleReopen = () => {
if (confirm('確定要取消核准嗎?單據將回復為盤點中狀態,且庫存異動將被撤回(若已過帳)。')) {
router.visit(route('inventory.count.reopen', [doc.id]), {
method: 'put',
});
}
router.visit(route('inventory.count.reopen', [doc.id]), {
method: 'put',
});
}
const isCompleted = doc.status === 'completed';
@@ -123,16 +121,31 @@ export default function Show({ doc }: any) {
{isCompleted && (
<Can permission="inventory.adjust">
<Button
variant="outline"
size="sm"
className="button-outlined-error"
onClick={handleReopen}
disabled={processing}
>
<RotateCcw className="w-4 h-4 mr-2" />
</Button>
<AlertDialog>
<AlertDialogTrigger asChild>
<Button
variant="outline"
size="sm"
className="button-outlined-error"
disabled={processing}
>
<RotateCcw className="w-4 h-4 mr-2" />
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle></AlertDialogTitle>
<AlertDialogDescription>
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel></AlertDialogCancel>
<AlertDialogAction onClick={handleReopen} className="bg-red-600 hover:bg-red-700"></AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</Can>
)}