feat: 實作銷售單匯入權限控管並全面精簡權限顯示名稱
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 59s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-02-09 15:04:08 +08:00
parent b6fe9ad9f3
commit 65eb1a1b64
10 changed files with 227 additions and 141 deletions

View File

@@ -27,6 +27,7 @@ import { format } from 'date-fns';
import Pagination from "@/Components/shared/Pagination";
import { SearchableSelect } from "@/Components/ui/searchable-select";
import { router } from "@inertiajs/react";
import { usePermission } from "@/hooks/usePermission";
interface ImportBatch {
id: number;
@@ -51,6 +52,7 @@ interface Props {
}
export default function SalesImportIndex({ batches, filters = {} }: Props) {
const { can } = usePermission();
const [perPage, setPerPage] = useState(filters?.per_page?.toString() || "10");
useEffect(() => {
@@ -88,12 +90,14 @@ export default function SalesImportIndex({ batches, filters = {} }: Props) {
</p>
</div>
<Link href={route('sales-imports.create')}>
<Button className="button-filled-primary gap-2">
<Plus className="h-4 w-4" />
</Button>
</Link>
{can('sales_imports.create') && (
<Link href={route('sales-imports.create')}>
<Button className="button-filled-primary gap-2">
<Plus className="h-4 w-4" />
</Button>
</Link>
)}
</div>
<div className="bg-white rounded-lg border shadow-sm overflow-hidden">
@@ -142,7 +146,7 @@ export default function SalesImportIndex({ batches, filters = {} }: Props) {
<Eye className="h-4 w-4" />
</Button>
</Link>
{batch.status === 'pending' && (
{batch.status === 'pending' && can('sales_imports.delete') && (
<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline" size="sm" className="button-outlined-error" title="刪除">