@@ -10,7 +10,7 @@ export default async function Layout({ children }: { children: React.ReactNode }
|
||||
const user = await funGetUserByCookies()
|
||||
return (
|
||||
<>
|
||||
<WrapLayout role={user.idUserRole} theme={user.theme} user={user.id}>
|
||||
<WrapLayout role={user.idUserRole} theme={user.theme} user={user.id} village={user.idVillage}>
|
||||
{children}
|
||||
</WrapLayout>
|
||||
</>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { EditDetailTaskProject } from "@/module/project";
|
||||
|
||||
import React from "react";
|
||||
|
||||
function Page() {
|
||||
|
||||
@@ -87,7 +87,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
totalComments: comments.length,
|
||||
};
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan diskusi", data: response }, { status: 200 });
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan diskusi", data: response, user: user.id }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -175,7 +175,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
// create log user
|
||||
const log = await createLogUser({ act: 'DELETE', desc: 'User menghapus data diskusi', table: 'divisionDisscussion', data: id })
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil menghapus diskusi" }, { status: 200 });
|
||||
return NextResponse.json({ success: true, message: "Berhasil menghapus diskusi", user: user.id }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menghapus diskusi, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||
|
||||
@@ -173,8 +173,8 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
data: {
|
||||
title: name,
|
||||
idProject: id,
|
||||
dateStart: new Date(moment(dateStart).format('YYYY-MM-DD')),
|
||||
dateEnd: new Date(moment(dateEnd).format('YYYY-MM-DD')),
|
||||
dateStart: new Date(dateStart),
|
||||
dateEnd: new Date(dateEnd),
|
||||
},
|
||||
select: {
|
||||
id: true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { prisma } from "@/module/_global";
|
||||
import { funGetUserByCookies } from "@/module/auth";
|
||||
import { createLogUser } from "@/module/user";
|
||||
import moment from "moment";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
|
||||
@@ -231,8 +230,8 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
},
|
||||
data: {
|
||||
title,
|
||||
dateStart: new Date(moment(dateStart).format('YYYY-MM-DD')),
|
||||
dateEnd: new Date(moment(dateEnd).format('YYYY-MM-DD')),
|
||||
dateStart: new Date(dateStart),
|
||||
dateEnd: new Date(dateEnd),
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import { DIR, funUploadFile, prisma } from "@/module/_global";
|
||||
import { funGetUserByCookies } from "@/module/auth";
|
||||
import { createLogUser } from "@/module/user";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
|
||||
@@ -157,8 +156,8 @@ export async function POST(request: Request) {
|
||||
..._.omit(v, ["dateStart", "dateEnd", "name"]),
|
||||
idProject: data.id,
|
||||
title: v.title,
|
||||
dateStart: new Date(moment(v.dateStart).format('YYYY-MM-DD')),
|
||||
dateEnd: new Date(moment(v.dateEnd).format('YYYY-MM-DD')),
|
||||
dateStart: new Date(v.dateStart),
|
||||
dateEnd: new Date(v.dateEnd),
|
||||
}))
|
||||
|
||||
const insertTask = await prisma.projectTask.createMany({
|
||||
|
||||
@@ -170,7 +170,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
// create log user
|
||||
const log = await createLogUser({ act: 'DELETE', desc: 'User mengganti tema', table: 'colorTheme', data: id })
|
||||
|
||||
return NextResponse.json({ success: true, message: "Tema berhasil diganti", data: dataTheme }, { status: 200 });
|
||||
return NextResponse.json({ success: true, message: "Tema berhasil diganti", data: { village: user.idVillage, user: user.id }, theme: dataTheme }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
return NextResponse.json({ success: true, version: "0.1.9", mode: "staging" }, { status: 200 });
|
||||
return NextResponse.json({ success: true, version: "0.2.0", mode: "staging" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
'use client'
|
||||
import { globalParamJumlahNotif } from "@/module/home";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { globalNotifPage, globalRole, keyWibu, TEMA } from "../bin/val_global";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useWibuRealtime } from "wibu-realtime";
|
||||
import { globalNotifPage, globalRole, keyWibu, TEMA } from "../bin/val_global";
|
||||
import NotificationCustome from "./notification_custome";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { globalParamJumlahNotif } from "@/module/home";
|
||||
import ReloadButtonTop from "./reload_button_top";
|
||||
|
||||
export default function WrapLayout({ children, role, theme, user }: { children: React.ReactNode, role: any, theme: any, user: any }) {
|
||||
export default function WrapLayout({ children, role, theme, user, village }: { children: React.ReactNode, role: any, theme: any, user: any, village: any }) {
|
||||
const router = useRouter()
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
const tema = useHookstate(TEMA)
|
||||
@@ -44,6 +43,10 @@ export default function WrapLayout({ children, role, theme, user }: { children:
|
||||
}, 4000);
|
||||
}
|
||||
}
|
||||
|
||||
if (data && data.some((v: any) => v.category == "applied-theme" && v.user != user && v.village == village)) {
|
||||
tema.set(data[0]?.theme)
|
||||
}
|
||||
}, [data])
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ export default function DateEventDivision() {
|
||||
const [isMonth, setMonth] = useState<any>(moment().month() + 1)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const isMobile = useMediaQuery('(max-width: 369px)');
|
||||
const [isDateChoose, setDataChoose] = useState<any>(moment().format('YYYY-MM-DD'))
|
||||
const [dataRealTime, setDataRealtime] = useWibuRealtime({
|
||||
WIBU_REALTIME_TOKEN: keyWibu,
|
||||
project: "sdm"
|
||||
@@ -37,7 +38,6 @@ export default function DateEventDivision() {
|
||||
} else {
|
||||
toast.error(response.message)
|
||||
}
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan list acara")
|
||||
@@ -63,6 +63,7 @@ export default function DateEventDivision() {
|
||||
|
||||
async function changeMonth(value: any) {
|
||||
const monthKlik = moment(value).format('MM')
|
||||
setDataChoose(value)
|
||||
if (monthKlik != isMonth) {
|
||||
setMonth(monthKlik)
|
||||
getIndicator(value)
|
||||
@@ -99,7 +100,7 @@ export default function DateEventDivision() {
|
||||
getIndicator(isDate)
|
||||
getData(isDate, false)
|
||||
} else if (dataRealTime && dataRealTime.some((i: any) => i.category == 'calendar-event' && i.division == param.id && i.date != isDate)) {
|
||||
getIndicator(isDate)
|
||||
getIndicator(isDateChoose)
|
||||
}
|
||||
}, [dataRealTime])
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ export default function DetailEventDivision() {
|
||||
toast.error("Data telah di hapus, anda akan beralih ke halaman list acara")
|
||||
setTimeout(() => {
|
||||
router.push(`/division/${param.id}/calender`)
|
||||
}, 2000)
|
||||
}, 1000)
|
||||
}
|
||||
}, [dataRealTime])
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { FaUsers } from 'react-icons/fa6';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { useWibuRealtime } from 'wibu-realtime';
|
||||
|
||||
export default function DrawerDetailEvent({ idCalendar, close }: { idCalendar: string, close: (val:boolean) => void }) {
|
||||
export default function DrawerDetailEvent({ idCalendar, close }: { idCalendar: string, close: (val: boolean) => void }) {
|
||||
const router = useRouter()
|
||||
const [isModal, setModal] = useState(false)
|
||||
const param = useParams<{ id: string, detail: string }>()
|
||||
@@ -22,29 +22,27 @@ export default function DrawerDetailEvent({ idCalendar, close }: { idCalendar: s
|
||||
project: "sdm"
|
||||
})
|
||||
|
||||
async function fetchDeleteCalender(val: boolean) {
|
||||
async function fetchDeleteCalender() {
|
||||
try {
|
||||
if (val) {
|
||||
setLoadingDelete(true)
|
||||
const response = await funDeleteCalenderById(idCalendar)
|
||||
if (response.success) {
|
||||
setDataRealtime([
|
||||
{
|
||||
category: "calendar-detail-delete",
|
||||
id: idCalendar,
|
||||
},
|
||||
{
|
||||
category: "calendar-event",
|
||||
division: param.id,
|
||||
date: response.data.dateStart,
|
||||
idUserFrom: response.user
|
||||
}
|
||||
])
|
||||
toast.success(response.message)
|
||||
router.push(`/division/${param.id}/calender`)
|
||||
} else {
|
||||
toast.error(response.message)
|
||||
}
|
||||
setLoadingDelete(true)
|
||||
const response = await funDeleteCalenderById(idCalendar)
|
||||
if (response.success) {
|
||||
setDataRealtime([
|
||||
{
|
||||
category: "calendar-detail-delete",
|
||||
id: idCalendar,
|
||||
idUserFrom: response.user
|
||||
},
|
||||
{
|
||||
category: "calendar-event",
|
||||
division: param.id,
|
||||
date: response.data.dateStart,
|
||||
}
|
||||
])
|
||||
toast.success(response.message)
|
||||
router.push(`/division/${param.id}/calender`)
|
||||
} else {
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -94,7 +92,13 @@ export default function DrawerDetailEvent({ idCalendar, close }: { idCalendar: s
|
||||
</Stack>
|
||||
<LayoutModal loading={loadingDelete} opened={isModal} onClose={() => setModal(false)}
|
||||
description="Apakah Anda yakin ingin menghapus data acara ini? Data ini akan mempengaruhi semua data yang terkait"
|
||||
onYes={(val) => { fetchDeleteCalender(val) }} />
|
||||
onYes={(val) => {
|
||||
if (val) {
|
||||
fetchDeleteCalender()
|
||||
} else {
|
||||
setModal(false)
|
||||
}
|
||||
}} />
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TEMA } from '@/module/_global';
|
||||
import { keyWibu, TEMA } from '@/module/_global';
|
||||
import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Box, Flex, SimpleGrid, Text } from '@mantine/core';
|
||||
@@ -9,6 +9,7 @@ import { FaPencil, FaTrash } from 'react-icons/fa6';
|
||||
import { IoColorPalette } from 'react-icons/io5';
|
||||
import { funChangeTheme, funDeleteTheme } from '../lib/api_theme';
|
||||
import { globalRefreshTheme } from '../lib/val_theme';
|
||||
import { useWibuRealtime } from 'wibu-realtime';
|
||||
|
||||
export default function DrawerPaletEditEndDefault({ id, idVillage, isUse }: { id: string, idVillage: string, isUse: boolean }) {
|
||||
const router = useRouter()
|
||||
@@ -18,13 +19,23 @@ export default function DrawerPaletEditEndDefault({ id, idVillage, isUse }: { id
|
||||
const refresh = useHookstate(globalRefreshTheme)
|
||||
const [loadingApply, setLoadingApply] = useState(false)
|
||||
const [loadingDelete, setLoadingDelete] = useState(false)
|
||||
const [dataRealTime, setDataRealtime] = useWibuRealtime({
|
||||
WIBU_REALTIME_TOKEN: keyWibu,
|
||||
project: "sdm"
|
||||
})
|
||||
|
||||
async function onChangeTheme() {
|
||||
try {
|
||||
setLoadingApply(true)
|
||||
const res = await funChangeTheme(id)
|
||||
if (res.success) {
|
||||
tema.set(res.data)
|
||||
setDataRealtime([{
|
||||
category: "applied-theme",
|
||||
village: res.data.village,
|
||||
user: res.data.user,
|
||||
theme: res.theme
|
||||
}])
|
||||
tema.set(res.theme)
|
||||
refresh.set(!refresh.get())
|
||||
} else {
|
||||
toast.error(res.message);
|
||||
@@ -101,7 +112,7 @@ export default function DrawerPaletEditEndDefault({ id, idVillage, isUse }: { id
|
||||
onYes={(val) => {
|
||||
if (val) {
|
||||
onChangeTheme()
|
||||
}else{
|
||||
} else {
|
||||
setModal(false)
|
||||
}
|
||||
}} />
|
||||
@@ -112,7 +123,7 @@ export default function DrawerPaletEditEndDefault({ id, idVillage, isUse }: { id
|
||||
onYes={(val) => {
|
||||
if (val) {
|
||||
onDelete()
|
||||
}else{
|
||||
} else {
|
||||
setModalDel(false)
|
||||
}
|
||||
}} />
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
"use client"
|
||||
import { LayoutDrawer, LayoutNavbarNew, TEMA } from '@/module/_global';
|
||||
import { ActionIcon, Box, Checkbox, Flex, Group, Skeleton, Text } from '@mantine/core';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import React, { useState } from 'react';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { ActionIcon, Box, Flex, Group, Skeleton, Text } from '@mantine/core';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import { useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import { FaCircleCheck } from 'react-icons/fa6';
|
||||
import { HiMenu } from 'react-icons/hi';
|
||||
import DrawerCreatePalette from './drawer_create_palette';
|
||||
import DrawerPaletEditEndDefault from './drawer_palet_edit_end_default';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { funGetAllTheme } from '../lib/api_theme';
|
||||
import { IDataTheme } from '../lib/type_theme';
|
||||
import toast from 'react-hot-toast';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import { globalRefreshTheme } from '../lib/val_theme';
|
||||
import DrawerCreatePalette from './drawer_create_palette';
|
||||
import DrawerPaletEditEndDefault from './drawer_palet_edit_end_default';
|
||||
|
||||
export default function ListColorPalette() {
|
||||
const router = useRouter()
|
||||
const [isOpen, setOpen] = useState(false)
|
||||
const [isOpenTambahan, setOpenTambahan] = useState(false)
|
||||
const tema = useHookstate(TEMA)
|
||||
@@ -36,7 +34,6 @@ export default function ListColorPalette() {
|
||||
} else {
|
||||
toast.error(res.message)
|
||||
}
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan data tema, coba lagi nanti")
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ActionIcon, Avatar, Badge, Box, Center, Divider, Flex, Grid, Group, rem
|
||||
import { useMediaQuery, useShallowEffect } from "@mantine/hooks";
|
||||
import moment from "moment";
|
||||
import "moment/locale/id";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { GrChatOption } from "react-icons/gr";
|
||||
@@ -26,8 +26,10 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
||||
const refresh = useHookstate(globalRefreshDiscussion)
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
const [isCreator, setCreator] = useState(false)
|
||||
const [isUser, setUser] = useState('')
|
||||
const adminLogin = useHookstate(globalIsAdminDivision)
|
||||
const tema = useHookstate(TEMA)
|
||||
const router = useRouter()
|
||||
const isMobile = useMediaQuery('(max-width: 369px)');
|
||||
const isMobile2 = useMediaQuery("(max-width: 438px)");
|
||||
const [dataRealTime, setDataRealtime] = useWibuRealtime({
|
||||
@@ -42,6 +44,7 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
||||
setData(response.data)
|
||||
setIsLoad(false)
|
||||
setCreator(response.data.isCreator)
|
||||
setUser(response.user)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
@@ -57,6 +60,13 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
||||
if (dataRealTime && dataRealTime.some((i: any) => i.category == 'discussion-detail' && i.id == id)) {
|
||||
getData(false)
|
||||
}
|
||||
|
||||
if (dataRealTime && dataRealTime.some((i: any) => i.category == 'discussion-delete' && i.id == id && i.user != isUser)) {
|
||||
toast.error("Data telah di hapus, anda akan beralih ke halaman list diskusi")
|
||||
setTimeout(() => {
|
||||
router.push(`/division/${param.id}/discussion`)
|
||||
}, 1000)
|
||||
}
|
||||
}, [dataRealTime])
|
||||
|
||||
async function reloadData() {
|
||||
|
||||
@@ -55,10 +55,15 @@ export default function DrawerDetailDiscussion({ onSuccess, id, status, idDivisi
|
||||
|
||||
async function fetchDeleteDiscussion(val: boolean) {
|
||||
try {
|
||||
setLoadingDelete(true)
|
||||
if (val) {
|
||||
setLoadingDelete(true)
|
||||
const response = await funDeleteDiscussion(id)
|
||||
if (response.success) {
|
||||
setDataRealtime([{
|
||||
category: "discussion-delete",
|
||||
id: id,
|
||||
user: response.user
|
||||
}])
|
||||
toast.success(response.message)
|
||||
onSuccess(false)
|
||||
router.push(`/division/${param.id}/discussion`)
|
||||
|
||||
@@ -45,15 +45,15 @@ export default function ListDiscussion({ id }: { id: string }) {
|
||||
}
|
||||
}
|
||||
|
||||
useShallowEffect(() => {
|
||||
getData(false)
|
||||
}, [isPage])
|
||||
|
||||
useShallowEffect(() => {
|
||||
setPage(1)
|
||||
getData(true)
|
||||
}, [searchQuery])
|
||||
|
||||
useShallowEffect(() => {
|
||||
getData(false)
|
||||
}, [isPage])
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = async () => {
|
||||
if (containerRef && containerRef.current) {
|
||||
@@ -78,7 +78,6 @@ export default function ListDiscussion({ id }: { id: string }) {
|
||||
|
||||
|
||||
useShallowEffect(() => {
|
||||
console.log(notifLoadPage.get())
|
||||
if (notifLoadPage.get().category == 'division/' + param.id + '/discussion' && notifLoadPage.get().load == true) {
|
||||
setRefresh(true)
|
||||
}
|
||||
|
||||
@@ -63,15 +63,18 @@ export default function ListDivision() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
useShallowEffect(() => {
|
||||
fetchData(false)
|
||||
}, [isPage])
|
||||
|
||||
|
||||
useShallowEffect(() => {
|
||||
setPage(1)
|
||||
fetchData(true)
|
||||
}, [status, searchQuery])
|
||||
|
||||
|
||||
useShallowEffect(() => {
|
||||
fetchData(false)
|
||||
}, [isPage])
|
||||
|
||||
useEffect(() => {
|
||||
const handleScroll = async () => {
|
||||
@@ -157,7 +160,7 @@ export default function ListDivision() {
|
||||
<Box bg={tema.get().bgTotalKegiatan} p={10} style={{ borderRadius: 10 }}>
|
||||
<Text fw={'bold'} c={tema.get().utama}>Total Divisi</Text>
|
||||
<Flex justify={'center'} align={'center'} h={'100%'}>
|
||||
<Text fz={40} fw={'bold'} c={tema.get().utama}>{jumlah}</Text>
|
||||
<Text fz={40} fw={'bold'} c={tema.get().utama}>{loading ? 0 : jumlah}</Text>
|
||||
</Flex>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function ListProjects() {
|
||||
return (
|
||||
<>
|
||||
<Box pt={10}>
|
||||
<Text c={tema.get().utama} mb={10} fw={'bold'} fz={16}>Kegiatan Terbaru</Text>
|
||||
<Text c={tema.get().utama} mb={10} fw={'bold'} fz={16}>Kegiatan Terupdate</Text>
|
||||
{loading ?
|
||||
<Box pb={20}>
|
||||
<Skeleton width={"100%"} height={200} radius={"md"} />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IFormAddDetailproject, IFormAddMemberProject, IFormDateProject } from "./type_project";
|
||||
import { IFormAddDetailproject, IFormAddMemberProject, IFormDateProject, NewIFormDateProject } from "./type_project";
|
||||
|
||||
|
||||
export const funGetAllProject = async (path?: string) => {
|
||||
@@ -54,7 +54,7 @@ export const funGetDetailProject = async (path: string) => {
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funEditDetailProject = async (path: string, data: IFormDateProject) => {
|
||||
export const funEditDetailProject = async (path: string, data: NewIFormDateProject) => {
|
||||
const response = await fetch(`/api/project/detail/${path}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
||||
@@ -45,6 +45,12 @@ export interface IFormDateProject {
|
||||
title: string,
|
||||
}
|
||||
|
||||
export interface NewIFormDateProject{
|
||||
dateStart: string,
|
||||
dateEnd: string,
|
||||
title: string,
|
||||
}
|
||||
|
||||
export interface IFormMemberProject {
|
||||
idUser: string,
|
||||
name: string,
|
||||
@@ -53,8 +59,8 @@ export interface IFormMemberProject {
|
||||
|
||||
|
||||
export interface IFormAddDetailproject {
|
||||
dateStart: Date,
|
||||
dateEnd: Date,
|
||||
dateStart: string,
|
||||
dateEnd: string,
|
||||
name: string
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
import { Box, Button, Flex, Group, rem, SimpleGrid, Stack, Text, TextInput } from '@mantine/core';
|
||||
import { DatePicker } from '@mantine/dates';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import moment from 'moment';
|
||||
import { useParams, useRouter } from 'next/navigation';
|
||||
import { useState } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
import { useWibuRealtime } from 'wibu-realtime';
|
||||
import { funCreateDetailProject } from '../lib/api_project';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
|
||||
export default function AddDetailTaskProject() {
|
||||
const [value, setValue] = useState<[Date | null, Date | null]>([null, null]);
|
||||
@@ -35,8 +35,8 @@ export default function AddDetailTaskProject() {
|
||||
setLoadingModal(true)
|
||||
const res = await funCreateDetailProject(param.id, {
|
||||
name,
|
||||
dateStart: (value[0] != null) ? value[0] : new Date,
|
||||
dateEnd: (value[1] != null) ? value[1] : new Date,
|
||||
dateStart: (value[0] != null) ? moment(value[0]).format('YYYY-MM-DD') : moment(new Date).format('YYYY-MM-DD'),
|
||||
dateEnd: (value[1] != null) ? moment(value[1]).format('YYYY-MM-DD') : moment(new Date).format('YYYY-MM-DD'),
|
||||
})
|
||||
|
||||
if (res.success) {
|
||||
|
||||
@@ -223,12 +223,12 @@ export default function AddMemberDetailProject() {
|
||||
</Box>
|
||||
|
||||
<Box p={20}>
|
||||
<Group justify="space-between" mt={100} onClick={handleSelectAll}>
|
||||
{/* <Group justify="space-between" mt={100} onClick={handleSelectAll}>
|
||||
<Text c={tema.get().utama} fw={"bold"}>
|
||||
Pilih Semua Anggota
|
||||
</Text>
|
||||
{selectAll ? <FaCheck style={{ marginRight: 10 }} /> : ""}
|
||||
</Group>
|
||||
</Group> */}
|
||||
{loading ?
|
||||
Array(8)
|
||||
.fill(null)
|
||||
|
||||
@@ -3,15 +3,15 @@ import { LayoutNavbarNew, TEMA } from "@/module/_global";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { ActionIcon, Box, Button, Flex, Group, rem, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
|
||||
import { DatePicker } from "@mantine/dates";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import moment from "moment";
|
||||
import { useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { HiChevronLeft } from "react-icons/hi2";
|
||||
import { IFormDateProject } from "../lib/type_project";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { NewIFormDateProject } from "../lib/type_project";
|
||||
|
||||
|
||||
export default function ViewDateEndTask({ onClose, onSet }: { onClose: (val: boolean) => void, onSet: (val: IFormDateProject) => void }) {
|
||||
export default function ViewDateEndTask({ onClose, onSet }: { onClose: (val: boolean) => void, onSet: (val: NewIFormDateProject) => void }) {
|
||||
const [value, setValue] = useState<[Date | null, Date | null]>([null, null]);
|
||||
const [title, setTitle] = useState("")
|
||||
const tema = useHookstate(TEMA)
|
||||
@@ -29,8 +29,8 @@ export default function ViewDateEndTask({ onClose, onSet }: { onClose: (val: boo
|
||||
return toast.error("Error! harus memasukkan judul tugas")
|
||||
|
||||
onSet({
|
||||
dateStart: value[0],
|
||||
dateEnd: value[1],
|
||||
dateStart: moment(value[0]).format('YYYY-MM-DD'),
|
||||
dateEnd: moment(value[1]).format('YYYY-MM-DD'),
|
||||
title: title
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { FaTrash } from "react-icons/fa6";
|
||||
import { IoIosArrowDropright } from "react-icons/io";
|
||||
import { useWibuRealtime } from "wibu-realtime";
|
||||
import { funCreateProject } from "../lib/api_project";
|
||||
import { IFormDateProject, IFormMemberProject, IListFileTaskProject } from "../lib/type_project";
|
||||
import { IFormMemberProject, IListFileTaskProject, NewIFormDateProject } from "../lib/type_project";
|
||||
import { globalMemberProject } from "../lib/val_project";
|
||||
import ViewDateEndTask from "./create_date_end_task";
|
||||
import CreateUsersProject from "./create_users_project";
|
||||
@@ -32,7 +32,7 @@ export default function CreateProject() {
|
||||
const member = useHookstate(globalMemberProject)
|
||||
const memberValue = member.get() as IFormMemberProject[]
|
||||
const [openTugas, setOpenTugas] = useState(false)
|
||||
const [dataTask, setDataTask] = useState<IFormDateProject[]>([])
|
||||
const [dataTask, setDataTask] = useState<NewIFormDateProject[]>([])
|
||||
const openRef = useRef<() => void>(null)
|
||||
const [fileForm, setFileForm] = useState<any[]>([])
|
||||
const [listFile, setListFile] = useState<IListFileTaskProject[]>([])
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
||||
const res = await funGetAllmember('?active=true&group=' + grup + '&search=' + search);
|
||||
const user = await funGetUserByCookies();
|
||||
if (res.success) {
|
||||
setDataMember(res.data.filter((i: any) => i.id != user.id))
|
||||
setDataMember(res.data.filter((i: any) => i.id != user.id && i.idUserRole != 'supadmin' && i.idUserRole != 'cosupadmin'))
|
||||
// cek data member sebelumnya
|
||||
if (member.length > 0) {
|
||||
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
||||
|
||||
@@ -42,8 +42,8 @@ export default function EditDetailTaskProject() {
|
||||
setLoadingModal(true)
|
||||
const res = await funEditDetailProject(param.id, {
|
||||
title: name,
|
||||
dateStart: value[0],
|
||||
dateEnd: value[1],
|
||||
dateStart: moment(value[0]).format('YYYY-MM-DD'),
|
||||
dateEnd: moment(value[1]).format('YYYY-MM-DD'),
|
||||
|
||||
})
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ export default function ListProject() {
|
||||
<Box bg={tema.get().bgTotalKegiatan} p={10} style={{ borderRadius: 10 }}>
|
||||
<Text fw={'bold'} c={tema.get().utama}>Total Kegiatan</Text>
|
||||
<Flex justify={'center'} align={'center'} h={'100%'}>
|
||||
<Text fz={40} fw={'bold'} c={tema.get().utama}>{totalData}</Text>
|
||||
<Text fz={40} fw={'bold'} c={tema.get().utama}>{loading ? 0 : totalData}</Text>
|
||||
</Flex>
|
||||
</Box>
|
||||
{isList ? (
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { Box, Center, Grid, Group, SimpleGrid, Spoiler, Text } from '@mantine/core';
|
||||
import React from 'react';
|
||||
import { AiOutlineFileSync } from "react-icons/ai";
|
||||
import { IFormDateProject } from '../lib/type_project';
|
||||
import { Box, Center, Grid, Group, SimpleGrid, Text } from '@mantine/core';
|
||||
import moment from 'moment';
|
||||
import { AiOutlineFileSync } from "react-icons/ai";
|
||||
import { NewIFormDateProject } from '../lib/type_project';
|
||||
|
||||
export default function ResultsDateAndTask(data: IFormDateProject) {
|
||||
export default function ResultsDateAndTask(data: NewIFormDateProject) {
|
||||
return (
|
||||
<Box pt={5}>
|
||||
<Box bg={"white"} style={{
|
||||
|
||||
@@ -42,7 +42,7 @@ export default function ListMember() {
|
||||
Aktif
|
||||
</Tabs.Tab>
|
||||
<Tabs.Tab
|
||||
value="tidak-aktif"
|
||||
value="false"
|
||||
w={"53%"}
|
||||
leftSection={<IoCloseCircleOutline style={iconStyle} />}
|
||||
onClick={() => {
|
||||
|
||||
Reference in New Issue
Block a user