diff --git a/src/app/api/user/[id]/route.ts b/src/app/api/user/[id]/route.ts index 9cb622f..c6d9fef 100644 --- a/src/app/api/user/[id]/route.ts +++ b/src/app/api/user/[id]/route.ts @@ -55,8 +55,9 @@ export async function GET(request: Request, context: { params: { id: string } }) const position = users?.Position.name const idUserRole = users?.UserRole.id const phone = users?.phone.substr(2) + const role = users?.UserRole.name - const result = { ...userData, group, position, idUserRole, phone }; + const result = { ...userData, group, position, idUserRole, phone, role }; const omitData = _.omit(result, ["Group", "Position", "UserRole"]); diff --git a/src/app/api/user/profile/route.ts b/src/app/api/user/profile/route.ts index 3a27995..21a3b20 100644 --- a/src/app/api/user/profile/route.ts +++ b/src/app/api/user/profile/route.ts @@ -36,6 +36,11 @@ export async function GET(request: Request) { select: { name: true } + }, + UserRole:{ + select:{ + name: true + } } } }) @@ -43,10 +48,11 @@ export async function GET(request: Request) { const group = data?.Group.name const position = data?.Position.name const phone = data?.phone.substr(2) + const role = data?.UserRole.name - const omitData = _.omit(data, ["Group", "Position", "phone"]) + const omitData = _.omit(data, ["Group", "Position", "phone", "UserRole"]); - const result = { ...userData, group, position, phone }; + const result = { ...userData, group, position, phone, role }; return NextResponse.json({ success: true, data: result }); } catch (error) { diff --git a/src/module/user/member/lib/type_member.ts b/src/module/user/member/lib/type_member.ts index 3d3f2ba..60be080 100644 --- a/src/module/user/member/lib/type_member.ts +++ b/src/module/user/member/lib/type_member.ts @@ -8,7 +8,8 @@ export interface IListMember { position: string, group: string, img: string, - isActive: boolean + isActive: boolean, + role: string } export interface IFormMember { diff --git a/src/module/user/member/ui/navbar_detail_member.tsx b/src/module/user/member/ui/navbar_detail_member.tsx index c3123ab..176e17f 100644 --- a/src/module/user/member/ui/navbar_detail_member.tsx +++ b/src/module/user/member/ui/navbar_detail_member.tsx @@ -5,7 +5,7 @@ import { ActionIcon, Avatar, Box, Center, Grid, Group, Skeleton, Stack, Text } f import { useShallowEffect } from "@mantine/hooks"; import { useState } from "react"; import toast from "react-hot-toast"; -import { FaSquarePhone } from "react-icons/fa6"; +import { FaBuildingUser, FaSquarePhone } from "react-icons/fa6"; import { HiMenu } from "react-icons/hi"; import { IoMaleFemale } from "react-icons/io5"; import { MdEmail } from "react-icons/md"; @@ -14,6 +14,8 @@ import { valueRoleUser } from "../../lib/val_user"; import { funGetOneMember } from "../lib/api_member"; import { IListMember, IMember } from "../lib/type_member"; import DrawerDetailMember from "./drawer_detail_member"; +import { BiSolidUserBadge } from "react-icons/bi"; +import { PiGenderIntersexFill } from "react-icons/pi"; export default function NavbarDetailMember({ id }: IMember) { @@ -47,7 +49,7 @@ export default function NavbarDetailMember({ id }: IMember) { setLoading(false) } catch (error) { console.error(error) - toast.error("Gagal mendapatkan detail user, coba lagi nanti"); + toast.error("Gagal mendapatkan detail anggota, coba lagi nanti"); } finally { setLoading(false) } @@ -89,7 +91,7 @@ export default function NavbarDetailMember({ id }: IMember) { : <> {dataOne?.name} - {dataOne?.group} - {dataOne?.position} + {dataOne?.role} } @@ -113,6 +115,28 @@ export default function NavbarDetailMember({ id }: IMember) { {dataOne?.nik} + + + + + Lembaga Desa + + + + {dataOne?.group} + + + + + + + Jabatan + + + + {dataOne?.position} + + @@ -138,7 +162,7 @@ export default function NavbarDetailMember({ id }: IMember) { - + Jenis Kelamin diff --git a/src/module/user/profile/lib/type_profile.ts b/src/module/user/profile/lib/type_profile.ts index fa386ad..c176c9f 100644 --- a/src/module/user/profile/lib/type_profile.ts +++ b/src/module/user/profile/lib/type_profile.ts @@ -9,6 +9,7 @@ export interface IProfileById { idPosition: string group: string position: string + role:string } export interface IEditDataProfile { diff --git a/src/module/user/profile/ui/profile.tsx b/src/module/user/profile/ui/profile.tsx index c3af99e..2013722 100644 --- a/src/module/user/profile/ui/profile.tsx +++ b/src/module/user/profile/ui/profile.tsx @@ -7,10 +7,11 @@ import { useShallowEffect } from "@mantine/hooks"; import { useRouter } from "next/navigation"; import { useState } from "react"; import toast from "react-hot-toast"; -import { FaSquarePhone } from "react-icons/fa6"; -import { IoMaleFemale } from "react-icons/io5"; +import { BiSolidUserBadge } from "react-icons/bi"; +import { FaBuildingUser, FaSquarePhone } from "react-icons/fa6"; import { LuLogOut } from "react-icons/lu"; import { MdEmail } from "react-icons/md"; +import { PiGenderIntersexFill } from "react-icons/pi"; import { RiIdCardFill } from "react-icons/ri"; import { funGetProfileByCookies } from "../lib/api_profile"; import { IProfileById } from "../lib/type_profile"; @@ -88,7 +89,7 @@ export default function Profile() { : <> {isData?.name} - {isData?.group} - {isData?.position} + {isData?.role} } @@ -115,6 +116,28 @@ export default function Profile() { {isData?.nik} + + + + + Lembaga Desa + + + + {isData?.group} + + + + + + + Jabatan + + + + {isData?.position} + + @@ -140,7 +163,7 @@ export default function Profile() { - + Jenis Kelamin