upd: user role developer
Deskripsi: - update fitur akses buat user role developer - update akses jabatan - update akses lembaga desa - update akses developer pada tema - update akses developer pada banner - update akses developer pada anggota No Issues
This commit is contained in:
@@ -47,6 +47,9 @@ export async function GET(request: Request) {
|
|||||||
name: {
|
name: {
|
||||||
contains: (name == undefined || name == null) ? "" : name,
|
contains: (name == undefined || name == null) ? "" : name,
|
||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
NOT: {
|
||||||
|
idUserRole: 'developer'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
@@ -78,7 +81,7 @@ export async function GET(request: Request) {
|
|||||||
const allData = users.map((v: any) => ({
|
const allData = users.map((v: any) => ({
|
||||||
..._.omit(v, ["Group", "Position"]),
|
..._.omit(v, ["Group", "Position"]),
|
||||||
group: v.Group.name,
|
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 });
|
return NextResponse.json({ success: true, message: "Berhasil member", data: allData, filter }, { status: 200 });
|
||||||
@@ -90,6 +93,9 @@ export async function GET(request: Request) {
|
|||||||
name: {
|
name: {
|
||||||
contains: (name == undefined || name == null) ? "" : name,
|
contains: (name == undefined || name == null) ? "" : name,
|
||||||
mode: "insensitive",
|
mode: "insensitive",
|
||||||
|
},
|
||||||
|
NOT: {
|
||||||
|
idUserRole: 'developer'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
@@ -121,7 +127,7 @@ export async function GET(request: Request) {
|
|||||||
const allData = users.map((v: any) => ({
|
const allData = users.map((v: any) => ({
|
||||||
..._.omit(v, ["Group", "Position"]),
|
..._.omit(v, ["Group", "Position"]),
|
||||||
group: v.Group.name,
|
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 });
|
return NextResponse.json({ success: true, message: "Berhasil member", data: allData, filter }, { status: 200 });
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<HiMiniUserGroup size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<HiMiniUserGroup size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -46,7 +45,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<HiMiniPresentationChartBar size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<HiMiniPresentationChartBar size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -62,7 +60,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<HiMegaphone size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<HiMegaphone size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -78,7 +75,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<FaComments size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<FaComments size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -94,7 +90,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<PiUsersFourFill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<PiUsersFourFill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -110,7 +105,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<FaUserTie size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<FaUserTie size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -128,7 +122,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<RiLayoutTop2Fill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<RiLayoutTop2Fill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -140,7 +133,7 @@ export default function ViewDetailFeature() {
|
|||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
roleLogin.get() == "supadmin" &&
|
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||||
<>
|
<>
|
||||||
<Box onClick={() => router.push('/group')}>
|
<Box onClick={() => router.push('/group')}>
|
||||||
<Center>
|
<Center>
|
||||||
@@ -148,7 +141,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<FaUserTag size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<FaUserTag size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -164,7 +156,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<IoColorPalette size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<IoColorPalette size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
@@ -180,7 +171,6 @@ export default function ViewDetailFeature() {
|
|||||||
size={isMobile ? 50 : 68}
|
size={isMobile ? 50 : 68}
|
||||||
aria-label="Gradient action icon"
|
aria-label="Gradient action icon"
|
||||||
radius={100}
|
radius={100}
|
||||||
// gradient={{ from: '#DFDA7C', to: '#F2AF46', deg: 174 }}
|
|
||||||
bg={tema.get().bgFiturHome}
|
bg={tema.get().bgFiturHome}
|
||||||
>
|
>
|
||||||
<RiLayoutTop2Fill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
<RiLayoutTop2Fill size={isMobile ? 25 : 35} color={tema.get().utama} />
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
nilai = false
|
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 }))
|
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||||
nilai = false
|
nilai = false
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</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)}>
|
<Flex justify={'center'} align={'center'} direction={'column'} onClick={() => router.push('/position?page=filter&group=' + group)}>
|
||||||
<Box>
|
<Box>
|
||||||
<RiFilter2Line size={30} color={tema.get().utama} />
|
<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">
|
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'} size="md">
|
||||||
<Box pos={"relative"} h={"35vh"}>
|
<Box pos={"relative"} h={"35vh"}>
|
||||||
{
|
{
|
||||||
roleLogin.get() == "supadmin" &&
|
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||||
<Select
|
<Select
|
||||||
label="Lembaga Desa"
|
label="Lembaga Desa"
|
||||||
placeholder="Pilih Lembaga Desa"
|
placeholder="Pilih Lembaga Desa"
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ export default function ListPositionActive() {
|
|||||||
placeholder="Pencarian"
|
placeholder="Pencarian"
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
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) => (
|
{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
|
<Group
|
||||||
align="center"
|
align="center"
|
||||||
style={{
|
style={{
|
||||||
@@ -107,7 +107,7 @@ export default function ListPositionActive() {
|
|||||||
</Group>
|
</Group>
|
||||||
</Box>
|
</Box>
|
||||||
)) :
|
)) :
|
||||||
<Box pt={roleLogin.get() == 'supadmin' ? "0" : "20"}>
|
<Box pt={roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer' ? "0" : "20"}>
|
||||||
{isDataPosition.length == 0 ?
|
{isDataPosition.length == 0 ?
|
||||||
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '60vh' }}>
|
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '60vh' }}>
|
||||||
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada jabatan</Text>
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada jabatan</Text>
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
export const valueRoleUser =
|
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",
|
login: "supadmin",
|
||||||
data: [
|
data: [
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { FaCamera } from "react-icons/fa6";
|
import { FaCamera } from "react-icons/fa6";
|
||||||
|
import { useWibuRealtime } from "wibu-realtime";
|
||||||
import { valueRoleUser } from "../../lib/val_user";
|
import { valueRoleUser } from "../../lib/val_user";
|
||||||
import { funCreateMember } from "../lib/api_member";
|
import { funCreateMember } from "../lib/api_member";
|
||||||
import { IDataPositionMember, IDataROleMember } from "../lib/type_member";
|
import { IDataPositionMember, IDataROleMember } from "../lib/type_member";
|
||||||
import { useWibuRealtime } from "wibu-realtime";
|
|
||||||
|
|
||||||
export default function CreateMember() {
|
export default function CreateMember() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -73,7 +73,7 @@ export default function CreateMember() {
|
|||||||
async function getLogin() {
|
async function getLogin() {
|
||||||
try {
|
try {
|
||||||
const res = await funGetUserByCookies();
|
const res = await funGetUserByCookies();
|
||||||
if (roleLogin.get() != "supadmin") {
|
if (roleLogin.get() != "supadmin" && roleLogin.get() != "developer") {
|
||||||
getAllPosition(res.idGroup)
|
getAllPosition(res.idGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ export default function CreateMember() {
|
|||||||
nilai = false
|
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 }))
|
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||||
nilai = false
|
nilai = false
|
||||||
}
|
}
|
||||||
@@ -298,7 +298,7 @@ export default function CreateMember() {
|
|||||||
/>
|
/>
|
||||||
</Indicator>
|
</Indicator>
|
||||||
{
|
{
|
||||||
roleLogin.get() == "supadmin" &&
|
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||||
<Select
|
<Select
|
||||||
placeholder="Lembaga Desa"
|
placeholder="Lembaga Desa"
|
||||||
label="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 { useHookstate } from '@hookstate/core';
|
||||||
import { Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
|
import { Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
import React from 'react';
|
|
||||||
import { IoAddCircle } from "react-icons/io5";
|
import { IoAddCircle } from "react-icons/io5";
|
||||||
import { RiFilter2Line } from 'react-icons/ri';
|
import { RiFilter2Line } from 'react-icons/ri';
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@ export default function DrawerListMember() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
{
|
{
|
||||||
roleLogin.get() === 'supadmin' &&
|
(roleLogin.get() === 'supadmin' || roleLogin.get() === 'developer') &&
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
style={{ cursor: 'pointer' }}
|
style={{ cursor: 'pointer' }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ export default function TabListMember() {
|
|||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
my={20}
|
my={20}
|
||||||
/>
|
/>
|
||||||
{roleLogin.get() == 'supadmin' && <Text mt={10}>Filter : {nameGroup}</Text>}
|
{(roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer') && <Text mt={10}>Filter : {nameGroup}</Text>}
|
||||||
{loading
|
{loading
|
||||||
?
|
?
|
||||||
Array(6)
|
Array(6)
|
||||||
|
|||||||
Reference in New Issue
Block a user