Merge pull request #323 from bipproduction/amalia/31-okt-24
fix: project
This commit is contained in:
@@ -136,6 +136,10 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
id: {
|
id: {
|
||||||
not: String(userId)
|
not: String(userId)
|
||||||
},
|
},
|
||||||
|
OR: [
|
||||||
|
{ idUserRole: 'coadmin', },
|
||||||
|
{ idUserRole: 'user', }
|
||||||
|
],
|
||||||
isActive: true,
|
isActive: true,
|
||||||
name: {
|
name: {
|
||||||
contains: (name == undefined || name == "null") ? "" : name,
|
contains: (name == undefined || name == "null") ? "" : name,
|
||||||
@@ -147,14 +151,24 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
id: true,
|
id: true,
|
||||||
name: true,
|
name: true,
|
||||||
email: true,
|
email: true,
|
||||||
img: true
|
img: true,
|
||||||
|
UserRole: {
|
||||||
|
select: {
|
||||||
|
name: true
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
orderBy: {
|
orderBy: {
|
||||||
name: 'asc'
|
name: 'asc'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const fixMember = member.map((v: any) => ({
|
const omitData = member.map((v: any) => ({
|
||||||
|
..._.omit(v, ["UserRole"]),
|
||||||
|
userRole: v.UserRole.name
|
||||||
|
}))
|
||||||
|
|
||||||
|
const fixMember = omitData.map((v: any) => ({
|
||||||
idUser: v.id,
|
idUser: v.id,
|
||||||
name: v.name,
|
name: v.name,
|
||||||
email: v.email,
|
email: v.email,
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
status: true,
|
status: true,
|
||||||
dateStart: true,
|
dateStart: true,
|
||||||
dateEnd: true,
|
dateEnd: true,
|
||||||
|
createdAt: true
|
||||||
},
|
},
|
||||||
orderBy: {
|
orderBy: {
|
||||||
createdAt: 'asc'
|
createdAt: 'asc'
|
||||||
@@ -72,12 +73,13 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
})
|
})
|
||||||
|
|
||||||
const formatData = dataProgress.map((v: any) => ({
|
const formatData = dataProgress.map((v: any) => ({
|
||||||
..._.omit(v, ["dateStart", "dateEnd"]),
|
..._.omit(v, ["dateStart", "dateEnd", "createdAt"]),
|
||||||
dateStart: moment(v.dateStart).format("DD-MM-YYYY"),
|
dateStart: moment(v.dateStart).format("DD-MM-YYYY"),
|
||||||
dateEnd: moment(v.dateEnd).format("DD-MM-YYYY"),
|
dateEnd: moment(v.dateEnd).format("DD-MM-YYYY"),
|
||||||
|
createdAt: moment(v.createdAt).format("DD-MM-YYYY HH:mm"),
|
||||||
}))
|
}))
|
||||||
|
const dataFix = _.orderBy(formatData, 'createdAt', 'asc')
|
||||||
allData = formatData
|
allData = dataFix
|
||||||
|
|
||||||
} else if (kategori == "file") {
|
} else if (kategori == "file") {
|
||||||
const dataFile = await prisma.projectFile.findMany({
|
const dataFile = await prisma.projectFile.findMany({
|
||||||
@@ -86,7 +88,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
idProject: String(id)
|
idProject: String(id)
|
||||||
},
|
},
|
||||||
orderBy: {
|
orderBy: {
|
||||||
createdAt: 'desc'
|
createdAt: 'asc'
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IFormAddDetailproject, IFormAddMemberProject, IFormDateProject, IFormProject } from "./type_project";
|
import { IFormAddDetailproject, IFormAddMemberProject, IFormDateProject } from "./type_project";
|
||||||
|
|
||||||
|
|
||||||
export const funGetAllProject = async (path?: string) => {
|
export const funGetAllProject = async (path?: string) => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { keyWibu, LayoutDrawer, LayoutNavbarNew, TEMA } from "@/module/_global";
|
import { keyWibu, LayoutDrawer, LayoutNavbarNew, TEMA } from "@/module/_global";
|
||||||
import LayoutModal from "@/module/_global/layout/layout_modal";
|
import LayoutModal from "@/module/_global/layout/layout_modal";
|
||||||
import { useHookstate } from "@hookstate/core";
|
import { useHookstate } from "@hookstate/core";
|
||||||
import { Box, Button, Flex, Group, rem, SimpleGrid, Stack, Text, } from "@mantine/core";
|
import { Box, Button, Flex, Group, Loader, rem, SimpleGrid, Stack, Text, } from "@mantine/core";
|
||||||
import { Dropzone } from "@mantine/dropzone";
|
import { Dropzone } from "@mantine/dropzone";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useParams, useRouter } from "next/navigation";
|
import { useParams, useRouter } from "next/navigation";
|
||||||
@@ -10,10 +10,10 @@ import { useRef, useState } from "react";
|
|||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { FaTrash } from "react-icons/fa6";
|
import { FaTrash } from "react-icons/fa6";
|
||||||
import { IoIosArrowDropright } from "react-icons/io";
|
import { IoIosArrowDropright } from "react-icons/io";
|
||||||
|
import { useWibuRealtime } from "wibu-realtime";
|
||||||
import { funAddFileProject, funCekNamFileUploadProject } from "../lib/api_project";
|
import { funAddFileProject, funCekNamFileUploadProject } from "../lib/api_project";
|
||||||
import { IListFileTaskProject } from "../lib/type_project";
|
import { IListFileTaskProject } from "../lib/type_project";
|
||||||
import ResultsFile from "./results_file";
|
import ResultsFile from "./results_file";
|
||||||
import { useWibuRealtime } from "wibu-realtime";
|
|
||||||
|
|
||||||
|
|
||||||
export default function AddFileDetailProject() {
|
export default function AddFileDetailProject() {
|
||||||
@@ -26,6 +26,7 @@ export default function AddFileDetailProject() {
|
|||||||
const [indexDelFile, setIndexDelFile] = useState<number>(0)
|
const [indexDelFile, setIndexDelFile] = useState<number>(0)
|
||||||
const [openDrawerFile, setOpenDrawerFile] = useState(false)
|
const [openDrawerFile, setOpenDrawerFile] = useState(false)
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
|
const [loadingUpload, setLoadingUpload] = useState(false)
|
||||||
const openRef = useRef<() => void>(null)
|
const openRef = useRef<() => void>(null)
|
||||||
const [dataRealTime, setDataRealtime] = useWibuRealtime({
|
const [dataRealTime, setDataRealtime] = useWibuRealtime({
|
||||||
WIBU_REALTIME_TOKEN: keyWibu,
|
WIBU_REALTIME_TOKEN: keyWibu,
|
||||||
@@ -41,6 +42,7 @@ export default function AddFileDetailProject() {
|
|||||||
|
|
||||||
async function cekFileName(data: any) {
|
async function cekFileName(data: any) {
|
||||||
try {
|
try {
|
||||||
|
setLoadingUpload(true)
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append(`file`, data);
|
fd.append(`file`, data);
|
||||||
const res = await funCekNamFileUploadProject(param.id, fd)
|
const res = await funCekNamFileUploadProject(param.id, fd)
|
||||||
@@ -53,6 +55,8 @@ export default function AddFileDetailProject() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan file, coba lagi nanti")
|
toast.error("Gagal menambahkan file, coba lagi nanti")
|
||||||
|
} finally {
|
||||||
|
setLoadingUpload(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,8 +96,7 @@ export default function AddFileDetailProject() {
|
|||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<LayoutNavbarNew back="" title={"Tambah File"} menu />
|
<LayoutNavbarNew back="" title={"Tambah File"} menu />
|
||||||
|
<Box p={20} pb={100}>
|
||||||
<Box p={20}>
|
|
||||||
<Stack>
|
<Stack>
|
||||||
<Dropzone
|
<Dropzone
|
||||||
openRef={openRef}
|
openRef={openRef}
|
||||||
@@ -147,6 +150,13 @@ export default function AddFileDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
loadingUpload &&
|
||||||
|
<Group justify="center" py={20}>
|
||||||
|
<Loader color="gray" type="dots" />
|
||||||
|
</Group>
|
||||||
|
}
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
||||||
maxWidth: rem(550),
|
maxWidth: rem(550),
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { keyWibu, LayoutNavbarNew, SkeletonList, TEMA } from '@/module/_global';
|
|||||||
import LayoutModal from '@/module/_global/layout/layout_modal';
|
import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import { Carousel } from '@mantine/carousel';
|
import { Carousel } from '@mantine/carousel';
|
||||||
import { ActionIcon, Avatar, Box, Button, Center, Divider, Flex, Grid, Group, Indicator, rem, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
import { ActionIcon, Avatar, Box, Button, Center, Divider, Flex, Grid, Group, Indicator, rem, Stack, Text, TextInput } from '@mantine/core';
|
||||||
import { useMediaQuery, useShallowEffect } from '@mantine/hooks';
|
import { useMediaQuery, useShallowEffect } from '@mantine/hooks';
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
@@ -50,7 +50,6 @@ export default function AddMemberDetailProject() {
|
|||||||
} else {
|
} else {
|
||||||
toast.error(res.message);
|
toast.error(res.message);
|
||||||
}
|
}
|
||||||
setLoading(false)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
@@ -296,20 +295,16 @@ export default function AddMemberDetailProject() {
|
|||||||
zIndex: 999,
|
zIndex: 999,
|
||||||
backgroundColor: `${tema.get().bgUtama}`,
|
backgroundColor: `${tema.get().bgUtama}`,
|
||||||
}}>
|
}}>
|
||||||
{loading ?
|
<Button
|
||||||
<Skeleton height={50} radius={30} />
|
c={"white"}
|
||||||
:
|
bg={tema.get().utama}
|
||||||
<Button
|
size="lg"
|
||||||
c={"white"}
|
radius={30}
|
||||||
bg={tema.get().utama}
|
fullWidth
|
||||||
size="lg"
|
onClick={() => { onVerifikasi() }}
|
||||||
radius={30}
|
>
|
||||||
fullWidth
|
Simpan
|
||||||
onClick={() => { onVerifikasi() }}
|
</Button>
|
||||||
>
|
|
||||||
Simpan
|
|
||||||
</Button>
|
|
||||||
}
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export default function CancelProject() {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [alasan, setAlasan] = useState("")
|
const [alasan, setAlasan] = useState("")
|
||||||
const [openModal, setOpenModal] = useState(false)
|
const [openModal, setOpenModal] = useState(false)
|
||||||
|
const [loadingModal, setLoadingModal] = useState(false)
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
const [touched, setTouched] = useState({
|
const [touched, setTouched] = useState({
|
||||||
@@ -23,15 +24,38 @@ export default function CancelProject() {
|
|||||||
project: "sdm"
|
project: "sdm"
|
||||||
})
|
})
|
||||||
|
|
||||||
function onVerification() {
|
function onCheck() {
|
||||||
if (alasan == "")
|
const cek = checkAll()
|
||||||
return toast.error("Error! harus memasukkan alasan pembatalan Kegiatan")
|
if (!cek)
|
||||||
|
return false
|
||||||
|
|
||||||
setOpenModal(true)
|
setOpenModal(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkAll() {
|
||||||
|
let nilai = true
|
||||||
|
if (alasan == "") {
|
||||||
|
setTouched(touched => ({ ...touched, reason: true }))
|
||||||
|
nilai = false
|
||||||
|
}
|
||||||
|
return nilai
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function onValidation(kategori: string, val: string) {
|
||||||
|
if (kategori == 'reason') {
|
||||||
|
setAlasan(val)
|
||||||
|
if (val == "") {
|
||||||
|
setTouched({ ...touched, reason: true })
|
||||||
|
} else {
|
||||||
|
setTouched({ ...touched, reason: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingModal(true)
|
||||||
const res = await funCancelProject(param.id, { reason: alasan })
|
const res = await funCancelProject(param.id, { reason: alasan })
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setDataRealtime([{
|
setDataRealtime([{
|
||||||
@@ -39,13 +63,16 @@ export default function CancelProject() {
|
|||||||
id: param.id,
|
id: param.id,
|
||||||
}])
|
}])
|
||||||
toast.success(res.message)
|
toast.success(res.message)
|
||||||
router.push("/project")
|
router.push("/project/" + param.id)
|
||||||
} else {
|
} else {
|
||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast.error("Gagal membatalkan Kegiatan, coba lagi nanti")
|
toast.error("Gagal membatalkan Kegiatan, coba lagi nanti")
|
||||||
|
} finally {
|
||||||
|
setLoadingModal(false)
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,8 +90,7 @@ export default function CancelProject() {
|
|||||||
value={alasan}
|
value={alasan}
|
||||||
size="md" placeholder='Contoh : Kegiatan tidak sesuai' label="Alasan Pembatalan"
|
size="md" placeholder='Contoh : Kegiatan tidak sesuai' label="Alasan Pembatalan"
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
setAlasan(event.target.value)
|
onValidation('reason', event.target.value)
|
||||||
setTouched({ ...touched, reason: false })
|
|
||||||
}}
|
}}
|
||||||
error={
|
error={
|
||||||
touched.reason && (
|
touched.reason && (
|
||||||
@@ -86,20 +112,21 @@ export default function CancelProject() {
|
|||||||
size="lg"
|
size="lg"
|
||||||
radius={30}
|
radius={30}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() => { onVerification() }}
|
onClick={() => { onCheck() }}
|
||||||
>
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
||||||
<LayoutModal opened={openModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
|
||||||
description="Apakah Anda yakin ingin membatalkan Kegiatan ini? Pembatalan Kegiatan bersifat permanen"
|
description="Apakah Anda yakin ingin membatalkan kegiatan ini? Pembatalan kegiatan bersifat permanen"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
|
} else {
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
setOpenModal(false)
|
|
||||||
}} />
|
}} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,27 +1,24 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, SkeletonList, SkeletonSingle, SkeletonUser, TEMA } from '@/module/_global';
|
import { LayoutNavbarNew, SkeletonList, TEMA } from '@/module/_global';
|
||||||
import { useHookstate } from '@hookstate/core';
|
|
||||||
import { ActionIcon, Avatar, Box, Button, Center, Divider, Flex, Grid, Indicator, Input, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
|
||||||
import { useMediaQuery, useShallowEffect } from '@mantine/hooks';
|
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import React, { useState } from 'react';
|
|
||||||
import { HiChevronLeft, HiMagnifyingGlass } from 'react-icons/hi2';
|
|
||||||
import { funGetAllmember, TypeUser } from '@/module/user';
|
|
||||||
import { funGetUserByCookies } from '@/module/auth';
|
import { funGetUserByCookies } from '@/module/auth';
|
||||||
import toast from 'react-hot-toast';
|
import { funGetAllmember, TypeUser } from '@/module/user';
|
||||||
import { globalMemberProject } from '../lib/val_project';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import { FaCheck } from 'react-icons/fa6';
|
|
||||||
import { IoArrowBackOutline, IoClose } from 'react-icons/io5';
|
|
||||||
import { Carousel } from '@mantine/carousel';
|
import { Carousel } from '@mantine/carousel';
|
||||||
|
import { ActionIcon, Avatar, Box, Button, Center, Divider, Flex, Grid, Indicator, rem, Stack, Text, TextInput } from '@mantine/core';
|
||||||
|
import { useMediaQuery, useShallowEffect } from '@mantine/hooks';
|
||||||
|
import { useState } from 'react';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { FaCheck } from 'react-icons/fa6';
|
||||||
|
import { HiChevronLeft, HiMagnifyingGlass } from 'react-icons/hi2';
|
||||||
|
import { IoArrowBackOutline, IoClose } from 'react-icons/io5';
|
||||||
|
import { globalMemberProject } from '../lib/val_project';
|
||||||
|
|
||||||
|
|
||||||
export default function CreateUsersProject({ grup, onClose }: { grup?: string, onClose: (val: any) => void }) {
|
export default function CreateUsersProject({ grup, onClose }: { grup?: string, onClose: (val: any) => void }) {
|
||||||
const router = useRouter()
|
|
||||||
const member = useHookstate(globalMemberProject)
|
const member = useHookstate(globalMemberProject)
|
||||||
const [selectedFiles, setSelectedFiles] = useState<any>([]);
|
const [selectedFiles, setSelectedFiles] = useState<any>([]);
|
||||||
const [dataMember, setDataMember] = useState<TypeUser>([])
|
const [dataMember, setDataMember] = useState<TypeUser>([])
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [openTugas, setOpenTugas] = useState(false)
|
|
||||||
const [onClickSearch, setOnClickSearch] = useState(false)
|
const [onClickSearch, setOnClickSearch] = useState(false)
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
const isMobile2 = useMediaQuery("(max-width: 438px)");
|
const isMobile2 = useMediaQuery("(max-width: 438px)");
|
||||||
@@ -36,21 +33,25 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
|||||||
|
|
||||||
|
|
||||||
async function loadData(search: string) {
|
async function loadData(search: string) {
|
||||||
setLoading(true)
|
try {
|
||||||
const res = await funGetAllmember('?active=true&group=' + grup + '&search=' + search);
|
setLoading(true)
|
||||||
const user = await funGetUserByCookies();
|
const res = await funGetAllmember('?active=true&group=' + grup + '&search=' + search);
|
||||||
|
const user = await funGetUserByCookies();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setDataMember(res.data.filter((i: any) => i.id != user.id))
|
setDataMember(res.data.filter((i: any) => i.id != user.id))
|
||||||
|
// cek data member sebelumnya
|
||||||
// cek data member sebelumnya
|
if (member.length > 0) {
|
||||||
if (member.length > 0) {
|
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
||||||
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
}
|
||||||
|
} else {
|
||||||
|
toast.error("Gagal mendapatkan data, coba lagi nanti")
|
||||||
}
|
}
|
||||||
} else {
|
} catch (error) {
|
||||||
toast.error(res.message)
|
console.error(error)
|
||||||
|
toast.error("Gagal mendapatkan data, coba lagi nanti")
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
setLoading(false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, TEMA } from '@/module/_global';
|
import { keyWibu, LayoutNavbarNew, TEMA } from '@/module/_global';
|
||||||
import LayoutModal from '@/module/_global/layout/layout_modal';
|
import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import { Box, Button, Flex, Group, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
import { Box, Button, Flex, Group, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
||||||
@@ -9,6 +9,7 @@ import moment from 'moment';
|
|||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, 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 { useWibuRealtime } from 'wibu-realtime';
|
||||||
import { funEditDetailProject, funGetDetailProject } from '../lib/api_project';
|
import { funEditDetailProject, funGetDetailProject } from '../lib/api_project';
|
||||||
|
|
||||||
export default function EditDetailTaskProject() {
|
export default function EditDetailTaskProject() {
|
||||||
@@ -24,6 +25,10 @@ export default function EditDetailTaskProject() {
|
|||||||
title: false,
|
title: false,
|
||||||
date: false,
|
date: false,
|
||||||
});
|
});
|
||||||
|
const [dataRealTime, setDataRealtime] = useWibuRealtime({
|
||||||
|
WIBU_REALTIME_TOKEN: keyWibu,
|
||||||
|
project: "sdm"
|
||||||
|
})
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
@@ -43,6 +48,10 @@ export default function EditDetailTaskProject() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
setDataRealtime([{
|
||||||
|
category: "project-detail-task",
|
||||||
|
id: idProject,
|
||||||
|
}])
|
||||||
toast.success(res.message);
|
toast.success(res.message);
|
||||||
router.push('/project/' + idProject)
|
router.push('/project/' + idProject)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ export default function ListProject() {
|
|||||||
} else {
|
} else {
|
||||||
toast.error(response.message);
|
toast.error(response.message);
|
||||||
}
|
}
|
||||||
setLoading(false);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error("Gagal mendapatkan kegiatan, coba lagi nanti");
|
toast.error("Gagal mendapatkan kegiatan, coba lagi nanti");
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export default function NavbarDetailProject() {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const [name, setName] = useState('')
|
const [name, setName] = useState('')
|
||||||
|
const [grup, setGrup] = useState("")
|
||||||
const [isOpen, setOpen] = useState(false)
|
const [isOpen, setOpen] = useState(false)
|
||||||
const roleLogin = useHookstate(globalRole)
|
const roleLogin = useHookstate(globalRole)
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
@@ -32,6 +33,7 @@ export default function NavbarDetailProject() {
|
|||||||
if (res.success) {
|
if (res.success) {
|
||||||
setName(res.data.title);
|
setName(res.data.title);
|
||||||
setReason(res.data.reason);
|
setReason(res.data.reason);
|
||||||
|
setGrup(res.data.idGroup);
|
||||||
} else {
|
} else {
|
||||||
toast.error(res.message);
|
toast.error(res.message);
|
||||||
}
|
}
|
||||||
@@ -54,7 +56,7 @@ export default function NavbarDetailProject() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutNavbarNew back="" title={name} menu={
|
<LayoutNavbarNew back={`/project?group=${grup}`} title={name} menu={
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="light"
|
variant="light"
|
||||||
bg={tema.get().bgIcon}
|
bg={tema.get().bgIcon}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export default function ProgressDetailProject() {
|
|||||||
:
|
:
|
||||||
<Box
|
<Box
|
||||||
p={20}
|
p={20}
|
||||||
bg={"#DCEED8"}
|
bg={tema.get().bgTotalKegiatan}
|
||||||
style={{
|
style={{
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user