Merge pull request #427 from bipproduction/amalia/21-apr-25
Amalia/21 apr 25
This commit is contained in:
@@ -98,8 +98,8 @@ model User {
|
||||
idVillage String
|
||||
Group Group @relation(fields: [idGroup], references: [id])
|
||||
idGroup String
|
||||
Position Position @relation(fields: [idPosition], references: [id])
|
||||
idPosition String
|
||||
Position Position? @relation(fields: [idPosition], references: [id])
|
||||
idPosition String?
|
||||
nik String @unique
|
||||
name String
|
||||
phone String @unique
|
||||
|
||||
@@ -34,7 +34,7 @@ export async function GET(request: Request) {
|
||||
}
|
||||
}
|
||||
|
||||
if (roleUser != "supadmin") {
|
||||
if (roleUser != "supadmin" && roleUser != "developer") {
|
||||
if (roleUser == "cosupadmin" || roleUser == "admin") {
|
||||
kondisi = {
|
||||
idVillage: String(villageId),
|
||||
|
||||
@@ -44,7 +44,7 @@ export async function GET(request: Request) {
|
||||
|
||||
|
||||
// JIKA ROLE = USER ATAU COADMIN DAN KATEGORI != SEMUA (DIVISI SAYA)
|
||||
if (roleUser != "supadmin" && roleUser != "cosupadmin" && roleUser != "admin") {
|
||||
if (roleUser != "supadmin" && roleUser != "developer" && roleUser != "cosupadmin" && roleUser != "admin") {
|
||||
if (kategori != "semua") {
|
||||
kondisi = {
|
||||
isActive: active == 'false' ? false : true,
|
||||
|
||||
@@ -27,8 +27,8 @@ export async function GET(request: Request) {
|
||||
if (kategori == "kegiatan") {
|
||||
let kondisi
|
||||
|
||||
// klo perbekel == semua grup
|
||||
if (roleUser == "supadmin") {
|
||||
// klo perbekel/developer == semua grup
|
||||
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
idVillage: idVillage,
|
||||
@@ -87,8 +87,8 @@ export async function GET(request: Request) {
|
||||
} else if (kategori == "division") {
|
||||
let kondisi
|
||||
|
||||
// klo perbekel == semua grup
|
||||
if (roleUser == "supadmin") {
|
||||
// klo perbekel/developer == semua grup
|
||||
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
idVillage: idVillage,
|
||||
@@ -139,8 +139,8 @@ export async function GET(request: Request) {
|
||||
} else if (kategori == "progress") {
|
||||
let kondisi
|
||||
|
||||
// klo perbekel == semua grup
|
||||
if (roleUser == "supadmin") {
|
||||
// klo perbekel/developer == semua grup
|
||||
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
Division: {
|
||||
@@ -205,8 +205,8 @@ export async function GET(request: Request) {
|
||||
} else if (kategori == "dokumen") {
|
||||
let kondisi
|
||||
|
||||
// klo perbekel == semua grup
|
||||
if (roleUser == "supadmin") {
|
||||
// klo perbekel/developer == semua grup
|
||||
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
category: 'FILE',
|
||||
@@ -283,8 +283,8 @@ export async function GET(request: Request) {
|
||||
} else if (kategori == "event") {
|
||||
let kondisi
|
||||
|
||||
// klo perbekel == semua grup
|
||||
if (roleUser == "supadmin") {
|
||||
// klo perbekel/developer == semua grup
|
||||
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
dateStart: new Date(),
|
||||
@@ -364,8 +364,8 @@ export async function GET(request: Request) {
|
||||
} else if (kategori == "discussion") {
|
||||
let kondisi
|
||||
|
||||
// klo perbekel == semua grup
|
||||
if (roleUser == "supadmin") {
|
||||
// klo perbekel/developer == semua grup
|
||||
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
status: 1,
|
||||
|
||||
@@ -15,8 +15,8 @@ export async function GET(request: Request) {
|
||||
|
||||
let kondisi: any, kondisiProject: any
|
||||
|
||||
// klo perbekel == semua grup
|
||||
if (userId.idUserRole == "supadmin") {
|
||||
// klo perbekel/developer == semua grup
|
||||
if (userId.idUserRole == "supadmin" || userId.idUserRole == "developer") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
idVillage: userId.idVillage,
|
||||
|
||||
@@ -57,7 +57,7 @@ export async function GET(request: Request) {
|
||||
|
||||
|
||||
// JIKA ROLE = USER ATAU COADMIN DAN KATEGORI != SEMUA (KEGIATAN SAYA)
|
||||
if (roleUser != "supadmin" && roleUser != "cosupadmin" && roleUser != "admin") {
|
||||
if (roleUser != "supadmin" && roleUser != "developer" && roleUser != "cosupadmin" && roleUser != "admin") {
|
||||
if (kategori != "semua") {
|
||||
kondisi = {
|
||||
isActive: true,
|
||||
|
||||
@@ -52,7 +52,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
|
||||
const { ...userData } = users;
|
||||
const group = users?.Group.name
|
||||
const position = users?.Position.name
|
||||
const position = users?.Position?.name
|
||||
const idUserRole = users?.UserRole.id
|
||||
const phone = users?.phone.substr(2)
|
||||
const role = users?.UserRole.name
|
||||
|
||||
@@ -19,6 +19,7 @@ export async function GET(request: Request) {
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
idUserRole: true,
|
||||
name: true,
|
||||
email: true,
|
||||
phone: true,
|
||||
@@ -46,7 +47,7 @@ export async function GET(request: Request) {
|
||||
})
|
||||
const { ...userData } = data;
|
||||
const group = data?.Group.name
|
||||
const position = data?.Position.name
|
||||
const position = data?.Position?.name
|
||||
const phone = data?.phone.substr(2)
|
||||
const role = data?.UserRole.name
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ export async function GET(request: Request) {
|
||||
name: {
|
||||
contains: (name == undefined || name == null) ? "" : name,
|
||||
mode: "insensitive",
|
||||
},
|
||||
NOT: {
|
||||
idUserRole: 'developer'
|
||||
}
|
||||
},
|
||||
select: {
|
||||
@@ -78,7 +81,7 @@ export async function GET(request: Request) {
|
||||
const allData = users.map((v: any) => ({
|
||||
..._.omit(v, ["Group", "Position"]),
|
||||
group: v.Group.name,
|
||||
position: v.Position.name
|
||||
position: v?.Position?.name
|
||||
}))
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil member", data: allData, filter }, { status: 200 });
|
||||
@@ -90,6 +93,9 @@ export async function GET(request: Request) {
|
||||
name: {
|
||||
contains: (name == undefined || name == null) ? "" : name,
|
||||
mode: "insensitive",
|
||||
},
|
||||
NOT: {
|
||||
idUserRole: 'developer'
|
||||
}
|
||||
},
|
||||
select: {
|
||||
@@ -121,7 +127,7 @@ export async function GET(request: Request) {
|
||||
const allData = users.map((v: any) => ({
|
||||
..._.omit(v, ["Group", "Position"]),
|
||||
group: v.Group.name,
|
||||
position: v.Position.name
|
||||
position: v?.Position?.name
|
||||
}))
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil member", data: allData, filter }, { status: 200 });
|
||||
|
||||
@@ -1,41 +1,56 @@
|
||||
'use server'
|
||||
|
||||
import { pwd_key_config, prisma } from "@/module/_global";
|
||||
import { prisma, pwd_key_config } from "@/module/_global";
|
||||
import { unsealData } from "iron-session";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
export default async function funGetUserByCookies() {
|
||||
const sessionCookie = cookies().get("sessionCookieSDM");
|
||||
const userId : any = await unsealData(sessionCookie!.value, {
|
||||
password: pwd_key_config,
|
||||
});
|
||||
const sessionCookie = cookies().get("sessionCookieSDM")
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: userId.user ? String(userId.user) : String(userId),
|
||||
},
|
||||
});
|
||||
if (sessionCookie != undefined) {
|
||||
const userId: any = await unsealData(sessionCookie.value, {
|
||||
password: pwd_key_config,
|
||||
});
|
||||
|
||||
const village = await prisma.village.findUnique({
|
||||
where: {
|
||||
id: user?.idVillage
|
||||
}
|
||||
})
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: userId.user ? String(userId.user) : String(userId),
|
||||
},
|
||||
});
|
||||
|
||||
const warna = await prisma.colorTheme.findUnique({
|
||||
where: {
|
||||
id: String(village?.idTheme)
|
||||
}
|
||||
})
|
||||
const village = await prisma.village.findUnique({
|
||||
where: {
|
||||
id: user?.idVillage
|
||||
}
|
||||
})
|
||||
|
||||
const warna = await prisma.colorTheme.findUnique({
|
||||
where: {
|
||||
id: String(village?.idTheme)
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
id: user?.id,
|
||||
idUserRole: user?.idUserRole,
|
||||
name: user?.name,
|
||||
idVillage: user?.idVillage,
|
||||
idGroup: user?.idGroup,
|
||||
idPosition: user?.idPosition,
|
||||
theme: warna,
|
||||
showNotification: userId?.showNotification
|
||||
};
|
||||
}else{
|
||||
return {
|
||||
id: undefined,
|
||||
idUserRole: undefined,
|
||||
name: undefined,
|
||||
idVillage: undefined,
|
||||
idGroup: undefined,
|
||||
idPosition: undefined,
|
||||
theme: undefined,
|
||||
showNotification: undefined
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
id: user?.id,
|
||||
idUserRole: user?.idUserRole,
|
||||
name: user?.name,
|
||||
idVillage: user?.idVillage,
|
||||
idGroup: user?.idGroup,
|
||||
idPosition: user?.idPosition,
|
||||
theme: warna,
|
||||
showNotification: userId?.showNotification
|
||||
};
|
||||
}
|
||||
@@ -44,7 +44,7 @@ export default function FormCreateDiscussionGeneral() {
|
||||
});
|
||||
|
||||
function onToChooseAnggota() {
|
||||
if (roleLogin.get() == "supadmin" && (body.idGroup == "" || String(body.idGroup) == "null"))
|
||||
if ((roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (body.idGroup == "" || String(body.idGroup) == "null"))
|
||||
return toast.error("Error! lembaga desa tidak boleh kosong")
|
||||
setChooseAnggota(true)
|
||||
}
|
||||
@@ -57,7 +57,7 @@ export default function FormCreateDiscussionGeneral() {
|
||||
toast.error(loadGroup.message);
|
||||
}
|
||||
|
||||
if (roleLogin.get() != "supadmin") {
|
||||
if (roleLogin.get() != "supadmin" && roleLogin.get() != "developer") {
|
||||
const loadUser = await funGetUserByCookies();
|
||||
setBody({ ...body, idGroup: loadUser.idGroup })
|
||||
}
|
||||
@@ -156,7 +156,7 @@ export default function FormCreateDiscussionGeneral() {
|
||||
<Box p={20}>
|
||||
<Box>
|
||||
{
|
||||
(roleLogin.get() == "supadmin") && (
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (
|
||||
<Select
|
||||
placeholder="Lembaga Desa"
|
||||
label="Lembaga Desa"
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function DrawerDiscussionGeneral() {
|
||||
</Box>
|
||||
</Flex>
|
||||
{
|
||||
roleLogin.get() == "supadmin" &&
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||
<Flex onClick={() => {
|
||||
router.push('/discussion?page=filter&group=' + group)
|
||||
}} justify={'center'} align={'center'} direction={'column'} >
|
||||
|
||||
@@ -137,7 +137,7 @@ export default function ListDiscussionGeneral() {
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
/>
|
||||
{roleLogin.get() == 'supadmin' && <Text>Filter : {nameGroup}</Text>}
|
||||
{(roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer') && <Text>Filter : {nameGroup}</Text>}
|
||||
{loading ?
|
||||
Array(3)
|
||||
.fill(null)
|
||||
|
||||
@@ -8,11 +8,11 @@ import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { HiChevronLeft } from "react-icons/hi2";
|
||||
import { IoIosArrowDropright } from "react-icons/io";
|
||||
import { globalMemberDivision } from "../lib/val_division";
|
||||
import NavbarAdminDivision from "./navbar_admin_division";
|
||||
import NavbarCreateUsers from "./navbar_create_users";
|
||||
import { HiChevronLeft } from "react-icons/hi2";
|
||||
|
||||
export default function CreateDivision() {
|
||||
const router = useRouter();
|
||||
@@ -59,7 +59,7 @@ export default function CreateDivision() {
|
||||
}
|
||||
|
||||
function onToChooseAnggota() {
|
||||
if (roleUser == "supadmin" && (body.idGroup == "" || String(body.idGroup) == "null"))
|
||||
if ((roleUser == "supadmin" || roleUser == "developer") && (body.idGroup == "" || String(body.idGroup) == "null"))
|
||||
return toast.error("Error! lembaga desa tidak boleh kosong")
|
||||
setChooseAnggota(true)
|
||||
}
|
||||
@@ -98,7 +98,7 @@ export default function CreateDivision() {
|
||||
|
||||
function checkAll() {
|
||||
let nilai = true
|
||||
if (roleUser == "supadmin" && (body.idGroup === "" || String(body.idGroup) == "null")) {
|
||||
if ((roleUser == "supadmin" || roleUser == "developer") && (body.idGroup === "" || String(body.idGroup) == "null")) {
|
||||
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||
nilai = false
|
||||
}
|
||||
@@ -145,7 +145,7 @@ export default function CreateDivision() {
|
||||
<Box p={20}>
|
||||
<Stack>
|
||||
{
|
||||
(roleUser == "supadmin") && (
|
||||
(roleUser == "supadmin" || roleUser == "developer") && (
|
||||
<Select
|
||||
placeholder="Lembaga Desa"
|
||||
label="Lembaga Desa"
|
||||
|
||||
@@ -111,7 +111,7 @@ export default function CreateReport() {
|
||||
setTampil(false)
|
||||
} else {
|
||||
setTouched({ ...touched, end_date: false })
|
||||
if (roleLogin.get() == "supadmin" && (isGroup == "" || isGroup == null || isGroup == undefined)) {
|
||||
if ((roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (isGroup == "" || isGroup == null || isGroup == undefined)) {
|
||||
setTampil(false)
|
||||
} else {
|
||||
onReport(isGroup, val, valueAkhir)
|
||||
@@ -127,7 +127,7 @@ export default function CreateReport() {
|
||||
setTampil(false)
|
||||
} else {
|
||||
setTouched({ ...touched, end_date: false })
|
||||
if (roleLogin.get() == "supadmin" && (isGroup == "" || isGroup == null || isGroup == undefined)) {
|
||||
if ((roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (isGroup == "" || isGroup == null || isGroup == undefined)) {
|
||||
setTampil(false)
|
||||
} else {
|
||||
onReport(isGroup, value, val)
|
||||
@@ -147,7 +147,7 @@ export default function CreateReport() {
|
||||
<LayoutNavbarNew back="/division" title="Laporan Divisi" menu />
|
||||
<Box p={20}>
|
||||
<Stack>
|
||||
{roleLogin.get() == "supadmin" &&
|
||||
{(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||
<Select
|
||||
placeholder="Lembaga Desa"
|
||||
label="Lembaga Desa"
|
||||
|
||||
@@ -3,7 +3,6 @@ import { globalRole, TEMA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import React from 'react';
|
||||
import { HiOutlineFilter } from 'react-icons/hi';
|
||||
import { IoAddCircle } from 'react-icons/io5';
|
||||
import { TbReportAnalytics } from "react-icons/tb";
|
||||
@@ -18,9 +17,7 @@ export default function DrawerDivision() {
|
||||
return (
|
||||
<Box>
|
||||
<Stack pt={10}>
|
||||
<SimpleGrid
|
||||
cols={{ base: 3, sm: 3, lg: 3 }}
|
||||
>
|
||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||
<Flex onClick={() => router.push('/division/create')} justify={'center'} align={'center'} direction={'column'} >
|
||||
<Box>
|
||||
<IoAddCircle size={30} color={tema.get().utama} />
|
||||
@@ -30,7 +27,7 @@ export default function DrawerDivision() {
|
||||
</Box>
|
||||
</Flex>
|
||||
{
|
||||
roleLogin.get() == "supadmin" &&
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||
<Flex onClick={() => {
|
||||
router.push('/division?page=filter&group=' + group)
|
||||
}} justify={'center'} align={'center'} direction={'column'} >
|
||||
@@ -44,7 +41,7 @@ export default function DrawerDivision() {
|
||||
}
|
||||
|
||||
{
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "cosupadmin") &&
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "cosupadmin" || roleLogin.get() == "developer") &&
|
||||
<Flex onClick={() => {
|
||||
router.push('/division?page=report')
|
||||
}} justify={'center'} align={'center'} direction={'column'} >
|
||||
|
||||
@@ -157,7 +157,7 @@ export default function ListDivision() {
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Box pt={20}>
|
||||
{roleLogin.get() == 'supadmin' && <Text>Filter : {nameGroup}</Text>}
|
||||
{(roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer') && <Text>Filter : {nameGroup}</Text>}
|
||||
<Box bg={tema.get().bgTotalKegiatan} p={10} style={{ borderRadius: 10 }}>
|
||||
<Text fw={'bold'} c={tema.get().utama}>Total Divisi</Text>
|
||||
<Flex justify={'center'} align={'center'} h={'100%'}>
|
||||
|
||||
@@ -30,7 +30,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<HiMiniUserGroup size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -46,7 +45,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<HiMiniPresentationChartBar size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -62,7 +60,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<HiMegaphone size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -78,7 +75,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<FaComments size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -94,7 +90,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<PiUsersFourFill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -110,7 +105,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<FaUserTie size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -128,7 +122,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<RiLayoutTop2Fill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -140,7 +133,7 @@ export default function ViewDetailFeature() {
|
||||
</Box>
|
||||
}
|
||||
{
|
||||
roleLogin.get() == "supadmin" &&
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||
<>
|
||||
<Box onClick={() => router.push('/group')}>
|
||||
<Center>
|
||||
@@ -148,7 +141,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<FaUserTag size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -164,7 +156,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<IoColorPalette size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
@@ -180,7 +171,6 @@ export default function ViewDetailFeature() {
|
||||
size={isMobile ? 50 : 68}
|
||||
aria-label="Gradient action icon"
|
||||
radius={100}
|
||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
||||
bg={tema.get().bgFiturHome}
|
||||
>
|
||||
<RiLayoutTop2Fill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||
|
||||
@@ -99,7 +99,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
||||
nilai = false
|
||||
}
|
||||
|
||||
if (roleLogin.get() == "supadmin" && (listData.idGroup == "" || String(listData.idGroup) == "null")) {
|
||||
if ((roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (listData.idGroup == "" || String(listData.idGroup) == "null")) {
|
||||
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||
nilai = false
|
||||
}
|
||||
@@ -140,7 +140,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
||||
</Box>
|
||||
</Flex>
|
||||
{
|
||||
roleLogin.get() == "supadmin" &&
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||
<Flex justify={'center'} align={'center'} direction={'column'} onClick={() => router.push('/position?page=filter&group=' + group)}>
|
||||
<Box>
|
||||
<RiFilter2Line size={30} color={tema.get().utama} />
|
||||
@@ -155,7 +155,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
||||
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'} size="md">
|
||||
<Box pos={"relative"} h={"35vh"}>
|
||||
{
|
||||
roleLogin.get() == "supadmin" &&
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||
<Select
|
||||
label="Lembaga Desa"
|
||||
placeholder="Pilih Lembaga Desa"
|
||||
|
||||
@@ -78,9 +78,9 @@ export default function ListPositionActive() {
|
||||
placeholder="Pencarian"
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
/>
|
||||
{roleLogin.get() == 'supadmin' && <Text mt={10}>Filter : {nameGroup}</Text>}
|
||||
{(roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer') && <Text mt={10}>Filter : {nameGroup}</Text>}
|
||||
{loading ? Array(6).fill(null).map((_, i) => (
|
||||
<Box key={i} mb={roleLogin.get() == 'supadmin' ? "20" : "0"} mt={roleLogin.get() == 'supadmin' ? "0" : "20"}>
|
||||
<Box key={i} mb={roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer' ? "20" : "0"} mt={roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer' ? "0" : "20"}>
|
||||
<Group
|
||||
align="center"
|
||||
style={{
|
||||
@@ -107,7 +107,7 @@ export default function ListPositionActive() {
|
||||
</Group>
|
||||
</Box>
|
||||
)) :
|
||||
<Box pt={roleLogin.get() == 'supadmin' ? "0" : "20"}>
|
||||
<Box pt={roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer' ? "0" : "20"}>
|
||||
{isDataPosition.length == 0 ?
|
||||
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '60vh' }}>
|
||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada jabatan</Text>
|
||||
|
||||
@@ -76,7 +76,7 @@ export default function CreateProject() {
|
||||
toast.error(loadGroup.message);
|
||||
}
|
||||
|
||||
if (roleLogin.get() != "supadmin") {
|
||||
if (roleLogin.get() != "supadmin" && roleLogin.get() != "developer") {
|
||||
const loadUser = await funGetUserByCookies();
|
||||
setBody({ ...body, idGroup: loadUser.idGroup })
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export default function CreateProject() {
|
||||
}
|
||||
|
||||
function onToChooseAnggota() {
|
||||
if (roleLogin.get() == "supadmin" && (body.idGroup == "" || String(body.idGroup) == "null"))
|
||||
if ((roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (body.idGroup == "" || String(body.idGroup) == "null"))
|
||||
return toast.error("Error! lembaga desa tidak boleh kosong")
|
||||
setChooseAnggota(true)
|
||||
}
|
||||
@@ -194,7 +194,7 @@ export default function CreateProject() {
|
||||
<Box p={20}>
|
||||
<Box>
|
||||
{
|
||||
(roleLogin.get() == "supadmin") && (
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (
|
||||
<Select
|
||||
placeholder="Lembaga Desa"
|
||||
label="Lembaga Desa"
|
||||
|
||||
@@ -153,7 +153,7 @@ export default function ListProject() {
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Box pt={20}>
|
||||
{roleLogin.get() == 'supadmin' && <Text mb={5}>Filter : {nameGroup}</Text>}
|
||||
{(roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer') && <Text mb={5}>Filter : {nameGroup}</Text>}
|
||||
{(roleLogin.get() == 'user' || roleLogin.get() == 'coadmin') && <Text mb={5}>Filter : {(kategori == null || kategori == undefined || kategori == '') ? 'Kegiatan Saya' : 'Semua Kegiatan'}</Text>}
|
||||
<Box bg={tema.get().bgTotalKegiatan} p={10} style={{ borderRadius: 10 }}>
|
||||
<Text fw={'bold'} c={tema.get().utama}>Total Kegiatan</Text>
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function MenuDrawerProject() {
|
||||
}
|
||||
|
||||
{
|
||||
roleLogin.get() == "supadmin" &&
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||
<Flex onClick={() => window.location.href = "/project?page=filter&group=" + group} justify={'center'} align={'center'} direction={'column'} >
|
||||
<Box>
|
||||
<HiOutlineFilter size={30} color={tema.get().utama} />
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
[
|
||||
{
|
||||
"id": "developer",
|
||||
"name": "Developer",
|
||||
"desc": "-"
|
||||
},
|
||||
{
|
||||
"id": "supadmin",
|
||||
"name": "Super Admin",
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
export const valueRoleUser =
|
||||
[
|
||||
{
|
||||
login: "developer",
|
||||
data: [
|
||||
{
|
||||
id: "supadmin",
|
||||
name: "Super Admin"
|
||||
},
|
||||
{
|
||||
id: "cosupadmin",
|
||||
name: "Wakil Super Admin"
|
||||
},
|
||||
{
|
||||
id: "admin",
|
||||
name: "Admin"
|
||||
},
|
||||
{
|
||||
id: "coadmin",
|
||||
name: "Wakil Admin"
|
||||
},
|
||||
{
|
||||
id: "user",
|
||||
name: "User"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
login: "supadmin",
|
||||
data: [
|
||||
|
||||
@@ -13,10 +13,10 @@ import { useRouter } from "next/navigation";
|
||||
import { useRef, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { FaCamera } from "react-icons/fa6";
|
||||
import { useWibuRealtime } from "wibu-realtime";
|
||||
import { valueRoleUser } from "../../lib/val_user";
|
||||
import { funCreateMember } from "../lib/api_member";
|
||||
import { IDataPositionMember, IDataROleMember } from "../lib/type_member";
|
||||
import { useWibuRealtime } from "wibu-realtime";
|
||||
|
||||
export default function CreateMember() {
|
||||
const router = useRouter();
|
||||
@@ -73,7 +73,7 @@ export default function CreateMember() {
|
||||
async function getLogin() {
|
||||
try {
|
||||
const res = await funGetUserByCookies();
|
||||
if (roleLogin.get() != "supadmin") {
|
||||
if (roleLogin.get() != "supadmin" && roleLogin.get() != "developer") {
|
||||
getAllPosition(res.idGroup)
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ export default function CreateMember() {
|
||||
nilai = false
|
||||
}
|
||||
|
||||
if (roleLogin.get() == "supadmin" && (listData.idGroup == "" || String(listData.idGroup) == "null")) {
|
||||
if ((roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (listData.idGroup == "" || String(listData.idGroup) == "null")) {
|
||||
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||
nilai = false
|
||||
}
|
||||
@@ -298,7 +298,7 @@ export default function CreateMember() {
|
||||
/>
|
||||
</Indicator>
|
||||
{
|
||||
roleLogin.get() == "supadmin" &&
|
||||
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||
<Select
|
||||
placeholder="Lembaga Desa"
|
||||
label="Lembaga Desa"
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { globalRole, TEMA, WARNA } from '@/module/_global';
|
||||
import { globalRole, TEMA } from '@/module/_global';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import React from 'react';
|
||||
import { IoAddCircle } from "react-icons/io5";
|
||||
import { RiFilter2Line } from 'react-icons/ri';
|
||||
|
||||
@@ -35,7 +34,7 @@ export default function DrawerListMember() {
|
||||
</Box>
|
||||
</Flex>
|
||||
{
|
||||
roleLogin.get() === 'supadmin' &&
|
||||
(roleLogin.get() === 'supadmin' || roleLogin.get() === 'developer') &&
|
||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||
style={{ cursor: 'pointer' }}
|
||||
onClick={() => {
|
||||
|
||||
@@ -131,7 +131,7 @@ export default function TabListMember() {
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
my={20}
|
||||
/>
|
||||
{roleLogin.get() == 'supadmin' && <Text mt={10}>Filter : {nameGroup}</Text>}
|
||||
{(roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer') && <Text mt={10}>Filter : {nameGroup}</Text>}
|
||||
{loading
|
||||
?
|
||||
Array(6)
|
||||
|
||||
@@ -18,6 +18,7 @@ import { IProfileById } from "../lib/type_profile";
|
||||
|
||||
export default function Profile() {
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
const [roleUser, setRoleUser] = useState("")
|
||||
const [isData, setData] = useState<IProfileById>()
|
||||
const router = useRouter()
|
||||
const [loading, setLoading] = useState(true)
|
||||
@@ -30,8 +31,8 @@ export default function Profile() {
|
||||
setLoading(true)
|
||||
const res = await funGetProfileByCookies()
|
||||
setData(res.data)
|
||||
setRoleUser(res.data.idUserRole)
|
||||
setIMG(`https://wibu-storage.wibudev.com/api/files/${res.data.img}`)
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
@@ -101,9 +102,12 @@ export default function Profile() {
|
||||
<Stack p={20}>
|
||||
<Group justify="space-between" grow py={5}>
|
||||
<Text fw={'bold'} fz={20}>Informasi</Text>
|
||||
<Group justify="flex-end">
|
||||
<Text style={{ cursor: 'pointer' }} ta={"right"} c={"blue"} onClick={() => router.push(`/profile/edit/`)}>Edit</Text>
|
||||
</Group>
|
||||
{
|
||||
roleUser != "developer" &&
|
||||
<Group justify="flex-end">
|
||||
<Text style={{ cursor: 'pointer' }} ta={"right"} c={"blue"} onClick={() => router.push(`/profile/edit/`)}>Edit</Text>
|
||||
</Group>
|
||||
}
|
||||
</Group>
|
||||
<Grid>
|
||||
<Grid.Col span={4}>
|
||||
@@ -127,17 +131,20 @@ export default function Profile() {
|
||||
<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>
|
||||
{
|
||||
roleUser != "developer" &&
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user