3
.gitignore
vendored
3
.gitignore
vendored
@@ -40,4 +40,5 @@ next-env.d.ts
|
|||||||
|
|
||||||
# folder foto kandidat
|
# folder foto kandidat
|
||||||
/public/image/
|
/public/image/
|
||||||
/public/file/
|
/public/file/
|
||||||
|
certificates
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev --experimental-https",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
@@ -77,4 +77,4 @@
|
|||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,6 @@ import _ from "lodash";
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// GET ONE PENGUMUMAN, UNTUK TAMPIL DETAIL PENGUMUMAN
|
// GET ONE PENGUMUMAN, UNTUK TAMPIL DETAIL PENGUMUMAN
|
||||||
export async function GET(request: Request, context: { params: { id: string } }) {
|
export async function GET(request: Request, context: { params: { id: string } }) {
|
||||||
try {
|
try {
|
||||||
@@ -72,7 +71,9 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
division: v.Division.name
|
division: v.Division.name
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const fixMember = Object.groupBy(formatMember, ({ group }) => group);
|
// const fixMember = Object.groupBy(formatMember, ({ group }) => group);
|
||||||
|
const fixMember = _.groupBy(formatMember, ({ group }) => group);
|
||||||
|
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
@@ -88,7 +89,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan pengumuman, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan pengumuman, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan pengumuman, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan pengumuman, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +218,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengeupdate pengumuman, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengeupdate pengumuman, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
export const dynamic = 'force-dynamic'
|
export const dynamic = 'force-dynamic'
|
||||||
export const revalidate = true
|
export const revalidate = true
|
||||||
|
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
const user = await funGetUserByCookies()
|
const user = await funGetUserByCookies()
|
||||||
@@ -32,6 +33,9 @@ export async function GET(request: Request) {
|
|||||||
id: true,
|
id: true,
|
||||||
name: true,
|
name: true,
|
||||||
Division: {
|
Division: {
|
||||||
|
where: {
|
||||||
|
isActive: true
|
||||||
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
name: true
|
name: true
|
||||||
@@ -44,6 +48,6 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,6 +287,7 @@ export async function GET(request: Request) {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
dateStart: new Date(),
|
dateStart: new Date(),
|
||||||
Division: {
|
Division: {
|
||||||
|
isActive: true,
|
||||||
idVillage: idVillage,
|
idVillage: idVillage,
|
||||||
Group: {
|
Group: {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
@@ -301,6 +302,7 @@ export async function GET(request: Request) {
|
|||||||
isActive: true,
|
isActive: true,
|
||||||
dateStart: new Date(),
|
dateStart: new Date(),
|
||||||
Division: {
|
Division: {
|
||||||
|
isActive: true,
|
||||||
idGroup: idGroup
|
idGroup: idGroup
|
||||||
},
|
},
|
||||||
DivisionCalendar: {
|
DivisionCalendar: {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambah anggota kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambah anggota kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,13 +141,16 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
contains: (name == undefined || name == "null") ? "" : name,
|
contains: (name == undefined || name == "null") ? "" : name,
|
||||||
mode: 'insensitive'
|
mode: 'insensitive'
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
name: true,
|
name: true,
|
||||||
email: true,
|
email: true,
|
||||||
img: true
|
img: true
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
name: 'asc'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -167,6 +170,6 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan project, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan project, data tidak ditemukan", }, { status: 404 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan", }, { status: 404 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -133,11 +133,11 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
allData = fix
|
allData = fix
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan project", data: allData, }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan kegiatan", data: allData, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan project, coba lagi nantiiiiii", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal tambah tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal tambah tahapan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
if (data == 0) {
|
if (data == 0) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||||
},
|
},
|
||||||
{ status: 404 }
|
{ status: 404 }
|
||||||
);
|
);
|
||||||
@@ -232,7 +232,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membatalkan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal membatalkan kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,6 +278,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengupdate kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupdate kegiatan, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
|
|||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
return NextResponse.json({ success: true, version: "0.1.4", mode: "staging" }, { status: 200 });
|
return NextResponse.json({ success: true, version: "0.1.5", mode: "staging" }, { status: 200 });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ export default function CreateDivision() {
|
|||||||
const cek = checkAll()
|
const cek = checkAll()
|
||||||
if (!cek)
|
if (!cek)
|
||||||
return false
|
return false
|
||||||
if (member.length == 0)
|
if (member.length <= 1)
|
||||||
return toast.error("Error! belum ada anggota yang terdaftar")
|
return toast.error("Error! Silahkan pilih anggota lebih dari 1")
|
||||||
|
|
||||||
setChooseAdmin(true)
|
setChooseAdmin(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,14 +152,8 @@ export default function DrawerListPosition({ onCreated }: { onCreated: (val: boo
|
|||||||
}
|
}
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'} size="lg">
|
<LayoutDrawer opened={openDrawerGroup} onClose={() => setOpenDrawerGroup(false)} title={'Tambah Jabatan'}>
|
||||||
<Box pt={10} pos={"relative"} h={{
|
<Box pt={10} pos={"relative"} h={"28.5vh"}>
|
||||||
base: "65vh",
|
|
||||||
sm: "67vh",
|
|
||||||
lg: "67vh",
|
|
||||||
xl: "70vh"
|
|
||||||
|
|
||||||
}}>
|
|
||||||
{
|
{
|
||||||
roleLogin.get() == "supadmin" &&
|
roleLogin.get() == "supadmin" &&
|
||||||
<Select
|
<Select
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export default function AddDetailTaskProject() {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [name, setName] = useState("")
|
const [name, setName] = 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({
|
||||||
@@ -38,6 +39,7 @@ export default function AddDetailTaskProject() {
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingModal(true)
|
||||||
const res = await funCreateDetailProject(param.id, {
|
const res = await funCreateDetailProject(param.id, {
|
||||||
name,
|
name,
|
||||||
dateStart: (value[0] != null) ? value[0] : new Date,
|
dateStart: (value[0] != null) ? value[0] : new Date,
|
||||||
@@ -50,7 +52,6 @@ export default function AddDetailTaskProject() {
|
|||||||
id: param.id,
|
id: param.id,
|
||||||
}])
|
}])
|
||||||
toast.success(res.message)
|
toast.success(res.message)
|
||||||
setOpenModal(false)
|
|
||||||
router.push(`/project/${param.id}`)
|
router.push(`/project/${param.id}`)
|
||||||
} else {
|
} else {
|
||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
@@ -58,6 +59,9 @@ export default function AddDetailTaskProject() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
||||||
|
} finally {
|
||||||
|
setOpenModal(false)
|
||||||
|
setLoadingModal(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,13 +152,14 @@ export default function AddDetailTaskProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|
||||||
<LayoutModal opened={openModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
|
||||||
description="Apakah Anda yakin ingin menambahkan tugas?"
|
description="Apakah Anda yakin ingin menambahkan tugas?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
|
} else {
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
setOpenModal(false)
|
|
||||||
}} />
|
}} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { useWibuRealtime } from "wibu-realtime";
|
|||||||
|
|
||||||
export default function AddFileDetailProject() {
|
export default function AddFileDetailProject() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const [loadingModal, setLoadingModal] = useState(false)
|
||||||
const [openModal, setOpenModal] = useState(false)
|
const [openModal, setOpenModal] = useState(false)
|
||||||
const [fileForm, setFileForm] = useState<any[]>([])
|
const [fileForm, setFileForm] = useState<any[]>([])
|
||||||
const [listFile, setListFile] = useState<IListFileTaskProject[]>([])
|
const [listFile, setListFile] = useState<IListFileTaskProject[]>([])
|
||||||
@@ -57,6 +58,7 @@ export default function AddFileDetailProject() {
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingModal(true)
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
for (let i = 0; i < fileForm.length; i++) {
|
for (let i = 0; i < fileForm.length; i++) {
|
||||||
fd.append(`file${i}`, fileForm[i]);
|
fd.append(`file${i}`, fileForm[i]);
|
||||||
@@ -79,6 +81,9 @@ 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 {
|
||||||
|
setOpenModal(false)
|
||||||
|
setLoadingModal(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,13 +188,14 @@ export default function AddFileDetailProject() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
<LayoutModal opened={openModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
|
||||||
description="Apakah Anda yakin ingin menambahkan file?"
|
description="Apakah Anda yakin ingin menambahkan file?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
|
} else {
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
setOpenModal(false)
|
|
||||||
}} />
|
}} />
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ export default function AddMemberDetailProject() {
|
|||||||
const [onClickSearch, setOnClickSearch] = useState(false)
|
const [onClickSearch, setOnClickSearch] = useState(false)
|
||||||
const [searchQuery, setSearchQuery] = useState('')
|
const [searchQuery, setSearchQuery] = useState('')
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
const isMobile2 = useMediaQuery("(max-width: 438px)");
|
const isMobile2 = useMediaQuery("(max-width: 438px)")
|
||||||
|
const [loadingModal, setLoadingModal] = useState(false)
|
||||||
const [dataRealTime, setDataRealtime] = useWibuRealtime({
|
const [dataRealTime, setDataRealtime] = useWibuRealtime({
|
||||||
WIBU_REALTIME_TOKEN: keyWibu,
|
WIBU_REALTIME_TOKEN: keyWibu,
|
||||||
project: "sdm"
|
project: "sdm"
|
||||||
@@ -102,6 +103,7 @@ export default function AddMemberDetailProject() {
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingModal(true)
|
||||||
const res = await funAddMemberProject(param.id, { member: selectedFiles });
|
const res = await funAddMemberProject(param.id, { member: selectedFiles });
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setDataRealtime([{
|
setDataRealtime([{
|
||||||
@@ -116,6 +118,9 @@ export default function AddMemberDetailProject() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setOpenModal(false)
|
||||||
|
setLoadingModal(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,13 +312,14 @@ export default function AddMemberDetailProject() {
|
|||||||
}
|
}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<LayoutModal opened={openModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingModal} opened={openModal} onClose={() => setOpenModal(false)}
|
||||||
description="Apakah Anda yakin ingin menambahkan anggota?"
|
description="Apakah Anda yakin ingin menambahkan anggota?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
|
} else {
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
setOpenModal(false)
|
|
||||||
}} />
|
}} />
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ export default function CreateProject() {
|
|||||||
if (dataTask.length == 0)
|
if (dataTask.length == 0)
|
||||||
return toast.error("Error! silahkan tambahkan tugas")
|
return toast.error("Error! silahkan tambahkan tugas")
|
||||||
|
|
||||||
if (memberValue.length == 0)
|
if (memberValue.length <= 1)
|
||||||
return toast.error("Error! silahkan pilih anggota")
|
return toast.error("Error! Silahkan pilih anggota lebih dari 1")
|
||||||
|
|
||||||
setModal(true)
|
setModal(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export default function ListAnggotaDetailProject() {
|
|||||||
const [isData, setData] = useState<IDataMemberProject[]>([])
|
const [isData, setData] = useState<IDataMemberProject[]>([])
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [loadingDelete, setLoadingDelete] = useState(false)
|
||||||
const [openDrawer, setOpenDrawer] = useState(false)
|
const [openDrawer, setOpenDrawer] = useState(false)
|
||||||
const [isOpenModal, setOpenModal] = useState(false)
|
const [isOpenModal, setOpenModal] = useState(false)
|
||||||
const [dataChoose, setDataChoose] = useState({ id: '', name: '' })
|
const [dataChoose, setDataChoose] = useState({ id: '', name: '' })
|
||||||
@@ -76,6 +77,7 @@ export default function ListAnggotaDetailProject() {
|
|||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingDelete(true)
|
||||||
const res = await funDeleteMemberProject(param.id, { idUser: dataChoose.id });
|
const res = await funDeleteMemberProject(param.id, { idUser: dataChoose.id });
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setDataRealtime([{
|
setDataRealtime([{
|
||||||
@@ -92,6 +94,9 @@ export default function ListAnggotaDetailProject() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toast.error("Gagal menghapus anggota Kegiatan, coba lagi nanti");
|
toast.error("Gagal menghapus anggota Kegiatan, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setOpenModal(false)
|
||||||
|
setLoadingDelete(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +134,7 @@ export default function ListAnggotaDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
))
|
))
|
||||||
:
|
:
|
||||||
isData.length === 0 ? <Text>Tidak ada anggota</Text> :
|
isData.length === 0 ? <Text c={"dimmed"} ta={"center"}>Tidak ada anggota</Text> :
|
||||||
isData.map((v, i) => {
|
isData.map((v, i) => {
|
||||||
return (
|
return (
|
||||||
<Box key={i}>
|
<Box key={i}>
|
||||||
@@ -198,13 +203,14 @@ export default function ListAnggotaDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
<LayoutModal opened={isOpenModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingDelete} opened={isOpenModal} onClose={() => setOpenModal(false)}
|
||||||
description="Apakah Anda yakin ingin mengeluarkan anggota?"
|
description="Apakah Anda yakin ingin mengeluarkan anggota?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
|
} else {
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
setOpenModal(false)
|
|
||||||
}} />
|
}} />
|
||||||
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export default function ListFileDetailProject() {
|
|||||||
const [isData, setData] = useState<IDataFileProject[]>([])
|
const [isData, setData] = useState<IDataFileProject[]>([])
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [loadingDelete, setLoadingDelete] = useState(false)
|
||||||
const [idData, setIdData] = useState('')
|
const [idData, setIdData] = useState('')
|
||||||
const [idStorage, setIdStorage] = useState('')
|
const [idStorage, setIdStorage] = useState('')
|
||||||
const [nameData, setNameData] = useState('')
|
const [nameData, setNameData] = useState('')
|
||||||
@@ -76,6 +77,7 @@ export default function ListFileDetailProject() {
|
|||||||
|
|
||||||
async function onDelete() {
|
async function onDelete() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingDelete(true)
|
||||||
const res = await funDeleteFileProject(idData);
|
const res = await funDeleteFileProject(idData);
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setDataRealtime([{
|
setDataRealtime([{
|
||||||
@@ -93,6 +95,9 @@ export default function ListFileDetailProject() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toast.error("Gagal menghapus file, coba lagi nanti");
|
toast.error("Gagal menghapus file, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setOpenModal(false)
|
||||||
|
setLoadingDelete(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -128,7 +133,7 @@ export default function ListFileDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
))
|
))
|
||||||
:
|
:
|
||||||
isData.length === 0 ? <Text>Tidak ada file</Text> :
|
isData.length === 0 ? <Text c={"dimmed"} ta={"center"}>Tidak ada file</Text> :
|
||||||
isData.map((item, index) => {
|
isData.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@@ -225,13 +230,14 @@ export default function ListFileDetailProject() {
|
|||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
|
|
||||||
<LayoutModal opened={isOpenModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingDelete} opened={isOpenModal} onClose={() => setOpenModal(false)}
|
||||||
description="Apakah Anda yakin ingin menghapus file ini? File yang dihapus tidak dapat dikembalikan"
|
description="Apakah Anda yakin ingin menghapus file ini? File yang dihapus tidak dapat dikembalikan"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onDelete()
|
onDelete()
|
||||||
|
} else {
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
setOpenModal(false)
|
|
||||||
}} />
|
}} />
|
||||||
|
|
||||||
<LayoutModalViewFile opened={isOpenModalView} onClose={() => setOpenModalView(false)} file={idStorage} extension={isExtension} fitur='project' />
|
<LayoutModalViewFile opened={isOpenModalView} onClose={() => setOpenModalView(false)} file={idStorage} extension={isExtension} fitur='project' />
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export default function ListTugasDetailProject() {
|
|||||||
const [statusData, setStatusData] = useState(0)
|
const [statusData, setStatusData] = useState(0)
|
||||||
const [openDrawerStatus, setOpenDrawerStatus] = useState(false)
|
const [openDrawerStatus, setOpenDrawerStatus] = useState(false)
|
||||||
const [isOpenModal, setOpenModal] = useState(false)
|
const [isOpenModal, setOpenModal] = useState(false)
|
||||||
|
const [loadingDelete, setLoadingDelete] = useState(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const tema = useHookstate(TEMA)
|
const tema = useHookstate(TEMA)
|
||||||
const [reason, setReason] = useState("")
|
const [reason, setReason] = useState("")
|
||||||
@@ -75,6 +76,7 @@ export default function ListTugasDetailProject() {
|
|||||||
|
|
||||||
async function onDelete() {
|
async function onDelete() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingDelete(true)
|
||||||
const res = await funDeleteDetailProject(idData, { idProject: param.id });
|
const res = await funDeleteDetailProject(idData, { idProject: param.id });
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setDataRealtime([{
|
setDataRealtime([{
|
||||||
@@ -92,6 +94,9 @@ export default function ListTugasDetailProject() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
toast.error("Gagal hapus tugas Kegiatan, coba lagi nanti");
|
toast.error("Gagal hapus tugas Kegiatan, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setOpenModal(false)
|
||||||
|
setLoadingDelete(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +143,6 @@ export default function ListTugasDetailProject() {
|
|||||||
style={{
|
style={{
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
// padding: 10,
|
|
||||||
}}
|
}}
|
||||||
pl={20}
|
pl={20}
|
||||||
pr={20}
|
pr={20}
|
||||||
@@ -149,7 +153,7 @@ export default function ListTugasDetailProject() {
|
|||||||
<SkeletonDetailListTugasTask />
|
<SkeletonDetailListTugasTask />
|
||||||
</Box>
|
</Box>
|
||||||
</> :
|
</> :
|
||||||
isData.length === 0 ? <Text>Tidak ada tugas</Text> :
|
isData.length === 0 ? <Text py={20} c={"dimmed"} ta={"center"}>Tidak ada tugas</Text> :
|
||||||
isData.map((item, index) => {
|
isData.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<Box key={index}>
|
<Box key={index}>
|
||||||
@@ -256,13 +260,14 @@ export default function ListTugasDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
<LayoutModal opened={isOpenModal} onClose={() => setOpenModal(false)}
|
<LayoutModal loading={loadingDelete} opened={isOpenModal} onClose={() => setOpenModal(false)}
|
||||||
description="Apakah Anda yakin ingin menghapus Tahapan Tugas ini?"
|
description="Apakah Anda yakin ingin menghapus tahapan tugas ini?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onDelete()
|
onDelete()
|
||||||
|
} else {
|
||||||
|
setOpenModal(false)
|
||||||
}
|
}
|
||||||
setOpenModal(false)
|
|
||||||
}} />
|
}} />
|
||||||
|
|
||||||
<LayoutDrawer opened={openDrawerStatus} title={'Status'} onClose={() => setOpenDrawerStatus(false)}>
|
<LayoutDrawer opened={openDrawerStatus} title={'Status'} onClose={() => setOpenDrawerStatus(false)}>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export default function ProgressDetailProject() {
|
|||||||
<>
|
<>
|
||||||
<Box mt={10}>
|
<Box mt={10}>
|
||||||
{loading ? "" :
|
{loading ? "" :
|
||||||
reason !== null ?
|
(reason !== null && reason != "") ?
|
||||||
(
|
(
|
||||||
<Box mb={10}>
|
<Box mb={10}>
|
||||||
<Box p={15} bg={"#FFF2CD"} style={{
|
<Box p={15} bg={"#FFF2CD"} style={{
|
||||||
|
|||||||
@@ -25,12 +25,32 @@ export default function CancelTask() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function onVerification() {
|
function onVerification() {
|
||||||
if (alasan == "")
|
const cek = checkAll()
|
||||||
return toast.error("Error! harus memasukkan alasan pembatalan tugas")
|
if (!cek) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
setOpenModal(true)
|
setOpenModal(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onValidation(kategori: string, val: string) {
|
||||||
|
if (kategori == 'alasan') {
|
||||||
|
setAlasan(val)
|
||||||
|
if (val == "") {
|
||||||
|
setTouched({ ...touched, reason: true })
|
||||||
|
} else {
|
||||||
|
setTouched({ ...touched, reason: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkAll() {
|
||||||
|
if (alasan == "") {
|
||||||
|
setTouched({ ...touched, reason: true })
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
try {
|
try {
|
||||||
const res = await funCancelTask(param.detail, { reason: alasan })
|
const res = await funCancelTask(param.detail, { reason: alasan })
|
||||||
@@ -38,7 +58,7 @@ export default function CancelTask() {
|
|||||||
setDataRealtime([{
|
setDataRealtime([{
|
||||||
category: "tugas-detail-status",
|
category: "tugas-detail-status",
|
||||||
id: param.detail,
|
id: param.detail,
|
||||||
}])
|
}])
|
||||||
toast.success(res.message)
|
toast.success(res.message)
|
||||||
router.push("./")
|
router.push("./")
|
||||||
} else {
|
} else {
|
||||||
@@ -66,12 +86,8 @@ export default function CancelTask() {
|
|||||||
value={alasan}
|
value={alasan}
|
||||||
size="md" placeholder='Contoh : Tugas tidak sesuai' label="Alasan Pembatalan"
|
size="md" placeholder='Contoh : Tugas tidak sesuai' label="Alasan Pembatalan"
|
||||||
required
|
required
|
||||||
onChange={(event) => {
|
onChange={(event) => { onValidation('alasan', event.target.value) }}
|
||||||
setAlasan(event.target.value)
|
|
||||||
setTouched({ ...touched, reason: false })
|
|
||||||
}}
|
|
||||||
error={touched.reason ? "Error! harus memasukkan alasan pembatalan tugas" : ""}
|
error={touched.reason ? "Error! harus memasukkan alasan pembatalan tugas" : ""}
|
||||||
onBlur={() => setTouched({ ...touched, reason: true })}
|
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ export default function CreateTask() {
|
|||||||
if (dataTask.length == 0)
|
if (dataTask.length == 0)
|
||||||
return toast.error("Error! silahkan tambahkan tugas")
|
return toast.error("Error! silahkan tambahkan tugas")
|
||||||
|
|
||||||
if (memberValue.length == 0)
|
if (memberValue.length <= 1)
|
||||||
return toast.error("Error! silahkan pilih anggota")
|
return toast.error("Error! silahkan pilih anggota lebih dari 1")
|
||||||
|
|
||||||
setOpenModal(true)
|
setOpenModal(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
value={data.gender}
|
value={data.gender}
|
||||||
error={
|
error={
|
||||||
touched.gender && (
|
touched.gender && (
|
||||||
data.gender == "" || String(data.gender) == "null" ? "Gender Tidak Boleh Kosong" : null
|
data.gender == "" || String(data.gender) == "null" ? "Jenis Kelamin Tidak Boleh Kosong" : null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export default function EditProfile() {
|
|||||||
}
|
}
|
||||||
} else if (kategori == 'gender') {
|
} else if (kategori == 'gender') {
|
||||||
setData({ ...data, gender: val })
|
setData({ ...data, gender: val })
|
||||||
if (val == "" || val == "null") {
|
if (val == "" || String(val) == "null") {
|
||||||
setTouched({ ...touched, gender: true })
|
setTouched({ ...touched, gender: true })
|
||||||
} else {
|
} else {
|
||||||
setTouched({ ...touched, gender: false })
|
setTouched({ ...touched, gender: false })
|
||||||
|
|||||||
Reference in New Issue
Block a user