feat: 完成權限管理系統、統一頁面標題樣式與表格對齊規範

This commit is contained in:
2026-01-13 13:30:51 +08:00
parent 6770a4ec2f
commit ecfcbb93ed
28 changed files with 2333 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
import { useState } from "react";
import { Plus } from "lucide-react";
import { Plus, Warehouse as WarehouseIcon } from 'lucide-react';
import { Button } from "@/Components/ui/button";
import AuthenticatedLayout from "@/Layouts/AuthenticatedLayout";
import { Head, router } from "@inertiajs/react";
@@ -35,9 +35,6 @@ export default function WarehouseIndex({ warehouses, filters }: PageProps) {
const [editingWarehouse, setEditingWarehouse] = useState<Warehouse | null>(null);
const [transferOrderDialogOpen, setTransferOrderDialogOpen] = useState(false);
// 暫時的 Mock Inventories直到後端 API 實作
// 搜尋處理
const handleSearch = (term: string) => {
setSearchTerm(term);
@@ -49,7 +46,7 @@ export default function WarehouseIndex({ warehouses, filters }: PageProps) {
};
// 導航處理
const handleViewInventory = (warehouseId: string) => {
const handleViewInventory = (warehouseId: string | number) => {
router.get(`/warehouses/${warehouseId}/inventory`);
};
@@ -77,16 +74,14 @@ export default function WarehouseIndex({ warehouses, filters }: PageProps) {
}
};
const handleDeleteWarehouse = (id: string) => {
const handleDeleteWarehouse = (id: string | number) => {
router.delete(route('warehouses.destroy', id), {
onSuccess: () => {
toast.success('倉庫已刪除');
setEditingWarehouse(null);
},
onError: (errors: any) => {
// If backend returns error bag or flash error
// Flash error is handled by AuthenticatedLayout usually via usePage props.
// But we can also check errors bag here if needed.
console.error(errors);
}
});
};
@@ -114,8 +109,13 @@ export default function WarehouseIndex({ warehouses, filters }: PageProps) {
<div className="container mx-auto p-6 max-w-7xl">
{/* 頁面標題 */}
<div className="mb-6">
<h1 className="mb-2"></h1>
<p className="text-gray-600 font-medium mb-4"></p>
<h1 className="text-2xl font-bold text-grey-0 flex items-center gap-2">
<WarehouseIcon className="h-6 w-6 text-[#01ab83]" />
</h1>
<p className="text-gray-500 mt-1">
</p>
</div>
{/* 工具列 */}