upd: akses user role developer
Deskripsi: - update akses list divisi - update akses detail divisi - update akses tambah divisi - update akses laporan divisi No Issues
This commit is contained in:
@@ -44,7 +44,7 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
|
|
||||||
// JIKA ROLE = USER ATAU COADMIN DAN KATEGORI != SEMUA (DIVISI SAYA)
|
// 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") {
|
if (kategori != "semua") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: active == 'false' ? false : true,
|
isActive: active == 'false' ? false : true,
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
|
import { HiChevronLeft } from "react-icons/hi2";
|
||||||
import { IoIosArrowDropright } from "react-icons/io";
|
import { IoIosArrowDropright } from "react-icons/io";
|
||||||
import { globalMemberDivision } from "../lib/val_division";
|
import { globalMemberDivision } from "../lib/val_division";
|
||||||
import NavbarAdminDivision from "./navbar_admin_division";
|
import NavbarAdminDivision from "./navbar_admin_division";
|
||||||
import NavbarCreateUsers from "./navbar_create_users";
|
import NavbarCreateUsers from "./navbar_create_users";
|
||||||
import { HiChevronLeft } from "react-icons/hi2";
|
|
||||||
|
|
||||||
export default function CreateDivision() {
|
export default function CreateDivision() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -59,7 +59,7 @@ export default function CreateDivision() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onToChooseAnggota() {
|
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")
|
return toast.error("Error! lembaga desa tidak boleh kosong")
|
||||||
setChooseAnggota(true)
|
setChooseAnggota(true)
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ export default function CreateDivision() {
|
|||||||
|
|
||||||
function checkAll() {
|
function checkAll() {
|
||||||
let nilai = true
|
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 }))
|
setTouched(touched => ({ ...touched, idGroup: true }))
|
||||||
nilai = false
|
nilai = false
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ export default function CreateDivision() {
|
|||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Stack>
|
<Stack>
|
||||||
{
|
{
|
||||||
(roleUser == "supadmin") && (
|
(roleUser == "supadmin" || roleUser == "developer") && (
|
||||||
<Select
|
<Select
|
||||||
placeholder="Lembaga Desa"
|
placeholder="Lembaga Desa"
|
||||||
label="Lembaga Desa"
|
label="Lembaga Desa"
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export default function CreateReport() {
|
|||||||
setTampil(false)
|
setTampil(false)
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, end_date: false })
|
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)
|
setTampil(false)
|
||||||
} else {
|
} else {
|
||||||
onReport(isGroup, val, valueAkhir)
|
onReport(isGroup, val, valueAkhir)
|
||||||
@@ -127,7 +127,7 @@ export default function CreateReport() {
|
|||||||
setTampil(false)
|
setTampil(false)
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, end_date: false })
|
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)
|
setTampil(false)
|
||||||
} else {
|
} else {
|
||||||
onReport(isGroup, value, val)
|
onReport(isGroup, value, val)
|
||||||
@@ -147,7 +147,7 @@ export default function CreateReport() {
|
|||||||
<LayoutNavbarNew back="/division" title="Laporan Divisi" menu />
|
<LayoutNavbarNew back="/division" title="Laporan Divisi" menu />
|
||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Stack>
|
<Stack>
|
||||||
{roleLogin.get() == "supadmin" &&
|
{(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||||
<Select
|
<Select
|
||||||
placeholder="Lembaga Desa"
|
placeholder="Lembaga Desa"
|
||||||
label="Lembaga Desa"
|
label="Lembaga Desa"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ 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 { HiOutlineFilter } from 'react-icons/hi';
|
import { HiOutlineFilter } from 'react-icons/hi';
|
||||||
import { IoAddCircle } from 'react-icons/io5';
|
import { IoAddCircle } from 'react-icons/io5';
|
||||||
import { TbReportAnalytics } from "react-icons/tb";
|
import { TbReportAnalytics } from "react-icons/tb";
|
||||||
@@ -18,9 +17,7 @@ export default function DrawerDivision() {
|
|||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Stack pt={10}>
|
<Stack pt={10}>
|
||||||
<SimpleGrid
|
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||||
cols={{ base: 3, sm: 3, lg: 3 }}
|
|
||||||
>
|
|
||||||
<Flex onClick={() => router.push('/division/create')} justify={'center'} align={'center'} direction={'column'} >
|
<Flex onClick={() => router.push('/division/create')} justify={'center'} align={'center'} direction={'column'} >
|
||||||
<Box>
|
<Box>
|
||||||
<IoAddCircle size={30} color={tema.get().utama} />
|
<IoAddCircle size={30} color={tema.get().utama} />
|
||||||
@@ -30,7 +27,7 @@ export default function DrawerDivision() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
{
|
{
|
||||||
roleLogin.get() == "supadmin" &&
|
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||||
<Flex onClick={() => {
|
<Flex onClick={() => {
|
||||||
router.push('/division?page=filter&group=' + group)
|
router.push('/division?page=filter&group=' + group)
|
||||||
}} justify={'center'} align={'center'} direction={'column'} >
|
}} 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={() => {
|
<Flex onClick={() => {
|
||||||
router.push('/division?page=report')
|
router.push('/division?page=report')
|
||||||
}} justify={'center'} align={'center'} direction={'column'} >
|
}} justify={'center'} align={'center'} direction={'column'} >
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ export default function ListDivision() {
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Box pt={20}>
|
<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 }}>
|
<Box bg={tema.get().bgTotalKegiatan} p={10} style={{ borderRadius: 10 }}>
|
||||||
<Text fw={'bold'} c={tema.get().utama}>Total Divisi</Text>
|
<Text fw={'bold'} c={tema.get().utama}>Total Divisi</Text>
|
||||||
<Flex justify={'center'} align={'center'} h={'100%'}>
|
<Flex justify={'center'} align={'center'} h={'100%'}>
|
||||||
|
|||||||
Reference in New Issue
Block a user