fix: project
Deskripsi: - menampilkan semua anggota kecuali supadmin pada tambah kegiatan dan tambah anggota di kegiatan NO Issues
This commit is contained in:
@@ -133,13 +133,13 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
const member = await prisma.user.findMany({
|
const member = await prisma.user.findMany({
|
||||||
where: {
|
where: {
|
||||||
idGroup: String(groupId),
|
idGroup: String(groupId),
|
||||||
id: {
|
// id: {
|
||||||
not: String(userId)
|
// not: String(userId)
|
||||||
},
|
// },
|
||||||
OR: [
|
// OR: [
|
||||||
{ idUserRole: 'coadmin', },
|
// { idUserRole: 'coadmin', },
|
||||||
{ idUserRole: 'user', }
|
// { idUserRole: 'user', }
|
||||||
],
|
// ],
|
||||||
isActive: true,
|
isActive: true,
|
||||||
name: {
|
name: {
|
||||||
contains: (name == undefined || name == "null") ? "" : name,
|
contains: (name == undefined || name == "null") ? "" : name,
|
||||||
@@ -149,6 +149,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
idUserRole: true,
|
||||||
name: true,
|
name: true,
|
||||||
email: true,
|
email: true,
|
||||||
img: true,
|
img: true,
|
||||||
@@ -172,7 +173,8 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
idUser: v.id,
|
idUser: v.id,
|
||||||
name: v.name,
|
name: v.name,
|
||||||
email: v.email,
|
email: v.email,
|
||||||
img: v.img
|
img: v.img,
|
||||||
|
idUserRole: v.idUserRole
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const dataFix = {
|
const dataFix = {
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ export default function AddMemberDetailProject() {
|
|||||||
setLoading(true)
|
setLoading(true)
|
||||||
const response = await funGetAllMemberById('?search=' + searchQuery, param.id)
|
const response = await funGetAllMemberById('?search=' + searchQuery, param.id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data.member)
|
// setData(response.data.member)
|
||||||
|
setData(response.data.member.filter((i: any) => i.idUserRole != 'supadmin'))
|
||||||
} else {
|
} else {
|
||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
@@ -243,7 +244,7 @@ export default function AddMemberDetailProject() {
|
|||||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada anggota</Text>
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada anggota</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
:
|
:
|
||||||
<Box mt={15} mb={100}>
|
<Box mt={100} mb={100}>
|
||||||
{isData.map((v, i) => {
|
{isData.map((v, i) => {
|
||||||
const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser);
|
const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser);
|
||||||
const found = isDataMember.some((i: any) => i.idUser == v.idUser)
|
const found = isDataMember.some((i: any) => i.idUser == v.idUser)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, SkeletonList, TEMA } from '@/module/_global';
|
import { LayoutNavbarNew, SkeletonList, TEMA } from '@/module/_global';
|
||||||
import { funGetUserByCookies } from '@/module/auth';
|
|
||||||
import { funGetAllmember, TypeUser } from '@/module/user';
|
import { funGetAllmember, TypeUser } from '@/module/user';
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import { Carousel } from '@mantine/carousel';
|
import { Carousel } from '@mantine/carousel';
|
||||||
@@ -36,9 +35,10 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
|||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const res = await funGetAllmember('?active=true&group=' + grup + '&search=' + search);
|
const res = await funGetAllmember('?active=true&group=' + grup + '&search=' + search);
|
||||||
const user = await funGetUserByCookies();
|
// const user = await funGetUserByCookies();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setDataMember(res.data.filter((i: any) => i.id != user.id && i.idUserRole != 'supadmin' && i.idUserRole != 'cosupadmin'))
|
// setDataMember(res.data.filter((i: any) => i.id != user.id && i.idUserRole != 'supadmin' && i.idUserRole != 'cosupadmin'))
|
||||||
|
setDataMember(res.data.filter((i: any) => i.idUserRole != 'supadmin'))
|
||||||
// cek data member sebelumnya
|
// cek data member sebelumnya
|
||||||
if (member.length > 0) {
|
if (member.length > 0) {
|
||||||
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
||||||
|
|||||||
@@ -15,17 +15,19 @@ export default function MenuDrawerProject() {
|
|||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Stack pt={10}>
|
<Stack pt={10}>
|
||||||
<SimpleGrid
|
<SimpleGrid cols={{ base: 2, sm: 2, lg: 3 }} >
|
||||||
cols={{ base: 2, sm: 2, lg: 3 }}
|
{
|
||||||
>
|
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
|
||||||
<Flex onClick={() => window.location.href = "/project/create"} justify={'center'} align={'center'} direction={'column'} >
|
<Flex onClick={() => window.location.href = "/project/create"} justify={'center'} align={'center'} direction={'column'} >
|
||||||
<Box>
|
<Box>
|
||||||
<IoAddCircle size={30} color={tema.get().utama} />
|
<IoAddCircle size={30} color={tema.get().utama} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={tema.get().utama}>Tambah Kegiatan</Text>
|
<Text c={tema.get().utama}>Tambah Kegiatan</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
roleLogin.get() == "supadmin" &&
|
roleLogin.get() == "supadmin" &&
|
||||||
<Flex onClick={() => window.location.href = "/project?page=filter&group=" + group} justify={'center'} align={'center'} direction={'column'} >
|
<Flex onClick={() => window.location.href = "/project?page=filter&group=" + group} justify={'center'} align={'center'} direction={'column'} >
|
||||||
|
|||||||
Reference in New Issue
Block a user