Merge pull request #94 from bipproduction/lukman/6-agustus-2024
Lukman/6 agustus 2024
This commit is contained in:
@@ -3,7 +3,7 @@ import { ViewListAnnouncement } from "@/module/announcement";
|
|||||||
|
|
||||||
function Page({ searchParams }: { searchParams: { page: string } }) {
|
function Page({ searchParams }: { searchParams: { page: string } }) {
|
||||||
if (searchParams.page == 'filter')
|
if (searchParams.page == 'filter')
|
||||||
return <ViewFilter />
|
return <ViewFilter linkFilter="announcement"/>
|
||||||
return (
|
return (
|
||||||
<ViewListAnnouncement />
|
<ViewListAnnouncement />
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
function Page({ searchParams }: { searchParams: { page: string } }) {
|
function Page({ searchParams }: { searchParams: { page: string } }) {
|
||||||
if (searchParams.page == "filter")
|
if (searchParams.page == "filter")
|
||||||
return <ViewFilter />
|
return <ViewFilter linkFilter='division'/>
|
||||||
if (searchParams.page == "report")
|
if (searchParams.page == "report")
|
||||||
return <ViewCreateReport />
|
return <ViewCreateReport />
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ViewListMember } from "@/module/user/member";
|
|||||||
|
|
||||||
function Page({ searchParams }: { searchParams: { page: string } }) {
|
function Page({ searchParams }: { searchParams: { page: string } }) {
|
||||||
if (searchParams.page == "filter")
|
if (searchParams.page == "filter")
|
||||||
return <ViewFilter />
|
return <ViewFilter linkFilter="member"/>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewListMember />
|
<ViewListMember />
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import React from 'react';
|
|||||||
|
|
||||||
function Page({ searchParams }: { searchParams: { page: string } }) {
|
function Page({ searchParams }: { searchParams: { page: string } }) {
|
||||||
if (searchParams.page == "filter")
|
if (searchParams.page == "filter")
|
||||||
return <ViewFilter />
|
return <ViewFilter linkFilter='position'/>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewListPosition />
|
<ViewListPosition />
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import React from 'react';
|
|||||||
|
|
||||||
function Page({ searchParams }: { searchParams: { cat: string } }) {
|
function Page({ searchParams }: { searchParams: { cat: string } }) {
|
||||||
if (searchParams.cat == 'filter')
|
if (searchParams.cat == 'filter')
|
||||||
return <ViewFilter />
|
return <ViewFilter linkFilter='project' />
|
||||||
return (
|
return (
|
||||||
<ViewProject />
|
<ViewProject />
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,62 +1,66 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { Box, Group, Divider, Button, Text } from "@mantine/core";
|
import { Box, Group, Divider, Button, Text } from "@mantine/core";
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { FaCheck } from "react-icons/fa6";
|
import { FaCheck } from "react-icons/fa6";
|
||||||
import { WARNA } from "../fun/WARNA";
|
import { WARNA } from "../fun/WARNA";
|
||||||
import LayoutNavbarNew from "../layout/layout_navbar_new";
|
import LayoutNavbarNew from "../layout/layout_navbar_new";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
import { API_ADDRESS } from "../bin/api_address";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
|
||||||
const dataFilter = [
|
interface dataGroup {
|
||||||
{
|
id: string;
|
||||||
id: 1,
|
name: string;
|
||||||
name: 'Dinas'
|
}
|
||||||
},
|
|
||||||
{
|
export default function ViewFilter({linkFilter}: {linkFilter: string}) {
|
||||||
id: 2,
|
|
||||||
name: 'Adat'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: 'LPD'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
name: 'Karang Taruna'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
name: 'BPD'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 6,
|
|
||||||
name: 'LPM'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
export default function ViewFilter() {
|
|
||||||
const [selectedFilter, setSelectedFilter] = useState<string | null>(null);
|
const [selectedFilter, setSelectedFilter] = useState<string | null>(null);
|
||||||
|
const [checked, setChecked] = useState<dataGroup[]>([]);
|
||||||
|
const [searchParams, setSearchParams] = useState({ groupId: '' });
|
||||||
|
|
||||||
const handleFilterClick = (filterName: string) => {
|
const handleFilterClick = (id: string) => {
|
||||||
setSelectedFilter(filterName);
|
setSelectedFilter(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function getAllGroupFilter() {
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_ADDRESS.apiGetAllGroup}&active=true&groupId=${searchParams.groupId}`);
|
||||||
|
const data = await response.json();
|
||||||
|
console.log("mana data", response);
|
||||||
|
setChecked(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedFilter) {
|
||||||
|
setSearchParams({ groupId: selectedFilter });
|
||||||
|
}
|
||||||
|
}, [selectedFilter]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getAllGroupFilter();
|
||||||
|
}, [searchParams.groupId]);
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<LayoutNavbarNew back='' title='Filter' menu />
|
<LayoutNavbarNew back='' title='Filter' menu />
|
||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
{dataFilter.map((filter) => (
|
{checked.map((filter) => (
|
||||||
<Box key={filter.id}>
|
<Box key={filter.id}>
|
||||||
<Group
|
<Group
|
||||||
justify="space-between"
|
justify="space-between"
|
||||||
align="center"
|
align="center"
|
||||||
mb={10}
|
mb={10}
|
||||||
onClick={() => handleFilterClick(filter.name)}
|
onClick={() => handleFilterClick(filter.id)}
|
||||||
>
|
>
|
||||||
<Text fw={selectedFilter === filter.name ? 'bold' : 'normal'}>
|
<Text fw={selectedFilter === filter.id ? 'bold' : 'normal'}>
|
||||||
{filter.name}
|
{filter.name}
|
||||||
</Text>
|
</Text>
|
||||||
{selectedFilter === filter.name && <FaCheck size={25} />}
|
{selectedFilter === filter.id && <FaCheck size={25} />}
|
||||||
</Group>
|
</Group>
|
||||||
<Divider my={"sm"} />
|
<Divider my={"sm"} />
|
||||||
</Box>
|
</Box>
|
||||||
@@ -66,7 +70,9 @@ export default function ViewFilter() {
|
|||||||
radius={100}
|
radius={100}
|
||||||
size="lg"
|
size="lg"
|
||||||
color={WARNA.biruTua}
|
color={WARNA.biruTua}
|
||||||
onClick={() => { router.back() }}
|
onClick={() => {
|
||||||
|
router.push(`/${linkFilter}?group=` + selectedFilter)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Terapkan
|
Terapkan
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default function ListGroupActive({ status }: { status: boolean }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useShallowEffect(() => {
|
||||||
getData();
|
getData();
|
||||||
}, [status]);
|
}, [status]);
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { FaPencil, FaToggleOff } from "react-icons/fa6";
|
import { FaPencil, FaToggleOff } from "react-icons/fa6";
|
||||||
@@ -42,7 +43,7 @@ export default function EditDrawerGroup({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useShallowEffect(() => {
|
||||||
getOneGroup();
|
getOneGroup();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ export default function EditDrawerGroup({
|
|||||||
<FaToggleOff size={30} color={WARNA.biruTua} />
|
<FaToggleOff size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua}>Non Aktifkan</Text>
|
<Text c={WARNA.biruTua}>{isActive == false ? "Aktifkan" : "Non Aktifkan"}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex
|
<Flex
|
||||||
|
|||||||
@@ -13,14 +13,12 @@ export async function getAllPosition(req: NextRequest) {
|
|||||||
const user = await funGetUserByCookies()
|
const user = await funGetUserByCookies()
|
||||||
console.log(groupID)
|
console.log(groupID)
|
||||||
|
|
||||||
if (groupID == null) {
|
if (groupID == "null") {
|
||||||
grupFix = user.idGroup
|
grupFix = user.idGroup
|
||||||
} else {
|
} else {
|
||||||
grupFix = groupID
|
grupFix = groupID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const positions = await prisma.position.findMany({
|
const positions = await prisma.position.findMany({
|
||||||
where: {
|
where: {
|
||||||
idGroup: String(grupFix),
|
idGroup: String(grupFix),
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
import { NextRequest } from "next/server";
|
||||||
|
|
||||||
export async function deletePosition(req: Request) {
|
export async function deletePosition(req: NextRequest) {
|
||||||
try {
|
try {
|
||||||
const data = await req.json();
|
const data = await req.json();
|
||||||
const active = data.isActive;
|
const active = data.isActive;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { API_ADDRESS, LayoutDrawer, WARNA } from "@/module/_global"
|
import { API_ADDRESS, LayoutDrawer, WARNA } from "@/module/_global"
|
||||||
import LayoutModal from "@/module/_global/layout/layout_modal"
|
import LayoutModal from "@/module/_global/layout/layout_modal"
|
||||||
import { Box, Stack, SimpleGrid, Flex, Text, Select, TextInput, Button } from "@mantine/core"
|
import { Box, Stack, SimpleGrid, Flex, Text, Select, TextInput, Button } from "@mantine/core"
|
||||||
|
import { useShallowEffect } from "@mantine/hooks"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import toast from "react-hot-toast"
|
import toast from "react-hot-toast"
|
||||||
import { FaPencil, FaToggleOff } from "react-icons/fa6"
|
import { FaPencil, FaToggleOff } from "react-icons/fa6"
|
||||||
@@ -11,8 +12,8 @@ type dataGroup = {
|
|||||||
idGroup: string
|
idGroup: string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function DrawerDetailPosition({ onUpdated, id }: {
|
export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
||||||
onUpdated: (val: boolean) => void, id: string | null,
|
onUpdated: (val: boolean) => void, id: string | null, isActive: boolean | null;
|
||||||
}) {
|
}) {
|
||||||
const [openDrawerGroup, setOpenDrawerGroup] = useState(false)
|
const [openDrawerGroup, setOpenDrawerGroup] = useState(false)
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
@@ -28,12 +29,6 @@ export default function DrawerDetailPosition({ onUpdated, id }: {
|
|||||||
setOpenDrawerGroup(false)
|
setOpenDrawerGroup(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTrue(val: boolean) {
|
|
||||||
if (val) {
|
|
||||||
onUpdated(true)
|
|
||||||
}
|
|
||||||
setModal(false)
|
|
||||||
}
|
|
||||||
async function getAllGroup() {
|
async function getAllGroup() {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${API_ADDRESS.apiGetAllGroup}&villageId=121212&active=true`)
|
const res = await fetch(`${API_ADDRESS.apiGetAllGroup}&villageId=121212&active=true`)
|
||||||
@@ -65,7 +60,7 @@ export default function DrawerDetailPosition({ onUpdated, id }: {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
id: data.id,
|
id: data.id,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
idGroup: data.idGroup
|
idGroup: data.idGroup,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -84,7 +79,7 @@ export default function DrawerDetailPosition({ onUpdated, id }: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useShallowEffect(() => {
|
||||||
getAllGroup()
|
getAllGroup()
|
||||||
getOneData()
|
getOneData()
|
||||||
}, [])
|
}, [])
|
||||||
@@ -98,7 +93,8 @@ export default function DrawerDetailPosition({ onUpdated, id }: {
|
|||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
data
|
id,
|
||||||
|
isActive,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -132,7 +128,7 @@ export default function DrawerDetailPosition({ onUpdated, id }: {
|
|||||||
<FaToggleOff size={30} color={WARNA.biruTua} />
|
<FaToggleOff size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua}>Non Aktifkan</Text>
|
<Text c={WARNA.biruTua}>{isActive == false ? "Aktifkan" : "Non Aktifkan"}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { WARNA, LayoutDrawer, API_ADDRESS } from "@/module/_global";
|
import { WARNA, LayoutDrawer, API_ADDRESS } from "@/module/_global";
|
||||||
import { Box, Stack, SimpleGrid, Flex, TextInput, Button, Text, Select } from "@mantine/core";
|
import { Box, Stack, SimpleGrid, Flex, TextInput, Button, Text, Select } from "@mantine/core";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
@@ -31,7 +32,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useShallowEffect(() => {
|
||||||
getAllGroup()
|
getAllGroup()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import DrawerDetailPosition from "./drawer_detail_position";
|
|||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { useSearchParams } from "next/navigation";
|
||||||
|
|
||||||
type dataPosition = {
|
type dataPosition = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -23,12 +24,14 @@ export default function ListPositionActive({ status }: { status: boolean }) {
|
|||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [selectId, setSelectId] = useState<string | null>(null);
|
const [selectId, setSelectId] = useState<string | null>(null);
|
||||||
const [active, setActive] = useState<boolean | null>(null)
|
const [active, setActive] = useState<boolean | null>(null)
|
||||||
|
const searchParams = useSearchParams()
|
||||||
|
const group = searchParams.get('group')
|
||||||
|
|
||||||
async function getAllPosition() {
|
async function getAllPosition() {
|
||||||
try {
|
try {
|
||||||
setDataPosition([]);
|
setDataPosition([]);
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const res = await fetch(`${API_ADDRESS.apiGetAllPosition}&active=` + status);
|
const res = await fetch(`${API_ADDRESS.apiGetAllPosition}&active=${status}&groupId=${group}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
setDataPosition(data);
|
setDataPosition(data);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -41,7 +44,7 @@ export default function ListPositionActive({ status }: { status: boolean }) {
|
|||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
getAllPosition();
|
getAllPosition();
|
||||||
}, [status])
|
}, [status, group])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box pt={20}>
|
<Box pt={20}>
|
||||||
@@ -111,6 +114,7 @@ export default function ListPositionActive({ status }: { status: boolean }) {
|
|||||||
>
|
>
|
||||||
<DrawerDetailPosition
|
<DrawerDetailPosition
|
||||||
id={selectId}
|
id={selectId}
|
||||||
|
isActive={active}
|
||||||
onUpdated={() => {
|
onUpdated={() => {
|
||||||
setOpenDrawer(false);
|
setOpenDrawer(false);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ export async function getAllUser(req: NextRequest) {
|
|||||||
try {
|
try {
|
||||||
let fixGroup
|
let fixGroup
|
||||||
const searchParams = req.nextUrl.searchParams;
|
const searchParams = req.nextUrl.searchParams;
|
||||||
const idGroup = searchParams.get("groupID");
|
const idGroup = searchParams.get("groupId");
|
||||||
const active = searchParams.get("active");
|
const active = searchParams.get("active");
|
||||||
const user = await funGetUserByCookies();
|
const user = await funGetUserByCookies();
|
||||||
|
|
||||||
if (idGroup == null || idGroup == undefined) {
|
if (idGroup == "null" || idGroup == undefined) {
|
||||||
fixGroup = user.idGroup
|
fixGroup = user.idGroup
|
||||||
} else {
|
} else {
|
||||||
fixGroup = idGroup
|
fixGroup = idGroup
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export async function getOneUser(req: NextRequest) {
|
|||||||
email: true,
|
email: true,
|
||||||
gender: true,
|
gender: true,
|
||||||
idGroup: true,
|
idGroup: true,
|
||||||
|
isActive: true,
|
||||||
idPosition: true,
|
idPosition: true,
|
||||||
UserRole: {
|
UserRole: {
|
||||||
select: {
|
select: {
|
||||||
|
|||||||
@@ -2,39 +2,42 @@
|
|||||||
import { API_ADDRESS, WARNA } from "@/module/_global";
|
import { API_ADDRESS, WARNA } from "@/module/_global";
|
||||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||||
import { Box, Flex, SimpleGrid, Stack, Text } from "@mantine/core";
|
import { Box, Flex, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { FaPencil, FaToggleOff } from "react-icons/fa6";
|
import { FaPencil, FaToggleOff } from "react-icons/fa6";
|
||||||
import { ImUserCheck } from "react-icons/im";
|
import { ImUserCheck } from "react-icons/im";
|
||||||
|
|
||||||
export default function DrawerDetailMember({ onDeleted, id }: { onDeleted: (val: boolean) => void, id: string | undefined }) {
|
export default function DrawerDetailMember({ onDeleted, id, status }: { onDeleted: (val: boolean) => void, id: string | undefined, status: boolean |undefined }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
|
|
||||||
|
|
||||||
async function nonActive(val: boolean) {
|
async function nonActive(val: boolean) {
|
||||||
// try {
|
try {
|
||||||
// if (val) {
|
const res = await fetch(API_ADDRESS.apiDeleteUser, {
|
||||||
// const res = await fetch(API_ADDRESS.apiDeleteUser, {
|
method: 'POST',
|
||||||
// method: 'POST',
|
headers: {
|
||||||
// headers: {
|
'Content-Type': 'application/json',
|
||||||
// 'Content-Type': 'application/json',
|
},
|
||||||
// },
|
body: JSON.stringify({
|
||||||
// body: JSON.stringify({ id: id}),
|
id,
|
||||||
// })
|
isActive: status
|
||||||
// if (res.status == 200) {
|
}),
|
||||||
// onDeleted(true);
|
})
|
||||||
// } else {
|
if (res.status == 200) {
|
||||||
// onDeleted(false);
|
onDeleted(true);
|
||||||
// }
|
} else {
|
||||||
// }
|
onDeleted(false);
|
||||||
// router.push('/member')
|
}
|
||||||
// setModal(false)
|
router.push('/member')
|
||||||
// } catch (error) {
|
setModal(false)
|
||||||
// console.error(error)
|
} catch (error) {
|
||||||
// setModal(false);
|
console.error(error)
|
||||||
// toast.error("Terjadi kesalahan");
|
setModal(false);
|
||||||
// }
|
toast.error("Terjadi kesalahan");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -53,7 +56,7 @@ export default function DrawerDetailMember({ onDeleted, id }: { onDeleted: (val:
|
|||||||
<FaToggleOff size={30} color={WARNA.biruTua} />
|
<FaToggleOff size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua} ta='center'>Non Aktifkan</Text>
|
<Text c={WARNA.biruTua} ta='center'> {status === false ? "Aktifkan" : "Non Aktifkan"}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ interface DataMember {
|
|||||||
gender: string
|
gender: string
|
||||||
position: string
|
position: string
|
||||||
group: string
|
group: string
|
||||||
|
isActive: boolean | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function NavbarDetailMember({ id }: IdMember) {
|
export default function NavbarDetailMember({ id }: IdMember) {
|
||||||
@@ -102,7 +103,7 @@ export default function NavbarDetailMember({ id }: IdMember) {
|
|||||||
</Group>
|
</Group>
|
||||||
</Box>
|
</Box>
|
||||||
<LayoutDrawer opened={isOpen} title={'Menu'} onClose={() => setOpen(false)}>
|
<LayoutDrawer opened={isOpen} title={'Menu'} onClose={() => setOpen(false)}>
|
||||||
<DrawerDetailMember id={dataOne?.id} onDeleted={() => setOpen(false)} />
|
<DrawerDetailMember id={dataOne?.id} status={dataOne?.isActive} onDeleted={() => setOpen(false)} />
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { API_ADDRESS, WARNA } from "@/module/_global"
|
import { API_ADDRESS, WARNA } from "@/module/_global"
|
||||||
import { Box, Group, ActionIcon, Text } from "@mantine/core"
|
import { Box, Group, ActionIcon, Text } from "@mantine/core"
|
||||||
import { useShallowEffect } from "@mantine/hooks"
|
import { useShallowEffect } from "@mantine/hooks"
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter, useSearchParams } from "next/navigation"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { HiMiniUser } from "react-icons/hi2"
|
import { HiMiniUser } from "react-icons/hi2"
|
||||||
|
|
||||||
@@ -22,12 +22,14 @@ export default function TabListMember({ status }: { status: boolean }) {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [dataMember, setDataMember] = useState<dataMember[]>([])
|
const [dataMember, setDataMember] = useState<dataMember[]>([])
|
||||||
|
const searchParams = useSearchParams()
|
||||||
|
const group = searchParams.get('group')
|
||||||
|
|
||||||
|
|
||||||
async function getAllUser() {
|
async function getAllUser() {
|
||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const res = await fetch(API_ADDRESS.apiGetAllUser + '&active=' + status )
|
const res = await fetch(`${API_ADDRESS.apiGetAllUser}&active=${status}&groupId=${group}` )
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
|
|
||||||
setDataMember(data)
|
setDataMember(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user