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
|
idVillage String
|
||||||
Group Group @relation(fields: [idGroup], references: [id])
|
Group Group @relation(fields: [idGroup], references: [id])
|
||||||
idGroup String
|
idGroup String
|
||||||
Position Position @relation(fields: [idPosition], references: [id])
|
Position Position? @relation(fields: [idPosition], references: [id])
|
||||||
idPosition String
|
idPosition String?
|
||||||
nik String @unique
|
nik String @unique
|
||||||
name String
|
name String
|
||||||
phone String @unique
|
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") {
|
if (roleUser == "cosupadmin" || roleUser == "admin") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
idVillage: String(villageId),
|
idVillage: String(villageId),
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ export async function GET(request: Request) {
|
|||||||
if (kategori == "kegiatan") {
|
if (kategori == "kegiatan") {
|
||||||
let kondisi
|
let kondisi
|
||||||
|
|
||||||
// klo perbekel == semua grup
|
// klo perbekel/developer == semua grup
|
||||||
if (roleUser == "supadmin") {
|
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
idVillage: idVillage,
|
idVillage: idVillage,
|
||||||
@@ -87,8 +87,8 @@ export async function GET(request: Request) {
|
|||||||
} else if (kategori == "division") {
|
} else if (kategori == "division") {
|
||||||
let kondisi
|
let kondisi
|
||||||
|
|
||||||
// klo perbekel == semua grup
|
// klo perbekel/developer == semua grup
|
||||||
if (roleUser == "supadmin") {
|
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
idVillage: idVillage,
|
idVillage: idVillage,
|
||||||
@@ -139,8 +139,8 @@ export async function GET(request: Request) {
|
|||||||
} else if (kategori == "progress") {
|
} else if (kategori == "progress") {
|
||||||
let kondisi
|
let kondisi
|
||||||
|
|
||||||
// klo perbekel == semua grup
|
// klo perbekel/developer == semua grup
|
||||||
if (roleUser == "supadmin") {
|
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
Division: {
|
Division: {
|
||||||
@@ -205,8 +205,8 @@ export async function GET(request: Request) {
|
|||||||
} else if (kategori == "dokumen") {
|
} else if (kategori == "dokumen") {
|
||||||
let kondisi
|
let kondisi
|
||||||
|
|
||||||
// klo perbekel == semua grup
|
// klo perbekel/developer == semua grup
|
||||||
if (roleUser == "supadmin") {
|
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
category: 'FILE',
|
category: 'FILE',
|
||||||
@@ -283,8 +283,8 @@ export async function GET(request: Request) {
|
|||||||
} else if (kategori == "event") {
|
} else if (kategori == "event") {
|
||||||
let kondisi
|
let kondisi
|
||||||
|
|
||||||
// klo perbekel == semua grup
|
// klo perbekel/developer == semua grup
|
||||||
if (roleUser == "supadmin") {
|
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
dateStart: new Date(),
|
dateStart: new Date(),
|
||||||
@@ -364,8 +364,8 @@ export async function GET(request: Request) {
|
|||||||
} else if (kategori == "discussion") {
|
} else if (kategori == "discussion") {
|
||||||
let kondisi
|
let kondisi
|
||||||
|
|
||||||
// klo perbekel == semua grup
|
// klo perbekel/developer == semua grup
|
||||||
if (roleUser == "supadmin") {
|
if (roleUser == "supadmin" || roleUser == "developer") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
status: 1,
|
status: 1,
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
let kondisi: any, kondisiProject: any
|
let kondisi: any, kondisiProject: any
|
||||||
|
|
||||||
// klo perbekel == semua grup
|
// klo perbekel/developer == semua grup
|
||||||
if (userId.idUserRole == "supadmin") {
|
if (userId.idUserRole == "supadmin" || userId.idUserRole == "developer") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
idVillage: userId.idVillage,
|
idVillage: userId.idVillage,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
|
|
||||||
// JIKA ROLE = USER ATAU COADMIN DAN KATEGORI != SEMUA (KEGIATAN SAYA)
|
// 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") {
|
if (kategori != "semua") {
|
||||||
kondisi = {
|
kondisi = {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
|
|
||||||
const { ...userData } = users;
|
const { ...userData } = users;
|
||||||
const group = users?.Group.name
|
const group = users?.Group.name
|
||||||
const position = users?.Position.name
|
const position = users?.Position?.name
|
||||||
const idUserRole = users?.UserRole.id
|
const idUserRole = users?.UserRole.id
|
||||||
const phone = users?.phone.substr(2)
|
const phone = users?.phone.substr(2)
|
||||||
const role = users?.UserRole.name
|
const role = users?.UserRole.name
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export async function GET(request: Request) {
|
|||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
idUserRole: true,
|
||||||
name: true,
|
name: true,
|
||||||
email: true,
|
email: true,
|
||||||
phone: true,
|
phone: true,
|
||||||
@@ -46,7 +47,7 @@ export async function GET(request: Request) {
|
|||||||
})
|
})
|
||||||
const { ...userData } = data;
|
const { ...userData } = data;
|
||||||
const group = data?.Group.name
|
const group = data?.Group.name
|
||||||
const position = data?.Position.name
|
const position = data?.Position?.name
|
||||||
const phone = data?.phone.substr(2)
|
const phone = data?.phone.substr(2)
|
||||||
const role = data?.UserRole.name
|
const role = data?.UserRole.name
|
||||||
|
|
||||||
|
|||||||
@@ -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 });
|
||||||
|
|||||||
@@ -1,41 +1,56 @@
|
|||||||
'use server'
|
'use server'
|
||||||
|
|
||||||
import { pwd_key_config, prisma } from "@/module/_global";
|
import { prisma, pwd_key_config } from "@/module/_global";
|
||||||
import { unsealData } from "iron-session";
|
import { unsealData } from "iron-session";
|
||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
|
|
||||||
export default async function funGetUserByCookies() {
|
export default async function funGetUserByCookies() {
|
||||||
const sessionCookie = cookies().get("sessionCookieSDM");
|
const sessionCookie = cookies().get("sessionCookieSDM")
|
||||||
const userId : any = await unsealData(sessionCookie!.value, {
|
|
||||||
password: pwd_key_config,
|
|
||||||
});
|
|
||||||
|
|
||||||
const user = await prisma.user.findUnique({
|
if (sessionCookie != undefined) {
|
||||||
where: {
|
const userId: any = await unsealData(sessionCookie.value, {
|
||||||
id: userId.user ? String(userId.user) : String(userId),
|
password: pwd_key_config,
|
||||||
},
|
});
|
||||||
});
|
|
||||||
|
|
||||||
const village = await prisma.village.findUnique({
|
const user = await prisma.user.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: user?.idVillage
|
id: userId.user ? String(userId.user) : String(userId),
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
const warna = await prisma.colorTheme.findUnique({
|
const village = await prisma.village.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: String(village?.idTheme)
|
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() {
|
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")
|
return toast.error("Error! lembaga desa tidak boleh kosong")
|
||||||
setChooseAnggota(true)
|
setChooseAnggota(true)
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ export default function FormCreateDiscussionGeneral() {
|
|||||||
toast.error(loadGroup.message);
|
toast.error(loadGroup.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roleLogin.get() != "supadmin") {
|
if (roleLogin.get() != "supadmin" && roleLogin.get() != "developer") {
|
||||||
const loadUser = await funGetUserByCookies();
|
const loadUser = await funGetUserByCookies();
|
||||||
setBody({ ...body, idGroup: loadUser.idGroup })
|
setBody({ ...body, idGroup: loadUser.idGroup })
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ export default function FormCreateDiscussionGeneral() {
|
|||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Box>
|
<Box>
|
||||||
{
|
{
|
||||||
(roleLogin.get() == "supadmin") && (
|
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (
|
||||||
<Select
|
<Select
|
||||||
placeholder="Lembaga Desa"
|
placeholder="Lembaga Desa"
|
||||||
label="Lembaga Desa"
|
label="Lembaga Desa"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function DrawerDiscussionGeneral() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
{
|
{
|
||||||
roleLogin.get() == "supadmin" &&
|
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") &&
|
||||||
<Flex onClick={() => {
|
<Flex onClick={() => {
|
||||||
router.push('/discussion?page=filter&group=' + group)
|
router.push('/discussion?page=filter&group=' + group)
|
||||||
}} justify={'center'} align={'center'} direction={'column'} >
|
}} justify={'center'} align={'center'} direction={'column'} >
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ export default function ListDiscussionGeneral() {
|
|||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={(e) => setSearchQuery(e.target.value)}
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
/>
|
/>
|
||||||
{roleLogin.get() == 'supadmin' && <Text>Filter : {nameGroup}</Text>}
|
{(roleLogin.get() == 'supadmin' || roleLogin.get() == 'developer') && <Text>Filter : {nameGroup}</Text>}
|
||||||
{loading ?
|
{loading ?
|
||||||
Array(3)
|
Array(3)
|
||||||
.fill(null)
|
.fill(null)
|
||||||
|
|||||||
@@ -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%'}>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export default function CreateProject() {
|
|||||||
toast.error(loadGroup.message);
|
toast.error(loadGroup.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roleLogin.get() != "supadmin") {
|
if (roleLogin.get() != "supadmin" && roleLogin.get() != "developer") {
|
||||||
const loadUser = await funGetUserByCookies();
|
const loadUser = await funGetUserByCookies();
|
||||||
setBody({ ...body, idGroup: loadUser.idGroup })
|
setBody({ ...body, idGroup: loadUser.idGroup })
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ export default function CreateProject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onToChooseAnggota() {
|
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")
|
return toast.error("Error! lembaga desa tidak boleh kosong")
|
||||||
setChooseAnggota(true)
|
setChooseAnggota(true)
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ export default function CreateProject() {
|
|||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Box>
|
<Box>
|
||||||
{
|
{
|
||||||
(roleLogin.get() == "supadmin") && (
|
(roleLogin.get() == "supadmin" || roleLogin.get() == "developer") && (
|
||||||
<Select
|
<Select
|
||||||
placeholder="Lembaga Desa"
|
placeholder="Lembaga Desa"
|
||||||
label="Lembaga Desa"
|
label="Lembaga Desa"
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ export default function ListProject() {
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Box pt={20}>
|
<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>}
|
{(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 }}>
|
<Box bg={tema.get().bgTotalKegiatan} p={10} style={{ borderRadius: 10 }}>
|
||||||
<Text fw={'bold'} c={tema.get().utama}>Total Kegiatan</Text>
|
<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'} >
|
<Flex onClick={() => window.location.href = "/project?page=filter&group=" + group} justify={'center'} align={'center'} direction={'column'} >
|
||||||
<Box>
|
<Box>
|
||||||
<HiOutlineFilter size={30} color={tema.get().utama} />
|
<HiOutlineFilter size={30} color={tema.get().utama} />
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"id": "developer",
|
||||||
|
"name": "Developer",
|
||||||
|
"desc": "-"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "supadmin",
|
"id": "supadmin",
|
||||||
"name": "Super Admin",
|
"name": "Super Admin",
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { IProfileById } from "../lib/type_profile";
|
|||||||
|
|
||||||
export default function Profile() {
|
export default function Profile() {
|
||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
|
const [roleUser, setRoleUser] = useState("")
|
||||||
const [isData, setData] = useState<IProfileById>()
|
const [isData, setData] = useState<IProfileById>()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
@@ -30,8 +31,8 @@ export default function Profile() {
|
|||||||
setLoading(true)
|
setLoading(true)
|
||||||
const res = await funGetProfileByCookies()
|
const res = await funGetProfileByCookies()
|
||||||
setData(res.data)
|
setData(res.data)
|
||||||
|
setRoleUser(res.data.idUserRole)
|
||||||
setIMG(`https://wibu-storage.wibudev.com/api/files/${res.data.img}`)
|
setIMG(`https://wibu-storage.wibudev.com/api/files/${res.data.img}`)
|
||||||
setLoading(false)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -101,9 +102,12 @@ export default function Profile() {
|
|||||||
<Stack p={20}>
|
<Stack p={20}>
|
||||||
<Group justify="space-between" grow py={5}>
|
<Group justify="space-between" grow py={5}>
|
||||||
<Text fw={'bold'} fz={20}>Informasi</Text>
|
<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>
|
roleUser != "developer" &&
|
||||||
</Group>
|
<Group justify="flex-end">
|
||||||
|
<Text style={{ cursor: 'pointer' }} ta={"right"} c={"blue"} onClick={() => router.push(`/profile/edit/`)}>Edit</Text>
|
||||||
|
</Group>
|
||||||
|
}
|
||||||
</Group>
|
</Group>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={4}>
|
<Grid.Col span={4}>
|
||||||
@@ -127,17 +131,20 @@ export default function Profile() {
|
|||||||
<Text fz={15} fw={'bold'} ta={"right"}>{isData?.group}</Text>
|
<Text fz={15} fw={'bold'} ta={"right"}>{isData?.group}</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid>
|
{
|
||||||
<Grid.Col span={4}>
|
roleUser != "developer" &&
|
||||||
<Group>
|
<Grid>
|
||||||
<BiSolidUserBadge size={25} />
|
<Grid.Col span={4}>
|
||||||
<Text fz={15}>Jabatan</Text>
|
<Group>
|
||||||
</Group>
|
<BiSolidUserBadge size={25} />
|
||||||
</Grid.Col>
|
<Text fz={15}>Jabatan</Text>
|
||||||
<Grid.Col span={8}>
|
</Group>
|
||||||
<Text fz={15} fw={'bold'} ta={"right"}>{isData?.position}</Text>
|
</Grid.Col>
|
||||||
</Grid.Col>
|
<Grid.Col span={8}>
|
||||||
</Grid>
|
<Text fz={15} fw={'bold'} ta={"right"}>{isData?.position}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
}
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={5}>
|
<Grid.Col span={5}>
|
||||||
<Group>
|
<Group>
|
||||||
|
|||||||
Reference in New Issue
Block a user