feat(Inventory): 同步調撥管理權限邏輯至盤點管理標準
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Has been skipped
Koori-ERP-Deploy-System / deploy-production (push) Successful in 1m5s

This commit is contained in:
2026-02-03 17:29:32 +08:00
parent bd999c7bb6
commit 19216f5846
2 changed files with 55 additions and 27 deletions

View File

@@ -1,4 +1,3 @@
import { useState, useEffect } from "react";
import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout";
import { Head, router, Link } from "@inertiajs/react";
@@ -37,8 +36,10 @@ import { Plus, Save, Trash2, ArrowLeft, CheckCircle, Package, ArrowLeftRight, Pr
import { toast } from "sonner";
import axios from "axios";
import { Can } from '@/Components/Permission/Can';
import { usePermission } from '@/hooks/usePermission';
export default function Show({ order }: any) {
const { can } = usePermission();
const [items, setItems] = useState(order.items || []);
const [remarks, setRemarks] = useState(order.remarks || "");
const [isSaving, setIsSaving] = useState(false);
@@ -181,7 +182,8 @@ export default function Show({ order }: any) {
});
};
const isReadOnly = order.status !== 'draft';
const canEdit = can('inventory_transfer.edit');
const isReadOnly = order.status !== 'draft' || !canEdit;
return (
<AuthenticatedLayout
@@ -234,7 +236,7 @@ export default function Show({ order }: any) {
{!isReadOnly && (
<div className="flex items-center gap-2">
<Can permission="inventory.view">
<Can permission="inventory_transfer.delete">
<AlertDialog open={!!deleteId} onOpenChange={(open) => !open && setDeleteId(null)}>
<AlertDialogTrigger asChild>
<Button variant="outline" size="sm" className="button-outlined-error" onClick={() => setDeleteId(order.id)}>
@@ -255,7 +257,9 @@ export default function Show({ order }: any) {
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</Can>
<Can permission="inventory_transfer.edit">
<Button
variant="outline"
size="sm"