Merge pull request #203 from bipproduction/amalia/06-september-24
Amalia/06 september 24
This commit is contained in:
@@ -139,7 +139,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan pengumuman, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export async function POST(req: NextRequest) {
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return Response.json({ message: "Internal Server Error", success: false });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export async function GET(request: Request) {
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, data tidak ditemukan" }, { status: 404 });
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ export async function GET(request: Request) {
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, data tidak ditemukan" }, { status: 404 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
return NextResponse.json({ success: true, message: "Berhasil menambah komentar", data: data, }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menambah komentar, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan diskusi", data: response }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
return NextResponse.json({ success: true, message: "Berhasil mengedit diskusi" }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengedit diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
});
|
||||
return NextResponse.json({ success: true, message: "Berhasil menghapus diskusi" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menghapus diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
return NextResponse.json({ success: true, message: "Berhasil mengedit diskusi" }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengedit diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export async function GET(request: Request) {
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ export async function POST(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan diskusi", data, }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menambahkan diskusi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -153,7 +153,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
|
||||
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengubah status admin divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan anggota divisi" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menambahkan anggota divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -61,7 +61,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: dataFix, }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengedit divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ export async function GET(request: Request) {
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: allData, }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ export async function POST(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan divisi", data, }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menambahkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -68,7 +68,7 @@ export async function POST(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil memindahkan item" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal memindahkan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -182,7 +182,7 @@ export async function PUT(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil salin item" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal salin item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -221,7 +221,7 @@ export async function DELETE(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil membagikan item" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal membagikan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -215,7 +215,7 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan item", data: formatData, jalur }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,7 @@ export async function POST(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil membuat folder baru" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal membuat folder, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -342,7 +342,7 @@ export async function PUT(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil mengubah nama item" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengubah nama item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -373,7 +373,7 @@ export async function DELETE(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil menghapus item" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menghapus item, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -94,7 +94,7 @@ export async function POST(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil upload file" }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal upload file, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -37,7 +37,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengedit grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengedit grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan grup", data, }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan grup", data, }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ export async function POST(request: Request) {
|
||||
|
||||
return NextResponse.json({ success: true, message: "Berhasil menambahkan grup", data, }, { status: 200 });
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menambahkan grup, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -345,7 +345,7 @@ export async function GET(request: Request) {
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan data, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { prisma } from "@/module/_global";
|
||||
import { funGetUserByCookies } from "@/module/auth";
|
||||
import { createLogUser } from "@/module/user";
|
||||
import _ from "lodash";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
@@ -24,7 +25,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
if (data == 0) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
||||
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||
},
|
||||
{ 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) {
|
||||
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) {
|
||||
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 { funGetUserByCookies } from "@/module/auth";
|
||||
import { createLogUser } from "@/module/user";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { NextResponse } from "next/server";
|
||||
@@ -159,7 +160,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
if (data == 0) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
||||
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||
},
|
||||
{ status: 404 }
|
||||
);
|
||||
@@ -171,14 +172,20 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
idProject: id,
|
||||
dateStart: new Date(moment(dateStart).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) {
|
||||
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) {
|
||||
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) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
||||
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||
},
|
||||
{ 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) {
|
||||
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 { funGetUserByCookies } from "@/module/auth";
|
||||
import { createLogUser } from "@/module/user";
|
||||
import moment from "moment";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
@@ -24,7 +25,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "Hapus project gagal, data tidak ditemukan",
|
||||
message: "Hapus tahapan kegiatan gagal, data tidak ditemukan",
|
||||
},
|
||||
{ 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(
|
||||
{
|
||||
success: true,
|
||||
message: "Project berhasil dihapus",
|
||||
message: "Tahapan kegiatan berhasil dihapus",
|
||||
data,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menghapus project, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
console.error(error);
|
||||
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) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false, message: "Gagal mendapatkan project, data tidak ditemukan",
|
||||
success: false, message: "Gagal mendapatkan kegiatan, data tidak ditemukan",
|
||||
},
|
||||
{ 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) {
|
||||
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 { 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({
|
||||
where: {
|
||||
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) {
|
||||
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 path from "path";
|
||||
import _ from "lodash";
|
||||
import { createLogUser } from "@/module/user";
|
||||
|
||||
// HAPUS FILE PROJECT BUKAN PAKE ISACTIVE
|
||||
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(
|
||||
{
|
||||
@@ -55,7 +59,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
);
|
||||
|
||||
} 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 });
|
||||
}
|
||||
}
|
||||
@@ -118,7 +122,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
}
|
||||
|
||||
} 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 });
|
||||
}
|
||||
}
|
||||
@@ -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 });
|
||||
|
||||
} 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 });
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menambah anggota tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -85,9 +85,6 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
);
|
||||
}
|
||||
|
||||
console.log(id, idUser)
|
||||
|
||||
|
||||
const del = await prisma.divisionProjectMember.deleteMany({
|
||||
where: {
|
||||
idUser: idUser,
|
||||
@@ -104,7 +101,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengeluarkan anggota, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengedit detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -246,7 +246,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal membatalkan tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengedit tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal menghapus tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengupdate status detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan detail tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mengedit detail tugas, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
||||
);
|
||||
|
||||
} 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 });
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
||||
return NextResponse.json({ success: true, message: "Berhasil membuat tugas divisi" }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal membuat tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
}
|
||||
|
||||
} 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 });
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json({ success: true, message: "Berhasil mendapatkan divisi", data: formatData, }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ export async function POST(request: Request) {
|
||||
return NextResponse.json({ success: true, message: "Berhasil membuat tugas divisi" }, { status: 200 });
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
return NextResponse.json({ success: false, message: "Gagal membuat tugas divisi, coba lagi nanti", reason: (error as Error).message, }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,6 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 });
|
||||
}
|
||||
const { id } = context.params;
|
||||
console.log(id)
|
||||
|
||||
const body = await request.formData()
|
||||
const file = body.get("file") as File
|
||||
|
||||
@@ -5,7 +5,7 @@ import { WARNA } from '../fun/WARNA';
|
||||
import LayoutIconBack from './layout_icon_back';
|
||||
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 (
|
||||
<Box pt={25} pl={20} pr={20} m={0} pos={'sticky'} top={0} pb={25} bg={WARNA.biruTua}
|
||||
style={{
|
||||
@@ -16,11 +16,18 @@ export const LayoutNavbarNew = ({ back, title, menu }: { back?: string, title: s
|
||||
}}
|
||||
>
|
||||
<Grid justify='center' align='center'>
|
||||
<Grid.Col span="auto">
|
||||
{
|
||||
back!=undefined && (<LayoutIconBack back={back} />)
|
||||
}
|
||||
</Grid.Col>
|
||||
{
|
||||
state != undefined &&
|
||||
<Grid.Col span="auto">
|
||||
{state}
|
||||
</Grid.Col>
|
||||
}
|
||||
{
|
||||
back != undefined &&
|
||||
<Grid.Col span="auto">
|
||||
<LayoutIconBack back={back} />
|
||||
</Grid.Col>
|
||||
}
|
||||
<Grid.Col span={8}>
|
||||
<Title c={WARNA.bgWhite} ta={'center'} order={5} lineClamp={1}>{_.startCase(title)}</Title>
|
||||
</Grid.Col>
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function CreateAnnouncement() {
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan pengumuman, coba lagi nanti");
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ export default function EditAnnouncement() {
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mengedit pengumuman, coba lagi nanti");
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function CreateUserCalender({ onClose }: { onClose: (val: any) =>
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false)
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function DateEventDivision() {
|
||||
}
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan list acara")
|
||||
} finally {
|
||||
setLoading(false)
|
||||
@@ -50,7 +50,7 @@ export default function DateEventDivision() {
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan list acara")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function DetailEventDivision() {
|
||||
setLengthMember(response.data.total)
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export default function DrawerDetailEvent() {
|
||||
}
|
||||
setModal(false)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
setModal(false)
|
||||
toast.error("Gagal hapus calender, coba lagi nanti");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function HistoryDivisionCalender() {
|
||||
setData(response.data)
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ export default function NavbarCreateDivisionCalender() {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
setModal(false)
|
||||
toast.error("Gagal menambahkan pengumuman, coba lagi nanti");
|
||||
} finally {
|
||||
|
||||
@@ -40,7 +40,7 @@ export default function UpdateDivisionCalender() {
|
||||
setDataCalender(response.data.calender)
|
||||
memberUser.set(response.data.member)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
@@ -76,7 +76,7 @@ export default function UpdateDivisionCalender() {
|
||||
}
|
||||
setModal(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Terjadi kesalahan! Silahkan coba kembali");
|
||||
setModal(false)
|
||||
} finally {
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function UpdateListUsers({ onClose }: { onClose: (val: any) => vo
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false)
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
||||
setData(response.data)
|
||||
setIsLoad(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
} finally {
|
||||
setIsLoad(false)
|
||||
}
|
||||
@@ -57,7 +57,7 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function DrawerDetailDiscussion({ onSuccess, id, status, idDivisi
|
||||
}
|
||||
setValModalStatus(false)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
setValModalStatus(false)
|
||||
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
||||
} finally {
|
||||
@@ -58,7 +58,7 @@ export default function DrawerDetailDiscussion({ onSuccess, id, status, idDivisi
|
||||
}
|
||||
setValModal(false)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
setValModal(false)
|
||||
toast.error("Gagal hapus diskusi, coba lagi nanti");
|
||||
} finally {
|
||||
|
||||
@@ -58,7 +58,7 @@ export default function FormCreateDiscussion({ id }: { id: string }) {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
||||
} finally {
|
||||
setValModal(false)
|
||||
|
||||
@@ -26,7 +26,7 @@ export default function FormEditDiscussion() {
|
||||
const response = await funGetDiscussionById(param.detail)
|
||||
setDataOne(response.data.desc)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
toast.error("Gagal menampilkan discussion, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false)
|
||||
@@ -49,7 +49,7 @@ export default function FormEditDiscussion() {
|
||||
}
|
||||
setValModal(false)
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
setValModal(false)
|
||||
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
||||
} finally {
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function ListDiscussion({ id }: { id: string }) {
|
||||
}
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export default function CreateAnggotaDivision() {
|
||||
setOpen(false)
|
||||
} catch (error) {
|
||||
setOpen(false)
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
toast.error("Gagal menambahkan anggota divisi, coba lagi nanti");
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export default function CreateReport() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false)
|
||||
|
||||
@@ -62,7 +62,7 @@ export default function EditDivision() {
|
||||
}
|
||||
setOpenModal(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
setOpenModal(false)
|
||||
toast.error("Gagal mengedit divisi, coba lagi nanti");
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function NavbarAdminDivision({ data, onSuccess }: { data: any, on
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
onSuccess(false)
|
||||
toast.error("Gagal menambahkan divisi, coba lagi nanti");
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export default function ReportDivisionId() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan data, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false)
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function DrawerMore({ data }: { data: IDataDocument[] }) {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal memindahkan item, coba lagi nanti")
|
||||
}
|
||||
setIsCut(false)
|
||||
@@ -44,7 +44,7 @@ export default function DrawerMore({ data }: { data: IDataDocument[] }) {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal memindahkan item, coba lagi nanti")
|
||||
}
|
||||
setIsCopy(false)
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function DrawerShareDocument({ data }: { data: IShareDivision[]})
|
||||
toast.error(respon.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal membagikan item, coba lagi nanti");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ export default function NavbarDocumentDivision() {
|
||||
toast.error(respon.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menghapus item, coba lagi nanti")
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ export default function NavbarDocumentDivision() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mengganti nama item, coba lagi nanti")
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ export default function DrawerGroup({ onSuccess, }: { onSuccess: (val: boolean)
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
toast.error("Gagal menambahkan grup, coba lagi nanti");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export default function DrawerDetailPosition({ onUpdated, id, isActive }: {
|
||||
}
|
||||
setModal(false);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.error(error);
|
||||
setModal(false);
|
||||
toast.error("Edit jabatan gagal, coba lagi nanti");
|
||||
onUpdated(false);
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function AddDetailTaskProject() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export default function AddFileDetailProject() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan file, coba lagi nanti")
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ export default function AddFileDetailProject() {
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan file, coba lagi nanti");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function AddMemberDetailProject() {
|
||||
}
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false)
|
||||
@@ -97,7 +97,7 @@ export default function AddMemberDetailProject() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function CancelProject() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal membatalkan Kegiatan, coba lagi nanti")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"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 { useRouter, useSearchParams } from "next/navigation";
|
||||
import React, { useRef, useState } from "react";
|
||||
@@ -29,7 +29,6 @@ export default function CreateProject() {
|
||||
const [openDrawerTask, setOpenDrawerTask] = useState(false)
|
||||
const [isModal, setModal] = useState(false)
|
||||
const [dataGroup, setDataGroup] = useState<IDataGroup[]>([]);
|
||||
const [roleUser, setRoleUser] = useState<any>("")
|
||||
const [isChooseAnggota, setChooseAnggota] = useState(false)
|
||||
const member = useHookstate(globalMemberProject)
|
||||
const memberValue = member.get() as IFormMemberProject[]
|
||||
@@ -40,6 +39,8 @@ export default function CreateProject() {
|
||||
const [listFile, setListFile] = useState<IListFileTaskProject[]>([])
|
||||
const [indexDelFile, setIndexDelFile] = useState<number>(0)
|
||||
const [indexDelTask, setIndexDelTask] = useState<number>(0)
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
|
||||
const [body, setBody] = useState<any>({
|
||||
idGroup: "",
|
||||
title: "",
|
||||
@@ -69,12 +70,15 @@ export default function CreateProject() {
|
||||
toast.error(loadGroup.message);
|
||||
}
|
||||
|
||||
const loadUser = await funGetUserByCookies();
|
||||
setRoleUser(loadUser.idUserRole)
|
||||
if (roleLogin.get() != "supadmin") {
|
||||
const loadUser = await funGetUserByCookies();
|
||||
setBody({ ...body, idGroup: loadUser.idGroup })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onToChooseAnggota() {
|
||||
if (roleUser == "supadmin" && body.idGroup == "")
|
||||
if (roleLogin.get() == "supadmin" && body.idGroup == "")
|
||||
return toast.error("Error! grup harus diisi")
|
||||
setChooseAnggota(true)
|
||||
}
|
||||
@@ -116,7 +120,7 @@ export default function CreateProject() {
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan kegiatan, coba lagi nanti");
|
||||
}
|
||||
}
|
||||
@@ -137,7 +141,7 @@ export default function CreateProject() {
|
||||
<Box p={20}>
|
||||
<Stack>
|
||||
{
|
||||
(roleUser == "supadmin") && (
|
||||
(roleLogin.get() == "supadmin") && (
|
||||
<Select
|
||||
placeholder="Grup"
|
||||
label="Grup"
|
||||
@@ -206,7 +210,10 @@ export default function CreateProject() {
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
borderRadius: 10,
|
||||
}}
|
||||
onClick={() => setOpenDrawer(true)}
|
||||
onClick={() =>
|
||||
// setOpenDrawer(true)
|
||||
openRef.current?.()
|
||||
}
|
||||
>
|
||||
<Text>Upload File</Text>
|
||||
<IoIosArrowDropright size={25} />
|
||||
@@ -290,111 +297,127 @@ export default function CreateProject() {
|
||||
>
|
||||
{member.get().map((v: any, i: any) => {
|
||||
return (
|
||||
<Box key={i}>
|
||||
<Grid align='center' mt={10}
|
||||
>
|
||||
<Grid.Col span={9}>
|
||||
<Group>
|
||||
<Avatar src={`/api/file/img?jenis=image&cat=user&file=${v.img}`} alt="it's me" size="lg" />
|
||||
<Box w={{
|
||||
base: 140,
|
||||
xl: 270
|
||||
}}>
|
||||
<Text c={WARNA.biruTua} fw={"bold"} lineClamp={1}>
|
||||
{v.name}
|
||||
</Text>
|
||||
</Box>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={3}>
|
||||
<Text c={WARNA.biruTua} fw={"bold"} ta={'end'}>
|
||||
Anggota
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Box mt={10}>
|
||||
<Divider size={"xs"} />
|
||||
<Box key={i}>
|
||||
<Grid align='center' mt={10}
|
||||
>
|
||||
<Grid.Col span={9}>
|
||||
<Group>
|
||||
<Avatar src={`/api/file/img?jenis=image&cat=user&file=${v.img}`} alt="it's me" size="lg" />
|
||||
<Box w={{
|
||||
base: 140,
|
||||
xl: 270
|
||||
}}>
|
||||
<Text c={WARNA.biruTua} fw={"bold"} lineClamp={1}>
|
||||
{v.name}
|
||||
</Text>
|
||||
</Box>
|
||||
</Group>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={3}>
|
||||
<Text c={WARNA.biruTua} fw={"bold"} ta={'end'}>
|
||||
Anggota
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Box mt={10}>
|
||||
<Divider size={"xs"} />
|
||||
</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 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
|
||||
opened={openDrawer}
|
||||
onClose={() => setOpenDrawer(false)}
|
||||
title={"Pilih File"}
|
||||
>
|
||||
<Flex justify={"flex-start"} px={20}>
|
||||
<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')
|
||||
}}
|
||||
>
|
||||
<Box onClick={() => openRef.current?.()}>
|
||||
<Box
|
||||
bg={"#DCEED8"}
|
||||
style={{
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
padding: 20,
|
||||
borderRadius: 10,
|
||||
}}
|
||||
>
|
||||
<Center>
|
||||
<BsFiletypeCsv size={40} />
|
||||
</Center>
|
||||
</Box>
|
||||
<Text mt={10} ta={"center"}>
|
||||
Pilih file
|
||||
</Text>
|
||||
<Text ta={"center"}>diperangkat</Text>
|
||||
|
||||
{/* Drawer pilih file */}
|
||||
{/* <LayoutDrawer
|
||||
opened={openDrawer}
|
||||
onClose={() => setOpenDrawer(false)}
|
||||
title={"Pilih File"}
|
||||
>
|
||||
<Flex justify={"flex-start"} px={20}>
|
||||
<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')
|
||||
}}
|
||||
>
|
||||
<Box onClick={() => openRef.current?.()}>
|
||||
<Box
|
||||
bg={"#DCEED8"}
|
||||
style={{
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
padding: 20,
|
||||
borderRadius: 10,
|
||||
}}
|
||||
>
|
||||
<Center>
|
||||
<BsFiletypeCsv size={40} />
|
||||
</Center>
|
||||
</Box>
|
||||
</Dropzone>
|
||||
{/* <Box onClick={() => router.push("/project/create?page=file-save")}>
|
||||
<Text mt={10} ta={"center"}>
|
||||
Pilih file
|
||||
</Text>
|
||||
<Text ta={"center"}>diperangkat</Text>
|
||||
</Box>
|
||||
</Dropzone>
|
||||
<Box onClick={() => router.push("/project/create?page=file-save")}>
|
||||
<Box
|
||||
bg={"#DCEED8"}
|
||||
style={{
|
||||
@@ -411,62 +434,62 @@ export default function CreateProject() {
|
||||
Pilih file yang
|
||||
</Text>
|
||||
<Text ta={"center"}>sudah ada</Text>
|
||||
</Box> */}
|
||||
</Flex>
|
||||
</LayoutDrawer>
|
||||
</Box>
|
||||
</Flex>
|
||||
</LayoutDrawer> */}
|
||||
|
||||
|
||||
|
||||
{/* Drawer hapus file */}
|
||||
<LayoutDrawer
|
||||
opened={openDrawerFile}
|
||||
onClose={() => setOpenDrawerFile(false)}
|
||||
title={""}
|
||||
>
|
||||
<Stack pt={10}>
|
||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteFile(indexDelFile)}>
|
||||
<Box>
|
||||
<FaTrash size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua} ta='center'>Hapus File</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</LayoutDrawer>
|
||||
{/* Drawer hapus file */}
|
||||
<LayoutDrawer
|
||||
opened={openDrawerFile}
|
||||
onClose={() => setOpenDrawerFile(false)}
|
||||
title={""}
|
||||
>
|
||||
<Stack pt={10}>
|
||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteFile(indexDelFile)}>
|
||||
<Box>
|
||||
<FaTrash size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua} ta='center'>Hapus File</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</LayoutDrawer>
|
||||
|
||||
|
||||
{/* Drawer hapus tugas */}
|
||||
<LayoutDrawer
|
||||
opened={openDrawerTask}
|
||||
onClose={() => setOpenDrawerTask(false)}
|
||||
title={""}
|
||||
>
|
||||
<Stack pt={10}>
|
||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteTask(indexDelTask)}>
|
||||
<Box>
|
||||
<FaTrash size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua} ta='center'>Hapus Tugas</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</LayoutDrawer>
|
||||
{/* Drawer hapus tugas */}
|
||||
<LayoutDrawer
|
||||
opened={openDrawerTask}
|
||||
onClose={() => setOpenDrawerTask(false)}
|
||||
title={""}
|
||||
>
|
||||
<Stack pt={10}>
|
||||
<SimpleGrid cols={{ base: 3, sm: 3, lg: 3 }} >
|
||||
<Flex style={{ cursor: 'pointer' }} justify={'center'} align={'center'} direction={'column'} onClick={() => deleteTask(indexDelTask)}>
|
||||
<Box>
|
||||
<FaTrash size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua} ta='center'>Hapus Tugas</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</LayoutDrawer>
|
||||
|
||||
|
||||
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
||||
description="Apakah Anda yakin ingin menambahkan data?"
|
||||
onYes={(val) => {
|
||||
if (val) {
|
||||
onSubmit()
|
||||
}
|
||||
setModal(false)
|
||||
}} />
|
||||
</Box >
|
||||
);
|
||||
<LayoutModal opened={isModal} onClose={() => setModal(false)}
|
||||
description="Apakah Anda yakin ingin menambahkan data?"
|
||||
onYes={(val) => {
|
||||
if (val) {
|
||||
onSubmit()
|
||||
}
|
||||
setModal(false)
|
||||
}} />
|
||||
</Box >
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use client"
|
||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||
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 { useRouter } from 'next/navigation';
|
||||
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 { funGetUserByCookies } from '@/module/auth';
|
||||
import toast from 'react-hot-toast';
|
||||
@@ -62,7 +62,13 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
||||
|
||||
return (
|
||||
<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}>
|
||||
<Stack>
|
||||
<TextInput
|
||||
@@ -128,22 +134,22 @@ export default function CreateUsersProject({ grup, onClose }: { grup?: string, o
|
||||
</Box>
|
||||
</Stack>
|
||||
</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={() => { onSubmit() }}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</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={() => { onSubmit() }}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function EditTaskProject() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mengedit Kegiatan, coba lagi nanti")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'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 React, { useState } from 'react';
|
||||
import { funDeleteMemberProject, funGetOneProjectById } from '../lib/api_project';
|
||||
@@ -10,6 +10,7 @@ import { IDataMemberProject } from '../lib/type_project';
|
||||
import { FaUser } from 'react-icons/fa6';
|
||||
import { IoIosCloseCircle } from 'react-icons/io';
|
||||
import LayoutModal from '@/module/_global/layout/layout_modal';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
|
||||
|
||||
export default function ListAnggotaDetailProject() {
|
||||
@@ -20,6 +21,7 @@ export default function ListAnggotaDetailProject() {
|
||||
const [isOpenModal, setOpenModal] = useState(false)
|
||||
const [dataChoose, setDataChoose] = useState({ id: '', name: '' })
|
||||
const router = useRouter()
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
|
||||
async function getOneData() {
|
||||
try {
|
||||
@@ -93,7 +95,7 @@ export default function ListAnggotaDetailProject() {
|
||||
<Grid align='center' mt={10}
|
||||
onClick={() => {
|
||||
setDataChoose({ id: v.idUser, name: v.name })
|
||||
setOpenDrawer(true)
|
||||
setOpenDrawer(true)
|
||||
}}
|
||||
>
|
||||
<Grid.Col span={9}>
|
||||
@@ -138,14 +140,17 @@ export default function ListAnggotaDetailProject() {
|
||||
</Box>
|
||||
</Flex>
|
||||
|
||||
<Flex onClick={() => { setOpenModal(true) }} justify={'center'} align={'center'} direction={'column'} >
|
||||
<Box>
|
||||
<IoIosCloseCircle size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua}>Keluarkan anggota</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
{
|
||||
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
|
||||
<Flex onClick={() => { setOpenModal(true) }} justify={'center'} align={'center'} direction={'column'} >
|
||||
<Box>
|
||||
<IoIosCloseCircle size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua}>Keluarkan anggota</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
}
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
</Box>
|
||||
|
||||
@@ -183,7 +183,11 @@ export default function ListProject() {
|
||||
<Avatar>
|
||||
<MdAccountCircle size={32} color={WARNA.biruTua} />
|
||||
</Avatar>
|
||||
<Avatar>+{v.member - 1}</Avatar>
|
||||
<Avatar>
|
||||
{
|
||||
v.member > 0 ? '+' + (v.member - 1) : "0"
|
||||
}
|
||||
</Avatar>
|
||||
</Avatar.Group>
|
||||
</Group>
|
||||
</Box>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'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 { useParams, useRouter } from 'next/navigation';
|
||||
import React, { useState } from 'react';
|
||||
@@ -10,12 +10,14 @@ import { IoAddCircle } from 'react-icons/io5';
|
||||
import { MdCancel } from 'react-icons/md';
|
||||
import { funGetOneProjectById } from '../lib/api_project';
|
||||
import { useShallowEffect } from '@mantine/hooks';
|
||||
import { useHookstate } from '@hookstate/core';
|
||||
|
||||
export default function NavbarDetailProject() {
|
||||
const router = useRouter()
|
||||
const param = useParams<{ id: string }>()
|
||||
const [name, setName] = useState('')
|
||||
const [isOpen, setOpen] = useState(false)
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
|
||||
async function getOneData() {
|
||||
try {
|
||||
@@ -73,22 +75,6 @@ export default function NavbarDetailProject() {
|
||||
</Box>
|
||||
</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'}
|
||||
style={{
|
||||
cursor: 'pointer'
|
||||
@@ -105,33 +91,54 @@ export default function NavbarDetailProject() {
|
||||
</Box>
|
||||
</Flex>
|
||||
|
||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||
style={{
|
||||
cursor: 'pointer'
|
||||
}}
|
||||
onClick={() => { router.push(param.id + '/edit') }}
|
||||
>
|
||||
<Box>
|
||||
<FaPencil size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua} ta='center'>Edit</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
{
|
||||
(roleLogin.get() != "user" && roleLogin.get() != "coadmin") &&
|
||||
<>
|
||||
<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'}
|
||||
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>
|
||||
<Flex justify={'center'} align={'center'} direction={'column'}
|
||||
style={{
|
||||
cursor: 'pointer'
|
||||
}}
|
||||
onClick={() => { router.push(param.id + '/edit') }}
|
||||
>
|
||||
<Box>
|
||||
<FaPencil size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua} ta='center'>Edit</Text>
|
||||
</Box>
|
||||
</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>
|
||||
</Stack>
|
||||
|
||||
@@ -60,7 +60,7 @@ export default function AddDetailTask() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan tugas, coba lagi nanti")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export default function AddFileDetailTask() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan file, coba lagi nanti")
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export default function AddFileDetailTask() {
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan tugas divisi, coba lagi nanti");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function AddMemberDetailTask() {
|
||||
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false)
|
||||
@@ -115,7 +115,7 @@ export default function AddMemberDetailTask() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan anggota, coba lagi nanti");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export default function CancelTask() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal membatalkan tugas, coba lagi nanti")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export default function CreateTask() {
|
||||
toast.error(response.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal menambahkan tugas divisi, coba lagi nanti");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export default function CreateUsersProject({ onClose }: { onClose: (val: any) =>
|
||||
}
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||
} finally {
|
||||
setLoading(false)
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function EditTask() {
|
||||
toast.error(res.message)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
toast.error("Gagal mengedit tugas, coba lagi nanti")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export default async function createLogUser({ act, desc, table, data }: { act: s
|
||||
return { success: true, message: "Success" }
|
||||
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
return { success: false, message: "Internal Server Error" }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user