fix: project

Deskripsi:
- menampilkan semua anggota kecuali supadmin pada tambah kegiatan dan tambah anggota di kegiatan

NO Issues
This commit is contained in:
amel
2024-12-26 17:40:00 +08:00
parent 512d1c1f2d
commit 166b4b18db
4 changed files with 29 additions and 24 deletions

View File

@@ -40,7 +40,8 @@ export default function AddMemberDetailProject() {
setLoading(true)
const response = await funGetAllMemberById('?search=' + searchQuery, param.id)
if (response.success) {
setData(response.data.member)
// setData(response.data.member)
setData(response.data.member.filter((i: any) => i.idUserRole != 'supadmin'))
} else {
toast.error(response.message)
}
@@ -243,7 +244,7 @@ export default function AddMemberDetailProject() {
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada anggota</Text>
</Stack>
:
<Box mt={15} mb={100}>
<Box mt={100} mb={100}>
{isData.map((v, i) => {
const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser);
const found = isDataMember.some((i: any) => i.idUser == v.idUser)

View File

@@ -1,6 +1,5 @@
"use client"
import { LayoutNavbarNew, SkeletonList, TEMA } from '@/module/_global';
import { funGetUserByCookies } from '@/module/auth';
import { funGetAllmember, TypeUser } from '@/module/user';
import { useHookstate } from '@hookstate/core';
import { Carousel } from '@mantine/carousel';
@@ -36,9 +35,10 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
try {
setLoading(true)
const res = await funGetAllmember('?active=true&group=' + grup + '&search=' + search);
const user = await funGetUserByCookies();
// const user = await funGetUserByCookies();
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
if (member.length > 0) {
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))

View File

@@ -15,17 +15,19 @@ export default function MenuDrawerProject() {
return (
<Box>
<Stack pt={10}>
<SimpleGrid
cols={{ base: 2, sm: 2, lg: 3 }}
>
<Flex onClick={() => window.location.href = "/project/create"} justify={'center'} align={'center'} direction={'column'} >
<Box>
<IoAddCircle size={30} color={tema.get().utama} />
</Box>
<Box>
<Text c={tema.get().utama}>Tambah Kegiatan</Text>
</Box>
</Flex>
<SimpleGrid 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'} >
<Box>
<IoAddCircle size={30} color={tema.get().utama} />
</Box>
<Box>
<Text c={tema.get().utama}>Tambah Kegiatan</Text>
</Box>
</Flex>
}
{
roleLogin.get() == "supadmin" &&
<Flex onClick={() => window.location.href = "/project?page=filter&group=" + group} justify={'center'} align={'center'} direction={'column'} >