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.
|
||||
# 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 React from 'react';
|
||||
|
||||
function Page() {
|
||||
function Page({ params }: { params: { id: string } }) {
|
||||
return (
|
||||
<ViewDetailDivision />
|
||||
<ViewDetailDivision id={params.id}/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,5 +38,7 @@ export const API_ADDRESS = {
|
||||
|
||||
// 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",
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import getAllDivision from "./get/getAllDivision";
|
||||
import getOneDivision from "./get/getOneDivision";
|
||||
import getOneDetailDivision from "./get/getOneDetailDivision";
|
||||
import createDivision from "./post/createDivision";
|
||||
import deleteDivision from "./post/deleteDivision";
|
||||
import updateDivision from "./post/updateDivision";
|
||||
@@ -30,4 +31,9 @@ export const API_INDEX_DIVISION = [
|
||||
method: "GET",
|
||||
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() {
|
||||
return (
|
||||
<Box>
|
||||
<NavbarDetailDivision />
|
||||
<Box p={20}>
|
||||
<Stack>
|
||||
<CarouselDivision />
|
||||
<FeatureDetailDivision />
|
||||
<ListTaskOnDetailDivision />
|
||||
<ListDocumentOnDetailDivision />
|
||||
<ListDiscussionOnDetailDivision />
|
||||
</Stack>
|
||||
</Box>
|
||||
</Box>
|
||||
<></>
|
||||
// <Box>
|
||||
// <NavbarDetailDivision />
|
||||
// <Box p={20}>
|
||||
// <Stack>
|
||||
// <CarouselDivision />
|
||||
// <FeatureDetailDivision />
|
||||
// <ListTaskOnDetailDivision />
|
||||
// <ListDocumentOnDetailDivision />
|
||||
// <ListDiscussionOnDetailDivision />
|
||||
// </Stack>
|
||||
// </Box>
|
||||
// </Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { IoCalendarOutline } from "react-icons/io5";
|
||||
import { LuFileSignature } from "react-icons/lu";
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
export default function FeatureDetailDivision() {
|
||||
export default function FeatureDetailDivision({ id }: { id: string }) {
|
||||
const router = useRouter()
|
||||
return (
|
||||
<Box pt={10}>
|
||||
@@ -21,29 +21,29 @@ export default function FeatureDetailDivision() {
|
||||
style={{
|
||||
alignItems: "center",
|
||||
alignContent: "center"
|
||||
}}
|
||||
}}
|
||||
>
|
||||
<Box bg={'white'} style={{
|
||||
border: `1px solid ${WARNA.bgHijauMuda}`,
|
||||
borderRadius: 10,
|
||||
padding: 10
|
||||
}} onClick={() => router.push('/task')}>
|
||||
}} onClick={() => router.push(id + '/task')}>
|
||||
<Grid justify='center' align='center'>
|
||||
<Grid.Col span={"auto"}>
|
||||
<ActionIcon variant="filled"
|
||||
size={"xl"}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
color={WARNA.bgHijauMuda}
|
||||
>
|
||||
<LuClipboardEdit size={25} color={WARNA.biruTua} />
|
||||
</ActionIcon>
|
||||
<ActionIcon variant="filled"
|
||||
size={"xl"}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
color={WARNA.bgHijauMuda}
|
||||
>
|
||||
<LuClipboardEdit size={25} color={WARNA.biruTua} />
|
||||
</ActionIcon>
|
||||
</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>
|
||||
<Group justify='space-between' align='center'>
|
||||
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
||||
<IoIosArrowRoundForward size={20} color='gray' />
|
||||
<IoIosArrowRoundForward size={20} color='gray' />
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
@@ -55,20 +55,20 @@ export default function FeatureDetailDivision() {
|
||||
}} onClick={() => router.push('/document')}>
|
||||
<Grid justify='center' align='center'>
|
||||
<Grid.Col span={"auto"}>
|
||||
<ActionIcon variant="filled"
|
||||
size={"xl"}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
color={WARNA.bgHijauMuda}
|
||||
>
|
||||
<BsFileEarmarkText size={25} color={WARNA.biruTua} />
|
||||
</ActionIcon>
|
||||
<ActionIcon variant="filled"
|
||||
size={"xl"}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
color={WARNA.bgHijauMuda}
|
||||
>
|
||||
<BsFileEarmarkText size={25} color={WARNA.biruTua} />
|
||||
</ActionIcon>
|
||||
</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>
|
||||
<Group justify='space-between' align='center'>
|
||||
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
||||
<IoIosArrowRoundForward size={20} color='gray' />
|
||||
<IoIosArrowRoundForward size={20} color='gray' />
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
@@ -80,20 +80,20 @@ export default function FeatureDetailDivision() {
|
||||
}} onClick={() => router.push('/discussion')}>
|
||||
<Grid justify='center' align='center'>
|
||||
<Grid.Col span={"auto"}>
|
||||
<ActionIcon variant="filled"
|
||||
size={"xl"}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
color={WARNA.bgHijauMuda}
|
||||
>
|
||||
<GoCommentDiscussion size={25} color={WARNA.biruTua} />
|
||||
</ActionIcon>
|
||||
<ActionIcon variant="filled"
|
||||
size={"xl"}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
color={WARNA.bgHijauMuda}
|
||||
>
|
||||
<GoCommentDiscussion size={25} color={WARNA.biruTua} />
|
||||
</ActionIcon>
|
||||
</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>
|
||||
<Group justify='space-between' align='center'>
|
||||
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
||||
<IoIosArrowRoundForward size={20} color='gray' />
|
||||
<IoIosArrowRoundForward size={20} color='gray' />
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
@@ -105,20 +105,20 @@ export default function FeatureDetailDivision() {
|
||||
}} onClick={() => router.push('/calender')}>
|
||||
<Grid justify='center' align='center'>
|
||||
<Grid.Col span={"auto"}>
|
||||
<ActionIcon variant="filled"
|
||||
size={"xl"}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
color={WARNA.bgHijauMuda}
|
||||
>
|
||||
<IoCalendarOutline size={25} color={WARNA.biruTua} />
|
||||
</ActionIcon>
|
||||
<ActionIcon variant="filled"
|
||||
size={"xl"}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
color={WARNA.bgHijauMuda}
|
||||
>
|
||||
<IoCalendarOutline size={25} color={WARNA.biruTua} />
|
||||
</ActionIcon>
|
||||
</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>
|
||||
<Group justify='space-between' align='center'>
|
||||
<Text fz={10} c={"gray"}>23 Tugas</Text>
|
||||
<IoIosArrowRoundForward size={20} color='gray' />
|
||||
<IoIosArrowRoundForward size={20} color='gray' />
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
@@ -5,11 +5,11 @@ import { useState } from "react";
|
||||
import { HiMenu } from "react-icons/hi";
|
||||
import DrawerDetailDivision from "./drawer_detail_division";
|
||||
|
||||
export default function NavbarDetailDivision() {
|
||||
export default function NavbarDetailDivision({ title }: { title: string }) {
|
||||
const [openDrawer, setOpenDrawer] = useState(false)
|
||||
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">
|
||||
<HiMenu size={20} color='white' />
|
||||
</ActionIcon>
|
||||
|
||||
@@ -1,9 +1,33 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
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 (
|
||||
<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(() => {
|
||||
getOneGroup();
|
||||
|
||||
Reference in New Issue
Block a user