Merge pull request #399 from bipproduction/amalia/04-feb-25

Amalia/04 feb 25
This commit is contained in:
Amalia
2025-02-04 17:26:41 +08:00
committed by GitHub
26 changed files with 369 additions and 100 deletions

View File

@@ -0,0 +1,46 @@
import { prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth";
import { createLogUser } from "@/module/user";
import { NextResponse } from "next/server";
export async function DELETE(request: Request, context: { params: { id: string } }) {
try {
const user = await funGetUserByCookies()
if (user.id == undefined) {
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
}
const { id } = context.params
const data = await prisma.project.count({
where: {
id: id,
}
})
if (data == 0) {
return NextResponse.json(
{
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
},
{ status: 404 }
);
}
const dataDelete = await prisma.project.update({
where: {
id
},
data: {
isActive: false
}
})
// create log user
const log = await createLogUser({ act: 'DELETE', desc: 'User menghapus data kegiatan', table: 'project', data: String(id) })
return NextResponse.json({ success: true, message: "Kegiatan berhasil dihapus" }, { status: 200 });
} catch (error) {
console.error(error);
return NextResponse.json({ success: false, message: "Gagal menghapus kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
}
}

View File

@@ -0,0 +1,48 @@
import { prisma } from "@/module/_global";
import { funGetUserByCookies } from "@/module/auth";
import { createLogUser } from "@/module/user";
import { NextResponse } from "next/server";
// PEMBATALAN TASK DIVISI
export async function DELETE(request: Request, context: { params: { id: string } }) {
try {
const user = await funGetUserByCookies()
if (user.id == undefined) {
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
}
const { id } = context.params;
const data = await prisma.divisionProject.count({
where: {
id: id,
},
});
if (data == 0) {
return NextResponse.json(
{
success: false,
message: "Penghapusan tugas gagal, data tugas tidak ditemukan",
},
{ status: 404 }
);
}
const update = await prisma.divisionProject.update({
where: {
id
},
data: {
isActive: false,
}
});
// create log user
const log = await createLogUser({ act: 'DELETE', desc: 'User menghapus tugas divisi', table: 'divisionProject', data: id })
return NextResponse.json({ success: true, message: "Tugas berhasil dihapuskan", }, { status: 200 });
} catch (error) {
console.error(error);
return NextResponse.json({ success: false, message: "Gagal menghapus tugas, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
}
}

View File

@@ -55,8 +55,9 @@ export async function GET(request: Request, context: { params: { id: string } })
const position = users?.Position.name
const idUserRole = users?.UserRole.id
const phone = users?.phone.substr(2)
const role = users?.UserRole.name
const result = { ...userData, group, position, idUserRole, phone };
const result = { ...userData, group, position, idUserRole, phone, role };
const omitData = _.omit(result, ["Group", "Position", "UserRole"]);

View File

@@ -36,6 +36,11 @@ export async function GET(request: Request) {
select: {
name: true
}
},
UserRole:{
select:{
name: true
}
}
}
})
@@ -43,10 +48,11 @@ export async function GET(request: Request) {
const group = data?.Group.name
const position = data?.Position.name
const phone = data?.phone.substr(2)
const role = data?.UserRole.name
const omitData = _.omit(data, ["Group", "Position", "phone"])
const omitData = _.omit(data, ["Group", "Position", "phone", "UserRole"]);
const result = { ...userData, group, position, phone };
const result = { ...userData, group, position, phone, role };
return NextResponse.json({ success: true, data: result });
} catch (error) {

View File

@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
export async function GET(request: Request) {
try {
return NextResponse.json({ success: true, version: "1.2.2", tahap: "beta", update:"-unshare dokumen divisi -jumlah dokumen pada detail divisi -tampil dokumen share pada detail divisi -loguser pada saat share dokumen divisi -boleh unduh file share" }, { status: 200 });
return NextResponse.json({ success: true, version: "1.2.3", tahap: "beta", update:"-nama grup darmasaba jadi lembaga desa, -menampilkan user role pada profile pada detail anggota, -fitur hapus pada data yg telah dibatalkan pada fitur kegiatan dan tugas divisi" }, { status: 200 });
} catch (error) {
console.error(error);
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });

View File

@@ -72,7 +72,7 @@ export default function DetailEventDivision() {
}
if (dataRealTime && dataRealTime.some((i: any) => i.category == 'calendar-detail-delete' && i.id == isDataCalender?.idCalendar && i.idUserFrom != isUserLogin)) {
toast.error("Data telah di hapus, anda akan beralih ke halaman list acara")
toast.error("Data telah dihapus, anda akan beralih ke halaman list acara")
setTimeout(() => {
router.push(`/division/${param.id}/calender`)
}, 1000)

View File

@@ -1,15 +1,15 @@
"use client"
import { keyWibu, TEMA } from '@/module/_global';
import LayoutModal from '@/module/_global/layout/layout_modal';
import { useHookstate } from '@hookstate/core';
import { Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
import { useParams, useRouter } from 'next/navigation';
import React, { useState } from 'react';
import { useState } from 'react';
import toast from 'react-hot-toast';
import { MdDelete, MdEdit } from 'react-icons/md';
import { funDeleteCalenderById } from '../lib/api_calender';
import { FaUsers } from 'react-icons/fa6';
import { useHookstate } from '@hookstate/core';
import { FaTrash, FaUsers } from 'react-icons/fa6';
import { MdEdit } from 'react-icons/md';
import { useWibuRealtime } from 'wibu-realtime';
import { funDeleteCalenderById } from '../lib/api_calender';
export default function DrawerDetailEvent({ idCalendar, close }: { idCalendar: string, close: (val: boolean) => void }) {
const router = useRouter()
@@ -82,7 +82,7 @@ export default function DrawerDetailEvent({ idCalendar, close }: { idCalendar: s
</Flex>
<Flex onClick={() => setModal(true)} justify={'center'} align={'center'} direction={'column'} >
<Box>
<MdDelete size={30} color={tema.get().utama} />
<FaTrash size={30} color={tema.get().utama} />
</Box>
<Box>
<Text ta={"center"} c={tema.get().utama}>Hapus Acara</Text>

View File

@@ -44,8 +44,8 @@ export default function FormCreateDiscussionGeneral() {
});
function onToChooseAnggota() {
if (roleLogin.get() == "supadmin" && body.idGroup == "")
return toast.error("Error! grup harus diisi")
if (roleLogin.get() == "supadmin" && (body.idGroup == "" || String(body.idGroup) == "null"))
return toast.error("Error! lembaga desa tidak boleh kosong")
setChooseAnggota(true)
}
@@ -158,8 +158,8 @@ export default function FormCreateDiscussionGeneral() {
{
(roleLogin.get() == "supadmin") && (
<Select
placeholder="Grup"
label="Grup"
placeholder="Lembaga Desa"
label="Lembaga Desa"
size="md"
styles={{
input: {
@@ -178,7 +178,7 @@ export default function FormCreateDiscussionGeneral() {
value={(body.idGroup == "") ? null : body.idGroup}
error={
touched.idGroup && (
body.idGroup == "" || String(body.idGroup) == "null" ? "Grup Tidak Boleh Kosong" : null
body.idGroup == "" || String(body.idGroup) == "null" ? "Lembaga Desa Tidak Boleh Kosong" : null
)
}
/>

View File

@@ -59,8 +59,8 @@ export default function CreateDivision() {
}
function onToChooseAnggota() {
if (roleUser == "supadmin" && body.idGroup == "")
return toast.error("Error! grup harus diisi")
if (roleUser == "supadmin" && (body.idGroup == "" || String(body.idGroup) == "null"))
return toast.error("Error! lembaga desa tidak boleh kosong")
setChooseAnggota(true)
}
@@ -147,8 +147,8 @@ export default function CreateDivision() {
{
(roleUser == "supadmin") && (
<Select
placeholder="Grup"
label="Grup"
placeholder="Lembaga Desa"
label="Lembaga Desa"
size="md"
required
radius={10}
@@ -161,7 +161,7 @@ export default function CreateDivision() {
}}
error={
touched.idGroup && (
body.idGroup == "" || String(body.idGroup) == "null" ? "Grup Tidak Boleh Kosong" : null
body.idGroup == "" || String(body.idGroup) == "null" ? "Lembaga Desa Tidak Boleh Kosong" : null
)
}
value={body.idGroup}

View File

@@ -5,17 +5,16 @@ import { useHookstate } from "@hookstate/core";
import { Badge, Box, Select, Skeleton, Stack, Table } from "@mantine/core";
import { DateInput } from "@mantine/dates";
import { useShallowEffect } from "@mantine/hooks";
import _ from "lodash";
import moment from "moment";
import { useParams } from "next/navigation";
import router from "next/router";
import { useState } from "react";
import toast from "react-hot-toast";
import { funGetReportDivision } from "../lib/api_division";
import EchartBarReportCalender from "./echart_bar_calender";
import EchartBarReport from "./echart_bar_report";
import EchartPaiReport from "./echart_pai_report";
import EventReport from "./event_report";
import _ from "lodash";
import router from "next/router";
import EchartBarReportCalender from "./echart_bar_calender";
export default function CreateReport() {
const [value, setValue] = useState<Date | null>(null);
@@ -150,8 +149,8 @@ export default function CreateReport() {
<Stack>
{roleLogin.get() == "supadmin" &&
<Select
placeholder="Grup"
label="Grup"
placeholder="Lembaga Desa"
label="Lembaga Desa"
size="md"
required
radius={10}
@@ -160,7 +159,7 @@ export default function CreateReport() {
label: pro.name
}))}
onChange={(val) => { onChangeDate(val, 'grup') }}
error={touched.grup && "Grup tidak boleh kosong"}
error={touched.grup && "Lembaga desa tidak boleh kosong"}
/>
}

View File

@@ -78,7 +78,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
<IoAddCircle size={30} color={tema.get().utama} />
</Box>
<Box>
<Text c={tema.get().utama}>Tambah Darmasaba</Text>
<Text c={tema.get().utama} ta={"center"}>Tambah Lembaga Desa</Text>
</Box>
</Flex>
</SimpleGrid>
@@ -86,7 +86,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
<LayoutDrawer
opened={openDrawerGroup}
onClose={() => setOpenDrawerGroup(false)}
title={"Tambah Darmasaba"}
title={"Tambah Lembaga Desa"}
>
<Box pos={"relative"} h={"28.5vh"}>
<TextInput
@@ -99,9 +99,9 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
}}
size="md"
radius={10}
label="Darmasaba"
label="Lembaga Desa"
required
placeholder="Darmasaba"
placeholder="Nama Lembaga Desa"
onChange={(e) => {
onValidation('name', e.target.value)
}}

View File

@@ -139,7 +139,7 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
<LayoutDrawer
opened={openDrawerGroup}
onClose={() => setOpenDrawerGroup(false)}
title={"Edit Darmasaba"}
title={"Edit Lembaga Desa"}
>
<Box pos={"relative"} h={"28.5vh"}>
<TextInput
@@ -162,8 +162,8 @@ export default function EditDrawerGroup({ onUpdated, id, isActive, }: { onUpdate
)
}
radius={10}
placeholder="Darmasaba"
label="Darmasaba"
placeholder="Nama Lembaga Desa"
label="Lembaga Desa"
required
/>
<Box pos={"absolute"} bottom={10} left={0} right={0}>

View File

@@ -43,7 +43,7 @@ export default function ListGroupActive() {
setLoading(false);
} catch (error) {
toast.error("Gagal mendapatkan grup, coba lagi nanti");
toast.error("Gagal mendapatkan lembaga desa, coba lagi nanti");
console.error(error);
} finally {
setLoading(false);

View File

@@ -11,7 +11,7 @@ export default function NavbarGroup() {
const tema = useHookstate(TEMA)
return (
<>
<LayoutNavbarNew back='/home' title='Darmasaba'
<LayoutNavbarNew back='/home' title='Lembaga Desa'
menu={
<ActionIcon onClick={() => setOpen(true)} variant="light" bg={tema.get().bgIcon} size="lg" radius="lg" aria-label="Settings">
<HiMenu size={20} color='white' />

View File

@@ -155,7 +155,7 @@ export default function ViewDetailFeature() {
</ActionIcon>
</Center>
<Center>
<Text fz={isMobile ? 13 : 15} c={tema.get().utama}>Darmasaba</Text>
<Text fz={isMobile ? 13 : 15} c={tema.get().utama} ta={'center'}>Lembaga Desa</Text>
</Center>
</Box>
<Box onClick={() => router.push('/color-palette')}>

View File

@@ -157,8 +157,8 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
{
roleLogin.get() == "supadmin" &&
<Select
label="Grup"
placeholder="Pilih grup"
label="Lembaga Desa"
placeholder="Pilih Lembaga Desa"
data={
listGroup
? listGroup.map((data) => ({
@@ -181,7 +181,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
}}
error={
touched.idGroup && (
listData.idGroup == "" || String(listData.idGroup) == "null" ? "Grup Tidak Boleh Kosong" : null
listData.idGroup == "" || String(listData.idGroup) == "null" ? "Lembaga Desa Tidak Boleh Kosong" : null
)
}
/>

View File

@@ -19,7 +19,7 @@ export const funGetOneProjectById = async (path: string, kategori: string) => {
return await response.json().catch(() => null);
}
export const funGetAllMemberById = async (path?: string, id?:string) => {
export const funGetAllMemberById = async (path?: string, id?: string) => {
const response = await fetch(`/api/project/${id}/member/${path}`);
return await response.json().catch(() => null);
}
@@ -148,3 +148,14 @@ export const funAddFileProject = async (path: string, data: FormData) => {
});
return await response.json().catch(() => null);
};
export const funDeleteProject = async (path: string) => {
const response = await fetch(`/api/project/${path}/lainnya`, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
});
return await response.json().catch(() => null);
};

View File

@@ -84,8 +84,8 @@ export default function CreateProject() {
}
function onToChooseAnggota() {
if (roleLogin.get() == "supadmin" && body.idGroup == "")
return toast.error("Error! grup harus diisi")
if (roleLogin.get() == "supadmin" && (body.idGroup == "" || String(body.idGroup) == "null"))
return toast.error("Error! lembaga desa tidak boleh kosong")
setChooseAnggota(true)
}
@@ -196,8 +196,8 @@ export default function CreateProject() {
{
(roleLogin.get() == "supadmin") && (
<Select
placeholder="Grup"
label="Grup"
placeholder="Lembaga Desa"
label="Lembaga Desa"
size="md"
styles={{
input: {
@@ -217,7 +217,7 @@ export default function CreateProject() {
value={(body.idGroup == "") ? null : body.idGroup}
error={
touched.idGroup && (
body.idGroup == "" || String(body.idGroup) == "null" ? "Grup Tidak Boleh Kosong" : null
body.idGroup == "" || String(body.idGroup) == "null" ? "Lembaga Desa Tidak Boleh Kosong" : null
)
}
/>

View File

@@ -1,17 +1,18 @@
'use client'
import { globalRole, keyWibu, LayoutDrawer, LayoutNavbarNew, TEMA } from '@/module/_global';
import LayoutModal from '@/module/_global/layout/layout_modal';
import { useHookstate } from '@hookstate/core';
import { ActionIcon, Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
import { useShallowEffect } from '@mantine/hooks';
import { useParams, useRouter } from 'next/navigation';
import { useState } from 'react';
import toast from 'react-hot-toast';
import { FaFileCirclePlus, FaPencil, FaUsers } from 'react-icons/fa6';
import { FaFileCirclePlus, FaPencil, FaTrash, FaUsers } from 'react-icons/fa6';
import { HiMenu } from 'react-icons/hi';
import { IoAddCircle } from 'react-icons/io5';
import { MdCancel } from 'react-icons/md';
import { useWibuRealtime } from 'wibu-realtime';
import { funGetOneProjectById } from '../lib/api_project';
import { funDeleteProject, funGetOneProjectById } from '../lib/api_project';
import { globalIsMemberProject } from '../lib/val_project';
export default function NavbarDetailProject() {
@@ -24,6 +25,8 @@ export default function NavbarDetailProject() {
const memberProject = useHookstate(globalIsMemberProject)
const tema = useHookstate(TEMA)
const [reason, setReason] = useState("")
const [openModal, setOpenModal] = useState(false)
const [loadingModal, setLoadingModal] = useState(false)
const [dataRealTime, setDataRealtime] = useWibuRealtime({
WIBU_REALTIME_TOKEN: keyWibu,
project: "sdm"
@@ -39,10 +42,32 @@ export default function NavbarDetailProject() {
} else {
toast.error(res.message);
}
} catch (error) {
console.error(error);
toast.error("Gagal mendapatkan data Kegiatan, coba lagi nanti");
toast.error("Gagal mendapatkan data kegiatan, coba lagi nanti");
}
}
async function deleteDataProject() {
try {
setLoadingModal(true)
const res = await funDeleteProject(param.id);
if (res.success) {
setDataRealtime([{
category: "project-delete",
id: param.id,
}])
toast.success(res.message)
router.push("/project")
} else {
toast.error(res.message)
}
} catch (error) {
console.error(error);
toast.error("Gagal menghapus data kegiatan, coba lagi nanti");
} finally {
setLoadingModal(false)
setOpenModal(false)
}
}
@@ -54,6 +79,13 @@ export default function NavbarDetailProject() {
if (dataRealTime && dataRealTime.some((i: any) => (i.category == 'project-detail' || i.category == 'project-detail-status') && i.id == param.id)) {
getOneData()
}
if (dataRealTime && dataRealTime.some((i: any) => (i.category == 'project-delete') && i.id == param.id)) {
toast.error("Data telah dihapus, anda akan beralih ke halaman list kegiatan")
setTimeout(() => {
router.push("/project")
}, 1000)
}
}, [dataRealTime])
return (
@@ -158,24 +190,34 @@ export default function NavbarDetailProject() {
<Text c={reason == null ? tema.get().utama : "gray"} ta='center'>Edit</Text>
</Box>
</Flex>
<Flex justify={'center'} align={'center'} direction={'column'}
style={{
cursor: 'pointer'
}}
onClick={() => {
reason == null ?
router.push(param.id + '/cancel')
: null
}}
>
<Box>
<MdCancel size={30} color={reason == null ? tema.get().utama : "gray"} />
</Box>
<Box>
<Text c={reason == null ? tema.get().utama : "gray"} ta='center'>Batal</Text>
</Box>
</Flex>
{
reason == null ?
<Flex justify={'center'} align={'center'} direction={'column'} style={{ cursor: 'pointer' }}
onClick={() => {
reason == null ?
router.push(param.id + '/cancel')
: null
}}
>
<Box>
<MdCancel size={30} color={reason == null ? tema.get().utama : "gray"} />
</Box>
<Box>
<Text c={reason == null ? tema.get().utama : "gray"} ta='center'>Batal</Text>
</Box>
</Flex>
:
<Flex justify={'center'} align={'center'} direction={'column'} style={{ cursor: 'pointer' }}
onClick={() => { setOpenModal(true) }}
>
<Box>
<FaTrash size={30} color={tema.get().utama} />
</Box>
<Box>
<Text c={tema.get().utama} ta='center'>Hapus</Text>
</Box>
</Flex>
}
</>
}
@@ -183,6 +225,10 @@ export default function NavbarDetailProject() {
</Stack>
</Box>
</LayoutDrawer>
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
description="Apakah Anda yakin ingin menghapus kegiatan ini?"
onYes={(val) => { val ? deleteDataProject() : setOpenModal(false) }} />
</>
);
}

View File

@@ -144,4 +144,14 @@ export const funAddFileTask = async (path: string, data: FormData) => {
body: data,
});
return await response.json().catch(() => null);
};
export const funDeleteTask = async (path: string) => {
const response = await fetch(`/api/task/${path}/lainnya`, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
});
return await response.json().catch(() => null);
};

View File

@@ -7,12 +7,13 @@ import { useShallowEffect } from "@mantine/hooks";
import { useParams, useRouter } from "next/navigation";
import { useState } from "react";
import toast from "react-hot-toast";
import { FaFileCirclePlus, FaPencil, FaUsers } from "react-icons/fa6";
import { FaFileCirclePlus, FaPencil, FaTrash, FaUsers } from "react-icons/fa6";
import { HiMenu } from "react-icons/hi";
import { IoAddCircle } from "react-icons/io5";
import { MdCancel } from "react-icons/md";
import { funGetTaskDivisionById } from "../lib/api_task";
import { funDeleteTask, funGetTaskDivisionById } from "../lib/api_task";
import { useWibuRealtime } from "wibu-realtime";
import LayoutModal from "@/module/_global/layout/layout_modal";
export default function NavbarDetailDivisionTask() {
const router = useRouter()
@@ -24,6 +25,8 @@ export default function NavbarDetailDivisionTask() {
const memberDivision = useHookstate(globalIsMemberDivision)
const tema = useHookstate(TEMA)
const [reason, setReason] = useState("")
const [loadingModal, setLoadingModal] = useState(false)
const [openModal, setOpenModal] = useState(false)
const [dataRealTime, setDataRealtime] = useWibuRealtime({
WIBU_REALTIME_TOKEN: keyWibu,
project: "sdm"
@@ -45,6 +48,29 @@ export default function NavbarDetailDivisionTask() {
}
}
async function deleteDataProject() {
try {
setLoadingModal(true)
const res = await funDeleteTask(param.detail);
if (res.success) {
setDataRealtime([{
category: "tugas-delete",
id: param.detail,
}])
toast.success(res.message)
router.push("/division/" + param.id + "/task")
} else {
toast.error(res.message)
}
} catch (error) {
console.error(error);
toast.error("Gagal menghapus data tugas divisi, coba lagi nanti");
} finally {
setLoadingModal(false)
setOpenModal(false)
}
}
useShallowEffect(() => {
getOneData();
}, [param.detail])
@@ -54,6 +80,13 @@ export default function NavbarDetailDivisionTask() {
if (dataRealTime && dataRealTime.some((i: any) => (i.category == 'tugas-detail' || i.category == 'tugas-detail-status') && i.id == param.detail)) {
getOneData()
}
if (dataRealTime && dataRealTime.some((i: any) => i.category == 'tugas-delete' && i.id == param.detail)) {
toast.error("Data telah dihapus, anda akan beralih ke halaman list tugas divisi")
setTimeout(() => {
router.push("/division/" + param.id + "/task")
}, 1000)
}
}, [dataRealTime])
return (
@@ -156,23 +189,39 @@ export default function NavbarDetailDivisionTask() {
<Text c={reason == null ? tema.get().utama : "gray"} ta='center'>Edit</Text>
</Box>
</Flex>
{
reason == null ?
<Flex justify={'center'} align={'center'} direction={'column'}
style={{
cursor: 'pointer'
}}
onClick={() => {
reason == null ?
router.push(param.detail + '/cancel')
: null
}} >
<Box>
<MdCancel size={30} color={reason == null ? tema.get().utama : "gray"} />
</Box>
<Box>
<Text c={reason == null ? tema.get().utama : "gray"} ta='center'>Batal</Text>
</Box>
</Flex>
:
<Flex justify={'center'} align={'center'} direction={'column'}
style={{
cursor: 'pointer'
}}
onClick={() => { setOpenModal(true) }} >
<Box>
<FaTrash size={30} color={tema.get().utama} />
</Box>
<Box>
<Text c={tema.get().utama} ta='center'>Hapus</Text>
</Box>
</Flex>
}
<Flex justify={'center'} align={'center'} direction={'column'}
style={{
cursor: 'pointer'
}}
onClick={() => {
reason == null ?
router.push(param.detail + '/cancel')
: null
}} >
<Box>
<MdCancel size={30} color={reason == null ? tema.get().utama : "gray"} />
</Box>
<Box>
<Text c={reason == null ? tema.get().utama : "gray"} ta='center'>Batal</Text>
</Box>
</Flex>
</> : <></>
}
@@ -182,6 +231,10 @@ export default function NavbarDetailDivisionTask() {
</Stack>
</Box>
</LayoutDrawer>
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
description="Apakah Anda yakin ingin menghapus tugas divisi ini?"
onYes={(val) => { val ? deleteDataProject() : setOpenModal(false) }} />
</>
)
}

View File

@@ -8,7 +8,8 @@ export interface IListMember {
position: string,
group: string,
img: string,
isActive: boolean
isActive: boolean,
role: string
}
export interface IFormMember {

View File

@@ -66,7 +66,7 @@ export default function CreateMember() {
}
} catch (error) {
console.error(error);
toast.error("Gagal mendapatkan grup, coba lagi nanti");
toast.error("Gagal mendapatkan lembaga desa, coba lagi nanti");
}
}
@@ -300,8 +300,8 @@ export default function CreateMember() {
{
roleLogin.get() == "supadmin" &&
<Select
placeholder="Pilih Grup"
label="Grup"
placeholder="Lembaga Desa"
label="Lembaga Desa"
w={"100%"}
size="md"
required
@@ -325,7 +325,7 @@ export default function CreateMember() {
onChange={(val: any) => { changeGrup(val) }}
error={
touched.idGroup && (
listData.idGroup == "" || String(listData.idGroup) == "null" ? "Grup Tidak Boleh Kosong" : null
listData.idGroup == "" || String(listData.idGroup) == "null" ? "Lembaga Desa Tidak Boleh Kosong" : null
)
}
/>

View File

@@ -5,7 +5,7 @@ import { ActionIcon, Avatar, Box, Center, Grid, Group, Skeleton, Stack, Text } f
import { useShallowEffect } from "@mantine/hooks";
import { useState } from "react";
import toast from "react-hot-toast";
import { FaSquarePhone } from "react-icons/fa6";
import { FaBuildingUser, FaSquarePhone } from "react-icons/fa6";
import { HiMenu } from "react-icons/hi";
import { IoMaleFemale } from "react-icons/io5";
import { MdEmail } from "react-icons/md";
@@ -14,6 +14,8 @@ import { valueRoleUser } from "../../lib/val_user";
import { funGetOneMember } from "../lib/api_member";
import { IListMember, IMember } from "../lib/type_member";
import DrawerDetailMember from "./drawer_detail_member";
import { BiSolidUserBadge } from "react-icons/bi";
import { PiGenderIntersexFill } from "react-icons/pi";
export default function NavbarDetailMember({ id }: IMember) {
@@ -47,7 +49,7 @@ export default function NavbarDetailMember({ id }: IMember) {
setLoading(false)
} catch (error) {
console.error(error)
toast.error("Gagal mendapatkan detail user, coba lagi nanti");
toast.error("Gagal mendapatkan detail anggota, coba lagi nanti");
} finally {
setLoading(false)
}
@@ -89,7 +91,7 @@ export default function NavbarDetailMember({ id }: IMember) {
:
<>
<Text c={'white'} fw={'bold'} fz={25} ta={"center"}>{dataOne?.name}</Text>
<Text c={'white'} fw={'lighter'} fz={15}>{dataOne?.group} - {dataOne?.position}</Text>
<Text c={'white'} fw={'lighter'} fz={15}>{dataOne?.role}</Text>
</>
}
</Stack>
@@ -113,6 +115,28 @@ export default function NavbarDetailMember({ id }: IMember) {
<Text fz={15} fw={'bold'} ta={"right"}>{dataOne?.nik}</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={5}>
<Group>
<FaBuildingUser size={25} />
<Text fz={15}>Lembaga Desa</Text>
</Group>
</Grid.Col>
<Grid.Col span={7}>
<Text fz={15} fw={'bold'} ta={"right"}>{dataOne?.group}</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={4}>
<Group>
<BiSolidUserBadge size={25} />
<Text fz={15}>Jabatan</Text>
</Group>
</Grid.Col>
<Grid.Col span={8}>
<Text fz={15} fw={'bold'} ta={"right"}>{dataOne?.position}</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={5}>
<Group>
@@ -138,7 +162,7 @@ export default function NavbarDetailMember({ id }: IMember) {
<Grid>
<Grid.Col span={6}>
<Group>
<IoMaleFemale size={25} />
<PiGenderIntersexFill size={25} />
<Text fz={15}>Jenis Kelamin</Text>
</Group>
</Grid.Col>

View File

@@ -9,6 +9,7 @@ export interface IProfileById {
idPosition: string
group: string
position: string
role:string
}
export interface IEditDataProfile {

View File

@@ -7,10 +7,11 @@ import { useShallowEffect } from "@mantine/hooks";
import { useRouter } from "next/navigation";
import { useState } from "react";
import toast from "react-hot-toast";
import { FaSquarePhone } from "react-icons/fa6";
import { IoMaleFemale } from "react-icons/io5";
import { BiSolidUserBadge } from "react-icons/bi";
import { FaBuildingUser, FaSquarePhone } from "react-icons/fa6";
import { LuLogOut } from "react-icons/lu";
import { MdEmail } from "react-icons/md";
import { PiGenderIntersexFill } from "react-icons/pi";
import { RiIdCardFill } from "react-icons/ri";
import { funGetProfileByCookies } from "../lib/api_profile";
import { IProfileById } from "../lib/type_profile";
@@ -88,7 +89,7 @@ export default function Profile() {
:
<>
<Text c={'white'} fw={'bold'} fz={25} ta={"center"}>{isData?.name}</Text>
<Text c={'white'} fw={'lighter'} fz={15}>{isData?.group} - {isData?.position}</Text>
<Text c={'white'} fw={'lighter'} fz={15}>{isData?.role}</Text>
</>
}
</Stack>
@@ -115,6 +116,28 @@ export default function Profile() {
<Text fz={15} fw={'bold'} ta={"right"}>{isData?.nik}</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={5}>
<Group>
<FaBuildingUser size={25} />
<Text fz={15}>Lembaga Desa</Text>
</Group>
</Grid.Col>
<Grid.Col span={7}>
<Text fz={15} fw={'bold'} ta={"right"}>{isData?.group}</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={4}>
<Group>
<BiSolidUserBadge size={25} />
<Text fz={15}>Jabatan</Text>
</Group>
</Grid.Col>
<Grid.Col span={8}>
<Text fz={15} fw={'bold'} ta={"right"}>{isData?.position}</Text>
</Grid.Col>
</Grid>
<Grid>
<Grid.Col span={5}>
<Group>
@@ -140,7 +163,7 @@ export default function Profile() {
<Grid>
<Grid.Col span={6}>
<Group>
<IoMaleFemale size={25} />
<PiGenderIntersexFill size={25} />
<Text fz={15}>Jenis Kelamin</Text>
</Group>
</Grid.Col>