@@ -12,30 +12,33 @@ datasource db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id String @id @default(cuid())
|
id String @id @default(cuid())
|
||||||
username String @unique
|
username String @unique
|
||||||
nomor String @unique
|
nomor String @unique
|
||||||
active Boolean @default(true)
|
active Boolean @default(true)
|
||||||
createdAt DateTime? @default(now())
|
createdAt DateTime? @default(now())
|
||||||
updatedAt DateTime? @updatedAt
|
updatedAt DateTime? @updatedAt
|
||||||
MasterUserRole MasterUserRole @relation(fields: [masterUserRoleId], references: [id])
|
MasterUserRole MasterUserRole @relation(fields: [masterUserRoleId], references: [id])
|
||||||
masterUserRoleId String @default("1")
|
masterUserRoleId String @default("1")
|
||||||
UserSession UserSession?
|
UserSession UserSession?
|
||||||
Profile Profile?
|
Profile Profile?
|
||||||
Investasi Investasi[]
|
Investasi Investasi[]
|
||||||
TransaksiInvestasi TransaksiInvestasi[]
|
TransaksiInvestasi TransaksiInvestasi[]
|
||||||
Donasi Donasi[]
|
Donasi Donasi[]
|
||||||
Donasi_Invoice Donasi_Invoice[]
|
Donasi_Invoice Donasi_Invoice[]
|
||||||
Donasi_Notif Donasi_Notif[]
|
Donasi_Notif Donasi_Notif[]
|
||||||
Event Event[]
|
Event Event[]
|
||||||
Event_Peserta Event_Peserta[]
|
Event_Peserta Event_Peserta[]
|
||||||
Voting Voting[]
|
Voting Voting[]
|
||||||
Voting_Kontributor Voting_Kontributor[]
|
Voting_Kontributor Voting_Kontributor[]
|
||||||
Job Job[]
|
Job Job[]
|
||||||
Forum_Posting Forum_Posting[]
|
Forum_Posting Forum_Posting[]
|
||||||
Forum_Komentar Forum_Komentar[]
|
Forum_Komentar Forum_Komentar[]
|
||||||
Forum_ReportPosting Forum_ReportPosting[]
|
Forum_ReportPosting Forum_ReportPosting[]
|
||||||
Forum_ReportKomentar Forum_ReportKomentar[]
|
Forum_ReportKomentar Forum_ReportKomentar[]
|
||||||
|
ProjectCollaboration ProjectCollaboration[]
|
||||||
|
ProjectCollaboration_Partisipasi ProjectCollaboration_Partisipasi[]
|
||||||
|
ProjectCollaboration_RoomChat ProjectCollaboration_RoomChat[]
|
||||||
}
|
}
|
||||||
|
|
||||||
model MasterUserRole {
|
model MasterUserRole {
|
||||||
@@ -719,3 +722,68 @@ model Forum_ReportKomentar {
|
|||||||
User User? @relation(fields: [userId], references: [id])
|
User User? @relation(fields: [userId], references: [id])
|
||||||
userId String?
|
userId String?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========================================= PROJECT COLLABORATION ========================================= //
|
||||||
|
|
||||||
|
model ProjectCollaboration {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
isActive Boolean @default(true)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
catatan String?
|
||||||
|
title String
|
||||||
|
lokasi String
|
||||||
|
purpose String @db.Text
|
||||||
|
benefit String @db.Text
|
||||||
|
|
||||||
|
ProjectCollaborationMaster_Industri ProjectCollaborationMaster_Industri? @relation(fields: [projectCollaborationMaster_IndustriId], references: [id])
|
||||||
|
projectCollaborationMaster_IndustriId Int?
|
||||||
|
Author User? @relation(fields: [userId], references: [id])
|
||||||
|
userId String?
|
||||||
|
ProjectCollaborationMaster_Status ProjectCollaborationMaster_Status? @relation(fields: [projectCollaborationMaster_StatusId], references: [id])
|
||||||
|
projectCollaborationMaster_StatusId Int? @default(1)
|
||||||
|
ProjectCollaboration_Partisipasi ProjectCollaboration_Partisipasi[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model ProjectCollaborationMaster_Industri {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
isActive Boolean @default(true)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
name String
|
||||||
|
|
||||||
|
ProjectCollaboration ProjectCollaboration[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model ProjectCollaborationMaster_Status {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
name String
|
||||||
|
isActive Boolean @default(true)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
ProjectCollaboration ProjectCollaboration[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model ProjectCollaboration_Partisipasi {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
isActive Boolean @default(true)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
User User? @relation(fields: [userId], references: [id])
|
||||||
|
userId String?
|
||||||
|
ProjectCollaboration ProjectCollaboration? @relation(fields: [projectCollaborationId], references: [id])
|
||||||
|
projectCollaborationId String?
|
||||||
|
ProjectCollaboration_RoomChat ProjectCollaboration_RoomChat? @relation(fields: [projectCollaboration_RoomChatId], references: [id])
|
||||||
|
projectCollaboration_RoomChatId String?
|
||||||
|
}
|
||||||
|
|
||||||
|
model ProjectCollaboration_RoomChat {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
isActive Boolean @default(true)
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
Author User? @relation(fields: [userId], references: [id])
|
||||||
|
userId String?
|
||||||
|
ProjectCollaboration_Partisipasi ProjectCollaboration_Partisipasi[]
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import voting_status from "../../../bin/seeder/voting/master_status.json";
|
|||||||
import master_status from "../../../bin/seeder/master_status.json";
|
import master_status from "../../../bin/seeder/master_status.json";
|
||||||
import forum_kategori_report from "../../../bin/seeder/forum/master_report.json";
|
import forum_kategori_report from "../../../bin/seeder/forum/master_report.json";
|
||||||
import forum_status_posting from "../../../bin/seeder/forum/master_status.json";
|
import forum_status_posting from "../../../bin/seeder/forum/master_status.json";
|
||||||
|
import collaboration_industri from "../../../bin/seeder/colab/master_industri.json";
|
||||||
|
import collaboration_status from "../../../bin/seeder/colab/master_status.json";
|
||||||
|
|
||||||
export async function GET(req: Request) {
|
export async function GET(req: Request) {
|
||||||
const dev = new URL(req.url).searchParams.get("dev");
|
const dev = new URL(req.url).searchParams.get("dev");
|
||||||
@@ -360,6 +362,34 @@ export async function GET(req: Request) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return NextResponse.json({ success: true });
|
return NextResponse.json({ success: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import { Colab_Create } from "@/app_modules/colab";
|
import { Colab_Create } from "@/app_modules/colab";
|
||||||
|
import colab_funGetMasterIndustri from "@/app_modules/colab/fun/master/fun_get_master_industri";
|
||||||
|
import colab_funGetMasterStatus from "@/app_modules/colab/fun/master/fun_get_master_status";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
|
const listIndustri = await colab_funGetMasterIndustri();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Colab_Create />
|
<Colab_Create listIndustri={listIndustri as any} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
import ComponentColab_HeaderTamplate from "@/app_modules/colab/component/header_tamplate";
|
|
||||||
import { AppShell } from "@mantine/core";
|
|
||||||
import React from "react";
|
|
||||||
|
|
||||||
export default async function Layout({
|
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
children: React.ReactNode;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<AppShell
|
|
||||||
header={<ComponentColab_HeaderTamplate title="Partisipasi Proyek" />}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</AppShell>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { Colab_PartisipasiProyek } from "@/app_modules/colab";
|
|
||||||
|
|
||||||
export default async function Page() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Colab_PartisipasiProyek />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,23 @@ import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
|||||||
import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core";
|
import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { MODEL_COLLABORATION_MASTER } from "../model/interface";
|
||||||
|
import colab_funCreateProyek from "../fun/create/fun_create_proyek";
|
||||||
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||||
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||||
|
|
||||||
export default function Colab_Create() {
|
export default function Colab_Create({
|
||||||
|
listIndustri,
|
||||||
|
}: {
|
||||||
|
listIndustri: MODEL_COLLABORATION_MASTER[];
|
||||||
|
}) {
|
||||||
|
const [value, setValue] = useState({
|
||||||
|
title: "",
|
||||||
|
lokasi: "",
|
||||||
|
purpose: "",
|
||||||
|
benefit: "",
|
||||||
|
projectCollaborationMaster_IndustriId: 0,
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack px={"sm"}>
|
<Stack px={"sm"}>
|
||||||
@@ -13,22 +28,40 @@ export default function Colab_Create() {
|
|||||||
label="Judul"
|
label="Judul"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
placeholder="Masukan judul proyek"
|
placeholder="Masukan judul proyek"
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
title: val.currentTarget.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextInput
|
<TextInput
|
||||||
label="Lokasi"
|
label="Lokasi"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
placeholder="Masukan lokasi proyek"
|
placeholder="Masukan lokasi proyek"
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
lokasi: val.currentTarget.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
placeholder="Pilih kategori industri"
|
placeholder="Pilih kategori industri"
|
||||||
label="Pilih Industri"
|
label="Pilih Industri"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
data={[
|
data={listIndustri.map((e) => ({
|
||||||
{ value: "1", label: "Teknologi" },
|
value: e.id,
|
||||||
{ value: "2", label: "Tambang Batu Bara" },
|
label: e.name,
|
||||||
]}
|
}))}
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
projectCollaborationMaster_IndustriId: val as any,
|
||||||
|
});
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Textarea
|
<Textarea
|
||||||
@@ -36,6 +69,12 @@ export default function Colab_Create() {
|
|||||||
placeholder="Masukan tujuan proyek"
|
placeholder="Masukan tujuan proyek"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
minRows={5}
|
minRows={5}
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
purpose: val.currentTarget.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Textarea
|
<Textarea
|
||||||
@@ -43,20 +82,33 @@ export default function Colab_Create() {
|
|||||||
placeholder="Masukan keuntungan dalam proyek"
|
placeholder="Masukan keuntungan dalam proyek"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
minRows={5}
|
minRows={5}
|
||||||
|
onChange={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
benefit: val.currentTarget.value,
|
||||||
|
});
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<ButtonAction />
|
<ButtonAction value={value} />
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ButtonAction() {
|
function ButtonAction({ value }: { value: any }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
async function onSave() {
|
async function onSave() {
|
||||||
setLoading(true);
|
await colab_funCreateProyek(value).then((res) => {
|
||||||
router.back();
|
if (res.status === 201) {
|
||||||
|
setLoading(true);
|
||||||
|
router.back();
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(res.message)
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
27
src/app_modules/colab/fun/create/fun_create_proyek.ts
Normal file
27
src/app_modules/colab/fun/create/fun_create_proyek.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||||
|
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
|
||||||
|
|
||||||
|
export default async function colab_funCreateProyek(
|
||||||
|
value: MODEL_COLLABORATION
|
||||||
|
) {
|
||||||
|
const Author = await User_getUserId();
|
||||||
|
console.log(Author);
|
||||||
|
|
||||||
|
const create = await prisma.projectCollaboration.create({
|
||||||
|
data: {
|
||||||
|
title: value.title,
|
||||||
|
lokasi: value.lokasi,
|
||||||
|
purpose: value.purpose,
|
||||||
|
benefit: value.benefit,
|
||||||
|
projectCollaborationMaster_IndustriId:
|
||||||
|
value.projectCollaborationMaster_IndustriId,
|
||||||
|
userId: Author
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!create) return { status: 400, message: "Gagal Membuat Proyek" };
|
||||||
|
return { status: 201, message: "Berhasil Membuar Proyek" };
|
||||||
|
}
|
||||||
5
src/app_modules/colab/fun/get/get_list_all_proyek.ts
Normal file
5
src/app_modules/colab/fun/get/get_list_all_proyek.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
"use server"
|
||||||
|
|
||||||
|
export default async function colab_getListAllProyek() {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export default async function colab_funGetMasterIndustri() {
|
||||||
|
const data = await prisma.projectCollaborationMaster_Industri.findMany({});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
|
export default async function colab_funGetMasterStatus() {
|
||||||
|
const data = await prisma.projectCollaborationMaster_Status.findMany({});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
27
src/app_modules/colab/model/interface.ts
Normal file
27
src/app_modules/colab/model/interface.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { MODEL_USER } from "@/app_modules/home/model/interface";
|
||||||
|
|
||||||
|
export interface MODEL_COLLABORATION_MASTER {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
isActive: boolean;
|
||||||
|
createdAt: Date;
|
||||||
|
updatedAt: Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MODEL_COLLABORATION {
|
||||||
|
id: string;
|
||||||
|
isActive: boolean;
|
||||||
|
createdAt: Date;
|
||||||
|
updatedAt: Date;
|
||||||
|
catatan: string;
|
||||||
|
title: string;
|
||||||
|
lokasi: string;
|
||||||
|
purpose: string;
|
||||||
|
benefit: string;
|
||||||
|
ProjectCollaborationMaster_Industri: MODEL_COLLABORATION_MASTER[];
|
||||||
|
projectCollaborationMaster_IndustriId: number;
|
||||||
|
Author: MODEL_USER;
|
||||||
|
ProjectCollaborationMaster_Status: MODEL_COLLABORATION_MASTER[];
|
||||||
|
projectCollaborationMaster_StatusId: number
|
||||||
|
// ProjectCollaboration_Partisipasi
|
||||||
|
}
|
||||||
26
src/bin/seeder/colab/master_industri.json
Normal file
26
src/bin/seeder/colab/master_industri.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Software Developer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"name": "Makanan & Minuman"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"name": "Kosmetik"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"name": "Furniture"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"name": "Kendaraan"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"name": "Kesehatan"
|
||||||
|
}
|
||||||
|
]
|
||||||
14
src/bin/seeder/colab/master_status.json
Normal file
14
src/bin/seeder/colab/master_status.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Publish"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"name": "Review"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"name": "Reject"
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user