diff --git a/package.json b/package.json index 9a4824a7..af974765 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@mantine/core": "^6.0.17", "@mantine/dates": "^6.0.17", "@mantine/dropzone": "^7.1.3", + "@mantine/form": "^7.6.1", "@mantine/hooks": "^6.0.17", "@mantine/next": "^6.0.17", "@mantine/notifications": "^6.0.17", @@ -47,12 +48,15 @@ "lodash": "^4.17.21", "midtrans-client": "^1.3.1", "moment": "^2.29.4", + "mqtt": "^5.5.0", "next": "^13.5.4-canary.8", "postcss": "8.4.27", "react": "18.2.0", "react-countdown": "^2.3.5", "react-dom": "18.2.0", "react-fast-marquee": "^1.6.4", + "react-icons": "^5.0.1", + "react-international-phone": "^4.2.6", "react-quill": "^2.0.0", "react-responsive-carousel": "^3.2.23", "react-simple-toasts": "^5.10.0", diff --git a/prisma/schema.prisma b/prisma/schema.prisma index cff18aa3..ad58a896 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -12,26 +12,30 @@ datasource db { } model User { - id String @id @default(cuid()) - username String @unique - nomor String @unique - active Boolean @default(true) - createdAt DateTime? @default(now()) - updatedAt DateTime? @updatedAt - MasterUserRole MasterUserRole @relation(fields: [masterUserRoleId], references: [id]) - masterUserRoleId String @default("1") - UserSession UserSession? - Profile Profile? - Investasi Investasi[] - TransaksiInvestasi TransaksiInvestasi[] - Donasi Donasi[] - Donasi_Invoice Donasi_Invoice[] - Donasi_Notif Donasi_Notif[] - Event Event[] - Event_Peserta Event_Peserta[] - Voting Voting[] - Voting_Kontributor Voting_Kontributor[] - Job Job[] + id String @id @default(cuid()) + username String @unique + nomor String @unique + active Boolean @default(true) + createdAt DateTime? @default(now()) + updatedAt DateTime? @updatedAt + MasterUserRole MasterUserRole @relation(fields: [masterUserRoleId], references: [id]) + masterUserRoleId String @default("1") + UserSession UserSession? + Profile Profile? + Investasi Investasi[] + TransaksiInvestasi TransaksiInvestasi[] + Donasi Donasi[] + Donasi_Invoice Donasi_Invoice[] + Donasi_Notif Donasi_Notif[] + Event Event[] + Event_Peserta Event_Peserta[] + Voting Voting[] + Voting_Kontributor Voting_Kontributor[] + Job Job[] + Forum_Posting Forum_Posting[] + Forum_Komentar Forum_Komentar[] + Forum_ReportPosting Forum_ReportPosting[] + Forum_ReportKomentar Forum_ReportKomentar[] } model MasterUserRole { @@ -54,6 +58,15 @@ model UserSession { userId String @unique } +model KodeOtp { + id String @id @default(cuid()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + nomor String + otp Int +} + model Profile { id String @id @default(cuid()) name String @@ -104,6 +117,7 @@ model ImagesBackground { model Portofolio { id String @id @default(cuid()) + id_Portofolio String @unique namaBisnis String alamatKantor String tlpn String @@ -625,3 +639,83 @@ model Job { MasterStatus MasterStatus? @relation(fields: [masterStatusId], references: [id]) masterStatusId String? @default("2") } + +// ========================================= FORUM ========================================= // + +model ForumMaster_StatusPosting { + id Int @id @default(autoincrement()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + status String + Forum_Posting Forum_Posting[] +} + +model Forum_Posting { + id String @id @default(cuid()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + publishAt DateTime? + diskusi String @db.Text + Forum_Komentar Forum_Komentar[] + Forum_ReportPosting Forum_ReportPosting[] + Author User? @relation(fields: [authorId], references: [id]) + authorId String? + ForumMaster_StatusPosting ForumMaster_StatusPosting? @relation(fields: [forumMaster_StatusPostingId], references: [id]) + forumMaster_StatusPostingId Int? +} + +model Forum_Komentar { + id String @id @default(cuid()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + komentar String @db.Text + Forum_Posting Forum_Posting? @relation(fields: [forum_PostingId], references: [id]) + forum_PostingId String? + Forum_ReportKomentar Forum_ReportKomentar[] + Author User? @relation(fields: [authorId], references: [id]) + authorId String? +} + +model ForumMaster_KategoriReport { + id Int @id @default(autoincrement()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + title String + deskripsi String @db.Text + Forum_ReportPosting Forum_ReportPosting[] + Forum_ReportKomentar Forum_ReportKomentar[] +} + +model Forum_ReportPosting { + id String @id @default(cuid()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + deskripsi String? @db.Text + + ForumMaster_KategoriReport ForumMaster_KategoriReport? @relation(fields: [forumMaster_KategoriReportId], references: [id]) + forumMaster_KategoriReportId Int? + Forum_Posting Forum_Posting? @relation(fields: [forum_PostingId], references: [id]) + forum_PostingId String? + User User? @relation(fields: [userId], references: [id]) + userId String? +} + +model Forum_ReportKomentar { + id String @id @default(cuid()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + deskripsi String? @db.Text + + ForumMaster_KategoriReport ForumMaster_KategoriReport? @relation(fields: [forumMaster_KategoriReportId], references: [id]) + forumMaster_KategoriReportId Int? + Forum_Komentar Forum_Komentar? @relation(fields: [forum_KomentarId], references: [id]) + forum_KomentarId String? + User User? @relation(fields: [userId], references: [id]) + userId String? +} diff --git a/public/aset/Hipmi Project Collaboration.png b/public/aset/colab/logo.png similarity index 100% rename from public/aset/Hipmi Project Collaboration.png rename to public/aset/colab/logo.png diff --git a/public/aset/forum/logo.png b/public/aset/forum/logo.png new file mode 100644 index 00000000..ced44c9c Binary files /dev/null and b/public/aset/forum/logo.png differ diff --git a/public/aset/investasi/home-hipmi.png b/public/aset/home/home-hipmi.png similarity index 100% rename from public/aset/investasi/home-hipmi.png rename to public/aset/home/home-hipmi.png diff --git a/public/donasi/image/58ac41fd-8f34-460c-83e2-3c12fba9f659.jpeg b/public/donasi/image/58ac41fd-8f34-460c-83e2-3c12fba9f659.jpeg new file mode 100644 index 00000000..d3ea1214 Binary files /dev/null and b/public/donasi/image/58ac41fd-8f34-460c-83e2-3c12fba9f659.jpeg differ diff --git a/public/donasi/image_cerita/ea5fb905-1926-4ea0-b829-da57054fd574.jpg b/public/donasi/image_cerita/ea5fb905-1926-4ea0-b829-da57054fd574.jpg new file mode 100644 index 00000000..b71d094e Binary files /dev/null and b/public/donasi/image_cerita/ea5fb905-1926-4ea0-b829-da57054fd574.jpg differ diff --git a/public/file/3e554564-51d3-436e-b763-a06c9b1653fa.pdf b/public/file/3e554564-51d3-436e-b763-a06c9b1653fa.pdf new file mode 100644 index 00000000..6b87abcb Binary files /dev/null and b/public/file/3e554564-51d3-436e-b763-a06c9b1653fa.pdf differ diff --git a/public/investasi/dd6a6ed4-ca5c-46b5-b12e-c314420077ae.jpeg b/public/investasi/dd6a6ed4-ca5c-46b5-b12e-c314420077ae.jpeg new file mode 100644 index 00000000..25a18f99 Binary files /dev/null and b/public/investasi/dd6a6ed4-ca5c-46b5-b12e-c314420077ae.jpeg differ diff --git a/public/profile/background/47266738-b42b-4f91-9b26-5730f334edaf.jpeg b/public/profile/background/47266738-b42b-4f91-9b26-5730f334edaf.jpeg new file mode 100644 index 00000000..8cd38350 Binary files /dev/null and b/public/profile/background/47266738-b42b-4f91-9b26-5730f334edaf.jpeg differ diff --git a/public/profile/background/64f55ff4-6192-4c0f-ac9e-d64c94ba670b.png b/public/profile/background/64f55ff4-6192-4c0f-ac9e-d64c94ba670b.png new file mode 100644 index 00000000..d0c9754c Binary files /dev/null and b/public/profile/background/64f55ff4-6192-4c0f-ac9e-d64c94ba670b.png differ diff --git a/public/profile/background/8099f775-c551-4715-bd9b-901b0bc4ffaa.jpeg b/public/profile/background/8099f775-c551-4715-bd9b-901b0bc4ffaa.jpeg new file mode 100644 index 00000000..b43c0679 Binary files /dev/null and b/public/profile/background/8099f775-c551-4715-bd9b-901b0bc4ffaa.jpeg differ diff --git a/public/profile/background/9be88bcd-90b5-47ef-8161-3044e1d3dd1e.jpeg b/public/profile/background/9be88bcd-90b5-47ef-8161-3044e1d3dd1e.jpeg new file mode 100644 index 00000000..32ce4052 Binary files /dev/null and b/public/profile/background/9be88bcd-90b5-47ef-8161-3044e1d3dd1e.jpeg differ diff --git a/public/profile/background/c6563aed-bd2c-4446-83e1-82107878aca2.jpeg b/public/profile/background/c6563aed-bd2c-4446-83e1-82107878aca2.jpeg new file mode 100644 index 00000000..b43c0679 Binary files /dev/null and b/public/profile/background/c6563aed-bd2c-4446-83e1-82107878aca2.jpeg differ diff --git a/public/profile/background/fb718146-8db1-4a44-aa3a-cb4dd607d9df.jpeg b/public/profile/background/fb718146-8db1-4a44-aa3a-cb4dd607d9df.jpeg new file mode 100644 index 00000000..66e914cb Binary files /dev/null and b/public/profile/background/fb718146-8db1-4a44-aa3a-cb4dd607d9df.jpeg differ diff --git a/public/profile/foto/0d7763e6-6a57-4521-8ac6-2784e4241cd2.jpeg b/public/profile/foto/0d7763e6-6a57-4521-8ac6-2784e4241cd2.jpeg new file mode 100644 index 00000000..4c3167d8 Binary files /dev/null and b/public/profile/foto/0d7763e6-6a57-4521-8ac6-2784e4241cd2.jpeg differ diff --git a/public/profile/foto/186134d1-1ed2-4521-a696-82a8f0c924c8.jpeg b/public/profile/foto/186134d1-1ed2-4521-a696-82a8f0c924c8.jpeg new file mode 100644 index 00000000..af6599d6 Binary files /dev/null and b/public/profile/foto/186134d1-1ed2-4521-a696-82a8f0c924c8.jpeg differ diff --git a/public/profile/foto/1c0cf07a-1ada-4a50-a88e-af5675d6d541.png b/public/profile/foto/1c0cf07a-1ada-4a50-a88e-af5675d6d541.png new file mode 100644 index 00000000..6e04e0ec Binary files /dev/null and b/public/profile/foto/1c0cf07a-1ada-4a50-a88e-af5675d6d541.png differ diff --git a/public/profile/foto/31510ea9-13ee-47b1-84f8-4ebd1413f9be.jpeg b/public/profile/foto/31510ea9-13ee-47b1-84f8-4ebd1413f9be.jpeg new file mode 100644 index 00000000..af6599d6 Binary files /dev/null and b/public/profile/foto/31510ea9-13ee-47b1-84f8-4ebd1413f9be.jpeg differ diff --git a/public/profile/foto/46c2413f-7b3d-4e55-b82f-31bab6d063b5.jpeg b/public/profile/foto/46c2413f-7b3d-4e55-b82f-31bab6d063b5.jpeg new file mode 100644 index 00000000..309c5830 Binary files /dev/null and b/public/profile/foto/46c2413f-7b3d-4e55-b82f-31bab6d063b5.jpeg differ diff --git a/public/profile/foto/7cfc36fd-239e-48eb-80fc-3558c5169f5d.jpeg b/public/profile/foto/7cfc36fd-239e-48eb-80fc-3558c5169f5d.jpeg new file mode 100644 index 00000000..af6599d6 Binary files /dev/null and b/public/profile/foto/7cfc36fd-239e-48eb-80fc-3558c5169f5d.jpeg differ diff --git a/public/profile/foto/9e8d7468-ca2a-4d64-bf10-abfe4f31c660.jpeg b/public/profile/foto/9e8d7468-ca2a-4d64-bf10-abfe4f31c660.jpeg new file mode 100644 index 00000000..3b15a8f8 Binary files /dev/null and b/public/profile/foto/9e8d7468-ca2a-4d64-bf10-abfe4f31c660.jpeg differ diff --git a/public/profile/foto/dda719a4-b392-4c4d-90c5-5607a12eb51b.jpeg b/public/profile/foto/dda719a4-b392-4c4d-90c5-5607a12eb51b.jpeg new file mode 100644 index 00000000..3b15a8f8 Binary files /dev/null and b/public/profile/foto/dda719a4-b392-4c4d-90c5-5607a12eb51b.jpeg differ diff --git a/src/app/api/auth/validasi/route.ts b/src/app/api/auth/validasi/route.ts index ba849d0e..be2bc349 100644 --- a/src/app/api/auth/validasi/route.ts +++ b/src/app/api/auth/validasi/route.ts @@ -4,9 +4,9 @@ import { NextResponse } from "next/server"; import { cookies } from "next/headers"; import { sealData, unsealData } from "iron-session"; import { getConfig } from "@/bin/config"; -import yaml from "yaml"; -import fs from "fs"; import { revalidatePath } from "next/cache"; +import fs from "fs"; +import yaml from "yaml"; const config = yaml.parse(fs.readFileSync("config.yaml").toString()); export async function POST(req: Request) { diff --git a/src/app/api/seeder/route.ts b/src/app/api/seeder/route.ts index ee22733d..0905f917 100644 --- a/src/app/api/seeder/route.ts +++ b/src/app/api/seeder/route.ts @@ -19,6 +19,8 @@ import event_status from "../../../bin/seeder/event/master_status.json"; import event_tipe_acara from "../../../bin/seeder/event/master_tipe_acara.json"; import voting_status from "../../../bin/seeder/voting/master_status.json"; import master_status from "../../../bin/seeder/master_status.json"; +import forum_kategori_report from "../../../bin/seeder/forum/master_report.json"; +import forum_status_posting from "../../../bin/seeder/forum/master_status.json"; export async function GET(req: Request) { const dev = new URL(req.url).searchParams.get("dev"); @@ -39,23 +41,23 @@ export async function GET(req: Request) { }); } - for (let i of userSeeder) { - await prisma.user.upsert({ - where: { - nomor: i.nomor, - }, - create: { - nomor: i.nomor, - username: i.name, - masterUserRoleId: i.masterUserRoleId, - }, - update: { - nomor: i.nomor, - username: i.name, - masterUserRoleId: i.masterUserRoleId, - }, - }); - } + // for (let i of userSeeder) { + // await prisma.user.upsert({ + // where: { + // nomor: i.nomor, + // }, + // create: { + // nomor: i.nomor, + // username: i.name, + // masterUserRoleId: i.masterUserRoleId, + // }, + // update: { + // nomor: i.nomor, + // username: i.name, + // masterUserRoleId: i.masterUserRoleId, + // }, + // }); + // } for (let i of bidangBisnis) { await prisma.masterBidangBisnis.upsert({ @@ -328,6 +330,36 @@ export async function GET(req: Request) { }); } + for (let m of forum_kategori_report) { + await prisma.forumMaster_KategoriReport.upsert({ + where: { + id: m.id as number, + }, + create: { + title: m.title, + deskripsi: m.deskripsi, + }, + update: { + title: m.title, + deskripsi: m.deskripsi, + }, + }); + } + + for (let s of forum_status_posting) { + await prisma.forumMaster_StatusPosting.upsert({ + where: { + id: s.id, + }, + create: { + status: s.status, + }, + update: { + status: s.status, + }, + }); + } + return NextResponse.json({ success: true }); } diff --git a/src/app/dev/admin/donasi/main/loading.tsx b/src/app/dev/admin/donasi/main/loading.tsx new file mode 100644 index 00000000..96547f3a --- /dev/null +++ b/src/app/dev/admin/donasi/main/loading.tsx @@ -0,0 +1,9 @@ +import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/component/loading_admin_page"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/event/main/loading.tsx b/src/app/dev/admin/event/main/loading.tsx new file mode 100644 index 00000000..96547f3a --- /dev/null +++ b/src/app/dev/admin/event/main/loading.tsx @@ -0,0 +1,9 @@ +import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/component/loading_admin_page"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/forum/child/publish/page.tsx b/src/app/dev/admin/forum/child/publish/page.tsx new file mode 100644 index 00000000..f98121f7 --- /dev/null +++ b/src/app/dev/admin/forum/child/publish/page.tsx @@ -0,0 +1,12 @@ +import { AdminForum_TablePublish } from "@/app_modules/admin/forum"; +import { adminForum_getListPublish } from "@/app_modules/admin/forum/fun/get/get_list_publish"; + +export default async function Page() { + const listPublish = await adminForum_getListPublish(); + + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/forum/child/report-komentar/page.tsx b/src/app/dev/admin/forum/child/report-komentar/page.tsx new file mode 100644 index 00000000..cf8566da --- /dev/null +++ b/src/app/dev/admin/forum/child/report-komentar/page.tsx @@ -0,0 +1,9 @@ +import { AdminForum_TableReportKomentar } from "@/app_modules/admin/forum"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/forum/child/report-posting/page.tsx b/src/app/dev/admin/forum/child/report-posting/page.tsx new file mode 100644 index 00000000..2235353a --- /dev/null +++ b/src/app/dev/admin/forum/child/report-posting/page.tsx @@ -0,0 +1,9 @@ +import { AdminForum_TableReportPosting } from "@/app_modules/admin/forum"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/forum/children/semua-komentar/[id]/page.tsx b/src/app/dev/admin/forum/children/semua-komentar/[id]/page.tsx new file mode 100644 index 00000000..663ee0e9 --- /dev/null +++ b/src/app/dev/admin/forum/children/semua-komentar/[id]/page.tsx @@ -0,0 +1,18 @@ +import { AdminForum_LihatSemuaKomentar } from "@/app_modules/admin/forum"; +import { adminForum_getListKomentarById } from "@/app_modules/admin/forum/fun/get/get_list_komentar_by_id"; +import { adminForum_getOnePostingById } from "@/app_modules/admin/forum/fun/get/get_one_posting_by_id"; + +export default async function Page({ params }: { params: { id: string } }) { + let postingId = params.id; + const listKomentar = await adminForum_getListKomentarById(postingId); + const dataPosting = await adminForum_getOnePostingById(postingId); + + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/forum/hasil-report/komentar/[id]/page.tsx b/src/app/dev/admin/forum/hasil-report/komentar/[id]/page.tsx new file mode 100644 index 00000000..9b9dbfe8 --- /dev/null +++ b/src/app/dev/admin/forum/hasil-report/komentar/[id]/page.tsx @@ -0,0 +1,13 @@ +import { AdminForum_HasilReportKomentar } from "@/app_modules/admin/forum" +import { adminForum_getListReportKomentarbyId } from "@/app_modules/admin/forum/fun/get/get_list_report_komentar_by_id"; + +export default async function Page({params}: {params: {id: string}}) { + let komentarId = params.id + const listReport = await adminForum_getListReportKomentarbyId(komentarId) + + return ( + <> + + + ); +} \ No newline at end of file diff --git a/src/app/dev/admin/forum/hasil-report/posting/[id]/page.tsx b/src/app/dev/admin/forum/hasil-report/posting/[id]/page.tsx new file mode 100644 index 00000000..a8f5eee0 --- /dev/null +++ b/src/app/dev/admin/forum/hasil-report/posting/[id]/page.tsx @@ -0,0 +1,16 @@ +import { AdminForum_HasilReportPosting } from "@/app_modules/admin/forum"; +import { adminForum_getListReportPostingById } from "@/app_modules/admin/forum/fun/get/get_list_report_posting_by_id"; + +export default async function Page({ params }: { params: { id: string } }) { + let postingId = params.id; + const listReport = await adminForum_getListReportPostingById(postingId); + + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/forum/main/loading.tsx b/src/app/dev/admin/forum/main/loading.tsx new file mode 100644 index 00000000..96547f3a --- /dev/null +++ b/src/app/dev/admin/forum/main/loading.tsx @@ -0,0 +1,9 @@ +import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/component/loading_admin_page"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/forum/main/page.tsx b/src/app/dev/admin/forum/main/page.tsx new file mode 100644 index 00000000..9be61059 --- /dev/null +++ b/src/app/dev/admin/forum/main/page.tsx @@ -0,0 +1,23 @@ +import { AdminForum_Main } from "@/app_modules/admin/forum"; +import { adminForum_countLaporanKomentar } from "@/app_modules/admin/forum/fun/count/fun_count_laporan_komentar"; +import { adminForum_countLaporanPosting } from "@/app_modules/admin/forum/fun/count/fun_count_laporan_posting"; +import { adminForum_countPublish } from "@/app_modules/admin/forum/fun/count/fun_count_publish"; + +export default async function Page() { +// await new Promise((a, b) => { +// setTimeout(a, 4000); +// }); + const countPublish = await adminForum_countPublish(); + const countLaporanPosting = await adminForum_countLaporanPosting() + const countLaporanKomentar = await adminForum_countLaporanKomentar(); + + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/job/main/loading.tsx b/src/app/dev/admin/job/main/loading.tsx new file mode 100644 index 00000000..96547f3a --- /dev/null +++ b/src/app/dev/admin/job/main/loading.tsx @@ -0,0 +1,9 @@ +import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/component/loading_admin_page"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/main/dashboard/loading.tsx b/src/app/dev/admin/main/dashboard/loading.tsx new file mode 100644 index 00000000..96547f3a --- /dev/null +++ b/src/app/dev/admin/main/dashboard/loading.tsx @@ -0,0 +1,9 @@ +import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/component/loading_admin_page"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/admin/vote/main/loading.tsx b/src/app/dev/admin/vote/main/loading.tsx new file mode 100644 index 00000000..96547f3a --- /dev/null +++ b/src/app/dev/admin/vote/main/loading.tsx @@ -0,0 +1,9 @@ +import ComponentAdminGlobal_LoadingPage from "@/app_modules/admin/component/loading_admin_page"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/auth/login/layout.tsx b/src/app/dev/auth/login/layout.tsx new file mode 100644 index 00000000..79a8e50e --- /dev/null +++ b/src/app/dev/auth/login/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutLogin } from "@/app_modules/auth"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/auth/login/page.tsx b/src/app/dev/auth/login/page.tsx index b36236db..9ef15c54 100644 --- a/src/app/dev/auth/login/page.tsx +++ b/src/app/dev/auth/login/page.tsx @@ -3,12 +3,10 @@ import { cookies } from "next/headers"; export default function Page() { const c = cookies().getAll(); - const tkn = c; return ( <> - {/* {JSON.stringify(tkn)} */} - ; + ); } diff --git a/src/app/dev/auth/register/[id]/page.tsx b/src/app/dev/auth/register/[id]/page.tsx new file mode 100644 index 00000000..b17e670f --- /dev/null +++ b/src/app/dev/auth/register/[id]/page.tsx @@ -0,0 +1,8 @@ +import { Register } from "@/app_modules/auth"; +import { auth_getKodeOtpById } from "@/app_modules/auth/fun/get_kode_otp_by_id"; + +export default async function Page({ params }: { params: { id: string } }) { + let otpId = params.id + const dataOtp = await auth_getKodeOtpById(otpId) + return ; +} diff --git a/src/app/dev/auth/register/page.tsx b/src/app/dev/auth/register/page.tsx deleted file mode 100644 index f35d8b13..00000000 --- a/src/app/dev/auth/register/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { Register } from "@/app_modules/auth"; - -export default function Page() { - return ; -} diff --git a/src/app/dev/auth/validasi/layout.tsx b/src/app/dev/auth/validasi/[id]/layout.tsx similarity index 100% rename from src/app/dev/auth/validasi/layout.tsx rename to src/app/dev/auth/validasi/[id]/layout.tsx diff --git a/src/app/dev/auth/validasi/[id]/page.tsx b/src/app/dev/auth/validasi/[id]/page.tsx new file mode 100644 index 00000000..fbd553f8 --- /dev/null +++ b/src/app/dev/auth/validasi/[id]/page.tsx @@ -0,0 +1,9 @@ +import { Validasi } from "@/app_modules/auth"; +import { auth_getKodeOtpById } from "@/app_modules/auth/fun/get_kode_otp_by_id"; + +export default async function Page({ params }: { params: { id: string } }) { + let kodeOtpId = params.id; + const dataOtp = await auth_getKodeOtpById(kodeOtpId); + + return ; +} diff --git a/src/app/dev/auth/validasi/page.tsx b/src/app/dev/auth/validasi/page.tsx deleted file mode 100644 index 9f5a20d0..00000000 --- a/src/app/dev/auth/validasi/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { Validasi } from "@/app_modules/auth"; - - -export default function Page() { - - return ; -} diff --git a/src/app/dev/colab/create/layout.tsx b/src/app/dev/colab/create/layout.tsx new file mode 100644 index 00000000..eb26692d --- /dev/null +++ b/src/app/dev/colab/create/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutColab_Create } from "@/app_modules/colab"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/colab/create/page.tsx b/src/app/dev/colab/create/page.tsx new file mode 100644 index 00000000..6a530d6f --- /dev/null +++ b/src/app/dev/colab/create/page.tsx @@ -0,0 +1,9 @@ +import { Colab_Create } from "@/app_modules/colab"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/grup/[id]/layout.tsx b/src/app/dev/colab/detail/grup/[id]/layout.tsx new file mode 100644 index 00000000..77f28576 --- /dev/null +++ b/src/app/dev/colab/detail/grup/[id]/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutColab_DetailGrupDiskusi } from "@/app_modules/colab"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/colab/detail/grup/[id]/page.tsx b/src/app/dev/colab/detail/grup/[id]/page.tsx new file mode 100644 index 00000000..24b9c782 --- /dev/null +++ b/src/app/dev/colab/detail/grup/[id]/page.tsx @@ -0,0 +1,7 @@ +import { Colab_DetailGrupDiskusi } from "@/app_modules/colab"; + +export default async function Page() { + return<> + + +} \ No newline at end of file diff --git a/src/app/dev/colab/detail/main_detail/[id]/layout.tsx b/src/app/dev/colab/detail/main_detail/[id]/layout.tsx new file mode 100644 index 00000000..433eb587 --- /dev/null +++ b/src/app/dev/colab/detail/main_detail/[id]/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutColab_MainDetail } from "@/app_modules/colab"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/colab/detail/main_detail/[id]/loading.tsx b/src/app/dev/colab/detail/main_detail/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/colab/detail/main_detail/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/main_detail/[id]/page.tsx b/src/app/dev/colab/detail/main_detail/[id]/page.tsx new file mode 100644 index 00000000..88b5c9b4 --- /dev/null +++ b/src/app/dev/colab/detail/main_detail/[id]/page.tsx @@ -0,0 +1,13 @@ +import { Colab_MainDetail } from "@/app_modules/colab"; +import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; + +export default async function Page({ params }: { params: { id: string } }) { + let colabId = params.id + const userLoginId = await User_getUserId() + + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/proyek/partisipasi/[id]/layout.tsx b/src/app/dev/colab/detail/proyek/partisipasi/[id]/layout.tsx new file mode 100644 index 00000000..2d9fef0e --- /dev/null +++ b/src/app/dev/colab/detail/proyek/partisipasi/[id]/layout.tsx @@ -0,0 +1,9 @@ +import { LayoutColab_DetailPartisipasiProyek } from "@/app_modules/colab"; + +export default async function Layout({ children }: { children: any }) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/colab/detail/proyek/partisipasi/[id]/page.tsx b/src/app/dev/colab/detail/proyek/partisipasi/[id]/page.tsx new file mode 100644 index 00000000..323e5439 --- /dev/null +++ b/src/app/dev/colab/detail/proyek/partisipasi/[id]/page.tsx @@ -0,0 +1,9 @@ +import { Colab_DetailPartisipasiProyek } from "@/app_modules/colab"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/status/publish/[id]/layout.tsx b/src/app/dev/colab/detail/status/publish/[id]/layout.tsx new file mode 100644 index 00000000..87398d2d --- /dev/null +++ b/src/app/dev/colab/detail/status/publish/[id]/layout.tsx @@ -0,0 +1,15 @@ + +import { LayoutColab_DetailStatusPublish } from "@/app_modules/colab"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/colab/detail/status/publish/[id]/loading.tsx b/src/app/dev/colab/detail/status/publish/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/colab/detail/status/publish/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/status/publish/[id]/page.tsx b/src/app/dev/colab/detail/status/publish/[id]/page.tsx new file mode 100644 index 00000000..96e91ea3 --- /dev/null +++ b/src/app/dev/colab/detail/status/publish/[id]/page.tsx @@ -0,0 +1,9 @@ +import { Colab_DetailStatusPublish } from "@/app_modules/colab"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/status/reject/[id]/layout.tsx b/src/app/dev/colab/detail/status/reject/[id]/layout.tsx new file mode 100644 index 00000000..778d5d48 --- /dev/null +++ b/src/app/dev/colab/detail/status/reject/[id]/layout.tsx @@ -0,0 +1,16 @@ +import { LayoutColab_DetailStatusReject } from "@/app_modules/colab"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + + {children} + + + ); +} diff --git a/src/app/dev/colab/detail/status/reject/[id]/loading.tsx b/src/app/dev/colab/detail/status/reject/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/colab/detail/status/reject/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/status/reject/[id]/page.tsx b/src/app/dev/colab/detail/status/reject/[id]/page.tsx new file mode 100644 index 00000000..0962f23f --- /dev/null +++ b/src/app/dev/colab/detail/status/reject/[id]/page.tsx @@ -0,0 +1,9 @@ +import { Colab_DetailStatusReject } from "@/app_modules/colab"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/status/review/[id]/layout.tsx b/src/app/dev/colab/detail/status/review/[id]/layout.tsx new file mode 100644 index 00000000..c2972b6a --- /dev/null +++ b/src/app/dev/colab/detail/status/review/[id]/layout.tsx @@ -0,0 +1,16 @@ +import { LayoutColab_DetailStatusReview } from "@/app_modules/colab"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + + {children} + + + ); +} diff --git a/src/app/dev/colab/detail/status/review/[id]/loading.tsx b/src/app/dev/colab/detail/status/review/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/colab/detail/status/review/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/detail/status/review/[id]/page.tsx b/src/app/dev/colab/detail/status/review/[id]/page.tsx new file mode 100644 index 00000000..f6b5ea3f --- /dev/null +++ b/src/app/dev/colab/detail/status/review/[id]/page.tsx @@ -0,0 +1,9 @@ +import { Colab_DetailStatusReview } from "@/app_modules/colab"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/edit/[id]/layout.tsx b/src/app/dev/colab/edit/[id]/layout.tsx new file mode 100644 index 00000000..719b077d --- /dev/null +++ b/src/app/dev/colab/edit/[id]/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutColab_Edit } from "@/app_modules/colab"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/colab/edit/[id]/page.tsx b/src/app/dev/colab/edit/[id]/page.tsx new file mode 100644 index 00000000..2295a415 --- /dev/null +++ b/src/app/dev/colab/edit/[id]/page.tsx @@ -0,0 +1,7 @@ +import { Colab_Edit } from "@/app_modules/colab"; + +export default async function Page(){ + return<> + + +} \ No newline at end of file diff --git a/src/app/dev/colab/main/beranda/loading.tsx b/src/app/dev/colab/main/beranda/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/colab/main/beranda/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/main/beranda/page.tsx b/src/app/dev/colab/main/beranda/page.tsx new file mode 100644 index 00000000..62cde404 --- /dev/null +++ b/src/app/dev/colab/main/beranda/page.tsx @@ -0,0 +1,7 @@ +import { Colab_Beranda } from "@/app_modules/colab"; + +export default async function Page() { + return<> + + +} \ No newline at end of file diff --git a/src/app/dev/colab/main/grup/loading.tsx b/src/app/dev/colab/main/grup/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/colab/main/grup/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/main/grup/page.tsx b/src/app/dev/colab/main/grup/page.tsx new file mode 100644 index 00000000..2a719aec --- /dev/null +++ b/src/app/dev/colab/main/grup/page.tsx @@ -0,0 +1,9 @@ +import Colab_GrupDiskus from "@/app_modules/colab/main/grup"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/main/layout.tsx b/src/app/dev/colab/main/layout.tsx new file mode 100644 index 00000000..0d4bcdcc --- /dev/null +++ b/src/app/dev/colab/main/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutColab_Main } from "@/app_modules/colab"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/colab/main/proyek/loading.tsx b/src/app/dev/colab/main/proyek/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/colab/main/proyek/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/main/proyek/page.tsx b/src/app/dev/colab/main/proyek/page.tsx new file mode 100644 index 00000000..6675c0cd --- /dev/null +++ b/src/app/dev/colab/main/proyek/page.tsx @@ -0,0 +1,10 @@ +import { Colab_Proyek } from "@/app_modules/colab"; + + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/main/status/loading.tsx b/src/app/dev/colab/main/status/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/colab/main/status/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/main/status/page.tsx b/src/app/dev/colab/main/status/page.tsx new file mode 100644 index 00000000..c16629e3 --- /dev/null +++ b/src/app/dev/colab/main/status/page.tsx @@ -0,0 +1,9 @@ +import { Colab_Status } from "@/app_modules/colab"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/colab/splash/page.tsx b/src/app/dev/colab/splash/page.tsx new file mode 100644 index 00000000..3f860c4c --- /dev/null +++ b/src/app/dev/colab/splash/page.tsx @@ -0,0 +1,9 @@ +import { Colab_Splash } from "@/app_modules/colab"; + +export default function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/event/main/loading.tsx b/src/app/dev/event/main/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/event/main/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/event/splash/loading.tsx b/src/app/dev/event/splash/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/event/splash/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/event/splash/page.tsx b/src/app/dev/event/splash/page.tsx index 731f1110..8a50c2da 100644 --- a/src/app/dev/event/splash/page.tsx +++ b/src/app/dev/event/splash/page.tsx @@ -1,5 +1,8 @@ import { Event_SplashScreen } from "@/app_modules/event"; export default async function Page() { + // await new Promise((a, b) => { + // setTimeout(a, 1000); + // }); return ; } diff --git a/src/app/dev/forum/create/layout.tsx b/src/app/dev/forum/create/layout.tsx new file mode 100644 index 00000000..322d1e25 --- /dev/null +++ b/src/app/dev/forum/create/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutForum_Create } from "@/app_modules/forum"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/create/page.tsx b/src/app/dev/forum/create/page.tsx new file mode 100644 index 00000000..68e10889 --- /dev/null +++ b/src/app/dev/forum/create/page.tsx @@ -0,0 +1,9 @@ +import { Forum_Create } from "@/app_modules/forum"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/detail/[id]/layout.tsx b/src/app/dev/forum/detail/[id]/layout.tsx new file mode 100644 index 00000000..01a3eab5 --- /dev/null +++ b/src/app/dev/forum/detail/[id]/layout.tsx @@ -0,0 +1,14 @@ +import LayoutForum_Detail from "@/app_modules/forum/detail/layout"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/detail/[id]/loading.tsx b/src/app/dev/forum/detail/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/forum/detail/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/detail/[id]/page.tsx b/src/app/dev/forum/detail/[id]/page.tsx new file mode 100644 index 00000000..05d53caf --- /dev/null +++ b/src/app/dev/forum/detail/[id]/page.tsx @@ -0,0 +1,26 @@ +import Forum_Detail from "@/app_modules/forum/detail"; +import { forum_getKomentarById } from "@/app_modules/forum/fun/get/get_komentar_by_id"; +import { forum_getOnePostingById } from "@/app_modules/forum/fun/get/get_one_posting_by_id"; +import { forum_countOneTotalKomentarById } from "@/app_modules/forum/fun/count/count_one_total_komentar_by_id"; +import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; + +export default async function Page({ params }: { params: { id: string } }) { + let postingId = params.id; + + const userLoginId = await User_getUserId() + const dataPosting = await forum_getOnePostingById(postingId); + const listKomentar = await forum_getKomentarById(postingId); + const totalKomentar = await forum_countOneTotalKomentarById(postingId) + + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/edit/komentar/[id]/layout.tsx b/src/app/dev/forum/edit/komentar/[id]/layout.tsx new file mode 100644 index 00000000..e2e6984c --- /dev/null +++ b/src/app/dev/forum/edit/komentar/[id]/layout.tsx @@ -0,0 +1,14 @@ +import { LaoyoutForum_EditKomentar } from "@/app_modules/forum"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/edit/komentar/[id]/page.tsx b/src/app/dev/forum/edit/komentar/[id]/page.tsx new file mode 100644 index 00000000..d7178b96 --- /dev/null +++ b/src/app/dev/forum/edit/komentar/[id]/page.tsx @@ -0,0 +1,10 @@ +import { Forum_EditKomentar } from "@/app_modules/forum"; + +export default async function Page({ params }: { params: { id: string } }) { + let komentarId = params.id; + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/edit/posting/[id]/layout.tsx b/src/app/dev/forum/edit/posting/[id]/layout.tsx new file mode 100644 index 00000000..058935bd --- /dev/null +++ b/src/app/dev/forum/edit/posting/[id]/layout.tsx @@ -0,0 +1,15 @@ + +import { LayoutForum_EditPosting } from "@/app_modules/forum"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/edit/posting/[id]/page.tsx b/src/app/dev/forum/edit/posting/[id]/page.tsx new file mode 100644 index 00000000..292059f4 --- /dev/null +++ b/src/app/dev/forum/edit/posting/[id]/page.tsx @@ -0,0 +1,13 @@ +import { Forum_EditPosting } from "@/app_modules/forum"; +import { forum_getOnePostingById } from "@/app_modules/forum/fun/get/get_one_posting_by_id"; + +export default async function Page({ params }: { params: { id: string } }) { + let postingId = params.id; + const dataPosting = await forum_getOnePostingById(postingId) + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/forumku/[id]/layout.tsx b/src/app/dev/forum/forumku/[id]/layout.tsx new file mode 100644 index 00000000..283a5c91 --- /dev/null +++ b/src/app/dev/forum/forumku/[id]/layout.tsx @@ -0,0 +1,23 @@ +import { LayoutForum_Forumku } from "@/app_modules/forum"; +import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; +import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; +import React from "react"; + +export default async function Layout({ + children, + params, +}: { + children: React.ReactNode; + params: { id: string }; +}) { + const authorId = params.id; + const dataAuthor = await user_getOneById(authorId); + + return ( + <> + + {children} + + + ); +} diff --git a/src/app/dev/forum/forumku/[id]/loading.tsx b/src/app/dev/forum/forumku/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/forum/forumku/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/forumku/[id]/page.tsx b/src/app/dev/forum/forumku/[id]/page.tsx new file mode 100644 index 00000000..ae4bba30 --- /dev/null +++ b/src/app/dev/forum/forumku/[id]/page.tsx @@ -0,0 +1,44 @@ +import { Forum_Forumku } from "@/app_modules/forum"; +import { forum_getListPostingByAuhtorId } from "@/app_modules/forum/fun/get/get_list_posting_by_author_id"; +import { forum_countOneTotalKomentarById } from "@/app_modules/forum/fun/count/count_one_total_komentar_by_id"; +import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; +import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; +import _ from "lodash"; +import { forum_countPostingByAuthorId } from "@/app_modules/forum/fun/count/count_posting_by_author_id"; + +export default async function Page({ params }: { params: { id: string } }) { + const authorId = params.id; + const userLoginId = await User_getUserId() + const dataAuthor = await user_getOneById(authorId); + const auhtorSelectedData = _.omit(dataAuthor, [ + "Profile.email", + "Profile.alamat", + "Profile.jenisKelamin", + "Profile.createdAt", + "Profile.updatedAt", + "Profile.imagesBackgroundId", + ]); + // console.log(dataAuthor) + // console.log(auhtorSelectedData) + + // await new Promise((a, b) => { + // setTimeout(a, 1000); + // }); + + + + const dataPosting = await forum_getListPostingByAuhtorId(authorId); + const totalPosting = await forum_countPostingByAuthorId(authorId); + + return ( + <> + + + + ); +} diff --git a/src/app/dev/forum/komentar/[id]/layout.tsx b/src/app/dev/forum/komentar/[id]/layout.tsx new file mode 100644 index 00000000..3ce7ca84 --- /dev/null +++ b/src/app/dev/forum/komentar/[id]/layout.tsx @@ -0,0 +1,8 @@ +import { LayoutForum_Komentar } from "@/app_modules/forum"; +import React from "react"; + +export default async function Layout({children}: {children: React.ReactNode}) { + return<> + {children} + +} \ No newline at end of file diff --git a/src/app/dev/forum/komentar/[id]/page.tsx b/src/app/dev/forum/komentar/[id]/page.tsx new file mode 100644 index 00000000..3fa5fb26 --- /dev/null +++ b/src/app/dev/forum/komentar/[id]/page.tsx @@ -0,0 +1,18 @@ +import { Forum_Komentar } from "@/app_modules/forum"; +import { forum_getOnePostingById } from "@/app_modules/forum/fun/get/get_one_posting_by_id"; +import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; + +export default async function Page({ params }: { params: { id: string } }) { + let postingId = params.id; + const dataPosting = await forum_getOnePostingById(postingId); + const userLoginId = await User_getUserId() + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/main/layout.tsx b/src/app/dev/forum/main/layout.tsx new file mode 100644 index 00000000..4587098b --- /dev/null +++ b/src/app/dev/forum/main/layout.tsx @@ -0,0 +1,19 @@ +import { LayoutForum_Main } from "@/app_modules/forum"; +import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; +import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + const authorId = await User_getUserId(); + const dataAuthor = await user_getOneById(authorId); + + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/main/loading.tsx b/src/app/dev/forum/main/loading.tsx new file mode 100644 index 00000000..874bc4a9 --- /dev/null +++ b/src/app/dev/forum/main/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/main/page.tsx b/src/app/dev/forum/main/page.tsx new file mode 100644 index 00000000..7ae55dae --- /dev/null +++ b/src/app/dev/forum/main/page.tsx @@ -0,0 +1,17 @@ + +import { Forum_Beranda } from "@/app_modules/forum"; +import { forum_getListAllPosting } from "@/app_modules/forum/fun/get/get_list_all_posting"; +import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; + +export default async function Page() { + const listForum = await forum_getListAllPosting(); + const userLoginId = await User_getUserId(); + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/proyek/layout.tsx b/src/app/dev/forum/proyek/layout.tsx new file mode 100644 index 00000000..3a5cd8e4 --- /dev/null +++ b/src/app/dev/forum/proyek/layout.tsx @@ -0,0 +1,19 @@ +import ComponentColab_HeaderTamplate from "@/app_modules/colab/component/header_tamplate"; +import { AppShell } from "@mantine/core"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + } + > + {children} + + + ); +} diff --git a/src/app/dev/forum/proyek/page.tsx b/src/app/dev/forum/proyek/page.tsx new file mode 100644 index 00000000..5c08e75c --- /dev/null +++ b/src/app/dev/forum/proyek/page.tsx @@ -0,0 +1,9 @@ +import { Colab_PartisipasiProyek } from "@/app_modules/colab"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/report/komentar-lainnya/[id]/layout.tsx b/src/app/dev/forum/report/komentar-lainnya/[id]/layout.tsx new file mode 100644 index 00000000..c20223e0 --- /dev/null +++ b/src/app/dev/forum/report/komentar-lainnya/[id]/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutForum_ReportKomentar } from "@/app_modules/forum"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx b/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx b/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx new file mode 100644 index 00000000..1f34498e --- /dev/null +++ b/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx @@ -0,0 +1,11 @@ +import { Forum_ReportKomentarLainnya } from "@/app_modules/forum"; + +export default async function Page({ params }: { params: { id: string } }) { + let komentarId = params.id; + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/report/komentar/[id]/layout.tsx b/src/app/dev/forum/report/komentar/[id]/layout.tsx new file mode 100644 index 00000000..c20223e0 --- /dev/null +++ b/src/app/dev/forum/report/komentar/[id]/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutForum_ReportKomentar } from "@/app_modules/forum"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/report/komentar/[id]/loading.tsx b/src/app/dev/forum/report/komentar/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/forum/report/komentar/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/report/komentar/[id]/page.tsx b/src/app/dev/forum/report/komentar/[id]/page.tsx new file mode 100644 index 00000000..64e4a7b4 --- /dev/null +++ b/src/app/dev/forum/report/komentar/[id]/page.tsx @@ -0,0 +1,16 @@ +import { Forum_ReportKomentar } from "@/app_modules/forum"; +import { forum_getMasterKategoriReport } from "@/app_modules/forum/fun/master/get_master_kategori_report"; + +export default async function Page({ params }: { params: { id: string } }) { + let komentarId = params.id; + const listReport = await forum_getMasterKategoriReport(); + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/report/posting-lainnya/[id]/layout.tsx b/src/app/dev/forum/report/posting-lainnya/[id]/layout.tsx new file mode 100644 index 00000000..9b4f4591 --- /dev/null +++ b/src/app/dev/forum/report/posting-lainnya/[id]/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutForum_ReportPosting } from "@/app_modules/forum"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx b/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/report/posting-lainnya/[id]/page.tsx b/src/app/dev/forum/report/posting-lainnya/[id]/page.tsx new file mode 100644 index 00000000..0d5b8cbd --- /dev/null +++ b/src/app/dev/forum/report/posting-lainnya/[id]/page.tsx @@ -0,0 +1,11 @@ +import { Forum_ReportPostingLainnya } from "@/app_modules/forum"; + +export default async function Page({ params }: { params: { id: string } }) { + let postingIg = params.id; + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/report/posting/[id]/layout.tsx b/src/app/dev/forum/report/posting/[id]/layout.tsx new file mode 100644 index 00000000..b4cdf878 --- /dev/null +++ b/src/app/dev/forum/report/posting/[id]/layout.tsx @@ -0,0 +1,15 @@ + +import { LayoutForum_ReportPosting } from "@/app_modules/forum"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + + ); +} diff --git a/src/app/dev/forum/report/posting/[id]/loading.tsx b/src/app/dev/forum/report/posting/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/forum/report/posting/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/report/posting/[id]/page.tsx b/src/app/dev/forum/report/posting/[id]/page.tsx new file mode 100644 index 00000000..2275c4ea --- /dev/null +++ b/src/app/dev/forum/report/posting/[id]/page.tsx @@ -0,0 +1,16 @@ +import { Forum_ReportPosting } from "@/app_modules/forum"; +import { forum_getMasterKategoriReport } from "@/app_modules/forum/fun/master/get_master_kategori_report"; + +export default async function Page({ params }: { params: { id: string } }) { + let postingId = params.id; + const listReport = await forum_getMasterKategoriReport(); + + return ( + <> + + + ); +} diff --git a/src/app/dev/forum/splash/page.tsx b/src/app/dev/forum/splash/page.tsx new file mode 100644 index 00000000..db8e7cda --- /dev/null +++ b/src/app/dev/forum/splash/page.tsx @@ -0,0 +1,9 @@ +import { Forum_Splash } from "@/app_modules/forum"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/home/layout.tsx b/src/app/dev/home/layout.tsx index e2cf3dee..e43dc67f 100644 --- a/src/app/dev/home/layout.tsx +++ b/src/app/dev/home/layout.tsx @@ -1,11 +1,11 @@ import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; import { HomeLayout } from "@/app_modules/home"; -import { User_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; +import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; import { redirect } from "next/navigation"; export default async function Layout({ children }: { children: any }) { const userId = await User_getUserId(); - const dataUser = await User_getOneById(userId); + const dataUser = await user_getOneById(userId); return ( <> diff --git a/src/app/dev/home/loading.tsx b/src/app/dev/home/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/home/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/home/page.tsx b/src/app/dev/home/page.tsx index 6238bb7f..017f267d 100644 --- a/src/app/dev/home/page.tsx +++ b/src/app/dev/home/page.tsx @@ -3,11 +3,14 @@ import { cookies } from "next/headers"; import { unsealData } from "iron-session"; import _ from "lodash"; import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; -import { User_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; +import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; export default async function Page() { const userId = await User_getUserId(); - const dataUser = await User_getOneById(userId); + const dataUser = await user_getOneById(userId); + // await new Promise((a, b) => { + // setTimeout(a, 4000); + // }); return ( <> diff --git a/src/app/dev/katalog/[id]/loading.tsx b/src/app/dev/katalog/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/katalog/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/dev/katalog/[id]/page.tsx b/src/app/dev/katalog/[id]/page.tsx index bd747c29..a486bd3d 100644 --- a/src/app/dev/katalog/[id]/page.tsx +++ b/src/app/dev/katalog/[id]/page.tsx @@ -12,18 +12,28 @@ import { funGetListPortofolio } from "@/app_modules/katalog/portofolio/fun/get/g import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; import { Profile_getOneById } from "@/app_modules/katalog/profile/fun/get/get_one_profile"; import { Profile_getOneProfileAndUserById } from "@/app_modules/katalog/profile/fun/get/get_one_user_profile"; +import { user_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; const config = yaml.parse(fs.readFileSync("config.yaml").toString()); export default async function Page({ params }: { params: { id: string } }) { let profileId = params.id; - const userLoginId = await User_getUserId() + const authorId = await User_getUserId(); + const dataUser = await user_getOneById(authorId) const listPorto = await funGetListPortofolio(profileId); - const dataProfile = await Profile_getOneProfileAndUserById(profileId) + const dataProfile = await Profile_getOneProfileAndUserById(profileId); // console.log(dataProfile) + // await new Promise((a, b) => { + // setTimeout(a, 1000); + // }); + return ( <> - + ); } diff --git a/src/app/dev/profile/edit/[id]/loading.tsx b/src/app/dev/profile/edit/[id]/loading.tsx new file mode 100644 index 00000000..b1f8b62f --- /dev/null +++ b/src/app/dev/profile/edit/[id]/loading.tsx @@ -0,0 +1,9 @@ +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; + +export default async function Page() { + return ( + <> + + + ); +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 2de3b93c..619c23f5 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,8 +1,11 @@ +import MqttLoader from '@/util/mqtt_loader'; import RootStyleRegistry from './emotion'; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - {children} + + + {children} ); } diff --git a/src/app/lib/router_admin/router_admin_forum.ts b/src/app/lib/router_admin/router_admin_forum.ts new file mode 100644 index 00000000..ddefb1fd --- /dev/null +++ b/src/app/lib/router_admin/router_admin_forum.ts @@ -0,0 +1,13 @@ +export const RouterAdminForum = { + main: "/dev/admin/forum/main", + publish: "/dev/admin/forum/child/publish", + report_komentar: "/dev/admin/forum/child/report-komentar", + report_posting: "/dev/admin/forum/child/report-posting", + + //children + semua_komentar: "/dev/admin/forum/children/semua-komentar/", + + // report + hasil_report_posting: "/dev/admin/forum/hasil-report/posting/", + hasil_report_komentar: "/dev/admin/forum/hasil-report/komentar/" +}; diff --git a/src/app/lib/router_hipmi/router_auth.ts b/src/app/lib/router_hipmi/router_auth.ts new file mode 100644 index 00000000..6149df2b --- /dev/null +++ b/src/app/lib/router_hipmi/router_auth.ts @@ -0,0 +1,5 @@ +export const RouterAuth = { + login: "/dev/auth/login", + validasi: "/dev/auth/validasi/", + register: "/dev/auth/register/", +}; diff --git a/src/app/lib/router_hipmi/router_colab.ts b/src/app/lib/router_hipmi/router_colab.ts new file mode 100644 index 00000000..f68374c0 --- /dev/null +++ b/src/app/lib/router_hipmi/router_colab.ts @@ -0,0 +1,24 @@ +export const RouterColab = { + //splash + splash: "/dev/colab/splash", + + //main + beranda: "/dev/colab/main/beranda", + status: "/dev/colab/main/status", + proyek: "/dev/colab/main/proyek", + grup_diskusi: "/dev/colab/main/grup", + + // create + create: "/dev/colab/create", + edit: "/dev/colab/edit/", + + //detail + main_detail: "/dev/colab/detail/main_detail/", + status_review: "/dev/colab/detail/status/review/", + status_reject: "/dev/colab/detail/status/reject/", + status_publish: "/dev/colab/detail/status/publish/", + partisipasi_proyek: "/dev/colab/detail/proyek/partisipasi/", + detail_grup: "/dev/colab/detail/grup/", + + // proyek +}; diff --git a/src/app/lib/router_hipmi/router_forum.ts b/src/app/lib/router_hipmi/router_forum.ts new file mode 100644 index 00000000..ee955887 --- /dev/null +++ b/src/app/lib/router_hipmi/router_forum.ts @@ -0,0 +1,26 @@ +export const RouterForum = { + splash: "/dev/forum/splash", + + // main + beranda: "/dev/forum/main", + forumku: "/dev/forum/forumku/", + + // create + create: "/dev/forum/create", + + //edit + edit_posting: "/dev/forum/edit/posting/", + edit_komentar: "/dev/forum/edit/komentar/", + + //detail + main_detail: "/dev/forum/detail/", + + // komentra + komentar: "/dev/forum/komentar/", + + //report + report_posting: "/dev/forum/report/posting/", + report_komentar: "/dev/forum/report/komentar/", + report_posting_lainnya: "/dev/forum/report/posting-lainnya/", + report_komentar_lainnya: "/dev/forum/report/komentar-lainnya/", +}; diff --git a/src/app/makuro/gs_coba.ts b/src/app/makuro/gs_coba.ts new file mode 100644 index 00000000..b63754c4 --- /dev/null +++ b/src/app/makuro/gs_coba.ts @@ -0,0 +1,3 @@ +import { atomWithStorage } from "jotai/utils"; + +export const gs_coba_chat = atomWithStorage("gs_coba_chat", []); \ No newline at end of file diff --git a/src/app/makuro/page.tsx b/src/app/makuro/page.tsx index 07482089..b75f7da5 100644 --- a/src/app/makuro/page.tsx +++ b/src/app/makuro/page.tsx @@ -1,8 +1,58 @@ -import { Text } from "@mantine/core"; +"use client"; + +import { Box, Paper, SimpleGrid, Stack, Text, TextInput } from "@mantine/core"; import ViewMakuro from "./_server/makuro_view"; +import mqtt_client from "@/util/mqtt_client"; +import { useState } from "react"; +import { useAtom } from "jotai"; +import { gs_coba_chat } from "./gs_coba"; export default function Page() { - return <> - + const [data1, setData1] = useState(""); + const [data2, setData2] = useState(""); + + const [msg, setMsg] = useAtom(gs_coba_chat); + + return ( + <> + + + setData1(val.currentTarget.value)} + /> + + + + setData2(val.currentTarget.value)} + /> + + + + + + {msg} + + + {/* */} -} \ No newline at end of file + ); +} diff --git a/src/app/zCoba/page.tsx b/src/app/zCoba/page.tsx index 5778dd02..7246f4be 100644 --- a/src/app/zCoba/page.tsx +++ b/src/app/zCoba/page.tsx @@ -1,19 +1,51 @@ "use client"; -import { NotifPeringatan } from "@/app_modules/donasi/component/notifikasi/notif_peringatan"; -import { Box, Button, Group } from "@mantine/core"; -import { notifications } from "@mantine/notifications"; +import { + Box, + Center, + Group, + LoadingOverlay, + Paper, + Skeleton, + Text, +} from "@mantine/core"; + +export default function ComponentCobaCoba_LoadingPage() { + const listhHuruf = [ + { + huruf: "H", + }, + { + huruf: "I", + }, + { + huruf: "P", + }, + { + huruf: "M", + }, + { + huruf: "I", + }, + ]; + const customLOader = ( +
+ + {listhHuruf.map((e, i) => ( +
+ + + {e.huruf} + +
+ ))} +
+
+ ); -export default function Coba() { return ( <> - - - - - + ); } diff --git a/src/app_modules/admin/component/loading_admin_page.tsx b/src/app_modules/admin/component/loading_admin_page.tsx new file mode 100644 index 00000000..6febf957 --- /dev/null +++ b/src/app_modules/admin/component/loading_admin_page.tsx @@ -0,0 +1,50 @@ +"use client"; + +import { + Box, + Center, + Group, + LoadingOverlay, + Skeleton, + Text, +} from "@mantine/core"; + +export default function ComponentAdminGlobal_LoadingPage() { + const listhHuruf = [ + { + huruf: "H", + }, + { + huruf: "I", + }, + { + huruf: "P", + }, + { + huruf: "M", + }, + { + huruf: "I", + }, + ]; + const customLOader = ( +
+ + {listhHuruf.map((e, i) => ( +
+ + + {e.huruf} + +
+ ))} +
+
+ ); + + return ( + <> + + + ); +} diff --git a/src/app_modules/admin/forum/child/publish/index.tsx b/src/app_modules/admin/forum/child/publish/index.tsx new file mode 100644 index 00000000..c63b9d9d --- /dev/null +++ b/src/app_modules/admin/forum/child/publish/index.tsx @@ -0,0 +1,288 @@ +"use client"; + +import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum"; +import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; +import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate"; +import { MODEL_FORUM_POSTING } from "@/app_modules/forum/model/interface"; +import { + Badge, + Box, + Button, + Center, + Group, + Modal, + ScrollArea, + Spoiler, + Stack, + Table, + Text, + Title, +} from "@mantine/core"; +import { IconMessageCircle } from "@tabler/icons-react"; +import { IconFlag3 } from "@tabler/icons-react"; +import { IconEyeCheck, IconTrash } from "@tabler/icons-react"; +import _ from "lodash"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { adminForum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; +import { useDisclosure } from "@mantine/hooks"; + +export default function AdminForum_TablePublish({ + listPublish, +}: { + listPublish: MODEL_FORUM_POSTING[]; +}) { + return ( + <> + + + + {/*
{JSON.stringify(listPublish, null, 2)}
*/} +
+ + ); +} + +function TablePublish({ listPublish }: { listPublish: MODEL_FORUM_POSTING[] }) { + const router = useRouter(); + // const [data, setData] = useState(listPublish); + + const TableRows = listPublish?.map((e, i) => ( + + +
+ {e?.Author?.Profile?.name} +
+ + +
+ + {e?.ForumMaster_StatusPosting?.status} + +
+ + +
+ +
+ +
+ + +
+ + {new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format( + e.createdAt + )} + +
+ + +
+ + {e?.Forum_Komentar.length} + +
+ + +
+ = 3 ? "red" : "black"} + fw={"bold"} + fz={"lg"} + > + {e?.Forum_ReportPosting.length} + +
+ + + + + + + + + )); + + return ( + <> + + + + POSTING + + + + + + + + + + + + + + + + {TableRows} +
+
Author
+
+
Status
+
+
Postingan
+
+
Tanggal Publish
+
+
Komentar Aktif
+
+
Total Report Posting
+
+
Aksi
+
+
+ +
+ {_.isEmpty(TableRows) ? ( +
+ Tidak Ada Data +
+ ) : ( + "" + )} +
+
+ + ); +} + +function ButtonAction({ postingId }: { postingId: string }) { + const router = useRouter(); + const [loadingKomentar, setLoadingKomentar] = useState(false); + const [loadingReport, setLoadingReport] = useState(false); + + return ( + <> + + + + ); +} + +function ButtonDeletePosting({ postingId }: { postingId: string }) { + const [opened, { open, close }] = useDisclosure(false); + const [loadingDel, setLoadingDel] = useState(false); + const [loadingDel2, setLoadingDel2] = useState(false); + + async function onDelete() { + await adminForum_funDeletePostingById(postingId).then((res) => { + if (res.status === 200) { + setLoadingDel2(false); + setLoadingDel(false); + close(); + ComponentGlobal_NotifikasiBerhasil(res.message); + } else { + ComponentGlobal_NotifikasiGagal(res.message); + } + }); + } + return ( + <> + + + Anda yakin menghapus posting ini + + + + + + + + + ); +} diff --git a/src/app_modules/admin/forum/child/report_komentar/index.tsx b/src/app_modules/admin/forum/child/report_komentar/index.tsx new file mode 100644 index 00000000..714ec270 --- /dev/null +++ b/src/app_modules/admin/forum/child/report_komentar/index.tsx @@ -0,0 +1,11 @@ +"use client"; + +import { Stack } from "@mantine/core"; + +export default function AdminForum_TableReportKomentar() { + return ( + <> + ini rep komen + + ); +} diff --git a/src/app_modules/admin/forum/child/report_posting/index.tsx b/src/app_modules/admin/forum/child/report_posting/index.tsx new file mode 100644 index 00000000..d9a9c9f1 --- /dev/null +++ b/src/app_modules/admin/forum/child/report_posting/index.tsx @@ -0,0 +1,11 @@ +"use client"; + +import { Stack } from "@mantine/core"; + +export default function AdminForum_TableReportPosting() { + return ( + <> + ini rep pos + + ); +} diff --git a/src/app_modules/admin/forum/children/semua_komentar/index.tsx b/src/app_modules/admin/forum/children/semua_komentar/index.tsx new file mode 100644 index 00000000..7a91f6ea --- /dev/null +++ b/src/app_modules/admin/forum/children/semua_komentar/index.tsx @@ -0,0 +1,291 @@ +"use client"; + +import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum"; +import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate"; +import ComponentAdminDonasi_TombolKembali from "@/app_modules/admin/donasi/component/tombol_kembali"; +import { + MODEL_FORUM_KOMENTAR, + MODEL_FORUM_POSTING, +} from "@/app_modules/forum/model/interface"; +import { + Badge, + Box, + Button, + Center, + Grid, + Group, + Modal, + Paper, + ScrollArea, + Spoiler, + Stack, + Table, + Text, + Title, +} from "@mantine/core"; +import { IconTrash } from "@tabler/icons-react"; +import { IconFlag3 } from "@tabler/icons-react"; +import _ from "lodash"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { adminForum_funDeleteKomentarById } from "../../fun/delete/fun_delete_komentar_by_id"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; +import { useDisclosure } from "@mantine/hooks"; + +export default function AdminForum_LihatSemuaKomentar({ + listKomentar, + dataPosting, +}: { + listKomentar: MODEL_FORUM_KOMENTAR[]; + dataPosting: MODEL_FORUM_POSTING; +}) { + return ( + <> + {/*
{JSON.stringify(listKomentar, null, 2)}
*/} + + + + + + + + ); +} + +function DataPosting({ dataPosting }: { dataPosting: MODEL_FORUM_POSTING }) { + return ( + <> + + + + + POSTING + + + + + + + Author : + + + + {dataPosting?.Author?.Profile?.name} + + + + + + +
+ + + + + + + + + ); +} + +function TableKomentar({ + listKomentar, +}: { + listKomentar: MODEL_FORUM_KOMENTAR[]; +}) { + const router = useRouter(); + // const [data, setData] = useState(listKomentar); + + const TableRows = listKomentar?.map((e, i) => ( + + +
+ {e?.Author?.Profile?.name} +
+ + +
+ +
+ +
+ + +
+ + {new Intl.DateTimeFormat(["id-ID"], { dateStyle: "medium" }).format( + e.createdAt + )} + +
+ + +
+ = 3 ? "red" : "black"} + fw={"bold"} + fz={"lg"} + > + {e?.Forum_ReportKomentar.length} + +
+ + + + + + + + + + )); + + return ( + <> + + + + KOMENTAR + + + + + + + + + + + + + + {TableRows} +
+
Author
+
+
Komentar
+
+
Tanggal Komentar
+
+
Total Report Komentar
+
+
Aksi
+
+
+ +
+ {_.isEmpty(TableRows) ? ( +
+ Tidak Ada Data +
+ ) : ( + "" + )} +
+
+ + ); +} + +function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) { + const router = useRouter(); + const [opened, { open, close }] = useDisclosure(false); + const [loadindDel, setLoadingDel] = useState(false); + const [loadingDel2, setLoadingDel2] = useState(false); + + async function onDelete() { + await adminForum_funDeleteKomentarById(komentarId).then((res) => { + if (res.status === 200) { + setLoadingDel(false); + setLoadingDel2(false); + ComponentGlobal_NotifikasiBerhasil(res.message); + close(); + } else { + ComponentGlobal_NotifikasiGagal(res.message); + } + }); + } + return ( + <> + + + Anda yakin menghapus komentar ini ? + + + + + + + + + + ); +} diff --git a/src/app_modules/admin/forum/fun/count/fun_count_laporan_komentar.ts b/src/app_modules/admin/forum/fun/count/fun_count_laporan_komentar.ts new file mode 100644 index 00000000..9402b709 --- /dev/null +++ b/src/app_modules/admin/forum/fun/count/fun_count_laporan_komentar.ts @@ -0,0 +1,13 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function adminForum_countLaporanKomentar() { + const count = await prisma.forum_ReportKomentar.count({ + where: { + isActive: true, + }, + }); + + return count; +} diff --git a/src/app_modules/admin/forum/fun/count/fun_count_laporan_posting.ts b/src/app_modules/admin/forum/fun/count/fun_count_laporan_posting.ts new file mode 100644 index 00000000..fa673c48 --- /dev/null +++ b/src/app_modules/admin/forum/fun/count/fun_count_laporan_posting.ts @@ -0,0 +1,13 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function adminForum_countLaporanPosting() { + const count = await prisma.forum_ReportPosting.count({ + where: { + isActive: true, + }, + }); + + return count; +} diff --git a/src/app_modules/admin/forum/fun/count/fun_count_publish.ts b/src/app_modules/admin/forum/fun/count/fun_count_publish.ts new file mode 100644 index 00000000..c5fde5de --- /dev/null +++ b/src/app_modules/admin/forum/fun/count/fun_count_publish.ts @@ -0,0 +1,13 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function adminForum_countPublish() { + const count = await prisma.forum_Posting.count({ + where: { + isActive: true, + }, + }); + + return count; +} diff --git a/src/app_modules/admin/forum/fun/delete/fun_delete_komentar_by_id.ts b/src/app_modules/admin/forum/fun/delete/fun_delete_komentar_by_id.ts new file mode 100644 index 00000000..796be1cf --- /dev/null +++ b/src/app_modules/admin/forum/fun/delete/fun_delete_komentar_by_id.ts @@ -0,0 +1,19 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import { revalidatePath } from "next/cache"; + +export async function adminForum_funDeleteKomentarById(komentarId: string) { + const delTemporary = await prisma.forum_Komentar.update({ + where: { + id: komentarId, + }, + data: { + isActive: false, + }, + }); + + if (!delTemporary) return { status: 400, message: "Gagal Dihapus" }; + revalidatePath("/dev/admin/forum/children/semua-komentar"); + return { status: 200, message: "Berhasil Dihapus" }; +} diff --git a/src/app_modules/admin/forum/fun/delete/fun_delete_posting_by_id.ts b/src/app_modules/admin/forum/fun/delete/fun_delete_posting_by_id.ts new file mode 100644 index 00000000..33c4226d --- /dev/null +++ b/src/app_modules/admin/forum/fun/delete/fun_delete_posting_by_id.ts @@ -0,0 +1,19 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import { revalidatePath } from "next/cache"; + +export async function adminForum_funDeletePostingById(postingId: string) { + const delTemporary = await prisma.forum_Posting.update({ + where: { + id: postingId, + }, + data: { + isActive: false, + }, + }); + + if (!delTemporary) return { status: 400, message: "Gagal Dihapus" }; + revalidatePath("/dev/admin/forum/child/publish"); + return { status: 200, message: "Berhasil Dihapus" }; +} diff --git a/src/app_modules/admin/forum/fun/get/get_list_komentar_by_id.ts b/src/app_modules/admin/forum/fun/get/get_list_komentar_by_id.ts new file mode 100644 index 00000000..d2a76ad7 --- /dev/null +++ b/src/app_modules/admin/forum/fun/get/get_list_komentar_by_id.ts @@ -0,0 +1,36 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function adminForum_getListKomentarById(postingId: string) { + const data = await prisma.forum_Komentar.findMany({ + orderBy: { + createdAt: "desc", + }, + where: { + forum_PostingId: postingId, + isActive: true, + }, + select: { + id: true, + isActive: true, + komentar: true, + createdAt: true, + authorId: true, + Author: { + select: { + id: true, + Profile: { + select: { + name: true, + imagesId: true, + }, + }, + }, + }, + Forum_ReportKomentar: true + }, + }); + + return data; +} diff --git a/src/app_modules/admin/forum/fun/get/get_list_publish.tsx b/src/app_modules/admin/forum/fun/get/get_list_publish.tsx new file mode 100644 index 00000000..028019d2 --- /dev/null +++ b/src/app_modules/admin/forum/fun/get/get_list_publish.tsx @@ -0,0 +1,36 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function adminForum_getListPublish() { + const data = await prisma.forum_Posting.findMany({ + orderBy: { + createdAt: "desc", + }, + where: { + isActive: true, + }, + select: { + id: true, + diskusi: true, + isActive: true, + createdAt: true, + Author: { + select: { + id: true, + username: true, + Profile: true, + }, + }, + Forum_ReportPosting: true, + Forum_Komentar: { + where: { + isActive: true + } + }, + ForumMaster_StatusPosting: true + }, + }); + + return data; +} diff --git a/src/app_modules/admin/forum/fun/get/get_list_report_komentar_by_id.ts b/src/app_modules/admin/forum/fun/get/get_list_report_komentar_by_id.ts new file mode 100644 index 00000000..8f479e14 --- /dev/null +++ b/src/app_modules/admin/forum/fun/get/get_list_report_komentar_by_id.ts @@ -0,0 +1,30 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function adminForum_getListReportKomentarbyId(komentarId: string) { + const data = await prisma.forum_ReportKomentar.findMany({ + where: { + forum_KomentarId: komentarId, + }, + select: { + id: true, + isActive: true, + createdAt: true, + deskripsi: true, + ForumMaster_KategoriReport: true, + User: { + select: { + Profile: { + select: { + id: true, + name: true, + }, + }, + }, + }, + }, + }); + + return data; +} diff --git a/src/app_modules/admin/forum/fun/get/get_list_report_posting_by_id.ts b/src/app_modules/admin/forum/fun/get/get_list_report_posting_by_id.ts new file mode 100644 index 00000000..033515a5 --- /dev/null +++ b/src/app_modules/admin/forum/fun/get/get_list_report_posting_by_id.ts @@ -0,0 +1,34 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function adminForum_getListReportPostingById(postingId: string) { + const data = await prisma.forum_ReportPosting.findMany({ + where: { + forum_PostingId: postingId, + }, + select: { + id: true, + deskripsi: true, + createdAt: true, + User: { + select: { + Profile: { + select: { + name: true, + }, + }, + }, + }, + ForumMaster_KategoriReport: { + select: { + id: true, + title: true, + deskripsi: true, + }, + }, + }, + }); + + return data; +} diff --git a/src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts b/src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts new file mode 100644 index 00000000..234f9f21 --- /dev/null +++ b/src/app_modules/admin/forum/fun/get/get_one_posting_by_id.ts @@ -0,0 +1,28 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function adminForum_getOnePostingById(postingId: string) { + const data = await prisma.forum_Posting.findFirst({ + where: { + id: postingId, + }, + select: { + id: true, + diskusi: true, + Author: { + select: { + Profile: { + select: { + name: true + }, + }, + }, + }, + }, + }); + +// console.log(data); + + return data; +} diff --git a/src/app_modules/admin/forum/hasil_report/komentar/index.tsx b/src/app_modules/admin/forum/hasil_report/komentar/index.tsx new file mode 100644 index 00000000..f30cb47f --- /dev/null +++ b/src/app_modules/admin/forum/hasil_report/komentar/index.tsx @@ -0,0 +1,219 @@ +"use client"; + +import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum"; +import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate"; +import ComponentAdminDonasi_TombolKembali from "@/app_modules/admin/donasi/component/tombol_kembali"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; +import { + MODEL_FORUM_MASTER_REPORT, + MODEL_FORUM_REPORT, +} from "@/app_modules/forum/model/interface"; +import { + Badge, + Box, + Button, + Center, + Group, + Modal, + ScrollArea, + Spoiler, + Stack, + Table, + Text, + Title, +} from "@mantine/core"; +import { IconMessageCircle, IconFlag3, IconTrash } from "@tabler/icons-react"; +import _ from "lodash"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { adminForum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id"; +import { adminForum_funDeleteKomentarById } from "../../fun/delete/fun_delete_komentar_by_id"; +import { useDisclosure } from "@mantine/hooks"; + +export default function AdminForum_HasilReportKomentar({ + komentarId, + listReport, +}: { + komentarId: string; + listReport: any[]; +}) { + return ( + <> + + + + + + + + {/*
{JSON.stringify(listReport, null, 2)}
*/} +
+ + ); +} + +function ButtonDeleteKomentar({ komentarId }: { komentarId: string }) { + const router = useRouter(); + const [opened, { open, close }] = useDisclosure(false); + const [loadindDel, setLoadingDel] = useState(false); + const [loadingDel2, setLoadingDel2] = useState(false); + + async function onDelete() { + await adminForum_funDeleteKomentarById(komentarId).then((res) => { + if (res.status === 200) { + setLoadingDel(false); + setLoadingDel2(false); + close(); + router.back(); + ComponentGlobal_NotifikasiBerhasil(res.message); + } else { + ComponentGlobal_NotifikasiGagal(res.message); + } + }); + } + return ( + <> + + + Anda yakin menghapus komentar ini ? + + + + + + + + + + ); +} + +function HasilReportPosting({ + listReport, +}: { + listReport: MODEL_FORUM_REPORT[]; +}) { + const router = useRouter(); + const [data, setData] = useState(listReport); + + const TableRows = data?.map((e, i) => ( + + +
+ {e?.User?.Profile?.name} +
+ + +
+ + {e?.ForumMaster_KategoriReport?.title + ? e?.ForumMaster_KategoriReport?.title + : "-"} + +
+ + + +
+ + {e?.ForumMaster_KategoriReport?.deskripsi ? ( + {e?.ForumMaster_KategoriReport?.deskripsi} + ) : ( + - + )} + +
+ + + +
+ + {e?.deskripsi ? {e?.deskripsi} : -} + +
+ + + )); + + return ( + <> + + + + REPORT KOMENTAR + + + + + + + + + + + + + {TableRows} +
+
Author
+
+
Title
+
+
Deskripsi
+
+
Deskripsi Lainnya
+
+
+ +
+ {_.isEmpty(TableRows) ? ( +
+ Tidak Ada Data +
+ ) : ( + "" + )} +
+
+ + ); +} diff --git a/src/app_modules/admin/forum/hasil_report/posting/index.tsx b/src/app_modules/admin/forum/hasil_report/posting/index.tsx new file mode 100644 index 00000000..c89610c8 --- /dev/null +++ b/src/app_modules/admin/forum/hasil_report/posting/index.tsx @@ -0,0 +1,222 @@ +"use client"; + +import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum"; +import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate"; +import ComponentAdminDonasi_TombolKembali from "@/app_modules/admin/donasi/component/tombol_kembali"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; +import { + MODEL_FORUM_MASTER_REPORT, + MODEL_FORUM_REPORT, +} from "@/app_modules/forum/model/interface"; +import { + Badge, + Box, + Button, + Center, + Group, + Modal, + ScrollArea, + Spoiler, + Stack, + Table, + Text, + Title, +} from "@mantine/core"; +import { IconMessageCircle, IconFlag3, IconTrash } from "@tabler/icons-react"; +import _ from "lodash"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { adminForum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id"; +import { useDisclosure } from "@mantine/hooks"; + +export default function AdminForum_HasilReportPosting({ + postingId, + listReport, +}: { + postingId: string; + listReport: any[]; +}) { + return ( + <> + + + + + + + + {/*
{JSON.stringify(listReport, null, 2)}
*/} +
+ + ); +} + +function ButtonDeletePosting({ postingId }: { postingId: string }) { + const router = useRouter(); + const [opened, { open, close }] = useDisclosure(false); + const [loadingDel, setLoadingDel] = useState(false); + const [loadingDel2, setLoadingDel2] = useState(false); + + async function onDelete() { + await adminForum_funDeletePostingById(postingId).then((res) => { + if (res.status === 200) { + setLoadingDel2(false); + setLoadingDel(false); + close(); + router.back(); + ComponentGlobal_NotifikasiBerhasil(res.message); + } else { + ComponentGlobal_NotifikasiGagal(res.message); + } + }); + } + return ( + <> + + + Anda yakin menghapus posting ini + + + + + + + + + ); +} + +function HasilReportPosting({ + listReport, +}: { + listReport: MODEL_FORUM_REPORT[]; +}) { + const router = useRouter(); + const [data, setData] = useState(listReport); + + const TableRows = data?.map((e, i) => ( + + +
+ {e?.User?.Profile?.name} +
+ + +
+ + {e?.ForumMaster_KategoriReport?.title + ? e?.ForumMaster_KategoriReport?.title + : "-"} + +
+ + + +
+ + {e?.ForumMaster_KategoriReport?.deskripsi ? ( + {e?.ForumMaster_KategoriReport?.deskripsi} + ) : ( + - + )} + +
+ + + +
+ + {e?.deskripsi ? {e?.deskripsi} : -} + +
+ + + )); + + return ( + <> + + + + REPORT POSTING + + + + + + + + + + + + + {TableRows} +
+
Author
+
+
Title
+
+
Deskripsi
+
+
Deskripsi Lainnya
+
+
+ +
+ {_.isEmpty(TableRows) ? ( +
+ Tidak Ada Data +
+ ) : ( + "" + )} +
+
+ + ); +} diff --git a/src/app_modules/admin/forum/index.tsx b/src/app_modules/admin/forum/index.tsx new file mode 100644 index 00000000..595b747a --- /dev/null +++ b/src/app_modules/admin/forum/index.tsx @@ -0,0 +1,17 @@ +import AdminForum_Main from "./main"; +import AdminForum_TablePublish from "./child/publish"; +import AdminForum_TableReportKomentar from "./child/report_komentar"; +import AdminForum_TableReportPosting from "./child/report_posting"; +import AdminForum_LihatSemuaKomentar from "./children/semua_komentar"; +import AdminForum_HasilReportPosting from "./hasil_report/posting"; +import AdminForum_HasilReportKomentar from "./hasil_report/komentar"; + +export { + AdminForum_Main, + AdminForum_TablePublish, + AdminForum_TableReportKomentar, + AdminForum_TableReportPosting, + AdminForum_LihatSemuaKomentar, + AdminForum_HasilReportPosting, + AdminForum_HasilReportKomentar, +}; diff --git a/src/app_modules/admin/forum/main/index.tsx b/src/app_modules/admin/forum/main/index.tsx new file mode 100644 index 00000000..9ab092f7 --- /dev/null +++ b/src/app_modules/admin/forum/main/index.tsx @@ -0,0 +1,91 @@ +"use client"; + +import { Group, Paper, SimpleGrid, Stack, Text, Title } from "@mantine/core"; +import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate"; +import ComponentAdminGlobal_LoadingPage from "../../component/loading_admin_page"; + +export default function AdminForum_Main({ + countPublish, + countLaporanPosting, + countLaporanKomentar, +}: { + countPublish: number; + countLaporanPosting: number; + countLaporanKomentar: number; +}) { + return ( + <> + + + + + {/* */} + + ); +} + +function ForumMain({ + countPublish, + countLaporanPosting, + countLaporanKomentar, +}: { + countPublish: number; + countLaporanPosting: number; + countLaporanKomentar: number; +}) { + const listBox = [ + { + id: 1, + name: "Publish", + jumlah: countPublish, + color: "green", + }, + { + id: 2, + name: "Laporan Posting", + jumlah: countLaporanPosting, + color: "orange", + }, + { + id: 3, + name: "Laporan Komentar", + jumlah: countLaporanKomentar, + color: "red", + }, + ]; + return ( + <> + + {listBox.map((e, i) => ( + + + + {e.name} + {e.jumlah ? e.jumlah : 0} + + + + ))} + + + ); +} diff --git a/src/app_modules/admin/global_state/index.ts b/src/app_modules/admin/global_state/index.ts index 32e642b8..689ebfa2 100644 --- a/src/app_modules/admin/global_state/index.ts +++ b/src/app_modules/admin/global_state/index.ts @@ -5,6 +5,6 @@ import { atomWithStorage } from "jotai/utils"; * @type number * @ */ -export const gs_admin_hotMenu = atomWithStorage("gs_admin_hotMenu", 0) +export const gs_admin_hotMenu = atomWithStorage("gs_admin_hotMenu", 1) export const gs_admin_subMenu = atomWithStorage("gs_admin_subMenu",null) \ No newline at end of file diff --git a/src/app_modules/admin/layout.tsx b/src/app_modules/admin/layout.tsx index cda67e17..ab809327 100644 --- a/src/app_modules/admin/layout.tsx +++ b/src/app_modules/admin/layout.tsx @@ -11,6 +11,7 @@ import { Footer, Group, Header, + Loader, MediaQuery, NavLink, Navbar, @@ -22,7 +23,13 @@ import { import React, { useState } from "react"; import ComponentGlobal_HeaderTamplate from "../component_global/header_tamplate"; import { useDisclosure } from "@mantine/hooks"; -import { IconCircleDot, IconCircleDotFilled, IconHome, IconLetterH, IconLogout } from "@tabler/icons-react"; +import { + IconCircleDot, + IconCircleDotFilled, + IconHome, + IconLetterH, + IconLogout, +} from "@tabler/icons-react"; import { RouterAdminAward, RouterAdminDashboard, @@ -51,8 +58,7 @@ export default function AdminLayout({ const router = useRouter(); const [active, setActive] = useAtom(gs_admin_hotMenu); const [activeChild, setActiveChild] = useAtom(gs_admin_subMenu); - - + const [loading, setLoading] = useState(false); const navbarItems = listAdminPage.map((e, i) => ( @@ -63,9 +69,13 @@ export default function AdminLayout({ }, }} fw={active === e.id ? "bold" : "normal"} - icon={e.icon} + icon={ + // active === e.id ? loading ? : e.icon : e.icon + e.icon + } label={{e.name}} onClick={() => { + setLoading(true); setActive(e.id); setActiveChild(null); e.path === "" ? router.push(e.child[0].path) : router.push(e.path); @@ -86,7 +96,13 @@ export default function AdminLayout({ }} fw={activeChild === v.id ? "bold" : "normal"} label={{v.name}} - icon={activeChild === v.id ? : } + icon={ + activeChild === v.id ? ( + + ) : ( + + ) + } onClick={() => { setActive(e.id); setActiveChild(v.id); @@ -107,7 +123,6 @@ export default function AdminLayout({ padding="md" navbarOffsetBreakpoint="md" asideOffsetBreakpoint="sm" - navbar={ , + child: [ + { + id: 71, + name: "Dashboard", + path: RouterAdminForum.main, + }, + { + id: 72, + name: "Table Posting", + path: RouterAdminForum.publish, + }, + // { + // id: 73, + // name: "Laporan Posting", + // path: RouterAdminForum.report_posting, + // }, + // { + // id: 74, + // name: "Laporan Komentar", + // path: RouterAdminForum.report_komentar, + // }, + ], + }, ]; diff --git a/src/app_modules/auth/fun/fun_edit_aktivasi_kode_otp_by_id.ts b/src/app_modules/auth/fun/fun_edit_aktivasi_kode_otp_by_id.ts new file mode 100644 index 00000000..5a533f04 --- /dev/null +++ b/src/app_modules/auth/fun/fun_edit_aktivasi_kode_otp_by_id.ts @@ -0,0 +1,18 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function auth_funEditAktivasiKodeOtpById(otpId: string) { + console.log(otpId); + const updt = await prisma.kodeOtp.update({ + where: { + id: otpId, + }, + data: { + isActive: false, + }, + }); + + if (!updt) return { status: 400, message: "Gagal Update Aktivasi Kode OTP" }; + return { status: 200, message: "Berhasil Update Aktivasi Kode OTP" }; +} diff --git a/src/app_modules/auth/fun/fun_login.ts b/src/app_modules/auth/fun/fun_login.ts new file mode 100644 index 00000000..ae9d2526 --- /dev/null +++ b/src/app_modules/auth/fun/fun_login.ts @@ -0,0 +1,35 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import { randomOTP } from "./rondom_otp"; + +export async function auth_funLogin(nomor: string) { + const codeOtp = randomOTP(); + + try { + const res = await fetch( + `https://wa.wibudev.com/code?nom=${nomor}&text=Masukan Kode OTP:${codeOtp}` + ); + + const sendWa = await res.json(); + if (sendWa.status !== "success") + return { status: 400, message: "WA Tidak Terdaftar" }; + + const createOtpId = await prisma.kodeOtp.create({ + data: { + nomor: nomor, + otp: codeOtp, + }, + }); + + if (!createOtpId) return { status: 400, message: "Gagal Membuat Kode OTP" }; + + return { + status: 200, + message: "Kode Verifikasi Dikirim", + kodeOtpId: createOtpId.id, + }; + } catch (error) { + return { status: 500, message: "Server Error !!!" }; + } +} diff --git a/src/app_modules/auth/fun/fun_logout.ts b/src/app_modules/auth/fun/fun_logout.ts new file mode 100644 index 00000000..6312472b --- /dev/null +++ b/src/app_modules/auth/fun/fun_logout.ts @@ -0,0 +1,26 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import { revalidatePath } from "next/cache"; +import { cookies } from "next/headers"; + +export async function auth_Logout(kodeId: string) { + cookies().set({ + name: "ssn", + value: "", + maxAge: 0, + }); + + const c = cookies().get("ssn"); + if (c?.value !== "") return { status: 400, message: "Gagal Logout" }; + + const del = await prisma.kodeOtp.delete({ + where: { + id: kodeId, + }, + }); + + if (!del) return { status: 400, message: "Gagal Hapus Kode OTP Id"}; + revalidatePath("/dev/katalog") + return { status: 200, message: "Logout Berhasil" }; +} diff --git a/src/app_modules/auth/fun/fun_register.ts b/src/app_modules/auth/fun/fun_register.ts new file mode 100644 index 00000000..5d7df13b --- /dev/null +++ b/src/app_modules/auth/fun/fun_register.ts @@ -0,0 +1,49 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import { sealData } from "iron-session"; +import { cookies } from "next/headers"; + +import fs from "fs"; +import yaml from "yaml"; +const config = yaml.parse(fs.readFileSync("config.yaml").toString()); + +export async function Auth_funRegister(data: any) { + const cekUsername = await prisma.user.findUnique({ + where: { + username: data.username, + }, + }); + + if (cekUsername != null) + return { + status: 400, + message: "Username sudah terdaftar", + }; + + const create = await prisma.user.create({ + data: { + username: data.username, + nomor: data.nomor, + }, + }); + if (!create) return { status: 400, message: "Gagal Mendaftar" }; + + const seal = await sealData( + JSON.stringify({ + id: create.id, + username: create.username, + }), + { + password: await config.server.password, + } + ); + + cookies().set({ + name: "ssn", + value: seal, + maxAge: 60 * 60 * 24 * 7, + }); + + return { status: 200, message: "Berhasil Mendaftar" }; +} diff --git a/src/app_modules/auth/fun/fun_validasi.ts b/src/app_modules/auth/fun/fun_validasi.ts new file mode 100644 index 00000000..3a4c5bd6 --- /dev/null +++ b/src/app_modules/auth/fun/fun_validasi.ts @@ -0,0 +1,46 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; +import { sealData } from "iron-session"; +import fs from "fs"; +import yaml from "yaml"; +import { cookies } from "next/headers"; +import { revalidatePath } from "next/cache"; +import { RouterHome } from "@/app/lib/router_hipmi/router_home"; +const config = yaml.parse(fs.readFileSync("config.yaml").toString()); + +export async function auth_funValidasi(nomor: string) { + const cek = await prisma.user.findUnique({ + where: { + nomor: nomor, + }, + select: { + id: true, + nomor: true, + username: true, + }, + }); + + if (cek === null) return { status: 400, message: "Nomor Belum Terdaftar" }; + if (cek) { + const res = await sealData( + JSON.stringify({ + id: cek.id, + username: cek.username, + }), + { + password: await config.server.password, + } + ); + + cookies().set({ + name: "ssn", + value: res, + maxAge: 60 * 60 * 24 * 7, + }); + + revalidatePath(RouterHome.main_home); + } + + return { status: 200, message: "Nomor Terverivikasi" }; +} diff --git a/src/app_modules/auth/fun/get_kode_otp_by_id.ts b/src/app_modules/auth/fun/get_kode_otp_by_id.ts new file mode 100644 index 00000000..8b0849ae --- /dev/null +++ b/src/app_modules/auth/fun/get_kode_otp_by_id.ts @@ -0,0 +1,13 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function auth_getKodeOtpById(otpId: string) { + const data = await prisma.kodeOtp.findFirst({ + where: { + id: otpId, + }, + }); + + return data +} diff --git a/src/app/fun/rondom_otp.ts b/src/app_modules/auth/fun/rondom_otp.ts similarity index 100% rename from src/app/fun/rondom_otp.ts rename to src/app_modules/auth/fun/rondom_otp.ts diff --git a/src/app_modules/auth/index.ts b/src/app_modules/auth/index.ts index ccb5b9fb..04c1a5f0 100644 --- a/src/app_modules/auth/index.ts +++ b/src/app_modules/auth/index.ts @@ -4,5 +4,14 @@ import Validasi from "./validasi/view"; import LayoutValidasi from "./validasi/layout"; import Register from "./register/view"; import User_Logout from "./logout/view"; +import LayoutLogin from "./login/layout"; -export { SplashScreen, Login, Validasi, Register, User_Logout as Logout, LayoutValidasi }; +export { + SplashScreen, + Login, + Validasi, + Register, + User_Logout as Logout, + LayoutValidasi, + LayoutLogin, +}; diff --git a/src/app_modules/auth/login/layout.tsx b/src/app_modules/auth/login/layout.tsx new file mode 100644 index 00000000..2bc4c164 --- /dev/null +++ b/src/app_modules/auth/login/layout.tsx @@ -0,0 +1,43 @@ +"use client"; + +import { + AppShell, + Center, + Footer, + Header, + Image, + Paper, + Text, +} from "@mantine/core"; +import React from "react"; + +export default function LayoutLogin({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + + // + //
+ // logo + //
+ //
+ // + // } + + > + {children} +
+ + ); +} diff --git a/src/app_modules/auth/login/view.tsx b/src/app_modules/auth/login/view.tsx index 77be0cff..11af4f84 100644 --- a/src/app_modules/auth/login/view.tsx +++ b/src/app_modules/auth/login/view.tsx @@ -1,101 +1,144 @@ "use client"; -import { myConsole } from "@/app/fun/my_console"; -import { randomOTP } from "@/app/fun/rondom_otp"; -import { ApiHipmi } from "@/app/lib/api"; -import { Warna } from "@/app/lib/warna"; -import { Button, Center, Flex, Stack, TextInput, Title } from "@mantine/core"; -import { getHotkeyHandler, useFocusTrap, useHotkeys } from "@mantine/hooks"; +import { + Box, + Button, + Center, + Flex, + Grid, + Group, + Image, + Stack, + Text, + TextInput, + Title, +} from "@mantine/core"; +import { useFocusTrap } from "@mantine/hooks"; import { useRouter } from "next/navigation"; import { useState } from "react"; -import toast from "react-simple-toasts"; import { useAtom } from "jotai"; -import { gs_otp, gs_nomor } from "../state/state"; -import { IconCircleLetterH } from "@tabler/icons-react"; -import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin"; -import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_berhasil"; -import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal"; +import { gs_kodeId } from "../state/state"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { auth_funLogin } from "@/app_modules/auth/fun/fun_login"; +import { RouterAuth } from "@/app/lib/router_hipmi/router_auth"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { PhoneInput } from "react-international-phone"; +import "react-international-phone/style.css"; export default function Login() { const router = useRouter(); - const [nomor, setNomor] = useState(""); - const [inputNumber, setInputNumber] = useAtom(gs_nomor); - const [code, setCode] = useAtom(gs_otp); + const [kodeId, setKodeId] = useAtom(gs_kodeId); const focusTrapRef = useFocusTrap(); + const [phone, setPhone] = useState(""); + const [loading, setLoading] = useState(false); - const onLogin = async () => { - const body = { - nomor: nomor, - otp: randomOTP(), - }; + async function onLogin() { + // if (nomor.length < 10) + // return ComponentGlobal_NotifikasiPeringatan("Nomor minimal 10 digit"); + // if (nomor.length > 13) + // return ComponentGlobal_NotifikasiPeringatan("Nomor maximal 13 digit"); - if (body.nomor.length < 10) return toast("Nomor minimal 10 digit"); - if (body.nomor.length > 13) return toast("Nomor maximal 13 digit"); + const nomorHp = phone.substring(1); - await fetch(ApiHipmi.login, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - }) - .then((res) => res.json()) - .then((val) => { - // console.log(val); - if (val.success === true) { - router.push(RouterAdminDashboard.splash_admin); - } else { - if (val.status == 200) { - setCode(val.body.otp); - setInputNumber(val.body.nomor); - router.push("/dev/auth/validasi"); - return NotifBerhasil("Nomor OTP terkirim"); - } else { - NotifGagal(val.message); - } - } - }); - }; + await auth_funLogin(nomorHp).then((res) => { + if (res.status === 200) { + ComponentGlobal_NotifikasiBerhasil(res.message, 2000); + setKodeId(res.kodeOtpId); + router.push(RouterAuth.validasi + res.kodeOtpId); + } else { + ComponentGlobal_NotifikasiPeringatan(res.message); + } + }); + + // await fetch(ApiHipmi.login, { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify(body), + // }) + // .then((res) => res.json()) + // .then((val) => { + // // console.log(val); + // if (val.success === true) { + // router.push(RouterAdminDashboard.splash_admin); + // } else { + // if (val.status == 200) { + // setCode(val.body.otp); + // setInputNumber(val.body.nomor); + // router.push("/dev/auth/validasi"); + // return NotifBerhasil("Nomor OTP terkirim"); + // } else { + // NotifGagal(val.message); + // } + // } + // }); + } return ( <> - - - Login +
+ +
+ logo +
+ + Selamat Datang di HIPMI App + + Silahkan masukan nomor telepon anda untuk masuk ! + + - { - setNomor(val.target.value); - }} - /> + {/* + +
+ +62 +
+
+ + { + setNomor(62 + val.target.value); + }} + /> + +
*/} - - + { + setPhone(val); + }} + /> + + +
+
); } diff --git a/src/app_modules/auth/logout/view.tsx b/src/app_modules/auth/logout/view.tsx index 58ffe935..51524892 100644 --- a/src/app_modules/auth/logout/view.tsx +++ b/src/app_modules/auth/logout/view.tsx @@ -1,35 +1,38 @@ "use client"; -import { myConsole } from "@/app/fun/my_console"; -import { ApiHipmi } from "@/app/lib/api"; + import { ActionIcon, Button, Group, Modal, Stack, Title } from "@mantine/core"; import { useRouter } from "next/navigation"; import { useAtom } from "jotai"; -import { gs_nomor, gs_otp } from "../state/state"; +import { gs_kodeId, gs_nomor, gs_otp } from "../state/state"; import { IconLogout } from "@tabler/icons-react"; import { Warna } from "@/app/lib/warna"; import { useDisclosure } from "@mantine/hooks"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { auth_Logout } from "../fun/fun_logout"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { RouterAuth } from "@/app/lib/router_hipmi/router_auth"; +import { useState } from "react"; export default function User_Logout() { const router = useRouter(); - const [nomor, setnomor] = useAtom(gs_nomor); - const [code, setCode] = useAtom(gs_otp); - const [opened, { toggle }] = useDisclosure(false); + const [kodeId, setKodeId] = useAtom(gs_kodeId); + const [loading, setLoading] = useState(false); + const [loading2, setLoading2] = useState(false); - const onLogout = async () => { - await fetch(ApiHipmi.logout) - .then((res) => res.json()) - .then((val) => { - if (val.status == 200) { - setnomor(null); - setCode(null); - - ComponentGlobal_NotifikasiBerhasil("Anda Berhasil Logout") - return router.push("/dev/auth/login"); - } - }); - }; + async function onClickLogout() { + // await auth_Logout(kodeId).then((res) => { + // ComponentGlobal_NotifikasiBerhasil("Berhasil Logout"); + // }); + await auth_Logout(kodeId).then((res) => { + if (res.status === 200) { + ComponentGlobal_NotifikasiBerhasil(res.message); + setKodeId(""); + } else { + ComponentGlobal_NotifikasiPeringatan(res.message); + } + }); + } return ( <> @@ -37,15 +40,25 @@ export default function User_Logout() { Anda yakin ingin keluar ? - @@ -55,7 +68,16 @@ export default function User_Logout() { {/* */} - diff --git a/src/app_modules/auth/register/view.tsx b/src/app_modules/auth/register/view.tsx index 9fa289ca..3c3b288f 100644 --- a/src/app_modules/auth/register/view.tsx +++ b/src/app_modules/auth/register/view.tsx @@ -1,8 +1,17 @@ "use client"; import { Warna } from "@/app/lib/warna"; -import { Flex, Title, TextInput, Button, Text } from "@mantine/core"; -import { IconCircleLetterH } from "@tabler/icons-react"; +import { + Flex, + Title, + TextInput, + Button, + Text, + Center, + PinInput, + Stack, +} from "@mantine/core"; +import { IconCircleLetterH, IconCloudLockOpen } from "@tabler/icons-react"; import { gs_nomor } from "../state/state"; import { useAtom } from "jotai"; import { useState } from "react"; @@ -12,46 +21,80 @@ import { ApiHipmi } from "@/app/lib/api"; import { useRouter } from "next/navigation"; import _ from "lodash"; import { useFocusTrap } from "@mantine/hooks"; +import { Auth_funRegister } from "../fun/fun_register"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { IconPencilCheck } from "@tabler/icons-react"; +import { RouterHome } from "@/app/lib/router_hipmi/router_home"; +import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id"; -export default function Register() { - const route = useRouter(); - const [nomor, setNomor] = useAtom(gs_nomor); +export default function Register({ dataOtp }: { dataOtp: any }) { + const router = useRouter(); + const [nomor, setNomor] = useState(dataOtp.nomor); const [value, setValue] = useState(""); const focusTrapRef = useFocusTrap(); + const [loading, setLoading] = useState(false); - const onRegister = async () => { - myConsole(value); + // const onRegister = async () => { + // myConsole(value); + // const body = { + // username: _.lowerCase(value), + // nomor: nomor, + // }; + + // if (!body) return toast("Lengkapi username"); + // if (body.username.length < 5) return toast("Username minimal 5 karakter"); + + // await fetch(ApiHipmi.register, { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify(body), + // }) + // .then((res) => res.json()) + // .then((val) => { + // myConsole(val); + // if (val.status == 201) { + // toast("Pendaftaran Berhasil"); + // return route.push("/dev/home"); + // } else { + // return toast(val.message); + // } + // }); + // }; + + async function onRegistarsi() { const body = { username: _.lowerCase(value), nomor: nomor, }; - if (!body) return toast("Lengkapi username"); - if (body.username.length < 5) return toast("Username minimal 5 karakter"); + if (_.values(body.username).includes("")) + return ComponentGlobal_NotifikasiPeringatan("Lengkapi Username"); + if (body.username.length < 5) + return ComponentGlobal_NotifikasiPeringatan("Username minimal 5 krakter"); - await fetch(ApiHipmi.register, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - }) - .then((res) => res.json()) - .then((val) => { - myConsole(val); - if (val.status == 201) { - toast("Pendaftaran Berhasil"); - return route.push("/dev/home"); - } else { - return toast(val.message); - } - }); - }; + await Auth_funRegister(body).then(async (res) => { + if (res.status === 200) { + await auth_funEditAktivasiKodeOtpById(dataOtp.id).then((val) => { + if (val.status === 200) { + ComponentGlobal_NotifikasiBerhasil(res.message); + router.push(RouterHome.main_home); + } else { + ComponentGlobal_NotifikasiPeringatan(val.message); + } + }); + } else { + ComponentGlobal_NotifikasiPeringatan(res.message); + } + }); + } return ( <> - - +
*/} + + {/*
{JSON.stringify(dataOtp,null,2)}
*/} + +
+ +
+ +
+ + + + REGISTRASI + Masukan username anda ! + + + { + setValue(val.currentTarget.value); + }} + /> + + Anda akan terdaftar dengan nomor berikut{" "} + + +{nomor} + + + + + + + + +
+
); } diff --git a/src/app_modules/auth/state/state.ts b/src/app_modules/auth/state/state.ts index 04c96225..1ce89583 100644 --- a/src/app_modules/auth/state/state.ts +++ b/src/app_modules/auth/state/state.ts @@ -1,4 +1,6 @@ import { atomWithStorage } from 'jotai/utils' export const gs_nomor = atomWithStorage("nomorHp", null) -export const gs_otp = atomWithStorage("code_otp", null) \ No newline at end of file +export const gs_otp = atomWithStorage("code_otp", null) + +export const gs_kodeId = atomWithStorage("gs_kodeId", ""); \ No newline at end of file diff --git a/src/app_modules/auth/validasi/view.tsx b/src/app_modules/auth/validasi/view.tsx index aa7e8284..439335a8 100644 --- a/src/app_modules/auth/validasi/view.tsx +++ b/src/app_modules/auth/validasi/view.tsx @@ -15,7 +15,11 @@ import { gs_nomor, gs_otp } from "../state/state"; import { Warna } from "@/app/lib/warna"; import { useState } from "react"; import { myConsole } from "@/app/fun/my_console"; -import { IconChevronLeft, IconCircleLetterH } from "@tabler/icons-react"; +import { + IconChevronLeft, + IconCircleLetterH, + IconCloudLockOpen, +} from "@tabler/icons-react"; import toast from "react-simple-toasts"; import { ApiHipmi } from "@/app/lib/api"; import { useRouter } from "next/navigation"; @@ -24,14 +28,21 @@ import { useFocusTrap } from "@mantine/hooks"; import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_berhasil"; import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal"; import { NotifPeringatan } from "@/app_modules/donasi/component/notifikasi/notif_peringatan"; +import Countdown from "react-countdown"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { auth_funValidasi } from "../fun/fun_validasi"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { RouterAuth } from "@/app/lib/router_hipmi/router_auth"; +import { RouterHome } from "@/app/lib/router_hipmi/router_home"; +import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id"; -export default function Validasi() { +export default function Validasi({ dataOtp }: { dataOtp: any }) { const router = useRouter(); - const [nomor, setnomor] = useAtom(gs_nomor); - const [code, setCode] = useAtom(gs_otp); - + const [nomor, setnomor] = useState(dataOtp.nomor); + const [code, setCode] = useState(dataOtp.otp); const [inputCode, setInputOtp] = useState(""); const focusTrapRef = useFocusTrap(); + const [loading, setLoading] = useState(false); const onValid = async () => { // MyConsole(inputCode) @@ -43,34 +54,53 @@ export default function Validasi() { if (!inputCode) return toast("Lengkapi Kode"); if (body.otp != inputCode) return toast("Kode Salah"); - await fetch(ApiHipmi.validasi, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - }) - .then((res) => res.json()) - .then((val) => { - myConsole(val); - if (val.status == 200) { - setTimeout(() => router.push("/dev/home"), 2000); - funGetUserProfile(val.data.id); - NotifBerhasil("Berhasil Login"); - } else { - router.push("/dev/auth/register"); - NotifPeringatan("Silahkan Registrasi"); - } - }); + // await fetch(ApiHipmi.validasi, { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify(body), + // }) + // .then((res) => res.json()) + // .then((val) => { + // myConsole(val); + // if (val.status == 200) { + // setTimeout(() => router.push("/dev/home"), 2000); + // funGetUserProfile(val.data.id); + // NotifBerhasil("Berhasil Login"); + // } else { + // router.push("/dev/auth/register"); + // NotifPeringatan("Silahkan Registrasi"); + // } + // }); }; + async function onVerifikasi() { + if (!inputCode) + return ComponentGlobal_NotifikasiPeringatan("Lengkapi Kode"); + if (code != inputCode) + return ComponentGlobal_NotifikasiPeringatan("Kode Salah"); + + await auth_funValidasi(nomor).then(async (res) => { + if (res.status === 200) { + await auth_funEditAktivasiKodeOtpById(dataOtp.id).then((val) => { + if (val.status === 200) { + ComponentGlobal_NotifikasiBerhasil(res.message); + router.push(RouterHome.main_home); + } else { + ComponentGlobal_NotifikasiPeringatan(val.message); + } + }); + } else { + ComponentGlobal_NotifikasiBerhasil(res.message); + router.push(RouterAuth.register + dataOtp.id); + } + }); + } + return ( <> - {/* {JSON.stringify(nomor)} - {JSON.stringify(code)} */} - - - - + */} + + {/*
{JSON.stringify(code)}
*/} + +
+ +
+ +
+ + + + Verifikasi Kode OTP + + Silahkan masukan 4 digit kode otp yang dikirim ke{" "} + + +{nomor} + + + + +
+ { + setInputOtp(val); + }} + /> +
+ + + +
+
+
); } diff --git a/src/app_modules/colab/component/card_view/card_section_data.tsx b/src/app_modules/colab/component/card_view/card_section_data.tsx new file mode 100644 index 00000000..911d5ecc --- /dev/null +++ b/src/app_modules/colab/component/card_view/card_section_data.tsx @@ -0,0 +1,82 @@ +"use client"; + +import { RouterColab } from "@/app/lib/router_hipmi/router_colab"; +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { Card, Center, Title, Stack, Grid, Text } from "@mantine/core"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; + +export default function ComponentColab_CardSectionData({ + colabId, + path, +}: { + colabId?: any; + path?: any; +}) { + const router = useRouter(); + + return ( + <> + { + if (path) { + router.push(path + colabId); + } else { + ComponentGlobal_NotifikasiPeringatan("Path tidak ditemukan"); + } + }} + > +
+ + Judul Proyek{" "} + +
+ + + + + Industri + + + + : + + + Industri + + + + + + + Lokasi + + + + : + + + + Lokasi dari proyek{" "} + + + + + + + Tujuan proyek + + + Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam + repudiandae nostrum temporibus velit possimus, voluptate inventore + recusandae hic ipsa praesentium deserunt, fuga asperiores + doloremque amet incidunt explicabo ea eius earum. + + + +
+ + ); +} diff --git a/src/app_modules/colab/component/card_view/card_section_header_author_name.tsx b/src/app_modules/colab/component/card_view/card_section_header_author_name.tsx new file mode 100644 index 00000000..7e7b1e58 --- /dev/null +++ b/src/app_modules/colab/component/card_view/card_section_header_author_name.tsx @@ -0,0 +1,76 @@ +"use client"; + +import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/author_name_on_header"; +import { Avatar, Card, Divider, Grid, Stack, Text } from "@mantine/core"; +import ComponentColab_AuthorNameOnHeader from "../header_author_name"; +import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { useRouter } from "next/navigation"; + +export default function ComponentColab_CardSectionHeaderAuthorName({ + profileId, + imagesId, + authorName, + tglPublish, + isPembatas, + jumlah_partisipan, +}: { + profileId?: string; + imagesId?: string; + authorName?: string; + tglPublish?: Date; + isPembatas?: boolean; + jumlah_partisipan?: number; +}) { + const router = useRouter(); + + return ( + <> + + + + { + if (profileId) { + router.push(RouterProfile.katalog + profileId); + } else { + ComponentGlobal_NotifikasiPeringatan("Id tidak ditemukan"); + } + }} + > + + + + + + {authorName ? authorName : "Nama author"} + + + + + + + {jumlah_partisipan + ? jumlah_partisipan + " " + "partisipan" + : 0 + " " + "partisipan"} + + + + + {isPembatas ? : ""} + + + + ); +} diff --git a/src/app_modules/colab/component/card_view/jumlah_partisipan.tsx b/src/app_modules/colab/component/card_view/jumlah_partisipan.tsx new file mode 100644 index 00000000..aea8f9a9 --- /dev/null +++ b/src/app_modules/colab/component/card_view/jumlah_partisipan.tsx @@ -0,0 +1,28 @@ +"use client"; + +import { Stack, Divider, Center, Text, Grid } from "@mantine/core"; +import { IconUsersGroup } from "@tabler/icons-react"; + +export default function ComponentColab_JumlahPartisipan() { + return ( + <> + + +
+ + + + 12 + + + + + Partisipan + + + +
+
+ + ); +} diff --git a/src/app_modules/colab/component/detail/button_partisipasi.tsx b/src/app_modules/colab/component/detail/button_partisipasi.tsx new file mode 100644 index 00000000..b6bee43b --- /dev/null +++ b/src/app_modules/colab/component/detail/button_partisipasi.tsx @@ -0,0 +1,23 @@ +"use client"; + +import { Center, Button } from "@mantine/core"; +import { useState } from "react"; + +export default function ComponentColab_ButtonPartisipasi() { + const [apply, setApply] = useState(false); + return ( + <> +
+ +
+ + ); +} diff --git a/src/app_modules/colab/component/detail/detail_data.tsx b/src/app_modules/colab/component/detail/detail_data.tsx new file mode 100644 index 00000000..d99f556e --- /dev/null +++ b/src/app_modules/colab/component/detail/detail_data.tsx @@ -0,0 +1,72 @@ +"use client" + +import { Stack, Box, Center, Title, Grid, Text } from "@mantine/core"; +import ComponentColab_AuthorNameOnHeader from "../header_author_name"; + +export default function ComponentColab_DetailData() { + return ( + <> + + +
+ Judul Proyek +
+ + + + + Industri + + + + : + + + Industri + + + + + + + Lokasi + + + + : + + + + Lokasi dari proyek{" "} + + + + + + + Tujuan proyek + + + Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam + repudiandae nostrum temporibus velit possimus, voluptate + inventore recusandae hic ipsa praesentium deserunt, fuga + asperiores doloremque amet incidunt explicabo ea eius earum. + + + + + Keutungan + + + Lorem ipsum dolor sit amet consectetur adipisicing elit. Nam + repudiandae nostrum temporibus velit possimus, voluptate + inventore recusandae hic ipsa praesentium deserunt, fuga + asperiores doloremque amet incidunt explicabo ea eius earum. + + + +
+
+ + ); +} \ No newline at end of file diff --git a/src/app_modules/colab/component/detail/list_partisipasi_user.tsx b/src/app_modules/colab/component/detail/list_partisipasi_user.tsx new file mode 100644 index 00000000..490df2ef --- /dev/null +++ b/src/app_modules/colab/component/detail/list_partisipasi_user.tsx @@ -0,0 +1,29 @@ +"use client" + +import { Paper, Center, Title, ScrollArea, Box, Stack } from "@mantine/core"; +import ComponentColab_AuthorNameOnHeader from "../header_author_name"; + +export default function ComponentColab_DetailListPartisipasiUser() { + return ( + <> + +
+ Partispasi User (12) +
{" "} + + + + {Array(10) + .fill(0) + .map((e, i) => ( + + + + ))} + + + +
+ + ); +} \ No newline at end of file diff --git a/src/app_modules/colab/component/header_author_name.tsx b/src/app_modules/colab/component/header_author_name.tsx new file mode 100644 index 00000000..91e115dc --- /dev/null +++ b/src/app_modules/colab/component/header_author_name.tsx @@ -0,0 +1,72 @@ +"use client"; + +import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; +import { Stack, Grid, Avatar, Divider, Text, Group } from "@mantine/core"; +import { useRouter } from "next/navigation"; +import moment from "moment"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; + +export default function ComponentColab_AuthorNameOnHeader({ + profileId, + imagesId, + authorName, + tglPublish, + isPembatas, +}: { + profileId?: string; + imagesId?: string; + authorName?: string; + tglPublish?: Date; + isPembatas?: boolean; +}) { + const router = useRouter(); + return ( + <> + + + { + if (profileId) { + router.push(RouterProfile.katalog + profileId); + } else { + ComponentGlobal_NotifikasiPeringatan("Id tidak ditemukan"); + } + }} + > + + + + + + {authorName ? authorName : "Nama author"} + + + + + + {tglPublish ? ( + + {new Intl.DateTimeFormat("id-ID").format(tglPublish)} + + ) : ( + "" + )} + + + + {isPembatas ? : ""} + + + ); +} diff --git a/src/app_modules/colab/component/header_tamplate.tsx b/src/app_modules/colab/component/header_tamplate.tsx new file mode 100644 index 00000000..774acd2e --- /dev/null +++ b/src/app_modules/colab/component/header_tamplate.tsx @@ -0,0 +1,82 @@ +"use client"; + +import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; +import { + Header, + Group, + ActionIcon, + Text, + Title, + Center, + Loader, +} from "@mantine/core"; +import { IconArrowLeft, IconChevronLeft } from "@tabler/icons-react"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; + +export default function ComponentColab_HeaderTamplate({ + hideBack, + changeIconBack, + route, + route2, + title, + icon, + bg, +}: { + hideBack?: boolean; + changeIconBack?: any; + route?: any; + route2?: any; + title: string; + icon?: any; + bg?: any; +}) { + const router = useRouter(); + const [loading, setLoading] = useState(false); + if (loading) return ; + + return ( + <> +
+ + {hideBack ? ( + + ) : ( + { + setLoading(true); + if (route === null || route === undefined) { + return router.back(); + } else { + return router.push(route); + } + }} + > + {changeIconBack ? changeIconBack : } + + )} + {title} + {(() => { + if (route2 === null || route2 === undefined) { + return ; + } else { + return ( + router.push(route2)} + > + {icon} + + ); + } + })()} + +
+ + ); +} diff --git a/src/app_modules/colab/component/noted_box.tsx b/src/app_modules/colab/component/noted_box.tsx new file mode 100644 index 00000000..f63ae161 --- /dev/null +++ b/src/app_modules/colab/component/noted_box.tsx @@ -0,0 +1,22 @@ +import { Center, Grid, Group, Paper, Text, Title } from "@mantine/core"; + +export default function ComponentColab_NotedBox({ + informasi, +}: { + informasi: string; +}) { + return ( + <> + + + + + *{" "} + + {informasi} + + + + + ); +} diff --git a/src/app_modules/colab/create/index.tsx b/src/app_modules/colab/create/index.tsx new file mode 100644 index 00000000..5d86c700 --- /dev/null +++ b/src/app_modules/colab/create/index.tsx @@ -0,0 +1,75 @@ +"use client"; + +import { RouterColab } from "@/app/lib/router_hipmi/router_colab"; +import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; + +export default function Colab_Create() { + return ( + <> + + + + + +