feat: 統一全系統頁面標題樣式、優化側邊欄與實作角色成員查看功能
This commit is contained in:
@@ -10,6 +10,7 @@ import { FormEvent } from 'react';
|
||||
interface Role {
|
||||
id: number;
|
||||
name: string;
|
||||
display_name: string;
|
||||
}
|
||||
|
||||
interface UserData {
|
||||
@@ -48,16 +49,6 @@ export default function UserEdit({ user, roles, currentRoles }: Props) {
|
||||
}
|
||||
};
|
||||
|
||||
const translateRoleName = (name: string) => {
|
||||
const map: Record<string, string> = {
|
||||
'super-admin': '超級管理員',
|
||||
'admin': '管理員',
|
||||
'warehouse-manager': '倉庫主管',
|
||||
'purchaser': '採購人員',
|
||||
'viewer': '檢視者',
|
||||
};
|
||||
return map[name] || name;
|
||||
}
|
||||
|
||||
return (
|
||||
<AuthenticatedLayout
|
||||
@@ -69,29 +60,34 @@ export default function UserEdit({ user, roles, currentRoles }: Props) {
|
||||
>
|
||||
<Head title={`編輯使用者 - ${user.name}`} />
|
||||
|
||||
<div className="p-8 max-w-4xl mx-auto">
|
||||
<form onSubmit={handleSubmit} className="space-y-8">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-grey-0 flex items-center gap-2">
|
||||
<Users className="h-6 w-6 text-[#01ab83]" />
|
||||
編輯使用者
|
||||
</h1>
|
||||
<p className="text-gray-500 mt-1">
|
||||
修改使用者資料、重設密碼或變更角色
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3">
|
||||
<Link href={route('users.index')}>
|
||||
<Button variant="outline" type="button">
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
取消
|
||||
</Button>
|
||||
</Link>
|
||||
<div className="container mx-auto p-6 max-w-7xl">
|
||||
<form onSubmit={handleSubmit} className="space-y-6">
|
||||
{/* Header Area */}
|
||||
<div>
|
||||
<Link href={route('users.index')}>
|
||||
<Button
|
||||
variant="outline"
|
||||
type="button"
|
||||
className="gap-2 button-outlined-primary mb-2"
|
||||
>
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
返回使用者管理
|
||||
</Button>
|
||||
</Link>
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-grey-0 flex items-center gap-2">
|
||||
<Users className="h-6 w-6 text-[#01ab83]" />
|
||||
編輯使用者
|
||||
</h1>
|
||||
<p className="text-gray-500 mt-1">
|
||||
修改使用者資料、重設密碼或變更角色
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
type="submit"
|
||||
className="bg-[#01ab83] hover:bg-[#019a76]"
|
||||
className="button-filled-primary"
|
||||
disabled={processing}
|
||||
>
|
||||
<Check className="h-4 w-4 mr-2" />
|
||||
@@ -203,7 +199,7 @@ export default function UserEdit({ user, roles, currentRoles }: Props) {
|
||||
htmlFor={`role-${role.id}`}
|
||||
className="text-sm font-medium leading-none cursor-pointer"
|
||||
>
|
||||
{translateRoleName(role.name)}
|
||||
{role.display_name}
|
||||
</label>
|
||||
<p className="text-xs text-gray-500 font-mono">
|
||||
{role.name}
|
||||
|
||||
Reference in New Issue
Block a user