fitur:
Deskripsi: - one detail divisi - update routing fitur divisi - update env No Issues
This commit is contained in:
3
.env
3
.env
@@ -4,4 +4,5 @@
|
|||||||
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
||||||
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
||||||
|
|
||||||
DATABASE_URL="postgresql://bip:Production_123d@localhost:5433/sistem_desa_mandiri?schema=public"
|
DATABASE_URL="postgresql://bip:Production_123d@localhost:5433/sistem_desa_mandiri?schema=public"
|
||||||
|
URL="http://localhost:3000"
|
||||||
@@ -6,4 +6,4 @@ function Page() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Page
|
export default Page
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { ViewDetailDivision } from '@/module/division_new';
|
import { ViewDetailDivision } from '@/module/division_new';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
function Page() {
|
function Page({ params }: { params: { id: string } }) {
|
||||||
return (
|
return (
|
||||||
<ViewDetailDivision />
|
<ViewDetailDivision id={params.id}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,5 +38,7 @@ export const API_ADDRESS = {
|
|||||||
|
|
||||||
// Division
|
// Division
|
||||||
"apiGetAllDivision": "/api/division/get?path=get-all-division",
|
"apiGetAllDivision": "/api/division/get?path=get-all-division",
|
||||||
|
"apiGetOneDivision": "/api/division/get?path=get-one-division",
|
||||||
|
"apiGetOneDetailDivision": "/api/division/get?path=get-one-detail-division",
|
||||||
"apiCreateDivision": "/api/division/post?path=create-division",
|
"apiCreateDivision": "/api/division/post?path=create-division",
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import getAllDivision from "./get/getAllDivision";
|
import getAllDivision from "./get/getAllDivision";
|
||||||
import getOneDivision from "./get/getOneDivision";
|
import getOneDivision from "./get/getOneDivision";
|
||||||
|
import getOneDetailDivision from "./get/getOneDetailDivision";
|
||||||
import createDivision from "./post/createDivision";
|
import createDivision from "./post/createDivision";
|
||||||
import deleteDivision from "./post/deleteDivision";
|
import deleteDivision from "./post/deleteDivision";
|
||||||
import updateDivision from "./post/updateDivision";
|
import updateDivision from "./post/updateDivision";
|
||||||
@@ -30,4 +31,9 @@ export const API_INDEX_DIVISION = [
|
|||||||
method: "GET",
|
method: "GET",
|
||||||
bin: getOneDivision,
|
bin: getOneDivision,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "get-one-detail-division",
|
||||||
|
method: "GET",
|
||||||
|
bin: getOneDetailDivision,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
41
src/module/division_new/api/get/getOneDetailDivision.ts
Normal file
41
src/module/division_new/api/get/getOneDetailDivision.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { prisma } from '@/module/_global';
|
||||||
|
import { NextRequest } from "next/server";
|
||||||
|
|
||||||
|
export default async function getOneDetailDivision(req: NextRequest) {
|
||||||
|
try {
|
||||||
|
const searchParams = req.nextUrl.searchParams
|
||||||
|
const id = searchParams.get('divisionId');
|
||||||
|
const division = await prisma.division.findUnique({
|
||||||
|
where: {
|
||||||
|
id: String(id),
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
name: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const member = await prisma.divisionMember.findMany({
|
||||||
|
where: {
|
||||||
|
idDivision: String(id),
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
idUser: true,
|
||||||
|
isLeader: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const allData = {
|
||||||
|
division: division,
|
||||||
|
member: member
|
||||||
|
}
|
||||||
|
return Response.json(allData);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
return Response.json(
|
||||||
|
{ message: "Internal Server Error", success: false },
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,18 +9,19 @@ import NavbarDetailDivision from '../ui/navbar_detail_division';
|
|||||||
|
|
||||||
export default function DetailDivision() {
|
export default function DetailDivision() {
|
||||||
return (
|
return (
|
||||||
<Box>
|
<></>
|
||||||
<NavbarDetailDivision />
|
// <Box>
|
||||||
<Box p={20}>
|
// <NavbarDetailDivision />
|
||||||
<Stack>
|
// <Box p={20}>
|
||||||
<CarouselDivision />
|
// <Stack>
|
||||||
<FeatureDetailDivision />
|
// <CarouselDivision />
|
||||||
<ListTaskOnDetailDivision />
|
// <FeatureDetailDivision />
|
||||||
<ListDocumentOnDetailDivision />
|
// <ListTaskOnDetailDivision />
|
||||||
<ListDiscussionOnDetailDivision />
|
// <ListDocumentOnDetailDivision />
|
||||||
</Stack>
|
// <ListDiscussionOnDetailDivision />
|
||||||
</Box>
|
// </Stack>
|
||||||
</Box>
|
// </Box>
|
||||||
|
// </Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { IoCalendarOutline } from "react-icons/io5";
|
|||||||
import { LuFileSignature } from "react-icons/lu";
|
import { LuFileSignature } from "react-icons/lu";
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
export default function FeatureDetailDivision() {
|
export default function FeatureDetailDivision({ id }: { id: string }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
return (
|
return (
|
||||||
<Box pt={10}>
|
<Box pt={10}>
|
||||||
@@ -21,29 +21,29 @@ export default function FeatureDetailDivision() {
|
|||||||
style={{
|
style={{
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
alignContent: "center"
|
alignContent: "center"
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box bg={'white'} style={{
|
<Box bg={'white'} style={{
|
||||||
border: `1px solid ${WARNA.bgHijauMuda}`,
|
border: `1px solid ${WARNA.bgHijauMuda}`,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
padding: 10
|
padding: 10
|
||||||
}} onClick={() => router.push('/task')}>
|
}} onClick={() => router.push(id + '/task')}>
|
||||||
<Grid justify='center' align='center'>
|
<Grid justify='center' align='center'>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<ActionIcon variant="filled"
|
<ActionIcon variant="filled"
|
||||||
size={"xl"}
|
size={"xl"}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
color={WARNA.bgHijauMuda}
|
color={WARNA.bgHijauMuda}
|
||||||
>
|
>
|
||||||
<LuClipboardEdit size={25} color={WARNA.biruTua} />
|
<LuClipboardEdit size={25} color={WARNA.biruTua} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={{base: 7, md: 9}}>
|
<Grid.Col span={{ base: 7, md: 9 }}>
|
||||||
<Text fz={15} c={WARNA.biruTua} fw={"bold"}>Tugas</Text>
|
<Text fz={15} c={WARNA.biruTua} fw={"bold"}>Tugas</Text>
|
||||||
<Group justify='space-between' align='center'>
|
<Group justify='space-between' align='center'>
|
||||||
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
||||||
<IoIosArrowRoundForward size={20} color='gray' />
|
<IoIosArrowRoundForward size={20} color='gray' />
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -55,20 +55,20 @@ export default function FeatureDetailDivision() {
|
|||||||
}} onClick={() => router.push('/document')}>
|
}} onClick={() => router.push('/document')}>
|
||||||
<Grid justify='center' align='center'>
|
<Grid justify='center' align='center'>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<ActionIcon variant="filled"
|
<ActionIcon variant="filled"
|
||||||
size={"xl"}
|
size={"xl"}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
color={WARNA.bgHijauMuda}
|
color={WARNA.bgHijauMuda}
|
||||||
>
|
>
|
||||||
<BsFileEarmarkText size={25} color={WARNA.biruTua} />
|
<BsFileEarmarkText size={25} color={WARNA.biruTua} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={{base: 7, md: 9}}>
|
<Grid.Col span={{ base: 7, md: 9 }}>
|
||||||
<Text fz={15} c={WARNA.biruTua} fw={"bold"}>Dokumen</Text>
|
<Text fz={15} c={WARNA.biruTua} fw={"bold"}>Dokumen</Text>
|
||||||
<Group justify='space-between' align='center'>
|
<Group justify='space-between' align='center'>
|
||||||
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
||||||
<IoIosArrowRoundForward size={20} color='gray' />
|
<IoIosArrowRoundForward size={20} color='gray' />
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -80,20 +80,20 @@ export default function FeatureDetailDivision() {
|
|||||||
}} onClick={() => router.push('/discussion')}>
|
}} onClick={() => router.push('/discussion')}>
|
||||||
<Grid justify='center' align='center'>
|
<Grid justify='center' align='center'>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<ActionIcon variant="filled"
|
<ActionIcon variant="filled"
|
||||||
size={"xl"}
|
size={"xl"}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
color={WARNA.bgHijauMuda}
|
color={WARNA.bgHijauMuda}
|
||||||
>
|
>
|
||||||
<GoCommentDiscussion size={25} color={WARNA.biruTua} />
|
<GoCommentDiscussion size={25} color={WARNA.biruTua} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={{base: 7, md: 9}}>
|
<Grid.Col span={{ base: 7, md: 9 }}>
|
||||||
<Text fz={15} c={WARNA.biruTua} fw={"bold"}>Diskusi</Text>
|
<Text fz={15} c={WARNA.biruTua} fw={"bold"}>Diskusi</Text>
|
||||||
<Group justify='space-between' align='center'>
|
<Group justify='space-between' align='center'>
|
||||||
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
||||||
<IoIosArrowRoundForward size={20} color='gray' />
|
<IoIosArrowRoundForward size={20} color='gray' />
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -105,20 +105,20 @@ export default function FeatureDetailDivision() {
|
|||||||
}} onClick={() => router.push('/calender')}>
|
}} onClick={() => router.push('/calender')}>
|
||||||
<Grid justify='center' align='center'>
|
<Grid justify='center' align='center'>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<ActionIcon variant="filled"
|
<ActionIcon variant="filled"
|
||||||
size={"xl"}
|
size={"xl"}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
color={WARNA.bgHijauMuda}
|
color={WARNA.bgHijauMuda}
|
||||||
>
|
>
|
||||||
<IoCalendarOutline size={25} color={WARNA.biruTua} />
|
<IoCalendarOutline size={25} color={WARNA.biruTua} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={{base: 7, md: 9}}>
|
<Grid.Col span={{ base: 7, md: 9 }}>
|
||||||
<Text fz={15} c={WARNA.biruTua} fw={"bold"}>Kalender</Text>
|
<Text fz={15} c={WARNA.biruTua} fw={"bold"}>Kalender</Text>
|
||||||
<Group justify='space-between' align='center'>
|
<Group justify='space-between' align='center'>
|
||||||
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
||||||
<IoIosArrowRoundForward size={20} color='gray' />
|
<IoIosArrowRoundForward size={20} color='gray' />
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import { useState } from "react";
|
|||||||
import { HiMenu } from "react-icons/hi";
|
import { HiMenu } from "react-icons/hi";
|
||||||
import DrawerDetailDivision from "./drawer_detail_division";
|
import DrawerDetailDivision from "./drawer_detail_division";
|
||||||
|
|
||||||
export default function NavbarDetailDivision() {
|
export default function NavbarDetailDivision({ title }: { title: string }) {
|
||||||
const [openDrawer, setOpenDrawer] = useState(false)
|
const [openDrawer, setOpenDrawer] = useState(false)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutNavbarNew back="" title={"Divisi kemasyarakatan"} menu={
|
<LayoutNavbarNew back="" title={title} menu={
|
||||||
<ActionIcon variant="light" onClick={() => (setOpenDrawer(true))} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
<ActionIcon variant="light" onClick={() => (setOpenDrawer(true))} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||||
<HiMenu size={20} color='white' />
|
<HiMenu size={20} color='white' />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
|
|||||||
@@ -1,9 +1,33 @@
|
|||||||
import React from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import DetailDivision from '../components/detail_division/detail_division';
|
import DetailDivision from '../components/detail_division/detail_division';
|
||||||
|
import { Box, Stack } from '@mantine/core';
|
||||||
|
import CarouselDivision from '../components/detail_division/carousel_division';
|
||||||
|
import FeatureDetailDivision from '../components/detail_division/feature_detail_division';
|
||||||
|
import ListDiscussionOnDetailDivision from '../components/detail_division/list_discussion';
|
||||||
|
import ListDocumentOnDetailDivision from '../components/detail_division/list_document';
|
||||||
|
import ListTaskOnDetailDivision from '../components/detail_division/list_task';
|
||||||
|
import NavbarDetailDivision from '../components/ui/navbar_detail_division';
|
||||||
|
import { API_ADDRESS } from '@/module/_global';
|
||||||
|
|
||||||
|
export default async function ViewDetailDivision({ id }: { id: string }) {
|
||||||
|
|
||||||
|
const res = await fetch(`${process.env.URL + API_ADDRESS.apiGetOneDetailDivision}&divisionId=${id}`);
|
||||||
|
const data = await res.json();
|
||||||
|
|
||||||
export default function ViewDetailDivision() {
|
|
||||||
return (
|
return (
|
||||||
<DetailDivision />
|
// <DetailDivision />
|
||||||
|
<Box>
|
||||||
|
<NavbarDetailDivision title={data?.division?.name} />
|
||||||
|
<Box p={20}>
|
||||||
|
<Stack>
|
||||||
|
<CarouselDivision />
|
||||||
|
<FeatureDetailDivision id={id}/>
|
||||||
|
<ListTaskOnDetailDivision />
|
||||||
|
<ListDocumentOnDetailDivision />
|
||||||
|
<ListDiscussionOnDetailDivision />
|
||||||
|
</Stack>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default function EditDrawerGroup({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getOneGroup();
|
getOneGroup();
|
||||||
|
|||||||
Reference in New Issue
Block a user