upd: project
Deskripsi: - pembatasan user role - bersih log user - masang log user - bersih console.log No Issues
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
|
import { createLogUser } from "@/module/user";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ export async function POST(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 }
|
||||||
);
|
);
|
||||||
@@ -42,11 +43,13 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota project" }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'CREATE', desc: 'User menambah anggota kegiatan', table: 'project', data: String(id) })
|
||||||
|
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota kegiatan" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menambah anggota project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menambah anggota kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,11 +88,14 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Berhasil mengeluarkan anggota project" }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'DELETE', desc: 'User mengeluarkan anggota kegiatan', table: 'project', data: String(id) })
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Berhasil mengeluarkan anggota kegiatan" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
|
import { createLogUser } from "@/module/user";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
@@ -159,7 +160,7 @@ export async function POST(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 }
|
||||||
);
|
);
|
||||||
@@ -171,14 +172,20 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
idProject: id,
|
idProject: id,
|
||||||
dateStart: new Date(moment(dateStart).format('YYYY-MM-DD')),
|
dateStart: new Date(moment(dateStart).format('YYYY-MM-DD')),
|
||||||
dateEnd: new Date(moment(dateEnd).format('YYYY-MM-DD')),
|
dateEnd: new Date(moment(dateEnd).format('YYYY-MM-DD')),
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Detail project berhasil ditambahkan", data: dataCreate, }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'CREATE', desc: 'User membuat data tahapan kegiatan', table: 'projectTask', data: String(dataCreate.id) })
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Detail tahapan kegiatan berhasil ditambahkan", data: dataCreate, }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal tambah detail project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal tambah tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,11 +225,13 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Project berhasil dibatalkan" }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User membatalkan data kegiatan', table: 'project', data: String(id) })
|
||||||
|
return NextResponse.json({ success: true, message: "Kegiatan berhasil dibatalkan" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membatalkan project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal membatalkan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +255,7 @@ export async function PUT(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 }
|
||||||
);
|
);
|
||||||
@@ -261,10 +270,13 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Project berhasil diubah" }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate data kegiatan', table: 'project', data: String(id) })
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Kegiatan berhasil diupdate" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengubah project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupdate kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { prisma } from "@/module/_global";
|
import { prisma } from "@/module/_global";
|
||||||
import { funGetUserByCookies } from "@/module/auth";
|
import { funGetUserByCookies } from "@/module/auth";
|
||||||
|
import { createLogUser } from "@/module/user";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: false,
|
success: false,
|
||||||
message: "Hapus project gagal, data tidak ditemukan",
|
message: "Hapus tahapan kegiatan gagal, data tidak ditemukan",
|
||||||
},
|
},
|
||||||
{ status: 404 }
|
{ status: 404 }
|
||||||
);
|
);
|
||||||
@@ -67,18 +68,21 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'DELETE', desc: 'User menghapus tahapan kegiatan', table: 'projectTask', data: String(id) })
|
||||||
|
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
success: true,
|
success: true,
|
||||||
message: "Project berhasil dihapus",
|
message: "Tahapan kegiatan berhasil dihapus",
|
||||||
data,
|
data,
|
||||||
},
|
},
|
||||||
{ status: 200 }
|
{ status: 200 }
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menghapus project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menghapus tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +107,7 @@ export async function PUT(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 }
|
||||||
);
|
);
|
||||||
@@ -148,12 +152,14 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate status tahapan kegiatan', table: 'projectTask', data: String(id) })
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Status detail Project berhasil diupdate", data }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Status tahapan kegiatan berhasil diupdate", data }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membatalkan project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupdate status tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +208,21 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
const { id } = context.params;
|
const { id } = context.params;
|
||||||
const { name, dateStart, dateEnd } = (await request.json());
|
const { name, dateStart, dateEnd } = (await request.json());
|
||||||
|
|
||||||
|
const dataTask = await prisma.projectTask.count({
|
||||||
|
where: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (dataTask == 0) {
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||||
|
},
|
||||||
|
{ status: 404 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const data = await prisma.projectTask.update({
|
const data = await prisma.projectTask.update({
|
||||||
where: {
|
where: {
|
||||||
id
|
id
|
||||||
@@ -213,10 +234,13 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ success: true, message: "Detail project berhasil diupdate", data }, { status: 200 });
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'UPDATE', desc: 'User mengupdate tahapan kegiatan', table: 'projectTask', data: String(id) })
|
||||||
|
|
||||||
|
return NextResponse.json({ success: true, message: "Detail tahapan kegiatan berhasil diupdate", data }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal membatalkan project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupdate detail tahapan kegiatan, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import { NextResponse } from "next/server";
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import { createLogUser } from "@/module/user";
|
||||||
|
|
||||||
// HAPUS FILE PROJECT BUKAN PAKE ISACTIVE
|
// HAPUS FILE PROJECT BUKAN PAKE ISACTIVE
|
||||||
export async function DELETE(request: Request, context: { params: { id: string } }) {
|
export async function DELETE(request: Request, context: { params: { id: string } }) {
|
||||||
@@ -44,6 +45,9 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'DELETE', desc: 'User menghapus file kegiatan', table: 'project', data: String(dataRelasi?.idProject) })
|
||||||
|
|
||||||
|
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
{
|
{
|
||||||
@@ -55,7 +59,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
);
|
);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal menghapus file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal menghapus file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,7 +122,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Upload file gagal, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Upload file gagal, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,11 +195,12 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create log user
|
||||||
|
const log = await createLogUser({ act: 'CREATE', desc: 'User menambah file kegiatan', table: 'project', data: String(id) })
|
||||||
return NextResponse.json({ success: true, message: "Berhasil mengupload file kegiatan" }, { status: 200 });
|
return NextResponse.json({ success: true, message: "Berhasil mengupload file kegiatan" }, { status: 200 });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.error(error);
|
||||||
return NextResponse.json({ success: false, message: "Gagal mengupload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
return NextResponse.json({ success: false, message: "Gagal mengupload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import { WARNA } from '../fun/WARNA';
|
|||||||
import LayoutIconBack from './layout_icon_back';
|
import LayoutIconBack from './layout_icon_back';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
export const LayoutNavbarNew = ({ back, title, menu }: { back?: string, title: string, menu: React.ReactNode }) => {
|
export const LayoutNavbarNew = ({ back, state, title, menu }: { back?: string, title: string, menu: React.ReactNode, state?: React.ReactNode }) => {
|
||||||
return (
|
return (
|
||||||
<Box pt={25} pl={20} pr={20} m={0} pos={'sticky'} top={0} pb={25} bg={WARNA.biruTua}
|
<Box pt={25} pl={20} pr={20} m={0} pos={'sticky'} top={0} pb={25} bg={WARNA.biruTua}
|
||||||
style={{
|
style={{
|
||||||
@@ -16,11 +16,18 @@ export const LayoutNavbarNew = ({ back, title, menu }: { back?: string, title: s
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Grid justify='center' align='center'>
|
<Grid justify='center' align='center'>
|
||||||
<Grid.Col span="auto">
|
{
|
||||||
{
|
state != undefined &&
|
||||||
back!=undefined && (<LayoutIconBack back={back} />)
|
<Grid.Col span="auto">
|
||||||
}
|
{state}
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
}
|
||||||
|
{
|
||||||
|
back != undefined &&
|
||||||
|
<Grid.Col span="auto">
|
||||||
|
<LayoutIconBack back={back} />
|
||||||
|
</Grid.Col>
|
||||||
|
}
|
||||||
<Grid.Col span={8}>
|
<Grid.Col span={8}>
|
||||||
<Title c={WARNA.bgWhite} ta={'center'} order={5} lineClamp={1}>{_.startCase(title)}</Title>
|
<Title c={WARNA.bgWhite} ta={'center'} order={5} lineClamp={1}>{_.startCase(title)}</Title>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export default function AddDetailTaskProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default function AddFileDetailProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan file, coba lagi nanti")
|
toast.error("Gagal menambahkan file, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ export default function AddFileDetailProject() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan file, coba lagi nanti");
|
toast.error("Gagal menambahkan file, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export default function AddMemberDetailProject() {
|
|||||||
}
|
}
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@@ -97,7 +97,7 @@ export default function AddMemberDetailProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function CancelProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal membatalkan Kegiatan, coba lagi nanti")
|
toast.error("Gagal membatalkan Kegiatan, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { LayoutDrawer, LayoutNavbarNew, WARNA } from "@/module/_global";
|
import { globalRole, LayoutDrawer, LayoutNavbarNew, WARNA } from "@/module/_global";
|
||||||
import { Avatar, Box, Button, Center, Divider, Flex, Grid, Group, rem, Select, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
|
import { Avatar, Box, Button, Center, Divider, Flex, Grid, Group, rem, Select, SimpleGrid, Stack, Text, TextInput } from "@mantine/core";
|
||||||
import { useRouter, useSearchParams } from "next/navigation";
|
import { useRouter, useSearchParams } from "next/navigation";
|
||||||
import React, { useRef, useState } from "react";
|
import React, { useRef, useState } from "react";
|
||||||
@@ -29,7 +29,6 @@ export default function CreateProject() {
|
|||||||
const [openDrawerTask, setOpenDrawerTask] = useState(false)
|
const [openDrawerTask, setOpenDrawerTask] = useState(false)
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
const [dataGroup, setDataGroup] = useState<IDataGroup[]>([]);
|
const [dataGroup, setDataGroup] = useState<IDataGroup[]>([]);
|
||||||
const [roleUser, setRoleUser] = useState<any>("")
|
|
||||||
const [isChooseAnggota, setChooseAnggota] = useState(false)
|
const [isChooseAnggota, setChooseAnggota] = useState(false)
|
||||||
const member = useHookstate(globalMemberProject)
|
const member = useHookstate(globalMemberProject)
|
||||||
const memberValue = member.get() as IFormMemberProject[]
|
const memberValue = member.get() as IFormMemberProject[]
|
||||||
@@ -40,6 +39,8 @@ export default function CreateProject() {
|
|||||||
const [listFile, setListFile] = useState<IListFileTaskProject[]>([])
|
const [listFile, setListFile] = useState<IListFileTaskProject[]>([])
|
||||||
const [indexDelFile, setIndexDelFile] = useState<number>(0)
|
const [indexDelFile, setIndexDelFile] = useState<number>(0)
|
||||||
const [indexDelTask, setIndexDelTask] = useState<number>(0)
|
const [indexDelTask, setIndexDelTask] = useState<number>(0)
|
||||||
|
const roleLogin = useHookstate(globalRole)
|
||||||
|
|
||||||
const [body, setBody] = useState<any>({
|
const [body, setBody] = useState<any>({
|
||||||
idGroup: "",
|
idGroup: "",
|
||||||
title: "",
|
title: "",
|
||||||
@@ -69,12 +70,15 @@ export default function CreateProject() {
|
|||||||
toast.error(loadGroup.message);
|
toast.error(loadGroup.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadUser = await funGetUserByCookies();
|
if (roleLogin.get() != "supadmin") {
|
||||||
setRoleUser(loadUser.idUserRole)
|
const loadUser = await funGetUserByCookies();
|
||||||
|
setBody({ ...body, idGroup: loadUser.idGroup })
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onToChooseAnggota() {
|
function onToChooseAnggota() {
|
||||||
if (roleUser == "supadmin" && body.idGroup == "")
|
if (roleLogin.get() == "supadmin" && body.idGroup == "")
|
||||||
return toast.error("Error! grup harus diisi")
|
return toast.error("Error! grup harus diisi")
|
||||||
setChooseAnggota(true)
|
setChooseAnggota(true)
|
||||||
}
|
}
|
||||||
@@ -116,7 +120,7 @@ export default function CreateProject() {
|
|||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal menambahkan kegiatan, coba lagi nanti");
|
toast.error("Gagal menambahkan kegiatan, coba lagi nanti");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,7 +141,7 @@ export default function CreateProject() {
|
|||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Stack>
|
<Stack>
|
||||||
{
|
{
|
||||||
(roleUser == "supadmin") && (
|
(roleLogin.get() == "supadmin") && (
|
||||||
<Select
|
<Select
|
||||||
placeholder="Grup"
|
placeholder="Grup"
|
||||||
label="Grup"
|
label="Grup"
|
||||||
@@ -206,7 +210,10 @@ export default function CreateProject() {
|
|||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
}}
|
}}
|
||||||
onClick={() => setOpenDrawer(true)}
|
onClick={() =>
|
||||||
|
// setOpenDrawer(true)
|
||||||
|
openRef.current?.()
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Text>Upload File</Text>
|
<Text>Upload File</Text>
|
||||||
<IoIosArrowDropright size={25} />
|
<IoIosArrowDropright size={25} />
|
||||||
@@ -290,111 +297,127 @@ export default function CreateProject() {
|
|||||||
>
|
>
|
||||||
{member.get().map((v: any, i: any) => {
|
{member.get().map((v: any, i: any) => {
|
||||||
return (
|
return (
|
||||||
<Box key={i}>
|
<Box key={i}>
|
||||||
<Grid align='center' mt={10}
|
<Grid align='center' mt={10}
|
||||||
>
|
>
|
||||||
<Grid.Col span={9}>
|
<Grid.Col span={9}>
|
||||||
<Group>
|
<Group>
|
||||||
<Avatar src={`/api/file/img?jenis=image&cat=user&file=${v.img}`} alt="it's me" size="lg" />
|
<Avatar src={`/api/file/img?jenis=image&cat=user&file=${v.img}`} alt="it's me" size="lg" />
|
||||||
<Box w={{
|
<Box w={{
|
||||||
base: 140,
|
base: 140,
|
||||||
xl: 270
|
xl: 270
|
||||||
}}>
|
}}>
|
||||||
<Text c={WARNA.biruTua} fw={"bold"} lineClamp={1}>
|
<Text c={WARNA.biruTua} fw={"bold"} lineClamp={1}>
|
||||||
{v.name}
|
{v.name}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Group>
|
</Group>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={3}>
|
<Grid.Col span={3}>
|
||||||
<Text c={WARNA.biruTua} fw={"bold"} ta={'end'}>
|
<Text c={WARNA.biruTua} fw={"bold"} ta={'end'}>
|
||||||
Anggota
|
Anggota
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Box mt={10}>
|
<Box mt={10}>
|
||||||
<Divider size={"xs"} />
|
<Divider size={"xs"} />
|
||||||
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
);
|
||||||
);
|
})}
|
||||||
})}
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
}
|
|
||||||
</Box>
|
</Box>
|
||||||
|
}
|
||||||
</Box>
|
|
||||||
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
|
||||||
maxWidth: rem(550),
|
|
||||||
zIndex: 999,
|
|
||||||
backgroundColor: `${WARNA.bgWhite}`,
|
|
||||||
}}>
|
|
||||||
<Button
|
|
||||||
color="white"
|
|
||||||
bg={WARNA.biruTua}
|
|
||||||
size="lg"
|
|
||||||
radius={30}
|
|
||||||
fullWidth
|
|
||||||
onClick={() => {
|
|
||||||
if (
|
|
||||||
body.title !== "" &&
|
|
||||||
body.idGroup !== ""
|
|
||||||
) {
|
|
||||||
setModal(true)
|
|
||||||
} else {
|
|
||||||
toast.error("Mohon lengkapi data terlebih dahulu");
|
|
||||||
}
|
|
||||||
}}>
|
|
||||||
Simpan
|
|
||||||
</Button>
|
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
</Box>
|
||||||
|
<Box pos={'fixed'} bottom={0} p={rem(20)} w={"100%"} style={{
|
||||||
|
maxWidth: rem(550),
|
||||||
|
zIndex: 999,
|
||||||
|
backgroundColor: `${WARNA.bgWhite}`,
|
||||||
|
}}>
|
||||||
|
<Button
|
||||||
|
color="white"
|
||||||
|
bg={WARNA.biruTua}
|
||||||
|
size="lg"
|
||||||
|
radius={30}
|
||||||
|
fullWidth
|
||||||
|
onClick={() => {
|
||||||
|
if (
|
||||||
|
body.title !== "" &&
|
||||||
|
body.idGroup !== ""
|
||||||
|
) {
|
||||||
|
setModal(true)
|
||||||
|
} else {
|
||||||
|
toast.error("Mohon lengkapi data terlebih dahulu");
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Dropzone
|
||||||
|
openRef={openRef}
|
||||||
|
onDrop={async (files) => {
|
||||||
|
if (!files || _.isEmpty(files))
|
||||||
|
return toast.error('Tidak ada file yang dipilih')
|
||||||
|
setFileForm([...fileForm, files[0]])
|
||||||
|
setListFile([...listFile, { name: files[0].name, extension: files[0].type.split("/")[1] }])
|
||||||
|
}}
|
||||||
|
activateOnClick={false}
|
||||||
|
maxSize={3 * 1024 ** 2}
|
||||||
|
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||||
|
onReject={(files) => {
|
||||||
|
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||||
|
}}
|
||||||
|
></Dropzone>
|
||||||
|
|
||||||
|
|
||||||
{/* Drawer pilih file */}
|
|
||||||
<LayoutDrawer
|
{/* Drawer pilih file */}
|
||||||
opened={openDrawer}
|
{/* <LayoutDrawer
|
||||||
onClose={() => setOpenDrawer(false)}
|
opened={openDrawer}
|
||||||
title={"Pilih File"}
|
onClose={() => setOpenDrawer(false)}
|
||||||
>
|
title={"Pilih File"}
|
||||||
<Flex justify={"flex-start"} px={20}>
|
>
|
||||||
<Dropzone
|
<Flex justify={"flex-start"} px={20}>
|
||||||
openRef={openRef}
|
<Dropzone
|
||||||
onDrop={async (files) => {
|
openRef={openRef}
|
||||||
if (!files || _.isEmpty(files))
|
onDrop={async (files) => {
|
||||||
return toast.error('Tidak ada file yang dipilih')
|
if (!files || _.isEmpty(files))
|
||||||
setFileForm([...fileForm, files[0]])
|
return toast.error('Tidak ada file yang dipilih')
|
||||||
setListFile([...listFile, { name: files[0].name, extension: files[0].type.split("/")[1] }])
|
setFileForm([...fileForm, files[0]])
|
||||||
}}
|
setListFile([...listFile, { name: files[0].name, extension: files[0].type.split("/")[1] }])
|
||||||
activateOnClick={false}
|
}}
|
||||||
maxSize={3 * 1024 ** 2}
|
activateOnClick={false}
|
||||||
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
maxSize={3 * 1024 ** 2}
|
||||||
onReject={(files) => {
|
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||||
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
onReject={(files) => {
|
||||||
}}
|
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||||
>
|
}}
|
||||||
<Box onClick={() => openRef.current?.()}>
|
>
|
||||||
<Box
|
<Box onClick={() => openRef.current?.()}>
|
||||||
bg={"#DCEED8"}
|
<Box
|
||||||
style={{
|
bg={"#DCEED8"}
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
style={{
|
||||||
padding: 20,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
borderRadius: 10,
|
padding: 20,
|
||||||
}}
|
borderRadius: 10,
|
||||||
>
|
}}
|
||||||
<Center>
|
>
|
||||||
<BsFiletypeCsv size={40} />
|
<Center>
|
||||||
</Center>
|
<BsFiletypeCsv size={40} />
|
||||||
</Box>
|
</Center>
|
||||||
<Text mt={10} ta={"center"}>
|
|
||||||
Pilih file
|
|
||||||
</Text>
|
|
||||||
<Text ta={"center"}>diperangkat</Text>
|
|
||||||
</Box>
|
</Box>
|
||||||
</Dropzone>
|
<Text mt={10} ta={"center"}>
|
||||||
{/* <Box onClick={() => router.push("/project/create?page=file-save")}>
|
Pilih file
|
||||||
|
</Text>
|
||||||
|
<Text ta={"center"}>diperangkat</Text>
|
||||||
|
</Box>
|
||||||
|
</Dropzone>
|
||||||
|
<Box onClick={() => router.push("/project/create?page=file-save")}>
|
||||||
<Box
|
<Box
|
||||||
bg={"#DCEED8"}
|
bg={"#DCEED8"}
|
||||||
style={{
|
style={{
|
||||||
@@ -411,62 +434,62 @@ export default function CreateProject() {
|
|||||||
Pilih file yang
|
Pilih file yang
|
||||||
</Text>
|
</Text>
|
||||||
<Text ta={"center"}>sudah ada</Text>
|
<Text ta={"center"}>sudah ada</Text>
|
||||||
</Box> */}
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer> */}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* Drawer hapus file */}
|
{/* Drawer hapus file */}
|
||||||
<LayoutDrawer
|
<LayoutDrawer
|
||||||
opened={openDrawerFile}
|
opened={openDrawerFile}
|
||||||
onClose={() => setOpenDrawerFile(false)}
|
onClose={() => setOpenDrawerFile(false)}
|
||||||
title={""}
|
title={""}
|
||||||
>
|
>
|
||||||
<Stack pt={10}>
|
<Stack pt={10}>
|
||||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||||
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteFile(indexDelFile)}>
|
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteFile(indexDelFile)}>
|
||||||
<Box>
|
<Box>
|
||||||
<FaTrash size={30} color={WARNA.biruTua} />
|
<FaTrash size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua} ta='center'>Hapus File</Text>
|
<Text c={WARNA.biruTua} ta='center'>Hapus File</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
|
|
||||||
{/* Drawer hapus tugas */}
|
{/* Drawer hapus tugas */}
|
||||||
<LayoutDrawer
|
<LayoutDrawer
|
||||||
opened={openDrawerTask}
|
opened={openDrawerTask}
|
||||||
onClose={() => setOpenDrawerTask(false)}
|
onClose={() => setOpenDrawerTask(false)}
|
||||||
title={""}
|
title={""}
|
||||||
>
|
>
|
||||||
<Stack pt={10}>
|
<Stack pt={10}>
|
||||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||||
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteTask(indexDelTask)}>
|
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteTask(indexDelTask)}>
|
||||||
<Box>
|
<Box>
|
||||||
<FaTrash size={30} color={WARNA.biruTua} />
|
<FaTrash size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua} ta='center'>Hapus Tugas</Text>
|
<Text c={WARNA.biruTua} ta='center'>Hapus Tugas</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</LayoutDrawer>
|
</LayoutDrawer>
|
||||||
|
|
||||||
|
|
||||||
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
||||||
description="Apakah Anda yakin ingin menambahkan data?"
|
description="Apakah Anda yakin ingin menambahkan data?"
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
onSubmit()
|
onSubmit()
|
||||||
}
|
}
|
||||||
setModal(false)
|
setModal(false)
|
||||||
}} />
|
}} />
|
||||||
</Box >
|
</Box >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import { Avatar, Box, Button, Center, Input, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
import { ActionIcon, Avatar, Box, Button, Center, Input, rem, SimpleGrid, Skeleton, Stack, Text, TextInput } from '@mantine/core';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { HiMagnifyingGlass } from 'react-icons/hi2';
|
import { HiChevronLeft, HiMagnifyingGlass } from 'react-icons/hi2';
|
||||||
import { funGetAllmember, TypeUser } from '@/module/user';
|
import { funGetAllmember, TypeUser } from '@/module/user';
|
||||||
import { funGetUserByCookies } from '@/module/auth';
|
import { funGetUserByCookies } from '@/module/auth';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
@@ -62,7 +62,13 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<LayoutNavbarNew title="Pilih Anggota" menu />
|
<LayoutNavbarNew state={
|
||||||
|
<Box>
|
||||||
|
<ActionIcon variant="light" onClick={() => { onClose(true) }} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||||
|
<HiChevronLeft size={20} color='white' />
|
||||||
|
</ActionIcon>
|
||||||
|
</Box>
|
||||||
|
} title="Pilih Anggota" menu />
|
||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -128,22 +134,22 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
|||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
</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),
|
||||||
zIndex: 999,
|
zIndex: 999,
|
||||||
backgroundColor: `${WARNA.bgWhite}`,
|
backgroundColor: `${WARNA.bgWhite}`,
|
||||||
}}>
|
}}>
|
||||||
<Button
|
<Button
|
||||||
color="white"
|
color="white"
|
||||||
bg={WARNA.biruTua}
|
bg={WARNA.biruTua}
|
||||||
size="lg"
|
size="lg"
|
||||||
radius={30}
|
radius={30}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() => { onSubmit() }}
|
onClick={() => { onSubmit() }}
|
||||||
>
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default function EditTaskProject() {
|
|||||||
toast.error(res.message)
|
toast.error(res.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.error(error)
|
||||||
toast.error("Gagal mengedit Kegiatan, coba lagi nanti")
|
toast.error("Gagal mengedit Kegiatan, coba lagi nanti")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { LayoutDrawer, SkeletonSingle, WARNA } from '@/module/_global';
|
import { globalRole, LayoutDrawer, SkeletonSingle, WARNA } from '@/module/_global';
|
||||||
import { Avatar, Box, Flex, Grid, Group, SimpleGrid, Stack, Text } from '@mantine/core';
|
import { Avatar, Box, Flex, Grid, Group, SimpleGrid, Stack, Text } from '@mantine/core';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { funDeleteMemberProject, funGetOneProjectById } from '../lib/api_project';
|
import { funDeleteMemberProject, funGetOneProjectById } from '../lib/api_project';
|
||||||
@@ -10,6 +10,7 @@ import { IDataMemberProject } from '../lib/type_project';
|
|||||||
import { FaUser } from 'react-icons/fa6';
|
import { FaUser } from 'react-icons/fa6';
|
||||||
import { IoIosCloseCircle } from 'react-icons/io';
|
import { IoIosCloseCircle } from 'react-icons/io';
|
||||||
import LayoutModal from '@/module/_global/layout/layout_modal';
|
import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||||
|
import { useHookstate } from '@hookstate/core';
|
||||||
|
|
||||||
|
|
||||||
export default function ListAnggotaDetailProject() {
|
export default function ListAnggotaDetailProject() {
|
||||||
@@ -20,6 +21,7 @@ export default function ListAnggotaDetailProject() {
|
|||||||
const [isOpenModal, setOpenModal] = useState(false)
|
const [isOpenModal, setOpenModal] = useState(false)
|
||||||
const [dataChoose, setDataChoose] = useState({ id: '', name: '' })
|
const [dataChoose, setDataChoose] = useState({ id: '', name: '' })
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const roleLogin = useHookstate(globalRole)
|
||||||
|
|
||||||
async function getOneData() {
|
async function getOneData() {
|
||||||
try {
|
try {
|
||||||
@@ -93,7 +95,7 @@ export default function ListAnggotaDetailProject() {
|
|||||||
<Grid align='center' mt={10}
|
<Grid align='center' mt={10}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setDataChoose({ id: v.idUser, name: v.name })
|
setDataChoose({ id: v.idUser, name: v.name })
|
||||||
setOpenDrawer(true)
|
setOpenDrawer(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Grid.Col span={9}>
|
<Grid.Col span={9}>
|
||||||
@@ -138,14 +140,17 @@ export default function ListAnggotaDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex onClick={() => { setOpenModal(true) }} justify={'center'} align={'center'} direction={'column'} >
|
{
|
||||||
<Box>
|
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
|
||||||
<IoIosCloseCircle size={30} color={WARNA.biruTua} />
|
<Flex onClick={() => { setOpenModal(true) }} justify={'center'} align={'center'} direction={'column'} >
|
||||||
</Box>
|
<Box>
|
||||||
<Box>
|
<IoIosCloseCircle size={30} color={WARNA.biruTua} />
|
||||||
<Text c={WARNA.biruTua}>Keluarkan anggota</Text>
|
</Box>
|
||||||
</Box>
|
<Box>
|
||||||
</Flex>
|
<Text c={WARNA.biruTua}>Keluarkan anggota</Text>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
}
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -183,7 +183,11 @@ export default function ListProject() {
|
|||||||
<Avatar>
|
<Avatar>
|
||||||
<MdAccountCircle size={32} color={WARNA.biruTua} />
|
<MdAccountCircle size={32} color={WARNA.biruTua} />
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<Avatar>+{v.member - 1}</Avatar>
|
<Avatar>
|
||||||
|
{
|
||||||
|
v.member > 0 ? '+' + (v.member - 1) : "0"
|
||||||
|
}
|
||||||
|
</Avatar>
|
||||||
</Avatar.Group>
|
</Avatar.Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global';
|
import { globalRole, LayoutDrawer, LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||||
import { ActionIcon, Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
|
import { ActionIcon, Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
@@ -10,12 +10,14 @@ import { IoAddCircle } from 'react-icons/io5';
|
|||||||
import { MdCancel } from 'react-icons/md';
|
import { MdCancel } from 'react-icons/md';
|
||||||
import { funGetOneProjectById } from '../lib/api_project';
|
import { funGetOneProjectById } from '../lib/api_project';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
|
import { useHookstate } from '@hookstate/core';
|
||||||
|
|
||||||
export default function NavbarDetailProject() {
|
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 [isOpen, setOpen] = useState(false)
|
const [isOpen, setOpen] = useState(false)
|
||||||
|
const roleLogin = useHookstate(globalRole)
|
||||||
|
|
||||||
async function getOneData() {
|
async function getOneData() {
|
||||||
try {
|
try {
|
||||||
@@ -73,22 +75,6 @@ export default function NavbarDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
|
||||||
style={{
|
|
||||||
cursor: 'pointer'
|
|
||||||
}}
|
|
||||||
onClick={() => {
|
|
||||||
router.push(param.id + '/add-member')
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box>
|
|
||||||
<FaUsers size={30} color={WARNA.biruTua} />
|
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<Text c={WARNA.biruTua} ta='center'>Tambah anggota</Text>
|
|
||||||
</Box>
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer'
|
cursor: 'pointer'
|
||||||
@@ -105,33 +91,54 @@ export default function NavbarDetailProject() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
{
|
||||||
style={{
|
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
|
||||||
cursor: 'pointer'
|
<>
|
||||||
}}
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
onClick={() => { router.push(param.id + '/edit') }}
|
style={{
|
||||||
>
|
cursor: 'pointer'
|
||||||
<Box>
|
}}
|
||||||
<FaPencil size={30} color={WARNA.biruTua} />
|
onClick={() => {
|
||||||
</Box>
|
router.push(param.id + '/add-member')
|
||||||
<Box>
|
}}
|
||||||
<Text c={WARNA.biruTua} ta='center'>Edit</Text>
|
>
|
||||||
</Box>
|
<Box>
|
||||||
</Flex>
|
<FaUsers size={30} color={WARNA.biruTua} />
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text c={WARNA.biruTua} ta='center'>Tambah anggota</Text>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer'
|
cursor: 'pointer'
|
||||||
}}
|
}}
|
||||||
onClick={() => { router.push(param.id + '/cancel') }}
|
onClick={() => { router.push(param.id + '/edit') }}
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<MdCancel size={30} color={WARNA.biruTua} />
|
<FaPencil size={30} color={WARNA.biruTua} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Text c={WARNA.biruTua} ta='center'>Batal</Text>
|
<Text c={WARNA.biruTua} ta='center'>Edit</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
|
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||||
|
style={{
|
||||||
|
cursor: 'pointer'
|
||||||
|
}}
|
||||||
|
onClick={() => { router.push(param.id + '/cancel') }}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<MdCancel size={30} color={WARNA.biruTua} />
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Text c={WARNA.biruTua} ta='center'>Batal</Text>
|
||||||
|
</Box>
|
||||||
|
</Flex>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
Reference in New Issue
Block a user