Merge pull request #253 from bipproduction/bagas/28-jan-25
Bagas/28 jan 25
This commit is contained in:
@@ -69,6 +69,7 @@
|
|||||||
"next": "^13.5.4-canary.8",
|
"next": "^13.5.4-canary.8",
|
||||||
"next-dev": "^1.1.9",
|
"next-dev": "^1.1.9",
|
||||||
"next-scroll-loader": "^1.0.9",
|
"next-scroll-loader": "^1.0.9",
|
||||||
|
"p-limit": "^6.2.0",
|
||||||
"pdfjs-dist": "^4.6.82",
|
"pdfjs-dist": "^4.6.82",
|
||||||
"postcss": "8.4.27",
|
"postcss": "8.4.27",
|
||||||
"prisma": "^5.19.1",
|
"prisma": "^5.19.1",
|
||||||
|
|||||||
@@ -968,12 +968,13 @@ model EventSponsor {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
updatedAt DateTime @updatedAt
|
updatedAt DateTime @updatedAt
|
||||||
name String
|
name String
|
||||||
|
isTransfer Boolean? @default(false)
|
||||||
fileName String
|
fileName String
|
||||||
fileExt String?
|
fileExt String?
|
||||||
fileId String
|
fileId String
|
||||||
|
|
||||||
Author User? @relation(fields: [auhtorId], references: [id])
|
Author User? @relation(fields: [authorId], references: [id])
|
||||||
auhtorId String?
|
authorId String?
|
||||||
|
|
||||||
Event Event? @relation(fields: [eventId], references: [id])
|
Event Event? @relation(fields: [eventId], references: [id])
|
||||||
eventId String?
|
eventId String?
|
||||||
|
|||||||
@@ -2,15 +2,15 @@ import prisma from "./../src/app/lib/prisma";
|
|||||||
import { generate_seeder } from "./../src/app_modules/_global/fun/generate_seeder";
|
import { generate_seeder } from "./../src/app_modules/_global/fun/generate_seeder";
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
console.log("start");
|
console.log("start seeder >>");
|
||||||
await generate_seeder();
|
await generate_seeder();
|
||||||
})()
|
})()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log("success");
|
console.log("<< success seeder");
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error(e);
|
console.error("<< error seeder", e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { prisma } from "@/app/lib";
|
import { prisma } from "@/app/lib";
|
||||||
|
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||||
|
import { IEventSponsor } from "@/app_modules/event/_lib/interface";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
export async function POST(
|
export async function POST(
|
||||||
@@ -13,40 +16,91 @@ export async function POST(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const userLoginId = await funGetUserIdByToken();
|
||||||
|
|
||||||
|
if (!userLoginId) {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, message: "User not found" },
|
||||||
|
{ status: 401 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
const { id } = context.params;
|
const { id } = context.params;
|
||||||
|
const req: IEventSponsor = await request.json();
|
||||||
|
|
||||||
const body = await request.json();
|
fixData = await prisma.eventSponsor.create({
|
||||||
console.log("body", body);
|
data: {
|
||||||
console.log("id", id);
|
eventId: id,
|
||||||
|
name: req.name as string,
|
||||||
// const res = await prisma.eventSponsor.create({
|
fileName: req.fileName as string,
|
||||||
|
fileExt: req.fileExt as string,
|
||||||
// })
|
fileId: req.fileId as string,
|
||||||
|
authorId: userLoginId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await prisma.$disconnect();
|
||||||
return NextResponse.json({
|
return NextResponse.json({
|
||||||
success: true,
|
success: true,
|
||||||
message: "Success create sponsor",
|
message: "Success create sponsor",
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
// try {
|
await prisma.$disconnect();
|
||||||
// const { id } = context.params;
|
backendLogger.error("Error create sponsor event", error);
|
||||||
|
return NextResponse.json(
|
||||||
// const body = await request.json();
|
{ success: false, message: "Failed create sponsor" },
|
||||||
// console.log("body",body);
|
{ status: 500 }
|
||||||
// console.log("id",id);
|
);
|
||||||
|
}
|
||||||
// // const res = await prisma.eventSponsor.create({
|
}
|
||||||
|
|
||||||
// // })
|
export async function GET(
|
||||||
|
request: Request,
|
||||||
// return NextResponse.json({
|
context: { params: { id: string } }
|
||||||
// success: true,
|
) {
|
||||||
// message: "Success create sponsor",
|
const method = request.method;
|
||||||
// });
|
if (method !== "GET") {
|
||||||
// } catch (error) {
|
return NextResponse.json(
|
||||||
// return NextResponse.json(
|
{ success: false, message: "Method not allowed" },
|
||||||
// { success: false, message: "Failed create sponsor" },
|
{ status: 405 }
|
||||||
// { status: 500 }
|
);
|
||||||
// );
|
}
|
||||||
// }
|
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
const { id } = context.params;
|
||||||
|
|
||||||
|
fixData = await prisma.eventSponsor.findUnique({
|
||||||
|
where: {
|
||||||
|
id: id,
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: {
|
||||||
|
include: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
await prisma.$disconnect();
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: "Success create sponsor",
|
||||||
|
data: fixData,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error("Error get sponsor event", error);
|
||||||
|
await prisma.$disconnect();
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: false,
|
||||||
|
message: "Failed create sponsor",
|
||||||
|
reason: (error as Error).message,
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
79
src/app/api/event/sponsor/list/[id]/route.ts
Normal file
79
src/app/api/event/sponsor/list/[id]/route.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import { prisma } from "@/app/lib";
|
||||||
|
import backendLogger from "@/util/backendLogger";
|
||||||
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export async function GET(
|
||||||
|
request: Request,
|
||||||
|
context: { params: { id: string } }
|
||||||
|
) {
|
||||||
|
const method = request.method;
|
||||||
|
if (method !== "GET") {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ success: false, message: "Method not allowed" },
|
||||||
|
{ status: 405 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let fixData;
|
||||||
|
const { id } = context.params;
|
||||||
|
const { searchParams } = new URL(request.url);
|
||||||
|
const page = searchParams.get("page");
|
||||||
|
const takeData = 10;
|
||||||
|
const skipData = Number(page) * takeData - takeData;
|
||||||
|
|
||||||
|
if (!page) {
|
||||||
|
fixData = await prisma.eventSponsor.findMany({
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
eventId: id,
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: {
|
||||||
|
include: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
fixData = await prisma.eventSponsor.findMany({
|
||||||
|
take: takeData,
|
||||||
|
skip: skipData,
|
||||||
|
orderBy: {
|
||||||
|
createdAt: "desc",
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
eventId: id,
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
Author: {
|
||||||
|
include: {
|
||||||
|
Profile: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await prisma.$disconnect();
|
||||||
|
return NextResponse.json({
|
||||||
|
success: true,
|
||||||
|
message: "Success create sponsor",
|
||||||
|
data: fixData,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
backendLogger.error("Error get sponsor event", error);
|
||||||
|
await prisma.$disconnect();
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
success: false,
|
||||||
|
message: "Failed create sponsor",
|
||||||
|
reason: (error as Error).message,
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
|
import { funGetUserIdByToken } from '@/app_modules/_global/fun/get';
|
||||||
import LayoutEvent_DetailSponsor from '@/app_modules/event/detail/detail_sponsor/layout';
|
import LayoutEvent_DetailSponsor from '@/app_modules/event/detail/detail_sponsor/layout';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
function Layout({children} : {children: React.ReactNode}) {
|
async function Layout({children} : {children: React.ReactNode}) {
|
||||||
|
const userLoginId = await funGetUserIdByToken()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutEvent_DetailSponsor>{children}</LayoutEvent_DetailSponsor>
|
<LayoutEvent_DetailSponsor userLoginId={userLoginId}>
|
||||||
|
{children}
|
||||||
|
</LayoutEvent_DetailSponsor>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
import { funGetUserIdByToken } from '@/app_modules/_global/fun/get';
|
||||||
import DetailSponsor_Event from '@/app_modules/event/detail/detail_sponsor';
|
import DetailSponsor_Event from '@/app_modules/event/detail/detail_sponsor';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
function Page() {
|
async function Page() {
|
||||||
|
const userLoginId = await funGetUserIdByToken();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DetailSponsor_Event/>
|
<DetailSponsor_Event userLoginId={userLoginId} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,4 +43,7 @@ export const RouterEvent = {
|
|||||||
`/dev/event/detail/sponsor/tambah_sponsor/${id}`,
|
`/dev/event/detail/sponsor/tambah_sponsor/${id}`,
|
||||||
detail_sponsor: ({ id }: { id: string }) =>
|
detail_sponsor: ({ id }: { id: string }) =>
|
||||||
`/dev/event/detail/detail_sponsor/${id}`,
|
`/dev/event/detail/detail_sponsor/${id}`,
|
||||||
|
|
||||||
|
nominal_sponsor: ({ id }: { id: string }) =>
|
||||||
|
`/dev/event/detail/sponsor/nominal_sponsor/${id}`,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,8 +25,9 @@ import voting_status from "../../../bin/seeder/voting/master_status.json";
|
|||||||
import { master_kategori_app } from "@/bin/seeder/master";
|
import { master_kategori_app } from "@/bin/seeder/master";
|
||||||
import { new_status_transaksi_investasi } from "@/bin/seeder/investasi";
|
import { new_status_transaksi_investasi } from "@/bin/seeder/investasi";
|
||||||
import { master_nama_bank } from "@/bin/seeder/master";
|
import { master_nama_bank } from "@/bin/seeder/master";
|
||||||
|
import pLimit from "p-limit";
|
||||||
|
|
||||||
export async function generate_seeder() {
|
async function masterUserRole() {
|
||||||
for (let i of userRole) {
|
for (let i of userRole) {
|
||||||
await prisma.masterUserRole.upsert({
|
await prisma.masterUserRole.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -42,7 +43,10 @@ export async function generate_seeder() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log("masterUserRole success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function seederUser() {
|
||||||
for (let i of userSeeder) {
|
for (let i of userSeeder) {
|
||||||
await prisma.user.upsert({
|
await prisma.user.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -62,7 +66,10 @@ export async function generate_seeder() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log("user seeder success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterBisnis() {
|
||||||
for (let i of bidangBisnis) {
|
for (let i of bidangBisnis) {
|
||||||
await prisma.masterBidangBisnis.upsert({
|
await prisma.masterBidangBisnis.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -78,7 +85,10 @@ export async function generate_seeder() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log("masterBisnis success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterPencarianInvestor() {
|
||||||
for (let i of pencarianInvestor) {
|
for (let i of pencarianInvestor) {
|
||||||
await prisma.masterPencarianInvestor.upsert({
|
await prisma.masterPencarianInvestor.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -95,6 +105,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterPencarianInvestor success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterPembagianDeviden() {
|
||||||
for (let i of pembagianDeviden) {
|
for (let i of pembagianDeviden) {
|
||||||
await prisma.masterPembagianDeviden.upsert({
|
await prisma.masterPembagianDeviden.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -111,6 +125,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterPembagianDeviden success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterPeriodeDeviden() {
|
||||||
for (let i of periodeDeviden) {
|
for (let i of periodeDeviden) {
|
||||||
await prisma.masterPeriodeDeviden.upsert({
|
await prisma.masterPeriodeDeviden.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -127,6 +145,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterPeriodeDeviden success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterStatusInvestasi() {
|
||||||
for (let i of statusInvestasi) {
|
for (let i of statusInvestasi) {
|
||||||
await prisma.masterStatusInvestasi.upsert({
|
await prisma.masterStatusInvestasi.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -145,6 +167,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterStatusInvestasi success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterNamaBank() {
|
||||||
for (let i of master_nama_bank) {
|
for (let i of master_nama_bank) {
|
||||||
await prisma.masterBank.upsert({
|
await prisma.masterBank.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -165,6 +191,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterNamaBank success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterStatusTransaksiInvestasi() {
|
||||||
for (let i of statusTransaksiInvestasi) {
|
for (let i of statusTransaksiInvestasi) {
|
||||||
await prisma.masterStatusTransaksiInvestasi.upsert({
|
await prisma.masterStatusTransaksiInvestasi.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -183,6 +213,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterStatusTransaksiInvestasi success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterProgressInvestasi() {
|
||||||
for (let i of jenisProgres) {
|
for (let i of jenisProgres) {
|
||||||
await prisma.masterProgresInvestasi.upsert({
|
await prisma.masterProgresInvestasi.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -198,6 +232,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterProgressInvestasi success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterStatusDonasi() {
|
||||||
for (let d of donasi_status) {
|
for (let d of donasi_status) {
|
||||||
await prisma.donasiMaster_StatusDonasi.upsert({
|
await prisma.donasiMaster_StatusDonasi.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -213,6 +251,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterStatusDonasi success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterKategoriDonasi() {
|
||||||
for (let d of donasi_kategori) {
|
for (let d of donasi_kategori) {
|
||||||
await prisma.donasiMaster_Kategori.upsert({
|
await prisma.donasiMaster_Kategori.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -228,6 +270,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterKategoriDonasi success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterDurasiDonasi() {
|
||||||
for (let d of donasi_durasi) {
|
for (let d of donasi_durasi) {
|
||||||
await prisma.donasiMaster_Durasi.upsert({
|
await prisma.donasiMaster_Durasi.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -243,6 +289,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterDurasiDonasi success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterDonasiNamaBank() {
|
||||||
for (let i of donasi_namaBank) {
|
for (let i of donasi_namaBank) {
|
||||||
await prisma.donasiMaster_Bank.upsert({
|
await prisma.donasiMaster_Bank.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -261,6 +311,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterDonasiBank success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterDonasiStatusInvoice() {
|
||||||
for (let d of donasi_status_invoice) {
|
for (let d of donasi_status_invoice) {
|
||||||
await prisma.donasiMaster_StatusInvoice.upsert({
|
await prisma.donasiMaster_StatusInvoice.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -276,6 +330,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterDonasiStatusInvoice success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterEventStatus() {
|
||||||
for (let e of event_status) {
|
for (let e of event_status) {
|
||||||
await prisma.eventMaster_Status.upsert({
|
await prisma.eventMaster_Status.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -291,6 +349,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterEventStatus success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterEventTipeAcara() {
|
||||||
for (let e of event_tipe_acara) {
|
for (let e of event_tipe_acara) {
|
||||||
await prisma.eventMaster_TipeAcara.upsert({
|
await prisma.eventMaster_TipeAcara.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -306,6 +368,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterEventTipeAcara success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterVotingStatus() {
|
||||||
for (let v of voting_status) {
|
for (let v of voting_status) {
|
||||||
await prisma.voting_Status.upsert({
|
await prisma.voting_Status.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -321,6 +387,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterVotingStatus success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterStatusProses() {
|
||||||
for (let m of master_status) {
|
for (let m of master_status) {
|
||||||
await prisma.masterStatus.upsert({
|
await prisma.masterStatus.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -336,6 +406,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterStatusProses success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterForumKategoriReport() {
|
||||||
for (let m of forum_kategori_report) {
|
for (let m of forum_kategori_report) {
|
||||||
await prisma.forumMaster_KategoriReport.upsert({
|
await prisma.forumMaster_KategoriReport.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -352,6 +426,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterForumKategoriReport success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterForumStatusPosting() {
|
||||||
for (let s of forum_status_posting) {
|
for (let s of forum_status_posting) {
|
||||||
await prisma.forumMaster_StatusPosting.upsert({
|
await prisma.forumMaster_StatusPosting.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -366,6 +444,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterForumStatusPosting success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterCollaborationIndustri() {
|
||||||
for (let p of collaboration_industri) {
|
for (let p of collaboration_industri) {
|
||||||
await prisma.projectCollaborationMaster_Industri.upsert({
|
await prisma.projectCollaborationMaster_Industri.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -380,6 +462,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterCollaborationIndustri success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterCollaborationStatus() {
|
||||||
for (let p of collaboration_status) {
|
for (let p of collaboration_status) {
|
||||||
await prisma.projectCollaborationMaster_Status.upsert({
|
await prisma.projectCollaborationMaster_Status.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -394,6 +480,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterCollaborationStatus success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function seederNomorAdmin() {
|
||||||
for (let a of nomor_admin) {
|
for (let a of nomor_admin) {
|
||||||
await prisma.nomorAdmin.upsert({
|
await prisma.nomorAdmin.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -410,6 +500,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("seederNomorAdmin success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterKategoriApp() {
|
||||||
for (let a of master_kategori_app) {
|
for (let a of master_kategori_app) {
|
||||||
await prisma.masterKategoriApp.upsert({
|
await prisma.masterKategoriApp.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -426,6 +520,10 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterKategoriApp success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function masterInvestasiNewTransaksiStatus() {
|
||||||
for (let a of new_status_transaksi_investasi) {
|
for (let a of new_status_transaksi_investasi) {
|
||||||
await prisma.investasiMaster_StatusInvoice.upsert({
|
await prisma.investasiMaster_StatusInvoice.upsert({
|
||||||
where: {
|
where: {
|
||||||
@@ -442,5 +540,45 @@ export async function generate_seeder() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("masterInvestasiNewTransaksiStatus success");
|
||||||
|
}
|
||||||
|
|
||||||
|
const listSeederQueue = [
|
||||||
|
masterUserRole,
|
||||||
|
seederUser,
|
||||||
|
masterBisnis,
|
||||||
|
masterPencarianInvestor,
|
||||||
|
masterPembagianDeviden,
|
||||||
|
masterPeriodeDeviden,
|
||||||
|
masterStatusInvestasi,
|
||||||
|
masterNamaBank,
|
||||||
|
masterStatusTransaksiInvestasi,
|
||||||
|
masterProgressInvestasi,
|
||||||
|
masterStatusDonasi,
|
||||||
|
masterKategoriDonasi,
|
||||||
|
masterDurasiDonasi,
|
||||||
|
masterDonasiNamaBank,
|
||||||
|
masterDonasiStatusInvoice,
|
||||||
|
masterEventStatus,
|
||||||
|
masterEventTipeAcara,
|
||||||
|
masterVotingStatus,
|
||||||
|
masterStatusProses,
|
||||||
|
masterForumKategoriReport,
|
||||||
|
masterForumStatusPosting,
|
||||||
|
masterCollaborationIndustri,
|
||||||
|
masterCollaborationStatus,
|
||||||
|
seederNomorAdmin,
|
||||||
|
masterKategoriApp,
|
||||||
|
masterInvestasiNewTransaksiStatus,
|
||||||
|
];
|
||||||
|
const limit = pLimit(1);
|
||||||
|
|
||||||
|
export async function generate_seeder() {
|
||||||
|
try {
|
||||||
|
await Promise.all(listSeederQueue.map((fn) => limit(fn)));
|
||||||
|
} catch (error) {
|
||||||
|
console.error("error generate seeder", error);
|
||||||
|
}
|
||||||
|
|
||||||
return { status: 200, success: true };
|
return { status: 200, success: true };
|
||||||
}
|
}
|
||||||
|
|||||||
465
src/app_modules/_global/fun/generete_seeder.back.txt
Normal file
465
src/app_modules/_global/fun/generete_seeder.back.txt
Normal file
@@ -0,0 +1,465 @@
|
|||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import bidangBisnis from "../../../bin/seeder/bidang_bisnis.json";
|
||||||
|
import collaboration_industri from "../../../bin/seeder/colab/master_industri.json";
|
||||||
|
import collaboration_status from "../../../bin/seeder/colab/master_status.json";
|
||||||
|
import donasi_namaBank from "../../../bin/seeder/donasi/master_bank.json";
|
||||||
|
import donasi_durasi from "../../../bin/seeder/donasi/master_durasi.json";
|
||||||
|
import donasi_kategori from "../../../bin/seeder/donasi/master_kategori.json";
|
||||||
|
import donasi_status from "../../../bin/seeder/donasi/master_status.json";
|
||||||
|
import donasi_status_invoice from "../../../bin/seeder/donasi/master_status_invoice.json";
|
||||||
|
import event_status from "../../../bin/seeder/event/master_status.json";
|
||||||
|
import event_tipe_acara from "../../../bin/seeder/event/master_tipe_acara.json";
|
||||||
|
import forum_kategori_report from "../../../bin/seeder/forum/master_report.json";
|
||||||
|
import forum_status_posting from "../../../bin/seeder/forum/master_status.json";
|
||||||
|
import jenisProgres from "../../../bin/seeder/investasi/master_progres.json";
|
||||||
|
import pembagianDeviden from "../../../bin/seeder/investasi/pembagian_deviden.json";
|
||||||
|
import pencarianInvestor from "../../../bin/seeder/investasi/pencarian_investor.json";
|
||||||
|
import periodeDeviden from "../../../bin/seeder/investasi/periode_deviden.json";
|
||||||
|
import statusInvestasi from "../../../bin/seeder/investasi/status_investasi.json";
|
||||||
|
import statusTransaksiInvestasi from "../../../bin/seeder/investasi/status_transaksi_investasi.json";
|
||||||
|
import master_status from "../../../bin/seeder/master_status.json";
|
||||||
|
import nomor_admin from "../../../bin/seeder/nomor_admin.json";
|
||||||
|
import userRole from "../../../bin/seeder/user_role.json";
|
||||||
|
import userSeeder from "../../../bin/seeder/user_seeder.json";
|
||||||
|
import voting_status from "../../../bin/seeder/voting/master_status.json";
|
||||||
|
import { master_kategori_app } from "@/bin/seeder/master";
|
||||||
|
import { new_status_transaksi_investasi } from "@/bin/seeder/investasi";
|
||||||
|
import { master_nama_bank } from "@/bin/seeder/master";
|
||||||
|
import pLimit from "p-limit";
|
||||||
|
|
||||||
|
// PAKEK p-limit
|
||||||
|
|
||||||
|
async function masterUserRole() {
|
||||||
|
for (let i of userRole) {
|
||||||
|
await prisma.masterUserRole.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||||
|
console.log("masterUserRole success");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function user() {
|
||||||
|
for (let i of userSeeder) {
|
||||||
|
await prisma.user.upsert({
|
||||||
|
where: {
|
||||||
|
nomor: i.nomor,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
nomor: i.nomor,
|
||||||
|
username: i.name,
|
||||||
|
masterUserRoleId: i.masterUserRoleId,
|
||||||
|
active: i.active,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
nomor: i.nomor,
|
||||||
|
username: i.name,
|
||||||
|
masterUserRoleId: i.masterUserRoleId,
|
||||||
|
active: i.active,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log("user success");
|
||||||
|
}
|
||||||
|
|
||||||
|
const listAntrean = [masterUserRole, user];
|
||||||
|
const limit = pLimit(1);
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
console.log("start generate seeder");
|
||||||
|
await Promise.all(listAntrean.map((fn) => limit(fn)));
|
||||||
|
console.log("success generate seeder");
|
||||||
|
})();
|
||||||
|
|
||||||
|
export async function generate_seeder() {
|
||||||
|
for (let i of bidangBisnis) {
|
||||||
|
await prisma.masterBidangBisnis.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of pencarianInvestor) {
|
||||||
|
await prisma.masterPencarianInvestor.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of pembagianDeviden) {
|
||||||
|
await prisma.masterPembagianDeviden.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of periodeDeviden) {
|
||||||
|
await prisma.masterPeriodeDeviden.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of statusInvestasi) {
|
||||||
|
await prisma.masterStatusInvestasi.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
color: i.color,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
color: i.color,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of master_nama_bank) {
|
||||||
|
await prisma.masterBank.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
namaBank: i.namaBank,
|
||||||
|
namaAkun: i.namaAkun,
|
||||||
|
norek: i.norek.toString(),
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id.toString(),
|
||||||
|
namaBank: i.namaBank,
|
||||||
|
namaAkun: i.namaAkun,
|
||||||
|
norek: i.norek.toString(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of statusTransaksiInvestasi) {
|
||||||
|
await prisma.masterStatusTransaksiInvestasi.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
color: i.color,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
color: i.color,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of jenisProgres) {
|
||||||
|
await prisma.masterProgresInvestasi.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: i.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let d of donasi_status) {
|
||||||
|
await prisma.donasiMaster_StatusDonasi.upsert({
|
||||||
|
where: {
|
||||||
|
id: d.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: d.id,
|
||||||
|
name: d.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: d.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let d of donasi_kategori) {
|
||||||
|
await prisma.donasiMaster_Kategori.upsert({
|
||||||
|
where: {
|
||||||
|
id: d.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: d.id,
|
||||||
|
name: d.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: d.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let d of donasi_durasi) {
|
||||||
|
await prisma.donasiMaster_Durasi.upsert({
|
||||||
|
where: {
|
||||||
|
id: d.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: d.id,
|
||||||
|
name: d.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: d.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i of donasi_namaBank) {
|
||||||
|
await prisma.donasiMaster_Bank.upsert({
|
||||||
|
where: {
|
||||||
|
id: i.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
norek: i.norek,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: i.id,
|
||||||
|
name: i.name,
|
||||||
|
norek: i.norek,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let d of donasi_status_invoice) {
|
||||||
|
await prisma.donasiMaster_StatusInvoice.upsert({
|
||||||
|
where: {
|
||||||
|
id: d.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: d.id,
|
||||||
|
name: d.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: d.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let e of event_status) {
|
||||||
|
await prisma.eventMaster_Status.upsert({
|
||||||
|
where: {
|
||||||
|
id: e.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: e.id,
|
||||||
|
name: e.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: e.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let e of event_tipe_acara) {
|
||||||
|
await prisma.eventMaster_TipeAcara.upsert({
|
||||||
|
where: {
|
||||||
|
id: e.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: e.id,
|
||||||
|
name: e.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: e.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let v of voting_status) {
|
||||||
|
await prisma.voting_Status.upsert({
|
||||||
|
where: {
|
||||||
|
id: v.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: v.id,
|
||||||
|
name: v.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: v.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let m of master_status) {
|
||||||
|
await prisma.masterStatus.upsert({
|
||||||
|
where: {
|
||||||
|
id: m.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: m.id,
|
||||||
|
name: m.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: m.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let p of collaboration_industri) {
|
||||||
|
await prisma.projectCollaborationMaster_Industri.upsert({
|
||||||
|
where: {
|
||||||
|
id: p.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
name: p.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: p.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let p of collaboration_status) {
|
||||||
|
await prisma.projectCollaborationMaster_Status.upsert({
|
||||||
|
where: {
|
||||||
|
id: p.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
name: p.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
name: p.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let a of nomor_admin) {
|
||||||
|
await prisma.nomorAdmin.upsert({
|
||||||
|
where: {
|
||||||
|
id: a.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: a.id,
|
||||||
|
nomor: a.nomor,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: a.id,
|
||||||
|
nomor: a.nomor,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let a of master_kategori_app) {
|
||||||
|
await prisma.masterKategoriApp.upsert({
|
||||||
|
where: {
|
||||||
|
id: a.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: a.id,
|
||||||
|
name: a.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: a.id,
|
||||||
|
name: a.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let a of new_status_transaksi_investasi) {
|
||||||
|
await prisma.investasiMaster_StatusInvoice.upsert({
|
||||||
|
where: {
|
||||||
|
id: a.id,
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: a.id,
|
||||||
|
name: a.name,
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
id: a.id,
|
||||||
|
name: a.name,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { status: 200, success: true };
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
import { Stack } from "@mantine/core";
|
import { Stack } from "@mantine/core";
|
||||||
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
import AdminGlobal_ComponentBackButton from "../../_admin_global/back_button";
|
||||||
import { AdminEvent_ViewDetailPeserta } from "../_view";
|
import { AdminEvent_ViewDetailPeserta } from "../_view";
|
||||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/_lib/interface";
|
||||||
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
|
||||||
|
|
||||||
export function AdminEvent_UiDetailPeserta({
|
export function AdminEvent_UiDetailPeserta({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/_lib/interface";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
Button,
|
Button,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ComponentGlobal_NotifikasiGagal,
|
ComponentGlobal_NotifikasiGagal,
|
||||||
ComponentGlobal_NotifikasiPeringatan,
|
ComponentGlobal_NotifikasiPeringatan,
|
||||||
} from "@/app_modules/_global/notif_global";
|
} from "@/app_modules/_global/notif_global";
|
||||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||||
import {
|
import {
|
||||||
Affix,
|
Affix,
|
||||||
Box,
|
Box,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Center,
|
Center,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function AdminEvent_funEditCatatanById(
|
export async function AdminEvent_funEditCatatanById(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
|
||||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useDisclosure } from "@mantine/hooks";
|
import { useDisclosure } from "@mantine/hooks";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
import { MODEL_EVENT } from "@/app_modules/event/model/interface";
|
import { MODEL_EVENT } from "@/app_modules/event/_lib/interface";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
|
||||||
import { adminEvent_funGetListReject } from "../fun";
|
import { adminEvent_funGetListReject } from "../fun";
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { IEventSponsor } from "./interface";
|
||||||
|
|
||||||
export const apiGetEventDetailById = async ({ id }: { id: string }) => {
|
export const apiGetEventDetailById = async ({ id }: { id: string }) => {
|
||||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
if (!token) return await token.json().catch(() => null);
|
if (!token) return await token.json().catch(() => null);
|
||||||
@@ -68,14 +70,54 @@ export const apiGetEventCreateSponsor = async ({
|
|||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
data: any;
|
data: IEventSponsor;
|
||||||
}) => {
|
}) => {
|
||||||
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
if (!token) return await token.json().catch(() => null);
|
if (!token) return await token.json().catch(() => null);
|
||||||
|
|
||||||
const response = await fetch(`/api/event/sponsor/${id}`, {
|
const response = await fetch(`/api/event/sponsor/${id}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: data,
|
body: JSON.stringify(data),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return await response.json().catch(() => null);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const apiGetEventSponsorListById = async ({
|
||||||
|
id,
|
||||||
|
page,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
page: string;
|
||||||
|
}) => {
|
||||||
|
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
|
if (!token) return await token.json().catch(() => null);
|
||||||
|
|
||||||
|
const isPage = page ? `?page=${page}` : "";
|
||||||
|
|
||||||
|
const response = await fetch(`/api/event/sponsor/list/${id}${isPage}`, {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
Authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return await response.json().catch(() => null);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const apiGetOneSponsorEventById = async ({ id }: { id: string }) => {
|
||||||
|
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
|
||||||
|
if (!token) return await token.json().catch(() => null);
|
||||||
|
|
||||||
|
const response = await fetch(`/api/event/sponsor/${id}`, {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
|
|||||||
@@ -30,6 +30,22 @@ export interface MODEL_EVENT_PESERTA {
|
|||||||
userId: string;
|
userId: string;
|
||||||
User: MODEL_USER;
|
User: MODEL_USER;
|
||||||
eventId: string;
|
eventId: string;
|
||||||
isPresent: boolean
|
isPresent: boolean;
|
||||||
Event: MODEL_EVENT;
|
Event: MODEL_EVENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IEventSponsor {
|
||||||
|
id?: string;
|
||||||
|
isActive?: boolean;
|
||||||
|
createdAt?: Date;
|
||||||
|
updatedAt?: Date;
|
||||||
|
name?: string;
|
||||||
|
isTransfer?: boolean;
|
||||||
|
fileName?: string;
|
||||||
|
fileExt?: string;
|
||||||
|
fileId?: string;
|
||||||
|
eventId?: string;
|
||||||
|
Event?: MODEL_EVENT;
|
||||||
|
authorId?: string;
|
||||||
|
Author?: MODEL_USER;
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ import { useState } from "react";
|
|||||||
import { event_funUpdateKehadiran } from "../fun";
|
import { event_funUpdateKehadiran } from "../fun";
|
||||||
import { Event_funJoinAndConfirmEvent } from "../fun/create/fun_join_and_confirm";
|
import { Event_funJoinAndConfirmEvent } from "../fun/create/fun_join_and_confirm";
|
||||||
import { gs_event_hotMenu } from "../global_state";
|
import { gs_event_hotMenu } from "../global_state";
|
||||||
import { MODEL_EVENT } from "../model/interface";
|
import { MODEL_EVENT } from "../_lib/interface";
|
||||||
import { Event_funJoinEvent } from "../fun/create/fun_join_event";
|
import { Event_funJoinEvent } from "../fun/create/fun_join_event";
|
||||||
import "moment/locale/id";
|
import "moment/locale/id";
|
||||||
import { apiGetEventDetailById } from "../_lib/api_event";
|
import { apiGetEventDetailById } from "../_lib/api_event";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
import { Card, Group, Stack, Text, Title } from "@mantine/core";
|
import { Card, Group, Stack, Text, Title } from "@mantine/core";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { MODEL_EVENT } from "../model/interface";
|
import { MODEL_EVENT } from "../_lib/interface";
|
||||||
|
|
||||||
export default function ComponentEvent_BoxListStatus({
|
export default function ComponentEvent_BoxListStatus({
|
||||||
data,
|
data,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
import { MODEL_EVENT_PESERTA } from "../../_lib/interface";
|
||||||
|
|
||||||
export function ComponentEvent_CardKontributor({
|
export function ComponentEvent_CardKontributor({
|
||||||
data,
|
data,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
} from "@/app_modules/_global/component";
|
} from "@/app_modules/_global/component";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
|
||||||
export function ComponentEvent_CardRiwayat({ data }: { data: MODEL_EVENT }) {
|
export function ComponentEvent_CardRiwayat({ data }: { data: MODEL_EVENT }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { ComponentGlobal_CardStyles } from "@/app_modules/_global/component";
|
import { ComponentGlobal_CardStyles } from "@/app_modules/_global/component";
|
||||||
import { Grid, Stack, Text, Title } from "@mantine/core";
|
import { Grid, Stack, Text, Title } from "@mantine/core";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
import { MainColor } from "@/app_modules/_global/color";
|
import { MainColor } from "@/app_modules/_global/color";
|
||||||
import { Event_ComponentSkeletonDetailData } from "../skeleton/comp_skeleton_detail_data";
|
import { Event_ComponentSkeletonDetailData } from "../skeleton/comp_skeleton_detail_data";
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import "moment/locale/id";
|
|||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { apiGetEventDetailById } from "../../_lib/api_event";
|
import { apiGetEventDetailById } from "../../_lib/api_event";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
import { Event_ComponentSkeletonDetail } from "../skeleton/comp_skeleton_detail";
|
import { Event_ComponentSkeletonDetail } from "../skeleton/comp_skeleton_detail";
|
||||||
import Event_ComponentBoxDaftarPeserta from "./comp_box_daftar_peserta";
|
import Event_ComponentBoxDaftarPeserta from "./comp_box_daftar_peserta";
|
||||||
import Event_ComponentBoxDaftarSponsor from "./comp_box_sponsor";
|
import Event_ComponentBoxDaftarSponsor from "./comp_box_sponsor";
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
ComponentGlobal_LoaderAvatar,
|
ComponentGlobal_LoaderAvatar,
|
||||||
} from "@/app_modules/_global/component";
|
} from "@/app_modules/_global/component";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
import { MODEL_EVENT_PESERTA } from "../../_lib/interface";
|
||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||||
|
|||||||
@@ -1,23 +1,66 @@
|
|||||||
'use client'
|
"use client";
|
||||||
import { RouterEvent } from '@/app/lib/router_hipmi/router_event';
|
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||||
import { AccentColor, MainColor } from '@/app_modules/_global/color';
|
import {
|
||||||
import { Avatar, Box, Card, Flex, Group, Image, Text } from '@mantine/core';
|
ComponentGlobal_AvatarAndUsername,
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
ComponentGlobal_CardLoadingOverlay,
|
||||||
|
ComponentGlobal_CardStyles,
|
||||||
|
} from "@/app_modules/_global/component";
|
||||||
|
import {
|
||||||
|
Box,
|
||||||
|
Divider,
|
||||||
|
Grid,
|
||||||
|
Stack,
|
||||||
|
Title
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
function ComponentEvent_ListSponsor({ backgroundColor, border, marginBottom, height, color, }:
|
function ComponentEvent_ListSponsor({
|
||||||
{
|
backgroundColor,
|
||||||
|
border,
|
||||||
|
marginBottom,
|
||||||
|
height,
|
||||||
|
color,
|
||||||
|
profile,
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
backgroundColor?: string;
|
backgroundColor?: string;
|
||||||
border?: string;
|
border?: string;
|
||||||
marginBottom?: string | number;
|
marginBottom?: string | number;
|
||||||
height?: string | number;
|
height?: string | number;
|
||||||
color?: string;
|
color?: string;
|
||||||
})
|
profile: any;
|
||||||
{
|
data: any;
|
||||||
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const params = useParams<{ id: string }>();
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box>
|
<ComponentGlobal_CardStyles>
|
||||||
|
<Stack>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<ComponentGlobal_AvatarAndUsername profile={profile} />
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<Box
|
||||||
|
p={"md"}
|
||||||
|
onClick={() => {
|
||||||
|
router.push(RouterEvent.detail_sponsor({ id: data.id }));
|
||||||
|
setVisible(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Title align="center" order={2}>
|
||||||
|
{data?.name}
|
||||||
|
</Title>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||||
|
</ComponentGlobal_CardStyles>
|
||||||
|
{/* <Box>
|
||||||
<Card
|
<Card
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: backgroundColor
|
backgroundColor: backgroundColor
|
||||||
@@ -31,19 +74,24 @@ function ComponentEvent_ListSponsor({ backgroundColor, border, marginBottom, hei
|
|||||||
height: height ? height : "auto",
|
height: height ? height : "auto",
|
||||||
marginBottom: marginBottom ? marginBottom : "15px",
|
marginBottom: marginBottom ? marginBottom : "15px",
|
||||||
}}
|
}}
|
||||||
onClick={() => router.push(RouterEvent.detail_sponsor({id: params.id}))}
|
onClick={() =>
|
||||||
|
router.push(RouterEvent.detail_sponsor({ id: params.id }))
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Flex gap={"md"} align={"center"} justify={"space-between"}>
|
<Flex gap={"md"} align={"center"} justify={"space-between"}>
|
||||||
<Group>
|
<Group>
|
||||||
<Avatar radius={"xl"} size={40}>
|
<Avatar radius={"xl"} size={40}>
|
||||||
<Image src={"https://images.app.goo.gl/C7WDoF9X52HC5SJX9"} alt='' />
|
<Image
|
||||||
|
src={"https://images.app.goo.gl/C7WDoF9X52HC5SJX9"}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
<Text fz={"md"}>INACO</Text>
|
<Text fz={"md"}>INACO</Text>
|
||||||
</Group>
|
</Group>
|
||||||
<Text style={{color: 'white'}}>Rp. 100.000</Text>
|
<Text style={{ color: "white" }}>Rp. 100.000</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Card>
|
</Card>
|
||||||
</Box>
|
</Box> */}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,69 @@
|
|||||||
'use client';
|
"use client";
|
||||||
import { AccentColor, MainColor } from '@/app_modules/_global/color';
|
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||||
import { ComponentGlobal_CardStyles } from '@/app_modules/_global/component';
|
import {
|
||||||
import { Box, Flex, Image, Stack, Text, Title } from '@mantine/core';
|
ComponentGlobal_AvatarAndUsername,
|
||||||
import { IconBrandWhatsapp } from '@tabler/icons-react';
|
ComponentGlobal_CardStyles,
|
||||||
import React from 'react';
|
} from "@/app_modules/_global/component";
|
||||||
import { TfiFacebook } from 'react-icons/tfi';
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Divider,
|
||||||
|
Flex,
|
||||||
|
Grid,
|
||||||
|
Image,
|
||||||
|
SimpleGrid,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { IconBrandWhatsapp } from "@tabler/icons-react";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { TfiFacebook } from "react-icons/tfi";
|
||||||
|
import { apiGetOneSponsorEventById } from "../../_lib/api_event";
|
||||||
|
import { useParams, useRouter } from "next/navigation";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
|
import { IEventSponsor } from "../../_lib/interface";
|
||||||
|
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||||
|
|
||||||
function DetailSponsor_Event() {
|
function DetailSponsor_Event({ userLoginId }: { userLoginId: string }) {
|
||||||
|
const params = useParams<{ id: string }>();
|
||||||
|
const router = useRouter();
|
||||||
|
const [data, setData] = useState<IEventSponsor | null>(null);
|
||||||
|
const [isLoadingTransfer, setIsLoadingTransfer] = useState(false);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function onLoadData() {
|
||||||
|
try {
|
||||||
|
const respone = await apiGetOneSponsorEventById({
|
||||||
|
id: params.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (respone) {
|
||||||
|
setData(respone.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get data sponsor", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack pb={"lg"}>
|
<CustomSkeleton height={200} width={"100%"} />
|
||||||
<Stack
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack spacing={"lg"}>
|
||||||
|
{/* <Stack
|
||||||
spacing={0}
|
spacing={0}
|
||||||
style={{
|
style={{
|
||||||
padding: "15px",
|
padding: "15px",
|
||||||
@@ -25,27 +78,82 @@ function DetailSponsor_Event() {
|
|||||||
<Title order={4} c={MainColor.yellow}>
|
<Title order={4} c={MainColor.yellow}>
|
||||||
Rp. 100.000
|
Rp. 100.000
|
||||||
</Title>
|
</Title>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
<ComponentGlobal_CardStyles>
|
|
||||||
|
{/* <ComponentGlobal_CardStyles>
|
||||||
<Stack>
|
<Stack>
|
||||||
<Image src={"https://job-portal.niramasutama.com/images/Banner-INACO.png"} alt='' />
|
<Image
|
||||||
<Flex justify={"space-between"} >
|
src={
|
||||||
|
"https://job-portal.niramasutama.com/images/Banner-INACO.png"
|
||||||
|
}
|
||||||
|
alt=""
|
||||||
|
/>
|
||||||
|
<Flex justify={"space-between"}>
|
||||||
<Box>
|
<Box>
|
||||||
<Title order={4}>INACO</Title>
|
<Title order={4}>INACO</Title>
|
||||||
</Box>
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Title order={4}>Sosial Media:</Title>
|
<Title order={4}>Sosial Media:</Title>
|
||||||
<Flex align={"center"} gap={"sm"}>
|
<Flex align={"center"} gap={"sm"}>
|
||||||
<TfiFacebook size={10}/>
|
<TfiFacebook size={10} />
|
||||||
<Text fz={"sm"}>InacoJellyku</Text>
|
<Text fz={"sm"}>InacoJellyku</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Flex align={"center"} gap={"sm"}>
|
<Flex align={"center"} gap={"sm"}>
|
||||||
<IconBrandWhatsapp size={10}/>
|
<IconBrandWhatsapp size={10} />
|
||||||
<Text fz={"sm"}>+6289647038426</Text>
|
<Text fz={"sm"}>+6289647038426</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
</ComponentGlobal_CardStyles> */}
|
||||||
|
|
||||||
|
<ComponentGlobal_CardStyles>
|
||||||
|
<Stack>
|
||||||
|
<ComponentGlobal_AvatarAndUsername
|
||||||
|
profile={data?.Author?.Profile as any}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4} fw={"bold"}>
|
||||||
|
Nama Sponsor
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={7}>{data.name}</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col span={4} fw={"bold"}>
|
||||||
|
Nominal
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>:</Grid.Col>
|
||||||
|
<Grid.Col span={7}> Rp. {data.isTransfer ? 0 : "-"} </Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{userLoginId == data.authorId && (
|
||||||
|
<SimpleGrid cols={2} mt={"xl"}>
|
||||||
|
<Button
|
||||||
|
loaderPosition="center"
|
||||||
|
loading={isLoadingTransfer}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
try {
|
||||||
|
setIsLoadingTransfer(true);
|
||||||
|
router.push(
|
||||||
|
RouterEvent.nominal_sponsor({ id: params.id })
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Selesaikan Transaksi
|
||||||
|
</Button>
|
||||||
|
<Button radius={"xl"}>Tampilkan Logo</Button>
|
||||||
|
</SimpleGrid>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
</ComponentGlobal_CardStyles>
|
</ComponentGlobal_CardStyles>
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,21 +1,83 @@
|
|||||||
'use client';
|
"use client";
|
||||||
import { AccentColor, MainColor } from '@/app_modules/_global/color';
|
|
||||||
import { UIGlobal_DrawerCustom, UIGlobal_LayoutHeaderTamplate, UIGlobal_LayoutTamplate, UIGlobal_Modal } from '@/app_modules/_global/ui';
|
|
||||||
import { ActionIcon, Box, Button, Center, Flex, Stack, Text } from '@mantine/core';
|
|
||||||
import { IconDotsVertical, IconEdit, IconTrash } from '@tabler/icons-react';
|
|
||||||
import React, { useState } from 'react';
|
|
||||||
|
|
||||||
function LayoutEvent_DetailSponsor({ children }: { children: React.ReactNode }) {
|
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||||
|
import {
|
||||||
|
UIGlobal_DrawerCustom,
|
||||||
|
UIGlobal_LayoutHeaderTamplate,
|
||||||
|
UIGlobal_LayoutTamplate,
|
||||||
|
UIGlobal_Modal,
|
||||||
|
} from "@/app_modules/_global/ui";
|
||||||
|
import {
|
||||||
|
ActionIcon,
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Center,
|
||||||
|
Flex,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { IconDotsVertical, IconEdit, IconTrash } from "@tabler/icons-react";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { apiGetOneSponsorEventById } from "../../_lib/api_event";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
|
|
||||||
|
function LayoutEvent_DetailSponsor({
|
||||||
|
children,
|
||||||
|
userLoginId,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
userLoginId: string;
|
||||||
|
}) {
|
||||||
|
const params = useParams<{ id: string }>();
|
||||||
|
const [authorId, setAuthorId] = useState<string | null>(null);
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
const [isLoading, setLoading] = useState(false);
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function onLoadData() {
|
||||||
|
try {
|
||||||
|
const respone = await apiGetOneSponsorEventById({
|
||||||
|
id: params.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (respone) {
|
||||||
|
setAuthorId(respone.data.authorId);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get data sponsor", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UIGlobal_LayoutTamplate header={<UIGlobal_LayoutHeaderTamplate title="Detail Sponsor"
|
<UIGlobal_LayoutTamplate
|
||||||
|
header={
|
||||||
|
<UIGlobal_LayoutHeaderTamplate
|
||||||
|
title="Detail Sponsor"
|
||||||
customButtonRight={
|
customButtonRight={
|
||||||
<ActionIcon variant='transparent' onClick={() => setOpenDrawer(true)}>
|
!authorId ? (
|
||||||
<IconDotsVertical color='white' />
|
<CustomSkeleton circle height={30} width={30} />
|
||||||
</ActionIcon>} />}>
|
) : authorId == userLoginId ? (
|
||||||
|
<ActionIcon
|
||||||
|
variant="transparent"
|
||||||
|
onClick={() => setOpenDrawer(true)}
|
||||||
|
>
|
||||||
|
<IconDotsVertical color="white" />
|
||||||
|
</ActionIcon>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</UIGlobal_LayoutTamplate>
|
</UIGlobal_LayoutTamplate>
|
||||||
<UIGlobal_DrawerCustom
|
<UIGlobal_DrawerCustom
|
||||||
@@ -25,12 +87,8 @@ function LayoutEvent_DetailSponsor({ children }: { children: React.ReactNode })
|
|||||||
<Stack align="center" spacing={"xs"}>
|
<Stack align="center" spacing={"xs"}>
|
||||||
<Flex gap={200} justify={"space-between"}>
|
<Flex gap={200} justify={"space-between"}>
|
||||||
<Box>
|
<Box>
|
||||||
<ActionIcon
|
<ActionIcon variant="transparent" c={MainColor.white}>
|
||||||
variant="transparent"
|
|
||||||
c={MainColor.white}
|
|
||||||
>
|
|
||||||
<IconEdit />
|
<IconEdit />
|
||||||
|
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
<Text fz={"sm"} align="center" color={MainColor.white}>
|
<Text fz={"sm"} align="center" color={MainColor.white}>
|
||||||
Edit
|
Edit
|
||||||
@@ -44,7 +102,6 @@ function LayoutEvent_DetailSponsor({ children }: { children: React.ReactNode })
|
|||||||
onClick={() => setOpenModal(true)}
|
onClick={() => setOpenModal(true)}
|
||||||
>
|
>
|
||||||
<IconTrash />
|
<IconTrash />
|
||||||
|
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</Center>
|
</Center>
|
||||||
<Text fz={"sm"} ta={"center"} color={MainColor.white}>
|
<Text fz={"sm"} ta={"center"} color={MainColor.white}>
|
||||||
@@ -60,7 +117,12 @@ function LayoutEvent_DetailSponsor({ children }: { children: React.ReactNode })
|
|||||||
opened={openModal}
|
opened={openModal}
|
||||||
close={() => setOpenModal(false)}
|
close={() => setOpenModal(false)}
|
||||||
buttonKiri={
|
buttonKiri={
|
||||||
<Button style={{ backgroundColor: AccentColor.blue }} c={AccentColor.white} radius={"xl"} onClick={() => setOpenModal(false)}>
|
<Button
|
||||||
|
style={{ backgroundColor: AccentColor.blue }}
|
||||||
|
c={AccentColor.white}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => setOpenModal(false)}
|
||||||
|
>
|
||||||
Batal
|
Batal
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
@@ -71,7 +133,6 @@ function LayoutEvent_DetailSponsor({ children }: { children: React.ReactNode })
|
|||||||
loading={isLoading ? true : false}
|
loading={isLoading ? true : false}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
c={AccentColor.white}
|
c={AccentColor.white}
|
||||||
|
|
||||||
>
|
>
|
||||||
Hapus
|
Hapus
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { Event_ComponentSkeletonDetailData } from "../../component";
|
|||||||
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
import { Event_funDeleteById } from "../../fun/delete/fun_delete";
|
import { Event_funDeleteById } from "../../fun/delete/fun_delete";
|
||||||
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { Stack, Loader, Center } from "@mantine/core";
|
import { Stack, Loader, Center } from "@mantine/core";
|
||||||
import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
|
import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
|
||||||
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
import { MODEL_EVENT_PESERTA } from "../../_lib/interface";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import ComponentEvent_ListPesertaNew from "../../component/detail/list_peserta_new";
|
import ComponentEvent_ListPesertaNew from "../../component/detail/list_peserta_new";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
|
import ComponentEvent_ListPeserta from "../../component/detail/list_peserta";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
|
||||||
export default function Event_DetailPublish({
|
export default function Event_DetailPublish({
|
||||||
dataEvent,
|
dataEvent,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { useState } from "react";
|
|||||||
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
import { Event_funDeleteById } from "../../fun/delete/fun_delete";
|
import { Event_funDeleteById } from "../../fun/delete/fun_delete";
|
||||||
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||||
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
import { IRealtimeData } from "@/app/lib/global_state";
|
import { IRealtimeData } from "@/app/lib/global_state";
|
||||||
import { WibuRealtime } from "wibu-pkg";
|
import { WibuRealtime } from "wibu-pkg";
|
||||||
import { event_checkStatus } from "../../fun/get/fun_check_status_by_id";
|
import { event_checkStatus } from "../../fun/get/fun_check_status_by_id";
|
||||||
|
|||||||
@@ -1,10 +1,97 @@
|
|||||||
'use client';
|
"use client";
|
||||||
import ComponentEvent_ListSponsor from '../../component/detail/list_sponsor';
|
import { useParams } from "next/navigation";
|
||||||
|
import ComponentEvent_ListSponsor from "../../component/detail/list_sponsor";
|
||||||
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { apiGetEventSponsorListById } from "../../_lib/api_event";
|
||||||
|
import { IEventSponsor, MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
import { Component, useState } from "react";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
|
import { ScrollOnly } from "next-scroll-loader";
|
||||||
|
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||||
|
import { ComponentDonasi_CardInvoice } from "@/app_modules/donasi/component/card_view/card_invoice";
|
||||||
|
import { donasi_funGetAllInvoiceByAuthorId } from "@/app_modules/donasi/fun/get/get_all_invoice_by_author_id";
|
||||||
|
import { Box, Center, Stack } from "@mantine/core";
|
||||||
|
import _ from "lodash";
|
||||||
|
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||||
|
|
||||||
function Event_DaftarSponsor() {
|
function Event_DaftarSponsor() {
|
||||||
|
const params = useParams<{ id: string }>();
|
||||||
|
const eventId = params.id;
|
||||||
|
const [data, setData] = useState<IEventSponsor[] | null>(null);
|
||||||
|
const [activePage, setActivePage] = useState(1);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function onLoadData() {
|
||||||
|
try {
|
||||||
|
const respone = await apiGetEventSponsorListById({
|
||||||
|
id: eventId,
|
||||||
|
page: `${activePage}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (respone) {
|
||||||
|
setData(respone.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get data sponsor", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ComponentEvent_ListSponsor/>
|
<Stack spacing={0}>
|
||||||
|
<CustomSkeleton height={100} width={"100%"} />;
|
||||||
|
<CustomSkeleton height={100} width={"100%"} />;
|
||||||
|
</Stack>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <ComponentEvent_ListSponsor /> */}
|
||||||
|
<Box>
|
||||||
|
{_.isEmpty(data) ? (
|
||||||
|
<ComponentGlobal_IsEmptyData />
|
||||||
|
) : (
|
||||||
|
<ScrollOnly
|
||||||
|
height="82vh"
|
||||||
|
renderLoading={() => (
|
||||||
|
<Center>
|
||||||
|
<ComponentGlobal_Loader size={25} />
|
||||||
|
</Center>
|
||||||
|
)}
|
||||||
|
data={data}
|
||||||
|
setData={setData as any}
|
||||||
|
moreData={async () => {
|
||||||
|
try {
|
||||||
|
const respone = await apiGetEventSponsorListById({
|
||||||
|
id: eventId,
|
||||||
|
page: `${activePage + 1}`,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (respone) {
|
||||||
|
setActivePage((val) => val + 1);
|
||||||
|
return respone.data;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get data sponsor", error);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{(item) => (
|
||||||
|
<ComponentEvent_ListSponsor
|
||||||
|
profile={item?.Author?.Profile}
|
||||||
|
data={item}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ScrollOnly>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,43 @@ import {
|
|||||||
UIGlobal_LayoutHeaderTamplate,
|
UIGlobal_LayoutHeaderTamplate,
|
||||||
UIGlobal_LayoutTamplate,
|
UIGlobal_LayoutTamplate,
|
||||||
} from "@/app_modules/_global/ui";
|
} from "@/app_modules/_global/ui";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import { ActionIcon } from "@mantine/core";
|
import { ActionIcon } from "@mantine/core";
|
||||||
import { IconDotsVertical } from "@tabler/icons-react";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
|
import { IconCirclePlus, IconDotsVertical } from "@tabler/icons-react";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams } from "next/navigation";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { TfiCup } from "react-icons/tfi";
|
import { apiGetEventDetailById } from "../../_lib/api_event";
|
||||||
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
import moment from "moment";
|
||||||
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
|
|
||||||
function LayoutEvent_Sponsor({ children }: { children: React.ReactNode }) {
|
function LayoutEvent_Sponsor({ children }: { children: React.ReactNode }) {
|
||||||
const params = useParams<{ id: string }>();
|
const params = useParams<{ id: string }>();
|
||||||
|
const eventId = params.id as string;
|
||||||
|
const [data, setData] = useState<MODEL_EVENT | null>(null);
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
|
|
||||||
|
useShallowEffect(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function onLoadData() {
|
||||||
|
try {
|
||||||
|
const respone = await apiGetEventDetailById({
|
||||||
|
id: eventId,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (respone) {
|
||||||
|
setData(respone.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
clientLogger.error("Error get data detail event", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const isExpired = moment(data?.tanggalSelesai).diff(moment(), "minutes") < 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<UIGlobal_LayoutTamplate
|
<UIGlobal_LayoutTamplate
|
||||||
@@ -22,12 +49,18 @@ function LayoutEvent_Sponsor({ children }: { children: React.ReactNode }) {
|
|||||||
<UIGlobal_LayoutHeaderTamplate
|
<UIGlobal_LayoutHeaderTamplate
|
||||||
title="Daftar Sponsor"
|
title="Daftar Sponsor"
|
||||||
customButtonRight={
|
customButtonRight={
|
||||||
|
!data ? (
|
||||||
|
<CustomSkeleton height={30} width={30} circle />
|
||||||
|
) : !isExpired ? (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
onClick={() => setOpenDrawer(true)}
|
onClick={() => setOpenDrawer(true)}
|
||||||
>
|
>
|
||||||
<IconDotsVertical color="white" />
|
<IconDotsVertical color="white" />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -41,7 +74,7 @@ function LayoutEvent_Sponsor({ children }: { children: React.ReactNode }) {
|
|||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "Tambah Sponsor",
|
name: "Tambah Sponsor",
|
||||||
icon: <TfiCup />,
|
icon: <IconCirclePlus />,
|
||||||
path: RouterEvent.tambah_sponsor({ id: params.id }),
|
path: RouterEvent.tambah_sponsor({ id: params.id }),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
|||||||
@@ -1,9 +1,24 @@
|
|||||||
'use client';
|
"use client";
|
||||||
import { AccentColor, MainColor } from '@/app_modules/_global/color';
|
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||||
import { Box, Button, Group, Paper, Stack, Text, TextInput, Title } from '@mantine/core';
|
import {
|
||||||
import { IconChevronRight, IconMoodSmile, IconMoodSmileBeam, IconMoodSmileDizzy, IconMoodXd } from '@tabler/icons-react';
|
Box,
|
||||||
import { useRouter } from 'next/navigation';
|
Button,
|
||||||
import React from 'react';
|
Group,
|
||||||
|
Paper,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
Title,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import {
|
||||||
|
IconChevronRight,
|
||||||
|
IconMoodSmile,
|
||||||
|
IconMoodSmileBeam,
|
||||||
|
IconMoodSmileDizzy,
|
||||||
|
IconMoodXd,
|
||||||
|
} from "@tabler/icons-react";
|
||||||
|
import { useParams, useRouter } from "next/navigation";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
const listNominal = [
|
const listNominal = [
|
||||||
{
|
{
|
||||||
@@ -28,7 +43,9 @@ const listNominal = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
function Event_PilihNominalSponsor() {
|
function Event_PilihNominalSponsor() {
|
||||||
|
const params = useParams<{ id: string }>();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
@@ -49,9 +66,7 @@ function Event_PilihNominalSponsor() {
|
|||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<Group>
|
<Group>
|
||||||
{e.icon}
|
{e.icon}
|
||||||
<Title order={4}>
|
<Title order={4}>Rp.{e.jumlah}</Title>
|
||||||
Rp.{e.jumlah}
|
|
||||||
</Title>
|
|
||||||
</Group>
|
</Group>
|
||||||
<IconChevronRight />
|
<IconChevronRight />
|
||||||
</Group>
|
</Group>
|
||||||
@@ -79,15 +94,16 @@ function Event_PilihNominalSponsor() {
|
|||||||
Minimal Donasi Rp. 10.000
|
Minimal Donasi Rp. 10.000
|
||||||
</Text>
|
</Text>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Paper >
|
</Paper>
|
||||||
<Button
|
<Button
|
||||||
style={{ transition: "0.5s" }}
|
style={{ transition: "0.5s" }}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
bg={MainColor.yellow}
|
bg={MainColor.yellow}
|
||||||
color="yellow"
|
color="yellow"
|
||||||
c={"black"}
|
c={"black"}
|
||||||
onClick={() => router.push("/dev/event/detail/sponsor/metode_pembayaran")}
|
onClick={() =>
|
||||||
|
router.push("/dev/event/detail/sponsor/metode_pembayaran")
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Lanjutan Pembayaran
|
Lanjutan Pembayaran
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import {
|
|||||||
ComponentGlobal_NotifikasiPeringatan,
|
ComponentGlobal_NotifikasiPeringatan,
|
||||||
} from "@/app_modules/_global/notif_global";
|
} from "@/app_modules/_global/notif_global";
|
||||||
import { DIRECTORY_ID } from "@/app/lib";
|
import { DIRECTORY_ID } from "@/app/lib";
|
||||||
|
import { IEventSponsor } from "../../_lib/interface";
|
||||||
|
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||||
|
|
||||||
function Event_TambahSponsor() {
|
function Event_TambahSponsor() {
|
||||||
const params = useParams<{ id: string }>();
|
const params = useParams<{ id: string }>();
|
||||||
@@ -62,9 +64,11 @@ function Event_TambahSponsor() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = {
|
const fileType = file.type.split("/").pop();
|
||||||
|
const data: IEventSponsor = {
|
||||||
name: name,
|
name: name,
|
||||||
fileName: file.name,
|
fileName: file.name,
|
||||||
|
fileExt: fileType,
|
||||||
fileId: uploadFile.data.id,
|
fileId: uploadFile.data.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -73,9 +77,14 @@ function Event_TambahSponsor() {
|
|||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("res >>", created);
|
||||||
|
|
||||||
if (created) {
|
if (created) {
|
||||||
setIsLoading(false);
|
router.replace(RouterEvent.nominal_sponsor({ id: params.id }));
|
||||||
ComponentGlobal_NotifikasiBerhasil(created.message);
|
ComponentGlobal_NotifikasiBerhasil(created.message);
|
||||||
|
} else {
|
||||||
|
setIsLoading(false);
|
||||||
|
ComponentGlobal_NotifikasiPeringatan(created.message);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@@ -168,7 +177,7 @@ function Event_TambahSponsor() {
|
|||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// onCreated();
|
onCreated();
|
||||||
}}
|
}}
|
||||||
bg={MainColor.yellow}
|
bg={MainColor.yellow}
|
||||||
color="yellow"
|
color="yellow"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.share
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
|
import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
|
||||||
import { MODEL_EVENT } from "../model/interface";
|
import { MODEL_EVENT } from "../_lib/interface";
|
||||||
import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
|
import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
import { MODEL_EVENT_PESERTA } from "../../_lib/interface";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function Event_funJoinAndConfirmEvent(data: MODEL_EVENT_PESERTA) {
|
export async function Event_funJoinAndConfirmEvent(data: MODEL_EVENT_PESERTA) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
import { MODEL_EVENT_PESERTA } from "../../_lib/interface";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
export async function Event_funJoinEvent(data: MODEL_EVENT_PESERTA) {
|
export async function Event_funJoinEvent(data: MODEL_EVENT_PESERTA) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
|
||||||
export async function Event_funEditById(data: MODEL_EVENT) {
|
export async function Event_funEditById(data: MODEL_EVENT) {
|
||||||
const updt = await prisma.event.update({
|
const updt = await prisma.event.update({
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { ScrollOnly } from "next-scroll-loader";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentEvent_CardBeranda } from "../component/card_view/card_beranda";
|
import { ComponentEvent_CardBeranda } from "../component/card_view/card_beranda";
|
||||||
import { event_getListAllPublish } from "../fun/get/get_list_all_publish";
|
import { event_getListAllPublish } from "../fun/get/get_list_all_publish";
|
||||||
import { MODEL_EVENT } from "../model/interface";
|
import { MODEL_EVENT } from "../_lib/interface";
|
||||||
import { Event_ComponentSkeletonBeranda } from "../component";
|
import { Event_ComponentSkeletonBeranda } from "../component";
|
||||||
import { API_RouteEvent } from "@/app/lib/api_user_router/route_api_event";
|
import { API_RouteEvent } from "@/app/lib/api_user_router/route_api_event";
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { ScrollOnly } from "next-scroll-loader";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentEvent_CardKontributor } from "../../component/card_view/card_kontributor";
|
import { ComponentEvent_CardKontributor } from "../../component/card_view/card_kontributor";
|
||||||
import { event_getListKontibusiByUserId } from "../../fun/get/get_list_kontribusi_by_user_id";
|
import { event_getListKontibusiByUserId } from "../../fun/get/get_list_kontribusi_by_user_id";
|
||||||
import { MODEL_EVENT_PESERTA } from "../../model/interface";
|
import { MODEL_EVENT_PESERTA } from "../../_lib/interface";
|
||||||
|
|
||||||
export default function Event_Kontribusi({
|
export default function Event_Kontribusi({
|
||||||
listKontribusi,
|
listKontribusi,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
} from "@/app_modules/_global/color/color_pallet";
|
} from "@/app_modules/_global/color/color_pallet";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
import Event_RiwayatSaya from "./saya";
|
import Event_RiwayatSaya from "./saya";
|
||||||
import Event_SemuaRiwayat from "./semua";
|
import Event_SemuaRiwayat from "./semua";
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentEvent_CardRiwayat } from "../../component/card_view/card_riwayat";
|
import { ComponentEvent_CardRiwayat } from "../../component/card_view/card_riwayat";
|
||||||
import { event_getListSemuaRiwayat } from "../../fun/get/riwayat/get_list_semua_riwayat";
|
import { event_getListSemuaRiwayat } from "../../fun/get/riwayat/get_list_semua_riwayat";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
import { event_getListRiwayatSaya } from "../../fun/get/riwayat/get_list_riwayat_saya";
|
import { event_getListRiwayatSaya } from "../../fun/get/riwayat/get_list_riwayat_saya";
|
||||||
|
|
||||||
export default function Event_RiwayatSaya({
|
export default function Event_RiwayatSaya({
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentEvent_CardRiwayat } from "../../component/card_view/card_riwayat";
|
import { ComponentEvent_CardRiwayat } from "../../component/card_view/card_riwayat";
|
||||||
import { event_getListSemuaRiwayat } from "../../fun/get/riwayat/get_list_semua_riwayat";
|
import { event_getListSemuaRiwayat } from "../../fun/get/riwayat/get_list_semua_riwayat";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
|
||||||
export default function Event_SemuaRiwayat({
|
export default function Event_SemuaRiwayat({
|
||||||
listData,
|
listData,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { ScrollOnly } from "next-scroll-loader";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||||
import { event_getAllDraft } from "../../fun/get/status/get_all_draft";
|
import { event_getAllDraft } from "../../fun/get/status/get_all_draft";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
|
||||||
export default function Event_StatusDraft({
|
export default function Event_StatusDraft({
|
||||||
listDraft,
|
listDraft,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { ScrollOnly } from "next-scroll-loader";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||||
import { event_getAllByStatusId } from "../../fun";
|
import { event_getAllByStatusId } from "../../fun";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
|
||||||
export default function Event_StatusPublish({
|
export default function Event_StatusPublish({
|
||||||
listPublish,
|
listPublish,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { ScrollOnly } from "next-scroll-loader";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||||
import { event_getAllReject } from "../../fun/get/status/get_all_reject";
|
import { event_getAllReject } from "../../fun/get/status/get_all_reject";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
|
||||||
export default function Event_StatusReject({
|
export default function Event_StatusReject({
|
||||||
listReject,
|
listReject,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { ScrollOnly } from "next-scroll-loader";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||||
import { event_getAllReview } from "../../fun/get/status/get_all_review";
|
import { event_getAllReview } from "../../fun/get/status/get_all_review";
|
||||||
import { MODEL_EVENT } from "../../model/interface";
|
import { MODEL_EVENT } from "../../_lib/interface";
|
||||||
|
|
||||||
export default function Event_StatusReview({
|
export default function Event_StatusReview({
|
||||||
listReview,
|
listReview,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { IconAffiliate, IconBriefcase, IconHeartHandshake, IconMap2, IconMessage
|
|||||||
export const listMenuHomeFooter = [
|
export const listMenuHomeFooter = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "Forums",
|
name: "Forum",
|
||||||
icon: <IconMessages />,
|
icon: <IconMessages />,
|
||||||
link: RouterForum.splash,
|
link: RouterForum.splash,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user