refactor: consolidate admin/users management under /people
This commit is contained in:
@@ -4,6 +4,11 @@ import { AssignmentService } from "@/services/assignment.service"
|
||||
import { PersonService } from "@/services/person.service"
|
||||
|
||||
import { formatPersonDepartment } from "../_components/person.copy"
|
||||
import {
|
||||
formatUserRole,
|
||||
type UserFallbackCopy,
|
||||
type UserRoleCopy,
|
||||
} from "../_components/user.copy"
|
||||
|
||||
export default async function PersonInfoPage({
|
||||
params,
|
||||
@@ -14,7 +19,8 @@ export default async function PersonInfoPage({
|
||||
const { dictionary } = await getI18n()
|
||||
const copy = dictionary.inventory.people
|
||||
const assignmentCopy = dictionary.inventory.assignments
|
||||
const person = await PersonService.findById(personId)
|
||||
const userCopy = dictionary.admin.users
|
||||
const person = await PersonService.findByIdWithUser(personId)
|
||||
const assignments = await AssignmentService.findAllByPerson(personId)
|
||||
|
||||
if (!person) {
|
||||
@@ -49,6 +55,37 @@ export default async function PersonInfoPage({
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
{person.user ? (
|
||||
<>
|
||||
<div className="flex justify-between">
|
||||
<span className="text-gray-600">
|
||||
{copy.detail.labels.role}
|
||||
</span>
|
||||
<span>
|
||||
{formatUserRole(
|
||||
person.user.role,
|
||||
userCopy.roles as UserRoleCopy,
|
||||
userCopy.fallback as UserFallbackCopy,
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="text-gray-600">
|
||||
{copy.detail.labels.status}
|
||||
</span>
|
||||
<span>
|
||||
{person.user.isActive
|
||||
? userCopy.status.active
|
||||
: userCopy.status.inactive}
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="col-span-2 flex justify-between">
|
||||
<span className="text-gray-600">{copy.detail.labels.role}</span>
|
||||
<span>{copy.detail.labels.noUser}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user