Merge pull request #172 from bipproduction/lukman-30-agustus-2024
feat : update user
This commit is contained in:
@@ -3,6 +3,8 @@ import { funGetUserByCookies } from "@/module/auth";
|
|||||||
import { createLogUser } from "@/module/user";
|
import { createLogUser } from "@/module/user";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
import path from "path";
|
||||||
|
import fs from "fs";
|
||||||
|
|
||||||
// GET ONE MEMBER / USER
|
// GET ONE MEMBER / USER
|
||||||
export async function GET(request: Request, context: { params: { id: string } }) {
|
export async function GET(request: Request, context: { params: { id: string } }) {
|
||||||
@@ -24,6 +26,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
phone: true,
|
phone: true,
|
||||||
email: true,
|
email: true,
|
||||||
gender: true,
|
gender: true,
|
||||||
|
img: true,
|
||||||
idGroup: true,
|
idGroup: true,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
idPosition: true,
|
idPosition: true,
|
||||||
@@ -131,12 +134,27 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
||||||
}
|
}
|
||||||
const { id } = context.params;
|
const { id } = context.params;
|
||||||
const data = await request.json();
|
console.log(id)
|
||||||
|
|
||||||
|
const body = await request.formData()
|
||||||
|
const file = body.get("file") as File
|
||||||
|
const data = body.get("data")
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
email,
|
||||||
|
phone,
|
||||||
|
nik,
|
||||||
|
gender,
|
||||||
|
idGroup,
|
||||||
|
idPosition,
|
||||||
|
idUserRole
|
||||||
|
} = JSON.parse(data as string)
|
||||||
|
// const data = await request.json();
|
||||||
const cek = await prisma.user.count({
|
const cek = await prisma.user.count({
|
||||||
where: {
|
where: {
|
||||||
nik: data.nik,
|
nik: nik,
|
||||||
email: data.email,
|
email: email,
|
||||||
phone: data.phone,
|
phone: phone,
|
||||||
NOT: {
|
NOT: {
|
||||||
id: id
|
id: id
|
||||||
}
|
}
|
||||||
@@ -149,22 +167,46 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
id: id
|
id: id
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
nik: data.nik,
|
nik: nik,
|
||||||
name: data.name,
|
name: name,
|
||||||
phone: data.phone,
|
phone: "62" + phone,
|
||||||
email: data.email,
|
email: email,
|
||||||
gender: data.gender,
|
gender: gender,
|
||||||
idGroup: data.idGroup,
|
idGroup: idGroup,
|
||||||
idPosition: data.idPosition,
|
idPosition: idPosition,
|
||||||
idUserRole: data.idUserRole,
|
idUserRole: idUserRole,
|
||||||
},
|
},
|
||||||
|
select: {
|
||||||
|
img: true
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (String(file) != "undefined" && String(file) != "null") {
|
||||||
|
fs.unlink(`./public/image/user/${updates.img}`, (err) => { })
|
||||||
|
const root = path.join(process.cwd(), "./public/image/user/");
|
||||||
|
const fExt = file.name.split(".").pop()
|
||||||
|
const fileName = id + '.' + fExt;
|
||||||
|
const filePath = path.join(root, fileName);
|
||||||
|
|
||||||
|
// Konversi ArrayBuffer ke Buffer
|
||||||
|
const buffer = Buffer.from(await file.arrayBuffer());
|
||||||
|
fs.writeFileSync(filePath, buffer);
|
||||||
|
|
||||||
|
await prisma.user.update({
|
||||||
|
where: {
|
||||||
|
id: id
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
img: fileName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// create log user
|
// create log user
|
||||||
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate data user', table: 'user', data: data.id })
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate data user', table: 'user', data: user.id })
|
||||||
|
|
||||||
return Response.json(
|
return Response.json(
|
||||||
{ success: true, message: "Sukses Update User", updates },
|
{ success: true, message: "Sukses Update User" },
|
||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -6,121 +6,122 @@ import { NextResponse } from "next/server";
|
|||||||
|
|
||||||
// GET ALL MEMBER / USER
|
// GET ALL MEMBER / USER
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
let fixGroup
|
let fixGroup
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const name = searchParams.get('search')
|
const name = searchParams.get('search')
|
||||||
const idGroup = searchParams.get("group");
|
const idGroup = searchParams.get("group");
|
||||||
const active = searchParams.get("active");
|
const active = searchParams.get("active");
|
||||||
const user = await funGetUserByCookies()
|
const user = await funGetUserByCookies()
|
||||||
if (user.id == undefined) {
|
if (user.id == undefined) {
|
||||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
||||||
}
|
|
||||||
if (idGroup == "null" || idGroup == undefined) {
|
|
||||||
fixGroup = user.idGroup
|
|
||||||
} else {
|
|
||||||
fixGroup = idGroup
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const users = await prisma.user.findMany({
|
|
||||||
where: {
|
|
||||||
isActive: active == 'false' ? false : true,
|
|
||||||
idGroup: String(fixGroup),
|
|
||||||
name: {
|
|
||||||
contains: (name == undefined || name == null) ? "" : name,
|
|
||||||
mode: "insensitive",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
select: {
|
|
||||||
id: true,
|
|
||||||
isActive: true,
|
|
||||||
nik: true,
|
|
||||||
name: true,
|
|
||||||
phone: true,
|
|
||||||
email: true,
|
|
||||||
gender: true,
|
|
||||||
Position: {
|
|
||||||
select: {
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Group: {
|
|
||||||
select: {
|
|
||||||
name: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const allData = users.map((v: any) => ({
|
|
||||||
..._.omit(v, ["Group", "Position" ]),
|
|
||||||
group: v.Group.name,
|
|
||||||
position: v.Position.name
|
|
||||||
}))
|
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil member", data: allData, }, { status: 200 });
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan member, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
|
||||||
}
|
}
|
||||||
|
if (idGroup == "null" || idGroup == undefined) {
|
||||||
|
fixGroup = user.idGroup
|
||||||
|
} else {
|
||||||
|
fixGroup = idGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const users = await prisma.user.findMany({
|
||||||
|
where: {
|
||||||
|
isActive: active == 'false' ? false : true,
|
||||||
|
idGroup: String(fixGroup),
|
||||||
|
name: {
|
||||||
|
contains: (name == undefined || name == null) ? "" : name,
|
||||||
|
mode: "insensitive",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
isActive: true,
|
||||||
|
nik: true,
|
||||||
|
name: true,
|
||||||
|
phone: true,
|
||||||
|
email: true,
|
||||||
|
gender: true,
|
||||||
|
img: true,
|
||||||
|
Position: {
|
||||||
|
select: {
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Group: {
|
||||||
|
select: {
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const allData = users.map((v: any) => ({
|
||||||
|
..._.omit(v, ["Group", "Position"]),
|
||||||
|
group: v.Group.name,
|
||||||
|
position: v.Position.name
|
||||||
|
}))
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Berhasil member", data: allData, }, { status: 200 });
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan member, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CREATE MEMBER / USER
|
// CREATE MEMBER / USER
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const user = await funGetUserByCookies()
|
const user = await funGetUserByCookies()
|
||||||
if (user.id == undefined) {
|
if (user.id == undefined) {
|
||||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
||||||
}
|
}
|
||||||
const data = await request.json();
|
const data = await request.json();
|
||||||
const village = "desa1"
|
const village = "desa1"
|
||||||
|
|
||||||
const cek = await prisma.user.count({
|
const cek = await prisma.user.count({
|
||||||
where: {
|
where: {
|
||||||
nik: data.nik,
|
nik: data.nik,
|
||||||
email: data.email,
|
email: data.email,
|
||||||
phone: data.phone
|
phone: data.phone
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cek == 0) {
|
if (cek == 0) {
|
||||||
const users = await prisma.user.create({
|
const users = await prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
nik: data.nik,
|
nik: data.nik,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
phone: data.phone,
|
phone: data.phone,
|
||||||
email: data.email,
|
email: data.email,
|
||||||
gender: data.gender,
|
gender: data.gender,
|
||||||
idGroup: data.idGroup,
|
idGroup: data.idGroup,
|
||||||
idVillage: village,
|
idVillage: village,
|
||||||
idPosition: data.idPosition,
|
idPosition: data.idPosition,
|
||||||
idUserRole: data.idUserRole,
|
idUserRole: data.idUserRole,
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
nik: true,
|
nik: true,
|
||||||
name: true,
|
name: true,
|
||||||
phone: true,
|
phone: true,
|
||||||
email: true,
|
email: true,
|
||||||
gender: true,
|
gender: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// create log user
|
// create log user
|
||||||
const log = await createLogUser({ act: 'CREATE', desc: 'User membuat data user baru', table: 'user', data: users.id })
|
const log = await createLogUser({ act: 'CREATE', desc: 'User membuat data user baru', table: 'user', data: users.id })
|
||||||
|
|
||||||
return Response.json({ success: true, message: 'Sukses membuat user' }, { status: 200 });
|
return Response.json({ success: true, message: 'Sukses membuat user' }, { status: 200 });
|
||||||
} else {
|
} else {
|
||||||
return Response.json({ success: false, message: "User sudah ada" }, { status: 400 });
|
return Response.json({ success: false, message: "User sudah ada" }, { status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
return Response.json({ success: false, message: "Internal Server Error" }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ export default function DateEventDivision() {
|
|||||||
const muncul = isListTgl.includes(coba)
|
const muncul = isListTgl.includes(coba)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Indicator color="red" offset={-3} disabled={!muncul} position='top-end' inline processing size={10} >
|
<Indicator color="red" offset={-3} disabled={!muncul} position='top-end' inline size={6} >
|
||||||
<div>{day}</div>
|
<div>{day}</div>
|
||||||
</Indicator>
|
</Indicator>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -52,13 +52,10 @@ export const funEditStatusMember = async (path: string, data: IStatusmember) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const funEditMember = async (path: string, data: IEditDataMember) => {
|
export const funEditMember = async (path: string, data: FormData) => {
|
||||||
const response = await fetch(`/api/user/${path}`, {
|
const response = await fetch(`/api/user/${path}`, {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
headers: {
|
body: data,
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify(data),
|
|
||||||
});
|
});
|
||||||
return await response.json().catch(() => null);
|
return await response.json().catch(() => null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +1,54 @@
|
|||||||
export interface IListMember {
|
export interface IListMember {
|
||||||
id: string,
|
id: string,
|
||||||
name: string,
|
name: string,
|
||||||
nik: string,
|
nik: string,
|
||||||
email: string,
|
email: string,
|
||||||
phone: string,
|
phone: string,
|
||||||
gender: string,
|
gender: string,
|
||||||
position: string,
|
position: string,
|
||||||
group: string,
|
group: string,
|
||||||
isActive: boolean
|
img: string,
|
||||||
|
isActive: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IFormMember {
|
export interface IFormMember {
|
||||||
nik: string;
|
nik: string;
|
||||||
name: string;
|
name: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
email: string;
|
email: string;
|
||||||
gender: string;
|
gender: string;
|
||||||
idGroup: string;
|
idGroup: string;
|
||||||
idPosition: string;
|
idPosition: string;
|
||||||
idUserRole: string;
|
idUserRole: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IStatusmember {
|
export interface IStatusmember {
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EDIT MEMBER
|
// EDIT MEMBER
|
||||||
export interface IEditDataMember {
|
export interface IEditDataMember {
|
||||||
id: string;
|
id: string;
|
||||||
nik: string;
|
nik: string;
|
||||||
name: string;
|
name: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
email: string;
|
email: string;
|
||||||
gender: string;
|
gender: string;
|
||||||
idGroup: string;
|
idGroup: string;
|
||||||
idPosition: string;
|
idPosition: string;
|
||||||
idUserRole: string;
|
idUserRole: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IDataPositionMember {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface IDataROleMember {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IMember{
|
export interface IDataPositionMember {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface IDataROleMember {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMember {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
@@ -3,15 +3,17 @@ import { WARNA } from "@/module/_global";
|
|||||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||||
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
import { funGetAllGroup, IDataGroup } from "@/module/group";
|
||||||
import { funGetAllPosition } from "@/module/position/lib/api_position";
|
import { funGetAllPosition } from "@/module/position/lib/api_position";
|
||||||
import { Box, Button, Select, Stack, Text, TextInput } from "@mantine/core";
|
import { Avatar, Box, Button, Indicator, Select, Stack, Text, TextInput } from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { HiUser } from "react-icons/hi2";
|
import { HiUser } from "react-icons/hi2";
|
||||||
import { IDataPositionMember, IDataROleMember, IEditDataMember, IFormMember } from "../lib/type_member";
|
import { IDataPositionMember, IDataROleMember, IEditDataMember, IFormMember } from "../lib/type_member";
|
||||||
import { funEditMember, funGetOneMember, funGetRoleUser } from "../lib/api_member";
|
import { funEditMember, funGetOneMember, funGetRoleUser } from "../lib/api_member";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import { Dropzone } from "@mantine/dropzone";
|
||||||
|
import { FaCamera } from "react-icons/fa6";
|
||||||
|
|
||||||
|
|
||||||
export default function EditMember({ id }: { id: string }) {
|
export default function EditMember({ id }: { id: string }) {
|
||||||
@@ -20,6 +22,9 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
const [listGroup, setListGorup] = useState<IDataGroup[]>([])
|
const [listGroup, setListGorup] = useState<IDataGroup[]>([])
|
||||||
const [listPosition, setListPosition] = useState<IDataPositionMember[]>([])
|
const [listPosition, setListPosition] = useState<IDataPositionMember[]>([])
|
||||||
const [listUserRole, setListUserRole] = useState<IDataROleMember[]>([])
|
const [listUserRole, setListUserRole] = useState<IDataROleMember[]>([])
|
||||||
|
const [imgForm, setImgForm] = useState<any>()
|
||||||
|
const openRef = useRef<() => void>(null)
|
||||||
|
const [img, setIMG] = useState<any | null>()
|
||||||
const [touched, setTouched] = useState({
|
const [touched, setTouched] = useState({
|
||||||
nik: false,
|
nik: false,
|
||||||
name: false,
|
name: false,
|
||||||
@@ -61,6 +66,7 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
const res = await funGetOneMember(id)
|
const res = await funGetOneMember(id)
|
||||||
setData(res.data)
|
setData(res.data)
|
||||||
getAllPosition(res.data?.idGroup)
|
getAllPosition(res.data?.idGroup)
|
||||||
|
setIMG(`/api/file/img?cat=user&file=${res.data.img}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
@@ -110,17 +116,11 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (val) {
|
if (val) {
|
||||||
const res = await funEditMember(id, {
|
const fd = new FormData()
|
||||||
id: data.id,
|
fd.append("file", imgForm)
|
||||||
nik: data.nik,
|
fd.append("data", JSON.stringify(data))
|
||||||
name: data.name,
|
|
||||||
phone: data.phone,
|
const res = await funEditMember(id, fd)
|
||||||
email: data.email,
|
|
||||||
gender: data.gender,
|
|
||||||
idGroup: data.idGroup,
|
|
||||||
idPosition: data.idPosition,
|
|
||||||
idUserRole: data.idUserRole
|
|
||||||
})
|
|
||||||
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
toast.success(res.message)
|
toast.success(res.message)
|
||||||
@@ -144,12 +144,30 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
pt={30}
|
pt={30}
|
||||||
px={20}
|
px={20}
|
||||||
>
|
>
|
||||||
<Box bg={WARNA.biruTua} py={30} px={50}
|
<Dropzone
|
||||||
style={{
|
openRef={openRef}
|
||||||
borderRadius: 10,
|
onDrop={async (files) => {
|
||||||
}}>
|
if (!files || _.isEmpty(files))
|
||||||
<HiUser size={100} color={WARNA.bgWhite} />
|
return toast.error('Tidak ada gambar yang dipilih')
|
||||||
</Box>
|
setImgForm(files[0])
|
||||||
|
const buffer = URL.createObjectURL(new Blob([new Uint8Array(await files[0].arrayBuffer())]))
|
||||||
|
setIMG(buffer)
|
||||||
|
}}
|
||||||
|
activateOnClick={false}
|
||||||
|
maxSize={1 * 1024 ** 2}
|
||||||
|
accept={['image/png', 'image/jpeg', 'image/heic']}
|
||||||
|
onReject={(files) => {
|
||||||
|
return toast.error('File yang diizinkan: .png, .jpg, dan .heic dengan ukuran maksimal 1 MB')
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
</Dropzone>
|
||||||
|
<Indicator offset={20} withBorder inline color={WARNA.borderBiruMuda} position="bottom-end" label={<FaCamera size={20} />} size={40} onClick={() => openRef.current?.()}>
|
||||||
|
<Avatar
|
||||||
|
size="150"
|
||||||
|
radius={"100"}
|
||||||
|
src={img}
|
||||||
|
/>
|
||||||
|
</Indicator>
|
||||||
<Select
|
<Select
|
||||||
placeholder="Pilih Grup" label="Grup" w={"100%"} size="md" required withAsterisk radius={30}
|
placeholder="Pilih Grup" label="Grup" w={"100%"} size="md" required withAsterisk radius={30}
|
||||||
styles={{
|
styles={{
|
||||||
@@ -311,7 +329,8 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
borderColor: WARNA.biruTua,
|
borderColor: WARNA.biruTua,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
placeholder="62xxx xxxx xxxx"
|
placeholder="8xxx xxxx xxxx"
|
||||||
|
leftSection={<Text>+62</Text>}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setData({ ...data, phone: e.target.value })
|
setData({ ...data, phone: e.target.value })
|
||||||
setTouched({ ...touched, phone: false })
|
setTouched({ ...touched, phone: false })
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default function NavbarDetailMember({ id }: IMember) {
|
|||||||
gap="xs"
|
gap="xs"
|
||||||
>
|
>
|
||||||
<Center>
|
<Center>
|
||||||
<Avatar src={'https://i.pravatar.cc/1000?img=25'} alt="it's me" size="xl" />
|
<Avatar src={`/api/file/img?cat=user&file=${dataOne?.img}`} alt="it's me" size="xl" />
|
||||||
</Center>
|
</Center>
|
||||||
{loading ?
|
{loading ?
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import { SkeletonSingle, WARNA } from "@/module/_global"
|
import { SkeletonSingle, WARNA } from "@/module/_global"
|
||||||
import { Box, Group, ActionIcon, Text, TextInput, Divider } from "@mantine/core"
|
import { Box, Group, ActionIcon, Text, TextInput, Divider, Avatar } from "@mantine/core"
|
||||||
import { useShallowEffect } from "@mantine/hooks"
|
import { useShallowEffect } from "@mantine/hooks"
|
||||||
import { useRouter, useSearchParams } from "next/navigation"
|
import { useRouter, useSearchParams } from "next/navigation"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
@@ -9,6 +9,7 @@ import { IListMember } from "../lib/type_member"
|
|||||||
import { funGetAllmember } from "../lib/api_member"
|
import { funGetAllmember } from "../lib/api_member"
|
||||||
import { funGetAllGroup, IDataGroup } from "@/module/group"
|
import { funGetAllGroup, IDataGroup } from "@/module/group"
|
||||||
import toast from "react-hot-toast"
|
import toast from "react-hot-toast"
|
||||||
|
import _ from "lodash"
|
||||||
|
|
||||||
|
|
||||||
export default function TabListMember() {
|
export default function TabListMember() {
|
||||||
@@ -107,12 +108,10 @@ export default function TabListMember() {
|
|||||||
padding: 10,
|
padding: 10,
|
||||||
}} >
|
}} >
|
||||||
<Box>
|
<Box>
|
||||||
<ActionIcon variant="light" bg={WARNA.biruTua} size={50} radius={100} aria-label="icon">
|
<Avatar src={`/api/file/img?cat=user&file=${v.img}`} size={50} alt="image" />
|
||||||
<HiMiniUser color={'white'} size={25} />
|
|
||||||
</ActionIcon>
|
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text fw={'bold'} c={WARNA.biruTua}>{v.name}</Text>
|
<Text fw={'bold'} c={WARNA.biruTua}>{_.startCase(v.name)}</Text>
|
||||||
<Text fw={'lighter'} fz={12}>{v.group + ' - ' + v.position}</Text>
|
<Text fw={'lighter'} fz={12}>{v.group + ' - ' + v.position}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Group>
|
</Group>
|
||||||
|
|||||||
Reference in New Issue
Block a user