#Job admin

- Tampilan user done
- Tampilan admin done
git commit -m
This commit is contained in:
2024-02-28 16:22:45 +08:00
parent fb7e89fb44
commit 83d2b0a1c4
114 changed files with 3572 additions and 375 deletions

View File

@@ -18,8 +18,18 @@
"@mantine/hooks": "^6.0.17", "@mantine/hooks": "^6.0.17",
"@mantine/next": "^6.0.17", "@mantine/next": "^6.0.17",
"@mantine/notifications": "^6.0.17", "@mantine/notifications": "^6.0.17",
"@mantine/tiptap": "^7.5.3",
"@prisma/client": "^5.0.0", "@prisma/client": "^5.0.0",
"@tabler/icons-react": "^2.38.0", "@tabler/icons-react": "^2.38.0",
"@tiptap/extension-highlight": "^2.2.3",
"@tiptap/extension-link": "^2.2.3",
"@tiptap/extension-subscript": "^2.2.3",
"@tiptap/extension-superscript": "^2.2.3",
"@tiptap/extension-text-align": "^2.2.3",
"@tiptap/extension-underline": "^2.2.3",
"@tiptap/pm": "^2.2.3",
"@tiptap/react": "^2.2.3",
"@tiptap/starter-kit": "^2.2.3",
"@types/lodash": "^4.14.199", "@types/lodash": "^4.14.199",
"@types/node": "20.4.5", "@types/node": "20.4.5",
"@types/react": "18.2.17", "@types/react": "18.2.17",
@@ -43,6 +53,7 @@
"react-countdown": "^2.3.5", "react-countdown": "^2.3.5",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-fast-marquee": "^1.6.4", "react-fast-marquee": "^1.6.4",
"react-quill": "^2.0.0",
"react-responsive-carousel": "^3.2.23", "react-responsive-carousel": "^3.2.23",
"react-simple-toasts": "^5.10.0", "react-simple-toasts": "^5.10.0",
"react-toastify": "^9.1.3", "react-toastify": "^9.1.3",

View File

@@ -2,7 +2,7 @@
// learn more about it in the docs: https://pris.ly/d/prisma-schema // learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client { generator client {
provider = "prisma-client-js" provider = "prisma-client-js"
engineType = "binary" engineType = "binary"
} }
@@ -30,7 +30,8 @@ model User {
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[]
} }
model MasterUserRole { model MasterUserRole {
@@ -88,6 +89,7 @@ model Images {
Donasi_PencairanDana Donasi_PencairanDana[] Donasi_PencairanDana Donasi_PencairanDana[]
Donasi_Invoice Donasi_Invoice[] Donasi_Invoice Donasi_Invoice[]
Portofolio Portofolio[] Portofolio Portofolio[]
Job Job[]
} }
model ImagesBackground { model ImagesBackground {
@@ -141,6 +143,15 @@ model MasterBidangBisnis {
Portofolio Portofolio[] Portofolio Portofolio[]
} }
model MasterStatus {
id String @id @default(cuid())
name String
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Job Job[]
}
// -------------------- INVESTASI --------------------- // // -------------------- INVESTASI --------------------- //
// Table investasi / saham // Table investasi / saham
model Investasi { model Investasi {
@@ -555,7 +566,7 @@ model Voting {
Voting_Status Voting_Status? @relation(fields: [voting_StatusId], references: [id]) Voting_Status Voting_Status? @relation(fields: [voting_StatusId], references: [id])
voting_StatusId String? @default("2") voting_StatusId String? @default("2")
Voting_DaftarNamaVote Voting_DaftarNamaVote[] Voting_DaftarNamaVote Voting_DaftarNamaVote[]
Voting_Kontributor Voting_Kontributor[] Voting_Kontributor Voting_Kontributor[]
} }
model Voting_Status { model Voting_Status {
@@ -575,8 +586,8 @@ model Voting_DaftarNamaVote {
createdAt DateTime @default(now()) createdAt DateTime @default(now())
updatedAt DateTime @updatedAt updatedAt DateTime @updatedAt
Voting Voting? @relation(fields: [votingId], references: [id]) Voting Voting? @relation(fields: [votingId], references: [id])
votingId String? votingId String?
Voting_Kontributor Voting_Kontributor[] Voting_Kontributor Voting_Kontributor[]
} }
@@ -592,5 +603,25 @@ model Voting_Kontributor {
authorId String? authorId String?
Voting_DaftarNamaVote Voting_DaftarNamaVote? @relation(fields: [voting_DaftarNamaVoteId], references: [id]) Voting_DaftarNamaVote Voting_DaftarNamaVote? @relation(fields: [voting_DaftarNamaVoteId], references: [id])
voting_DaftarNamaVoteId String? voting_DaftarNamaVoteId String?
}
// ========================================= JOB ========================================= //
model Job {
id String @id @default(cuid())
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
isArsip Boolean @default(false)
catatan String?
title String
content String @db.Text
deskripsi String @db.Text
Images Images? @relation(fields: [imagesId], references: [id])
imagesId String?
Author User? @relation(fields: [authorId], references: [id])
authorId String?
MasterStatus MasterStatus? @relation(fields: [masterStatusId], references: [id])
masterStatusId String? @default("2")
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@@ -0,0 +1,32 @@
import prisma from "@/app/lib/prisma";
import fs from "fs";
import { NextRequest, NextResponse } from "next/server";
export async function GET(
req: NextRequest,
{ params }: { params: { id: string } }
) {
const get = await prisma.images.findUnique({
where: {
id: params.id,
},
select: {
url: true,
},
});
if (!fs.existsSync(`./public/job/${get?.url}`)) {
const notFile = fs.readFileSync("./public/aset/global/no-file.png");
return new NextResponse(notFile, {
headers: {
"Content-Type": "image/png",
},
});
}
const file = fs.readFileSync(`./public/job/${get?.url}`);
return new NextResponse(file, {
headers: {
"Content-Type": "image/png",
},
});
}

View File

@@ -18,6 +18,7 @@ import donasi_status_invoice from "../../../bin/seeder/donasi/master_status_invo
import event_status from "../../../bin/seeder/event/master_status.json"; import event_status from "../../../bin/seeder/event/master_status.json";
import event_tipe_acara from "../../../bin/seeder/event/master_tipe_acara.json"; import event_tipe_acara from "../../../bin/seeder/event/master_tipe_acara.json";
import voting_status from "../../../bin/seeder/voting/master_status.json"; import voting_status from "../../../bin/seeder/voting/master_status.json";
import master_status from "../../../bin/seeder/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");
@@ -312,6 +313,21 @@ export async function GET(req: Request) {
}); });
} }
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,
},
});
}
return NextResponse.json({ success: true }); return NextResponse.json({ success: true });
} }

View File

@@ -0,0 +1,13 @@
import AdminJob_TableArsip from "@/app_modules/admin/job/child/arsip";
import { AdminJob_getListTableByStatusId } from "@/app_modules/admin/job/fun/get/get_list_table_by_status_id";
export default async function Page() {
const dataJob = await AdminJob_getListTableByStatusId("0")
return (
<>
<AdminJob_TableArsip dataVote={dataJob} />
</>
);
}

View File

@@ -0,0 +1,12 @@
import { AdminJob_TablePublish } from "@/app_modules/admin/job";
import { AdminJob_getListTableByStatusId } from "@/app_modules/admin/job/fun/get/get_list_table_by_status_id";
export default async function Page() {
const listPublish = await AdminJob_getListTableByStatusId("1")
// console.log(listPublish)
return (
<>
<AdminJob_TablePublish dataVote={listPublish} />
</>
);
}

View File

@@ -0,0 +1,13 @@
import { AdminJob_TableReject } from "@/app_modules/admin/job";
import { AdminJob_getListTableByStatusId } from "@/app_modules/admin/job/fun/get/get_list_table_by_status_id";
export default async function Page() {
const listReject = await AdminJob_getListTableByStatusId("4");
return (
<>
<AdminJob_TableReject dataVote={listReject} />
</>
);
}

View File

@@ -0,0 +1,11 @@
import { AdminJob_TableReview } from "@/app_modules/admin/job";
import { AdminJob_getListTableByStatusId } from "@/app_modules/admin/job/fun/get/get_list_table_by_status_id";
export default async function Page() {
const listReview = await AdminJob_getListTableByStatusId("2");
return (
<>
<AdminJob_TableReview dataVote={listReview} />
</>
);
}

View File

@@ -0,0 +1,23 @@
import { AdminJob_Main } from "@/app_modules/admin/job";
import { AdminJob_funCountStatusByStatusId } from "@/app_modules/admin/job/fun/count/fun_count_job_by_status_id";
export default async function Page() {
const countPublish = await AdminJob_funCountStatusByStatusId("1")
const countReview = await AdminJob_funCountStatusByStatusId("2");
const countReject = await AdminJob_funCountStatusByStatusId("4");
const countArsip = await AdminJob_funCountStatusByStatusId("0")
return (
<>
<AdminJob_Main
countPublish={countPublish as number}
countReview={countReview as number}
countReject={countReject as number}
countArsip={countArsip as number}
/>
</>
);
}

View File

@@ -1,10 +1,12 @@
import { User_getUserId } from "@/app_modules/fun_global/get_user_token"; import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
import { HomeLayout } from "@/app_modules/home"; import { HomeLayout } from "@/app_modules/home";
import { User_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id"; import { User_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
import { redirect } from "next/navigation";
export default async function Layout({ children }: { children: any }) { export default async function Layout({ children }: { children: any }) {
const userId = await User_getUserId(); const userId = await User_getUserId();
const dataUser = await User_getOneById(userId); const dataUser = await User_getOneById(userId);
return ( return (
<> <>
<HomeLayout dataUser={dataUser as any}>{children}</HomeLayout> <HomeLayout dataUser={dataUser as any}>{children}</HomeLayout>

View File

@@ -0,0 +1,12 @@
import { Job_DetailArsip } from "@/app_modules/job";
import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({params}:{params: {id: string}}) {
let jobId = params.id
const dataJob = await Job_getOneById(jobId)
return (
<>
<Job_DetailArsip dataJob={dataJob as any} />
</>
);
}

View File

@@ -1,9 +0,0 @@
import { Job_DetailArsip } from "@/app_modules/job";
export default async function Page() {
return (
<>
<Job_DetailArsip />
</>
);
}

View File

@@ -3,12 +3,15 @@ import React from "react";
export default async function Layout({ export default async function Layout({
children, children,
params
}: { }: {
children: React.ReactNode; children: React.ReactNode;
params: {id: string}
}) { }) {
let jobId = params.id
return ( return (
<> <>
<LayoutJob_DetailDraft>{children}</LayoutJob_DetailDraft> <LayoutJob_DetailDraft jobId={jobId}>{children}</LayoutJob_DetailDraft>
</> </>
); );
} }

View File

@@ -0,0 +1,14 @@
import Job_DetailDraft from "@/app_modules/job/detail/draft/view";
import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({params}: {params: {id: string}}) {
let jobId = params.id
const dataJob = await Job_getOneById(jobId)
return (
<>
<Job_DetailDraft dataJob={dataJob as any} />
</>
);
}

View File

@@ -1,10 +0,0 @@
import Job_DetailDraft from "@/app_modules/job/detail/draft/view";
export default async function Page() {
return (
<>
<Job_DetailDraft />
</>
);
}

View File

@@ -0,0 +1,13 @@
import { Job_MainDetail } from "@/app_modules/job";
import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
const jobId = params.id;
const dataJob = await Job_getOneById(jobId)
return (
<>
<Job_MainDetail dataJob={dataJob as any} />
</>
);
}

View File

@@ -1,9 +0,0 @@
import { Job_MainDetail } from "@/app_modules/job";
export default async function Page() {
return (
<>
<Job_MainDetail />
</>
);
}

View File

@@ -0,0 +1,13 @@
import { Job_DetailPublish } from "@/app_modules/job";
import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({params}: {params: {id: string}}) {
let jobId = params.id
const dataJob = await Job_getOneById(jobId)
return (
<>
<Job_DetailPublish dataJob={dataJob as any} />
</>
);
}

View File

@@ -1,9 +0,0 @@
import { Job_DetailPublish } from "@/app_modules/job";
export default async function Page() {
return (
<>
<Job_DetailPublish />
</>
);
}

View File

@@ -0,0 +1,14 @@
import Job_DetailReject from "@/app_modules/job/detail/reject/view";
import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({params}: {params: {id: string}}) {
let jobId = params.id
const dataJob = await Job_getOneById(jobId)
return (
<>
<Job_DetailReject dataJob={dataJob as any} />
</>
);
}

View File

@@ -1,10 +0,0 @@
import Job_DetailReject from "@/app_modules/job/detail/reject/view";
export default async function Page() {
return (
<>
<Job_DetailReject/>
</>
);
}

View File

@@ -0,0 +1,18 @@
import Job_DetailReview from "@/app_modules/job/detail/review/view";
import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
import React from "react";
export default async function Page({
params,
}: {
params: { id: React.ReactNode };
}) {
let jobId = params.id;
const dataJob = await Job_getOneById(jobId)
return (
<>
<Job_DetailReview dataJob={dataJob as any} />
</>
);
}

View File

@@ -1,9 +0,0 @@
import Job_DetailReview from "@/app_modules/job/detail/review/view";
export default async function Page() {
return (
<>
<Job_DetailReview />
</>
);
}

View File

@@ -0,0 +1,13 @@
import { Job_Edit } from "@/app_modules/job";
import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let jobId = params.id;
const dataJob = await Job_getOneById(jobId);
return (
<>
<Job_Edit dataJob={dataJob as any} />
</>
);
}

View File

@@ -1,9 +0,0 @@
import { Job_Edit } from "@/app_modules/job";
export default async function Page() {
return (
<>
<Job_Edit />
</>
);
}

View File

@@ -1,9 +1,12 @@
import { Job_Arsip } from "@/app_modules/job"; import { Job_Arsip } from "@/app_modules/job";
import { Job_getListAllArsipById } from "@/app_modules/job/fun/get/get_list_all_arsip";
export default async function Page() { export default async function Page() {
const dataJob = await Job_getListAllArsipById()
return ( return (
<> <>
<Job_Arsip /> <Job_Arsip dataJob={dataJob as any}/>
</> </>
); );
} }

View File

@@ -1,9 +1,12 @@
import { Job_Beranda } from "@/app_modules/job"; import { Job_Beranda } from "@/app_modules/job";
import { Job_getAllListPublish } from "@/app_modules/job/fun/get/get_list_all_publish";
export default async function Page() { export default async function Page() {
const listJob = await Job_getAllListPublish();
return ( return (
<> <>
<Job_Beranda /> <Job_Beranda listJob={listJob as any} />
</> </>
); );
} }

View File

@@ -1,13 +1,21 @@
import { Job_Status } from "@/app_modules/job"; import { Job_Status } from "@/app_modules/job";
import { Job_getListStatusByStatusId } from "@/app_modules/job/fun/get/get_list_status_by_status_id";
export default async function Page() { export default async function Page() {
const listPublish = await Job_getListStatusByStatusId("1");
const listReview = await Job_getListStatusByStatusId("2");
const listDraft = await Job_getListStatusByStatusId("3");
const listReject = await Job_getListStatusByStatusId("4");
return ( return (
<> <>
<Job_Status <Job_Status
listDraft={[]} listDraft={listDraft as any}
listPublish={[]} listPublish={listPublish as any}
listReject={[]} listReject={listReject as any}
listReview={[]} listReview={listReview as any}
/> />
</> </>
); );

View File

@@ -0,0 +1,13 @@
import { Job_NonUserView } from "@/app_modules/job";
import { Job_getOneById } from "@/app_modules/job/fun/get/get_one_by_id";
export default async function Page({ params }: { params: { id: string } }) {
let jobId = params.id;
const dataJob = await Job_getOneById(jobId);
return (
<>
<Job_NonUserView data={dataJob as any} />
</>
);
}

View File

@@ -1,9 +0,0 @@
import { Job_NonUserView } from "@/app_modules/job";
export default async function page() {
return (
<>
<Job_NonUserView />
</>
);
}

View File

@@ -0,0 +1,7 @@
export const RouterAdminJob = {
main: "/dev/admin/job/main",
table_publish: "/dev/admin/job/child/table_publish",
table_review: "/dev/admin/job/child/table_review",
table_reject: "/dev/admin/job/child/table_reject",
arsip: "/dev/admin/job/child/arsip",
};

View File

@@ -1,4 +1,8 @@
export const RouterJob = { export const RouterJob = {
//api
api_gambar: "/api/job/gambar/",
//spalsh
spalsh: "/dev/job/splash", spalsh: "/dev/job/splash",
// main // main
@@ -8,16 +12,16 @@ export const RouterJob = {
// create & edit // create & edit
create: "/dev/job/create", create: "/dev/job/create",
edit: "/dev/job/edit", edit: "/dev/job/edit/",
// detail // detail
main_detail: "/dev/job/detail/main", main_detail: "/dev/job/detail/main/",
detail_publish: "/dev/job/detail/publish", detail_publish: "/dev/job/detail/publish/",
detail_review: "/dev/job/detail/review", detail_review: "/dev/job/detail/review/",
detail_draft: "/dev/job/detail/draft", detail_draft: "/dev/job/detail/draft/",
detail_reject: "/dev/job/detail/reject", detail_reject: "/dev/job/detail/reject/",
detail_arsip: "/dev/job/detail/arsip", detail_arsip: "/dev/job/detail/arsip/",
// non user // non user
non_user_view: "/dev/job/non_user_view", non_user_view: "/dev/job/non_user_view/",
}; };

View File

@@ -0,0 +1,200 @@
"use client";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
import { AdminEvent_getListPesertaById } from "@/app_modules/admin/event/fun/get/get_list_peserta_by_id";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import {
MODEL_EVENT,
MODEL_EVENT_PESERTA,
} from "@/app_modules/event/model/interface";
import { MODEL_JOB } from "@/app_modules/job/model/interface";
import {
MODEL_VOTE_KONTRIBUTOR,
MODEL_VOTING,
MODEL_VOTING_DAFTAR_NAMA_VOTE,
} from "@/app_modules/vote/model/interface";
import {
Avatar,
Badge,
Box,
Button,
Card,
Center,
Divider,
Grid,
Group,
Modal,
Paper,
ScrollArea,
Spoiler,
Stack,
Table,
Text,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconEyeCheck, IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function AdminJob_TableArsip({
dataVote,
}: {
dataVote?: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy: Table Arsip" />
<TableStatus listArsip={dataVote} />
</Stack>
</>
);
}
function TableStatus({ listArsip }: { listArsip: MODEL_JOB[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listArsip);
const [img, setImg] = useState("");
const TableRows = data?.map((e, i) => (
<tr key={i}>
<td>
<Spoiler
w={200}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={150}>
{e.imagesId ? (
<Button
color="green"
radius={"xl"}
leftIcon={<IconEyeCheck />}
onClick={() => {
setImg(e.imagesId);
open();
}}
>
Lihat
</Button>
) : (
<Center w={150}>
<Text fw={"bold"} fz={"xs"} fs={"italic"}>
Tidak ada poster
</Text>
</Center>
)}
</Center>
</td>
<td>
<Spoiler
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.content }} />
</Spoiler>
</td>
<td>
<Spoiler
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.deskripsi }} />
</Spoiler>
</td>
</tr>
));
return (
<>
<Modal
opened={opened}
onClose={close}
size={"xl"}
withCloseButton={false}
>
{/* <ComponentAdminVote_DetailHasil
hasil={hasil}
kontributor={kontributor}
/> */}
</Modal>
<Box>
<Box bg={"gray.1"} p={"xs"}>
<Title order={6} c={"gray"}>
ARSIP
</Title>
</Box>
<ScrollArea w={"100%"}>
<Table
withBorder
verticalSpacing={"md"}
horizontalSpacing={"xl"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Poster</Center>
</th>
<th>
<Center>Syarat Ketentuan</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center>
{_.isEmpty(TableRows) ? (
<Center h={"50vh"}>
<Title order={6}>Tidak Ada Data</Title>
</Center>
) : (
""
)}
</Center>
</Box>
</>
);
}
async function onList(
voteId: string,
setHasil: any,
setKontributor: any,
setLoading: any,
open: any
) {
// await AdminVote_getHasilById(voteId).then((res) => {
// setHasil(res);
// setLoading(false);
// });
// await AdminVote_getListKontributorById(voteId).then((res) => {
// setKontributor(res);
// setLoading(false);
// });
open();
}

View File

@@ -0,0 +1,171 @@
"use client";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
import { MODEL_JOB } from "@/app_modules/job/model/interface";
import {
Avatar,
Badge,
Box,
Button,
Card,
Center,
Divider,
Grid,
Group,
Image,
Modal,
Paper,
ScrollArea,
Spoiler,
Stack,
Table,
Text,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconBan, IconEyeCheck, IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
export default function AdminJob_TablePublish({
dataVote,
}: {
dataVote?: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy: Table Publish" />
<TableStatus listReview={dataVote} />
</Stack>
</>
);
}
function TableStatus({ listReview }: { listReview: MODEL_JOB[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listReview);
const [img, setImg] = useState("");
const TableRows = data?.map((e, i) => (
<tr key={i}>
<td>
<Spoiler
w={200}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={150}>
{e.imagesId ? (
<Button
color="green"
radius={"xl"}
leftIcon={<IconEyeCheck />}
onClick={() => {
setImg(e.imagesId);
open();
}}
>
Lihat
</Button>
) : (
<Center w={150}>
<Text fw={"bold"} fz={"xs"} fs={"italic"}>
Tidak ada poster
</Text>
</Center>
)}
</Center>
</td>
<td>
<Spoiler
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.content }} />
</Spoiler>
</td>
<td>
<Spoiler
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.deskripsi }} />
</Spoiler>
</td>
</tr>
));
return (
<>
<Modal opened={opened} onClose={close} withCloseButton={false} centered>
<Center>
<Image
alt="Foto"
src={RouterJob.api_gambar + img}
mah={500}
maw={300}
/>
</Center>
</Modal>
<Box>
<Box bg={"green.1"} p={"xs"}>
<Title order={6} c={"green"}>
PUBLISH
</Title>
</Box>
<ScrollArea w={"100%"}>
<Table
withBorder
verticalSpacing={"md"}
horizontalSpacing={"xl"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Poster</Center>
</th>
<th>
<Center>Syarat Ketentuan</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center>
{_.isEmpty(TableRows) ? (
<Center h={"50vh"}>
<Title order={6}>Tidak Ada Data</Title>
</Center>
) : (
""
)}
</Center>
</Box>
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
</>
);
}

View File

@@ -0,0 +1,251 @@
"use client";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
import { MODEL_JOB } from "@/app_modules/job/model/interface";
import {
Avatar,
Badge,
Box,
Button,
Card,
Center,
Divider,
Grid,
Group,
Image,
Modal,
Paper,
ScrollArea,
Spoiler,
Stack,
Table,
Text,
Textarea,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconBan, IconEyeCheck, IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { AdminJob_funEditCatatanById } from "../../fun/edit/fun_edit_catatan_by_id";
import { AdminJob_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
export default function AdminJob_TableReject({ dataVote }: { dataVote?: any }) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy: Table Reject" />
<TableStatus listReject={dataVote} />
</Stack>
</>
);
}
function TableStatus({ listReject }: { listReject: MODEL_JOB[] }) {
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listReject);
const [reject, setReject] = useState(false);
const [img, setImg] = useState("");
const [jobId, setJobId] = useState("");
const [catatan, setCatatan] = useState("");
const TableRows = data?.map((e, i) => (
<tr key={i}>
<td>
<Spoiler
w={200}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={150}>
{e.imagesId ? (
<Button
color="green"
radius={"xl"}
leftIcon={<IconEyeCheck />}
onClick={() => {
setImg(e.imagesId);
open();
}}
>
Lihat
</Button>
) : (
<Center w={150}>
<Text fw={"bold"} fz={"xs"} fs={"italic"}>
Tidak ada poster
</Text>
</Center>
)}
</Center>
</td>
<td>
<Spoiler
w={400}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.content }} />
</Spoiler>
</td>
<td>
<Spoiler
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.deskripsi }} />
</Spoiler>
</td>
<td>
<Spoiler
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
{e.catatan}
</Spoiler>
</td>
<td>
<Button
color={"red"}
leftIcon={<IconBan />}
radius={"xl"}
onClick={() => {
setReject(true);
setJobId(e.id);
setCatatan(e.catatan);
}}
>
Reject
</Button>
</td>
</tr>
));
return (
<>
<Modal opened={opened} onClose={close} withCloseButton={false} centered>
<Center>
<Image
alt="Foto"
src={RouterJob.api_gambar + img}
mah={500}
maw={300}
/>
</Center>
</Modal>
<Modal
opened={reject}
onClose={() => {
setReject(false);
}}
withCloseButton={false}
size={"lg"}
centered
>
<Stack>
<Textarea
minRows={2}
maxRows={5}
maxLength={300}
autosize
label="Alasan Penolakan"
placeholder="Masukkan alasan penolakan lowongan ini"
value={catatan}
onChange={(val) => setCatatan(val.currentTarget.value)}
/>
<Group position="right">
<Button
radius={"xl"}
onClick={() => {
onReject(jobId, catatan, setData);
setReject(false);
}}
>
Simpan
</Button>
</Group>
</Stack>
</Modal>
<Box>
<Box bg={"red.1"} p={"xs"}>
<Title order={6} c={"red"}>
REJECT
</Title>
</Box>
<ScrollArea w={"100%"}>
<Table
withBorder
verticalSpacing={"md"}
horizontalSpacing={"xl"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Poster</Center>
</th>
<th>
<Center>Syarat Ketentuan</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Catatan</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center>
{_.isEmpty(TableRows) ? (
<Center h={"50vh"}>
<Title order={6}>Tidak Ada Data</Title>
</Center>
) : (
""
)}
</Center>
</Box>
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
</>
);
}
async function onReject(jobId: string, catatan: string, setData: any) {
await AdminJob_funEditCatatanById(jobId, catatan).then(async (res) => {
if (res.status === 200) {
await AdminJob_getListTableByStatusId("4").then((val) => {
setData(val);
ComponentGlobal_NotifikasiBerhasil(res.message);
});
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}

View File

@@ -0,0 +1,263 @@
"use client";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component/header_tamplate";
import { MODEL_JOB } from "@/app_modules/job/model/interface";
import {
Avatar,
Badge,
Box,
Button,
Card,
Center,
Divider,
Grid,
Group,
Image,
Modal,
Paper,
ScrollArea,
Spoiler,
Stack,
Table,
Text,
Textarea,
Title,
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconBan, IconEyeCheck, IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { AdminJob_funEditStatusPublishById } from "../../fun/edit/fun_edit_status_publish_by_id";
import { AdminJob_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { AdminJob_funEditCatatanById } from "../../fun/edit/fun_edit_catatan_by_id";
export default function AdminJob_TableReview({ dataVote }: { dataVote?: any }) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy: Table Review" />
<TableStatus listReview={dataVote} />
</Stack>
</>
);
}
function TableStatus({ listReview }: { listReview: MODEL_JOB[] }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listReview);
const [reject, setReject] = useState(false);
const [img, setImg] = useState("");
const [jobId, setJobId] = useState("");
const [catatan, setCatatan] = useState("");
const TableRows = data?.map((e, i) => (
<tr key={i}>
<td>
<Spoiler
w={200}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={150}>
{e.imagesId ? (
<Button
color="green"
radius={"xl"}
leftIcon={<IconEyeCheck />}
onClick={() => {
setImg(e.imagesId);
open();
}}
>
Lihat
</Button>
) : (
<Center w={150}>
<Text fw={"bold"} fz={"xs"} fs={"italic"}>
Tidak ada poster
</Text>
</Center>
)}
</Center>
</td>
<td>
<Spoiler
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.content }} />
</Spoiler>
</td>
<td>
<Spoiler
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.deskripsi }} />
</Spoiler>
</td>
<td>
<Stack>
<Stack align="center">
<Button
color={"green"}
leftIcon={<IconEyeShare />}
radius={"xl"}
onClick={() => onPublish(e.id, setData)}
>
Publish
</Button>
<Button
color={"red"}
leftIcon={<IconBan />}
radius={"xl"}
onClick={() => {
setReject(true);
setJobId(e.id);
}}
>
Reject
</Button>
</Stack>
</Stack>
</td>
</tr>
));
return (
<>
<Modal opened={opened} onClose={close} withCloseButton={false} centered>
<Center>
<Image
alt="Foto"
src={RouterJob.api_gambar + img}
mah={500}
maw={300}
/>
</Center>
</Modal>
<Modal
opened={reject}
onClose={() => {
setReject(false);
}}
withCloseButton={false}
size={"lg"}
centered
>
<Stack>
<Textarea
minRows={2}
maxRows={5}
maxLength={300}
autosize
label="Alasan Penolakan"
placeholder="Masukkan alasan penolakan lowongan ini"
onChange={(val) => setCatatan(val.currentTarget.value)}
/>
<Group position="right">
<Button
radius={"xl"}
onClick={() => {
onReject(jobId, catatan, setData);
setReject(false);
}}
>
Simpan
</Button>
</Group>
</Stack>
</Modal>
<Box>
<Box bg={"orange.1"} p={"xs"}>
<Title order={6} c={"orange"}>
REVIEW
</Title>
</Box>
<ScrollArea w={"100%"}>
<Table
withBorder
verticalSpacing={"md"}
horizontalSpacing={"xl"}
p={"md"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Judul</Center>
</th>
<th>
<Center>Poster</Center>
</th>
<th>
<Center>Syarat Ketentuan</Center>
</th>
<th>
<Center>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center>
{_.isEmpty(TableRows) ? (
<Center h={"50vh"}>
<Title order={6}>Tidak Ada Data</Title>
</Center>
) : (
""
)}
</Center>
</Box>
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
</>
);
}
async function onPublish(jobId: string, setData: any) {
await AdminJob_funEditStatusPublishById(jobId).then(async (res) => {
if (res.status === 200) {
await AdminJob_getListTableByStatusId("2").then((res) => {
setData(res);
ComponentGlobal_NotifikasiBerhasil("Berhasil Update");
});
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
async function onReject(jobId: string, catatan: string, setData: any) {
await AdminJob_funEditCatatanById(jobId, catatan).then(async (res) => {
if (res.status === 200) {
await AdminJob_getListTableByStatusId("2").then((val) => {
setData(val);
ComponentGlobal_NotifikasiBerhasil(res.message);
});
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}

View File

@@ -0,0 +1,44 @@
"use server";
import prisma from "@/app/lib/prisma";
export async function AdminJob_funCountStatusByStatusId(statusId: string) {
if (statusId === "0") {
const data = await prisma.job.count({
where: {
masterStatusId: "1",
isArsip: true,
},
});
return data;
}
if (statusId === "1") {
const data = await prisma.job.count({
where: {
masterStatusId: "1",
isArsip: false,
},
});
return data;
}
if (statusId === "2") {
const data = await prisma.job.count({
where: {
masterStatusId: "2",
},
});
return data;
}
if (statusId === "4") {
const data = await prisma.job.count({
where: {
masterStatusId: "4",
},
});
return data;
}
}

View File

@@ -0,0 +1,23 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function AdminJob_funEditCatatanById(
jobId: string,
catatan: string
) {
const up = await prisma.job.update({
where: {
id: jobId,
},
data: {
masterStatusId: "4",
catatan: catatan,
},
});
if (!up) return { status: 400, message: "Gagal reject" };
revalidatePath("/dev/admin/job/child/table_review");
return { status: 200, message: "Berhasil reject" };
}

View File

@@ -0,0 +1,20 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function AdminJob_funEditStatusPublishById(jobId: string) {
const updt = await prisma.job.update({
where: {
id: jobId,
},
data: {
masterStatusId: "1",
},
});
if(!updt) return {status: 400, message: "Update Gagal"}
revalidatePath("/dev/admin/job/child/table_review");
return {status: 200, message: "Berhasil Update"}
}

View File

@@ -0,0 +1,114 @@
"use server";
import prisma from "@/app/lib/prisma";
export async function AdminJob_getListTableByStatusId(statusId: string) {
if (statusId === "0") {
const getData = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "1",
isActive: true,
isArsip: true,
},
select: {
id: true,
title: true,
isActive: true,
isArsip: true,
createdAt: true,
updatedAt: true,
content: true,
deskripsi: true,
catatan: true,
authorId: true,
Author: true,
imagesId: true,
},
});
return getData;
}
if (statusId === "1") {
const getData = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "1",
isActive: true,
isArsip: false,
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
content: true,
deskripsi: true,
catatan: true,
authorId: true,
Author: true,
imagesId: true,
},
});
return getData;
}
if (statusId === "2") {
const getData = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "2",
isActive: true,
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
content: true,
deskripsi: true,
catatan: true,
authorId: true,
Author: true,
imagesId: true,
},
});
return getData;
}
if (statusId === "4") {
const getData = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "4",
isActive: true,
},
select: {
id: true,
title: true,
isActive: true,
createdAt: true,
updatedAt: true,
content: true,
deskripsi: true,
catatan: true,
authorId: true,
Author: true,
imagesId: true,
},
});
return getData;
}
}

View File

@@ -0,0 +1,6 @@
import AdminJob_Main from "./main";
import AdminJob_TablePublish from "./child/table_publish";
import AdminJob_TableReview from "./child/table_review";
import AdminJob_TableReject from "./child/table_reject";
export { AdminJob_Main, AdminJob_TablePublish, AdminJob_TableReview, AdminJob_TableReject };

View File

@@ -0,0 +1,80 @@
"use client";
import { Group, Paper, SimpleGrid, Stack, Text, Title } from "@mantine/core";
import ComponentAdminGlobal_HeaderTamplate from "../../component/header_tamplate";
import { useRouter } from "next/navigation";
export default function AdminJob_Main({
countPublish,
countReview,
countReject,
countArsip,
}: {
countPublish: number;
countReview: number;
countReject: number;
countArsip: number
}) {
const router = useRouter();
const listStatus = [
{
id: 1,
name: "Publish",
jumlah: countPublish,
color: "green",
},
{
id: 2,
name: "Review",
jumlah: countReview,
color: "orange",
},
{
id: 3,
name: "Reject",
jumlah: countReject,
color: "red",
},
{
id: 4,
name: "Arsip",
jumlah: countArsip,
color: "gray",
},
];
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy" />
<SimpleGrid
cols={4}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
]}
>
{listStatus.map((e, i) => (
<Paper
key={i}
bg={`${e.color}.2`}
shadow="md"
radius="md"
p="md"
// sx={{ borderColor: e.color, borderStyle: "solid" }}
>
<Group position="center">
<Stack align="center" spacing={0}>
<Text>{e.name}</Text>
<Title>{e.jumlah ? e.jumlah : 0}</Title>
</Stack>
</Group>
</Paper>
))}
</SimpleGrid>
</Stack>
</>
);
}

View File

@@ -22,7 +22,7 @@ import {
import React, { useState } from "react"; import React, { useState } from "react";
import ComponentGlobal_HeaderTamplate from "../component_global/header_tamplate"; import ComponentGlobal_HeaderTamplate from "../component_global/header_tamplate";
import { useDisclosure } from "@mantine/hooks"; import { useDisclosure } from "@mantine/hooks";
import { IconLetterH, IconLogout } from "@tabler/icons-react"; import { IconCircleDot, IconCircleDotFilled, IconHome, IconLetterH, IconLogout } from "@tabler/icons-react";
import { import {
RouterAdminAward, RouterAdminAward,
RouterAdminDashboard, RouterAdminDashboard,
@@ -38,6 +38,8 @@ import Admin_Logout from "./component/logout";
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event"; import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
import _ from "lodash"; import _ from "lodash";
import { listAdminPage } from "./list_page"; import { listAdminPage } from "./list_page";
import { RouterAdminVote } from "@/app/lib/router_admin/router_admin_vote";
import { RouterAdminJob } from "@/app/lib/router_admin/router_admin_job";
export default function AdminLayout({ export default function AdminLayout({
children, children,
@@ -50,6 +52,8 @@ export default function AdminLayout({
const [active, setActive] = useAtom(gs_admin_hotMenu); const [active, setActive] = useAtom(gs_admin_hotMenu);
const [activeChild, setActiveChild] = useAtom(gs_admin_subMenu); const [activeChild, setActiveChild] = useAtom(gs_admin_subMenu);
const navbarItems = listAdminPage.map((e, i) => ( const navbarItems = listAdminPage.map((e, i) => (
<Box key={e.id}> <Box key={e.id}>
<NavLink <NavLink
@@ -59,7 +63,8 @@ export default function AdminLayout({
}, },
}} }}
fw={active === e.id ? "bold" : "normal"} fw={active === e.id ? "bold" : "normal"}
label={<Text size={"md"}>{e.name}</Text>} icon={e.icon}
label={<Text size={"sm"}>{e.name}</Text>}
onClick={() => { onClick={() => {
setActive(e.id); setActive(e.id);
setActiveChild(null); setActiveChild(null);
@@ -81,6 +86,7 @@ export default function AdminLayout({
}} }}
fw={activeChild === v.id ? "bold" : "normal"} fw={activeChild === v.id ? "bold" : "normal"}
label={<Text>{v.name}</Text>} label={<Text>{v.name}</Text>}
icon={activeChild === v.id ? <IconCircleDotFilled size={10}/> : <IconCircleDot size={10}/> }
onClick={() => { onClick={() => {
setActive(e.id); setActive(e.id);
setActiveChild(v.id); setActiveChild(v.id);
@@ -98,9 +104,10 @@ export default function AdminLayout({
return ( return (
<> <>
<AppShell <AppShell
padding="sm" padding="md"
navbarOffsetBreakpoint="md" navbarOffsetBreakpoint="md"
asideOffsetBreakpoint="sm" asideOffsetBreakpoint="sm"
navbar={ navbar={
<MediaQuery smallerThan={"md"} styles={{ display: "none" }}> <MediaQuery smallerThan={"md"} styles={{ display: "none" }}>
<Navbar <Navbar

View File

@@ -1,34 +1,48 @@
import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event"; import { RouterAdminEvent } from "@/app/lib/router_admin/router_admin_event";
import { RouterAdminJob } from "@/app/lib/router_admin/router_admin_job";
import { RouterAdminVote } from "@/app/lib/router_admin/router_admin_vote"; import { RouterAdminVote } from "@/app/lib/router_admin/router_admin_vote";
import { import {
RouterAdminDashboard, RouterAdminDashboard,
RouterAdminDonasi, RouterAdminDonasi,
RouterAdminInvestasi, RouterAdminInvestasi,
} from "@/app/lib/router_hipmi/router_admin"; } from "@/app/lib/router_hipmi/router_admin";
import { IconBriefcase } from "@tabler/icons-react";
import {
IconHeartHandshake,
IconHome,
IconMoneybag,
IconPackageImport,
IconPresentation,
} from "@tabler/icons-react";
export const listAdminPage = [ export const listAdminPage = [
{ {
id: 1, id: 1,
name: "Main Dashboard", name: "Main Dashboard",
path: RouterAdminDashboard.main_admin, path: RouterAdminDashboard.main_admin,
icon: <IconHome />,
child: [], child: [],
}, },
{ {
id: 2, id: 2,
name: "Investasi", name: "Investasi",
path: RouterAdminInvestasi.main_investasi, path: RouterAdminInvestasi.main_investasi,
icon: <IconMoneybag />,
child: [], child: [],
}, },
{ {
id: 3, id: 3,
name: "Donasi", name: "Donasi",
path: RouterAdminDonasi.main_donasi, path: RouterAdminDonasi.main_donasi,
icon: <IconHeartHandshake />,
child: [], child: [],
}, },
{ {
id: 4, id: 4,
name: "Event", name: "Event",
path: "", path: "",
icon: <IconPresentation />,
child: [ child: [
{ {
id: 41, id: 41,
@@ -66,6 +80,7 @@ export const listAdminPage = [
id: 5, id: 5,
name: "Voting", name: "Voting",
path: "", path: "",
icon: <IconPackageImport />,
child: [ child: [
{ {
id: 51, id: 51,
@@ -94,4 +109,37 @@ export const listAdminPage = [
}, },
], ],
}, },
{
id: 6,
name: "Job Vacancy",
path: "",
icon: <IconBriefcase />,
child: [
{
id: 61,
name: "Dashboard",
path: RouterAdminJob.main,
},
{
id: 62,
name: "Table Publish",
path: RouterAdminJob.table_publish,
},
{
id: 63,
name: "Table Review",
path: RouterAdminJob.table_review,
},
{
id: 64,
name: "Table Reject",
path: RouterAdminJob.table_reject,
},
{
id: 65,
name: "Arsip",
path: RouterAdminJob.arsip,
},
],
},
]; ];

View File

@@ -79,15 +79,7 @@ export default function AdminVote_Main({
</Paper> </Paper>
))} ))}
</SimpleGrid> </SimpleGrid>
<SimpleGrid
cols={4}
spacing="lg"
breakpoints={[
{ maxWidth: "62rem", cols: 4, spacing: "lg" },
{ maxWidth: "48rem", cols: 2, spacing: "sm" },
{ maxWidth: "36rem", cols: 1, spacing: "sm" },
]}
></SimpleGrid>
</Stack> </Stack>
</> </>
); );

View File

@@ -3,7 +3,7 @@ import { notifications } from "@mantine/notifications";
import { IconAlertTriangle } from "@tabler/icons-react"; import { IconAlertTriangle } from "@tabler/icons-react";
/** /**
* *
* @param text | masukan text untuk peringatan * @param text | masukan text untuk peringatan
* @type string * @type string
* @returns notifikasi peringatan * @returns notifikasi peringatan
@@ -18,13 +18,23 @@ export async function ComponentGlobal_NotifikasiPeringatan(
<Text fw={"bold"}>{text}</Text> <Text fw={"bold"}>{text}</Text>
</Center> </Center>
), ),
color: "yellow.3", color: "yellow.1",
radius: "md", radius: "md",
autoClose: durasi ? durasi : 1000, autoClose: durasi ? durasi : 1000,
style: {
borderWidth: "0.5px",
borderStyle: "solid",
borderColor: "red"
},
icon: ( icon: (
<ActionIcon radius={"xl"} bg={"white"} p={3}> <ActionIcon variant="transparent" radius={"xl"} p={3}>
<IconAlertTriangle color="red" /> <IconAlertTriangle
color="red"
style={{ backgroundColor: "transparent" }}
/>
</ActionIcon> </ActionIcon>
), ),
withCloseButton: false, withCloseButton: false,
@@ -32,7 +42,7 @@ export async function ComponentGlobal_NotifikasiPeringatan(
styles: (theme) => ({ styles: (theme) => ({
description: { color: theme.white }, description: { color: theme.white },
root: { root: {
backgroundColor: theme.colors.yellow[7], backgroundColor: theme.colors.orange[5],
}, },
}), }),
}); });

View File

@@ -82,7 +82,7 @@ export default function HomeLayout({
<Grid.Col <Grid.Col
span={"auto"} span={"auto"}
onClick={() => { onClick={() => {
if (user.Profile === null) { if (user?.Profile === null) {
ComponentGlobal_NotifikasiPeringatan("Lengkapi Profile"); ComponentGlobal_NotifikasiPeringatan("Lengkapi Profile");
} else { } else {
// router.push(RouterProfile.katalog + `${user.Profile.id}`); // router.push(RouterProfile.katalog + `${user.Profile.id}`);
@@ -102,7 +102,7 @@ export default function HomeLayout({
<Grid.Col <Grid.Col
span={"auto"} span={"auto"}
onClick={() => { onClick={() => {
if (user.Profile === null) { if (user?.Profile === null) {
router.push(RouterProfile.create + `${user.id}`); router.push(RouterProfile.create + `${user.id}`);
} else { } else {
router.push(RouterProfile.katalog + `${user.Profile.id}`); router.push(RouterProfile.katalog + `${user.Profile.id}`);
@@ -111,7 +111,7 @@ export default function HomeLayout({
> >
<Stack align="center" spacing={2}> <Stack align="center" spacing={2}>
<ActionIcon variant={"transparent"}> <ActionIcon variant={"transparent"}>
{user.Profile === null ? ( {user?.Profile === null ? (
<IconUserCircle color="white" /> <IconUserCircle color="white" />
) : ( ) : (
<Avatar <Avatar
@@ -124,7 +124,7 @@ export default function HomeLayout({
}} }}
src={ src={
RouterProfile.api_foto_profile + RouterProfile.api_foto_profile +
`${user.Profile.imagesId}` `${user?.Profile.imagesId}`
} }
/> />
)} )}

View File

@@ -0,0 +1,40 @@
"use client";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { Card, Center, Grid, Image, Text } from "@mantine/core";
import { useRouter } from "next/navigation";
export default function ComponentJob_CardPreview({ path }: { path: string }) {
const router = useRouter();
return (
<>
<Card
shadow="lg"
withBorder
radius={"md"}
p={20}
onClick={() => {
router.push(path);
}}
>
<Card.Section px={"sm"}>
<Grid>
<Grid.Col span={"content"}>
<Image
height={100}
width={80}
alt="foto"
src={"/aset/no-file.png"}
/>
</Grid.Col>
<Grid.Col span={"auto"}>
<Center h={"100%"}>
<Text fw={"bold"}>Judul Lowongan kerja</Text>
</Center>
</Grid.Col>
</Grid>
</Card.Section>
</Card>
</>
);
}

View File

@@ -1,16 +1,19 @@
"use client"; "use client";
import { Stack, Card, Grid, Image, Text } from "@mantine/core"; import { Stack, Card, Grid, Image, Text, Center } from "@mantine/core";
import _ from "lodash"; import _ from "lodash";
import ComponentJob_IsEmptyData from "./is_empty_data"; import ComponentJob_IsEmptyData from "./is_empty_data";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import { MODEL_JOB } from "../model/interface";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { IconChevronRight } from "@tabler/icons-react";
export default function ComponentJob_CardViewStatus({ export default function ComponentJob_CardViewStatus({
listData, listData,
path, path,
}: { }: {
listData?: any[]; listData?: MODEL_JOB[];
path?: any; path?: any;
}) { }) {
const router = useRouter(); const router = useRouter();
@@ -30,33 +33,25 @@ export default function ComponentJob_CardViewStatus({
shadow="lg" shadow="lg"
withBorder withBorder
radius={"md"} radius={"md"}
p={20}
onClick={() => { onClick={() => {
if (path === undefined) { if (path === undefined) {
return ComponentGlobal_NotifikasiPeringatan( return ComponentGlobal_NotifikasiPeringatan(
"Path tidak ditemukan" "Path tidak ditemukan"
); );
} else { } else {
router.push(path); router.push(path + e.id);
} }
}} }}
> >
<Card.Section> <Card.Section px={"sm"}>
<Grid> <Grid>
<Grid.Col span={6}> <Grid.Col span={"auto"}>
<Image alt="foto" src={"/aset/no-file.png"} /> <Center h={"100%"}>
</Grid.Col> <Text fw={"bold"} lineClamp={1}>
<Grid.Col span={6}> {e.title}
<Stack justify="center" h={"100%"}>
<Text fw={"bold"} fz={20} truncate>
Judul Lowongan Kerja
</Text> </Text>
<Text lineClamp={3}> </Center>
Lorem ipsum dolor sit amet consectetur, adipisicing elit.
Laboriosam est id neque iste voluptatem consequuntur
veritatis dolorem illo et, repellat praesentium maiores
amet omnis voluptas aliquid tenetur nam sint obcaecati.
</Text>
</Stack>
</Grid.Col> </Grid.Col>
</Grid> </Grid>
</Card.Section> </Card.Section>

View File

@@ -1,11 +1,55 @@
"use client" "use client";
import { Card, Stack, Skeleton, Image, Text } from "@mantine/core"; import { Card, Stack, Skeleton, Image, Text, Center } from "@mantine/core";
import { MODEL_JOB } from "../../model/interface";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
export default function ComponentJob_DetailData({
data,
}: {
data?: MODEL_JOB;
}) {
return (
<>
{/* <pre>{JSON.stringify(data, null, 2)}</pre> */}
{data ? (
<Card shadow="lg" withBorder p={30}>
<Card.Section px={"xs"} pb={"lg"}>
<Stack spacing={"xl"}>
{data.imagesId ? (
<Stack align="center">
<Image
alt=""
src={
data.imagesId ? RouterJob.api_gambar + data.imagesId : ""
}
height={300}
width={200}
/>
</Stack>
) : (
""
)}
export default function ComponentJob_DetailData(){ <Stack>
return ( <Center>
<> <Text fz={20} fw={"bold"}>
{data.title}
</Text>
</Center>
<Stack spacing={0}>
<Text>
<div dangerouslySetInnerHTML={{ __html: data.content }} />
</Text>
<Text>
<div dangerouslySetInnerHTML={{ __html: data.deskripsi }} />
</Text>
</Stack>
</Stack>
</Stack>
</Card.Section>
</Card>
) : (
<Card shadow="lg" withBorder p={30}> <Card shadow="lg" withBorder p={30}>
<Card.Section px={"xs"} pb={"lg"}> <Card.Section px={"xs"} pb={"lg"}>
<Stack spacing={"xl"}> <Stack spacing={"xl"}>
@@ -44,6 +88,7 @@ export default function ComponentJob_DetailData(){
</Stack> </Stack>
</Card.Section> </Card.Section>
</Card> </Card>
</> )}
); </>
} );
}

View File

@@ -0,0 +1,61 @@
"use client";
import { Center, Stack } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import dynamic from "next/dynamic";
import React, { useState } from "react";
const ReactQuill = dynamic(
() => {
return import("react-quill");
},
{ ssr: false }
);
import "react-quill/dist/quill.snow.css";
export default function Demo() {
const [value, setValue] = useState("");
const [udah, setUdah] = useState(false);
// useShallowEffect(() => {
// if (window && window.document) setUdah(true);
// }, []);
// if (!udah) return <><Center></Center></>;
return (
<Stack>
<ReactQuill
defaultValue={`<h2 ">Judul Lowongan Kerja</h2>
<p "><br></p>
<p><strong>Syarat &amp; Ketentuan :</strong></p>
<ol>
<li>Minimal pendidika SMA / Sederajat</li>
<li>Pasif berbahasa inggris </li>
<li>Dll,.</li>
</ol>
<p></br></p>
<p><strong>Deskripsi :</strong></p>
<p>Jika berminat dapat menghubungi WA berikut</p>
<p>+6281 xxx xxx xx</p>
<p>Kirim CV anda melalui email berikut</p>
<p>@test-hipmi.com</p>
<p>Atau kunjungi website kami:</p>
<p><a href="https://test-hipmi.wibudev.com/" rel="noopener noreferrer" target="_blank">https://test-hipmi.wibudev.com/</a></p>
`}
modules={{
toolbar: [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
["bold", "italic", "underline", "link"],
// [{ align: [] }],
[{ list: "ordered" }, { list: "bullet" }],
["clean"],
],
}}
theme="snow"
onChange={setValue}
/>
{/* {value}
<div dangerouslySetInnerHTML={{ __html: value }} /> */}
</Stack>
);
}

View File

@@ -6,14 +6,18 @@ import {
Box, Box,
Button, Button,
Center, Center,
FileButton,
Flex, Flex,
Group,
Image, Image,
Loader,
Paper,
Stack, Stack,
Text, Text,
TextInput, TextInput,
Textarea, Textarea,
} from "@mantine/core"; } from "@mantine/core";
import { IconCamera } from "@tabler/icons-react"; import { IconCamera, IconUpload } from "@tabler/icons-react";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import _ from "lodash"; import _ from "lodash";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
@@ -21,78 +25,247 @@ import { useState } from "react";
import { gs_job_hot_menu, gs_job_status } from "../global_state"; import { gs_job_hot_menu, gs_job_status } from "../global_state";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import "react-quill/dist/quill.snow.css";
import dynamic from "next/dynamic";
import { useShallowEffect, useToggle } from "@mantine/hooks";
import { Job_funCreate } from "../fun/create/fun_create";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { MODEL_JOB } from "../model/interface";
import toast from "react-simple-toasts";
import ComponentJob_NotedBox from "../component/detail/noted_box";
const ReactQuill = dynamic(
() => {
return import("react-quill");
},
{ ssr: false }
);
export default function Job_Create() { export default function Job_Create() {
const [value, setValue] = useState<any>(); const [value, setValue] = useState({
const [ambil, setAmbil] = useState<String[]>([]); title: "",
content: "",
deskripsi: "",
});
const [reload, setReload] = useState(false);
const [file, setFile] = useState<File | null>(null);
const [images, setImages] = useState<any | null>();
useShallowEffect(() => {
if (window && window.document) setReload(true);
}, []);
if (!reload)
return (
<>
<Center h={"50vh"}>
<Loader />
</Center>
</>
);
return ( return (
<> <>
{/* <Stack px={"sm"}> {!reload ? (
<Stack align="center"> <Center h={"50vh"}>
<Image alt="" src={"/aset/no-file.png"} mah={500} maw={200} /> <Loader />
<Button radius={"xl"} w={100}> </Center>
<IconCamera /> ) : (
</Button> <Stack px={"sm"} spacing={40}>
</Stack> <Stack align="center" spacing={"xs"}>
<Stack> {images ? (
{ambil.map((v, k) => ( <Image alt="" src={images} height={300} width={200} />
<Text key={k}> {v}</Text> ) : (
))} <Paper h={300} w={200} withBorder shadow="lg" bg={"gray.1"}>
</Stack> <Stack justify="center" align="center" h={"100%"}>
<Stack> <IconUpload color="gray" />
<TextInput <Text fz={10} fs={"italic"} c={"gray"} fw={"bold"}>
withAsterisk Upload Gambar
label="Judul" </Text>
placeholder="Masukan judul lowongan" </Stack>
onChange={(val) => {}} </Paper>
/> )}
<Textarea
minRows={5}
withAsterisk
label="Syarat dan Ketentuan"
placeholder={`Contoh ${"\n"}- Minimal lulusan SMA ${"\n"}- Pasif berbahasa inggris ${"\n"}- Dll,`}
onChange={(val) => {
const data = val.currentTarget.value.split("\n");
if (!_.isEmpty(data)) {
setAmbil(data);
}
}}
/>
<Textarea
minRows={5}
withAsterisk
label="Deskripsi"
placeholder="Lokasi, Alamat Email, Nomor yang dapat dihubungi"
onChange={(val) => {}}
/>
</Stack>
<ButtonAction /> <FileButton
</Stack> */} onChange={async (files: any | null) => {
try {
const buffer = URL.createObjectURL(
new Blob([new Uint8Array(await files.arrayBuffer())])
);
if (files.size > 20000) {
ComponentGlobal_NotifikasiPeringatan(
"Maaf, Ukuran file terlalu besar, maximum 20Mb",
3000
);
} else {
setImages(buffer);
setFile(files);
}
} catch (error) {
console.log(error);
}
}}
accept="image/png,image/jpeg"
>
{(props) => (
<Button
compact
{...props}
radius={"xl"}
variant="outline"
w={150}
>
<IconCamera />
</Button>
)}
</FileButton>
</Stack>
<ComponentJob_NotedBox informasi="Poster atau Gambar tidak wajib untuk di upload. Upload lah jika dirasa perlu." />
<Stack spacing={"lg"}>
<TextInput
withAsterisk
label="Judul"
placeholder="Masukan judul lowongan kerja"
onChange={(val) => {
setValue({
...value,
title: val.currentTarget.value,
});
}}
/>
<Stack spacing={3}>
<Text fz={"sm"}>
Syarat & Ketentuan
<Text inherit span c={"red"}>
{" "}
*
</Text>
</Text>
<ReactQuill
defaultValue={`
<p><strong>Syarat &amp; Ketentuan :</strong></p>
<ol>
<li>Minimal pendidika SMA / Sederajat</li>
<li>Pasif berbahasa inggris </li>
<li>Dll,.</li>
</ol>
<p></br></p>
`}
modules={{
toolbar: [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
["bold", "italic", "underline", "link"],
// [{ align: [] }],
[{ list: "ordered" }, { list: "bullet" }],
["clean"],
],
}}
theme="snow"
onChange={(val) => {
setValue({
...value,
content: val,
});
}}
/>
</Stack>
<Stack spacing={3}>
<Text fz={"sm"}>
Deskripsi
<Text inherit span c={"red"}>
{" "}
*
</Text>
</Text>
<ReactQuill
defaultValue={`
<p>
<strong>Deskripsi :</strong>
</p>
<p>Jika berminat dapat menghubungi WA berikut</p>
<p>+6281 xxx xxx xx</p>
<p>Kirim CV anda melalui email berikut</p>
<p>test-email@gmail.com</p>
<p>Atau kunjungi website kami:</p>
<p>
<a
href="https://test-hipmi.wibudev.com/"
rel="noopener noreferrer"
target="_blank"
>
https://test-hipmi.wibudev.com/
</a>
</p>
`}
modules={{
toolbar: [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
["bold", "italic", "underline", "link"],
// [{ align: [] }],
[{ list: "ordered" }, { list: "bullet" }],
["clean"],
],
}}
theme="snow"
onChange={(val) => {
setValue({
...value,
deskripsi: val,
});
}}
/>
</Stack>
</Stack>
<ButtonAction value={value as any} file={file as any} />
</Stack>
)}
</> </>
); );
} }
function ButtonAction() { function ButtonAction({ value, file }: { value: MODEL_JOB; file: FormData }) {
const router = useRouter(); const router = useRouter();
const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu); const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu);
const [status, setStatus] = useAtom(gs_job_status); const [status, setStatus] = useAtom(gs_job_status);
const [preview, setPreview] = useToggle();
async function onAction() {
const gambar = new FormData();
gambar.append("file", file as any);
// console.log(value)
await Job_funCreate(value as any, gambar).then((res) => {
if (res.status === 201) {
setHotMenu(2);
setStatus("Review");
router.replace(RouterJob.status);
ComponentGlobal_NotifikasiBerhasil("Tambah Lowongan Berhasil");
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
return ( return (
<> <>
<Button <Stack>
radius={"xl"} <Group grow mt={"lg"} mb={70}>
mt={"lg"} <Button
mb={70} w={"100%"}
onClick={() => { radius={"xl"}
router.replace(RouterJob.status); onClick={() => {
setHotMenu(2); onAction();
setStatus("Review"); }}
ComponentGlobal_NotifikasiBerhasil("Tambah Lowongan Berhasil"); >
}} Simpan
> </Button>
Simpan </Group>
</Button> </Stack>
</> </>
); );
} }

View File

@@ -1,14 +1,56 @@
"use client"; "use client";
import { Stack } from "@mantine/core"; import { Button, Stack } from "@mantine/core";
import ComponentJob_DetailData from "../../component/detail/detail_data"; import ComponentJob_DetailData from "../../component/detail/detail_data";
import { MODEL_JOB } from "../../model/interface";
import { useRouter } from "next/navigation";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { useAtom } from "jotai";
import { Job_funEditArsipById } from "../../fun/edit/fun_edit_arsip_by_id";
import { gs_job_status, gs_job_hot_menu } from "../../global_state";
export default function Job_DetailArsip() { export default function Job_DetailArsip({ dataJob }: { dataJob: MODEL_JOB }) {
return ( return (
<> <>
<Stack> <Stack>
<ComponentJob_DetailData /> <ComponentJob_DetailData data={dataJob} />
<ButtonAction jobId={dataJob.id} />
</Stack> </Stack>
</> </>
); );
} }
function ButtonAction({ jobId }: { jobId: string }) {
const router = useRouter();
const [status, setStatus] = useAtom(gs_job_status);
const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu);
async function onAction() {
await Job_funEditArsipById(jobId, false).then((res) => {
if (res.status === 200) {
setStatus("Publish");
setHotMenu(1);
ComponentGlobal_NotifikasiBerhasil("Berhasil Diarsipkan");
router.replace(RouterJob.beranda);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
return (
<>
<Button
radius={"xl"}
color="green"
mb={30}
onClick={() => {
onAction();
}}
>
Publish Lagi
</Button>
</>
);
}

View File

@@ -8,8 +8,10 @@ import { RouterJob } from "@/app/lib/router_hipmi/router_job";
export default function LayoutJob_DetailDraft({ export default function LayoutJob_DetailDraft({
children, children,
jobId,
}: { }: {
children: React.ReactNode; children: React.ReactNode;
jobId: string
}) { }) {
return ( return (
<> <>
@@ -18,7 +20,7 @@ export default function LayoutJob_DetailDraft({
<ComponentJob_HeaderTamplate <ComponentJob_HeaderTamplate
title="Detail Draft" title="Detail Draft"
icon={<IconEdit />} icon={<IconEdit />}
route2={RouterJob.edit} route2={RouterJob.edit + jobId}
/> />
} }
> >

View File

@@ -9,33 +9,55 @@ import ComponentJob_DetailData from "../../component/detail/detail_data";
import { gs_job_status } from "../../global_state"; import { gs_job_status } from "../../global_state";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useDisclosure } from "@mantine/hooks"; import { useDisclosure } from "@mantine/hooks";
import { Job_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_status_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { Job_funDeleteById } from "../../fun/delete/fun_delete_by_id";
import ComponentJob_NotedBox from "../../component/detail/noted_box";
import { MODEL_JOB } from "../../model/interface";
export default function Job_DetailDraft() { export default function Job_DetailDraft({ dataJob }: { dataJob: MODEL_JOB }) {
return ( return (
<> <>
<Stack> <Stack>
<ComponentJob_DetailData /> {dataJob.catatan ? (
<ButtonAction /> <ComponentJob_NotedBox informasi={dataJob.catatan} />
) : (
""
)}
<ComponentJob_DetailData data={dataJob} />
<ButtonAction jobId={dataJob.id} />
</Stack> </Stack>
</> </>
); );
} }
function ButtonAction() { function ButtonAction({ jobId }: { jobId: string }) {
const router = useRouter(); const router = useRouter();
const [status, setStatus] = useAtom(gs_job_status); const [status, setStatus] = useAtom(gs_job_status);
const [opened, { open, close }] = useDisclosure(); const [opened, { open, close }] = useDisclosure();
async function onAction() { async function onAction() {
router.push(RouterJob.status); await Job_funEditStatusByStatusId(jobId, "2").then((res) => {
setStatus("Review"); if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan"); setStatus("Review");
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan");
router.push(RouterJob.status);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
} }
async function onDelete() { async function onDelete() {
router.push(RouterJob.status); await Job_funDeleteById(jobId).then((res) => {
setStatus("Draft"); if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil("Berhasil Hapus Draft"); setStatus("Draft");
ComponentGlobal_NotifikasiBerhasil(res.message);
router.push(RouterJob.status);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
} }
return ( return (
@@ -67,7 +89,7 @@ function ButtonAction() {
</Paper> </Paper>
</Modal> </Modal>
<Group grow mb={50} > <Group grow mb={50}>
<Button <Button
radius={"xl"} radius={"xl"}
color="yellow" color="yellow"

View File

@@ -9,22 +9,21 @@ import { useAtom } from "jotai";
import { gs_job_status, gs_job_hot_menu } from "../../global_state"; import { gs_job_status, gs_job_hot_menu } from "../../global_state";
import Link from "next/link"; import Link from "next/link";
import { IconBrandWhatsapp } from "@tabler/icons-react"; import { IconBrandWhatsapp } from "@tabler/icons-react";
import { MODEL_JOB } from "../../model/interface";
export default function Job_MainDetail() { export default function Job_MainDetail({ dataJob }: { dataJob: MODEL_JOB }) {
return ( return (
<> <>
<Stack> <Stack>
<ComponentJob_DetailData /> <ComponentJob_DetailData data={dataJob} />
<ButtonAction /> <ButtonAction jobId={dataJob.id} />
</Stack> </Stack>
</> </>
); );
} }
function ButtonAction() { function ButtonAction({ jobId }: { jobId: string }) {
const router = useRouter(); const router = useRouter();
const [status, setStatus] = useAtom(gs_job_status);
const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu);
async function onAction() { async function onAction() {
// router.push(RouterJob.arsip); // router.push(RouterJob.arsip);
@@ -41,13 +40,15 @@ function ButtonAction() {
color="teal" color="teal"
mb={30} mb={30}
leftIcon={<IconBrandWhatsapp />} leftIcon={<IconBrandWhatsapp />}
onClick={() => { // onClick={() => {
onAction(); // onAction();
}} // }}
> >
<Link <Link
style={{ textDecoration: "none", color: "white" }} style={{ textDecoration: "none", color: "white" }}
href={`whatsapp://send?text=Job Vacancy HIPMI BADUNG : http://localhost:3000/dev/job/non_user_view`} href={`whatsapp://send?text=Job Vacancy HIPMI BADUNG : http://localhost:3000${
RouterJob.non_user_view + jobId
}`}
// href={`https://t.me/share/url?url={${"http://localhost:3000/dev/job/non_user_view"}}&text={Lowongan Kerja Ini}`} // href={`https://t.me/share/url?url={${"http://localhost:3000/dev/job/non_user_view"}}&text={Lowongan Kerja Ini}`}
> >
Bagikan ke WhatsApp Bagikan ke WhatsApp

View File

@@ -7,27 +7,38 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob
import { Stack, Button } from "@mantine/core"; import { Stack, Button } from "@mantine/core";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { gs_job_hot_menu, gs_job_status } from "../../global_state"; import { gs_job_hot_menu, gs_job_status } from "../../global_state";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import { Job_funEditArsipById } from "../../fun/edit/fun_edit_arsip_by_id";
import { MODEL_JOB } from "../../model/interface";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
export default function Job_DetailPublish() { export default function Job_DetailPublish({ dataJob }: { dataJob: MODEL_JOB }) {
return ( return (
<> <>
<Stack> <Stack>
<ComponentJob_DetailData /> <ComponentJob_DetailData data={dataJob as any} />
<ButtonAction /> <ButtonAction jobId={dataJob.id} />
</Stack> </Stack>
</> </>
); );
} }
function ButtonAction() { function ButtonAction({ jobId }: { jobId: string }) {
const router = useRouter(); const router = useRouter();
const [status, setStatus] = useAtom(gs_job_status); const [status, setStatus] = useAtom(gs_job_status);
const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu) const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu);
async function onAction() { async function onAction() {
router.push(RouterJob.arsip); await Job_funEditArsipById(jobId, true).then((res) => {
setStatus("Publish"); if (res.status === 200) {
setHotMenu(3) setStatus("Publish");
ComponentGlobal_NotifikasiBerhasil("Berhasil Diarsipkan"); setHotMenu(3);
ComponentGlobal_NotifikasiBerhasil("Berhasil Diarsipkan");
router.replace(RouterJob.arsip);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
} }
return ( return (
<> <>

View File

@@ -10,34 +10,50 @@ import { gs_job_status } from "../../global_state";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useDisclosure } from "@mantine/hooks"; import { useDisclosure } from "@mantine/hooks";
import ComponentJob_NotedBox from "../../component/detail/noted_box"; import ComponentJob_NotedBox from "../../component/detail/noted_box";
import { MODEL_JOB } from "../../model/interface";
import { Job_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_status_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { Job_funDeleteById } from "../../fun/delete/fun_delete_by_id";
export default function Job_DetailReject() { export default function Job_DetailReject({ dataJob }: { dataJob: MODEL_JOB }) {
return ( return (
<> <>
<Stack> <Stack>
<ComponentJob_NotedBox informasi="Alasan reject"/> <ComponentJob_NotedBox informasi={dataJob.catatan} />
<ComponentJob_DetailData /> <ComponentJob_DetailData data={dataJob} />
<ButtonAction /> <ButtonAction jobId={dataJob.id} />
</Stack> </Stack>
</> </>
); );
} }
function ButtonAction() { function ButtonAction({ jobId }: { jobId: string }) {
const router = useRouter(); const router = useRouter();
const [status, setStatus] = useAtom(gs_job_status); const [status, setStatus] = useAtom(gs_job_status);
const [opened, { open, close }] = useDisclosure(); const [opened, { open, close }] = useDisclosure();
async function onAction() { async function onAction() {
router.push(RouterJob.status); await Job_funEditStatusByStatusId(jobId, "3").then((res) => {
setStatus("Draft"); if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil("Masuk Draft"); router.push(RouterJob.status);
setStatus("Draft");
ComponentGlobal_NotifikasiBerhasil("Masuk Draft");
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
} }
async function onDelete() { async function onDelete() {
router.push(RouterJob.status); await Job_funDeleteById(jobId).then((res) => {
setStatus("Reject"); if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil("Berhasil Hapus Job"); router.push(RouterJob.status);
setStatus("Reject");
ComponentGlobal_NotifikasiBerhasil("Berhasil Hapus Job");
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
} }
return ( return (

View File

@@ -7,25 +7,36 @@ import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { gs_job_status } from "../../global_state"; import { gs_job_status } from "../../global_state";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { MODEL_JOB } from "../../model/interface";
import { Job_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_status_id";
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
export default function Job_DetailReview() {
export default function Job_DetailReview({ dataJob }: { dataJob: MODEL_JOB }) {
return ( return (
<> <>
<Stack> <Stack>
<ComponentJob_DetailData /> <ComponentJob_DetailData data={dataJob} />
<ButtonAction /> <ButtonAction jobId={dataJob.id} />
</Stack> </Stack>
</> </>
); );
} }
function ButtonAction() { function ButtonAction({ jobId }: { jobId: string }) {
const router = useRouter(); const router = useRouter();
const [status, setStatus] = useAtom(gs_job_status); const [status, setStatus] = useAtom(gs_job_status);
async function onAction() { async function onAction() {
router.push(RouterJob.status); await Job_funEditStatusByStatusId(jobId, "3").then((res) => {
setStatus("Draft"); if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil("Berhasil Dibatalkan"); setStatus("Draft");
ComponentGlobal_NotifikasiBerhasil("Berhasil Dibatalkan");
router.push(RouterJob.status);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
} }
return ( return (
<> <>

View File

@@ -2,82 +2,324 @@
import { RouterJob } from "@/app/lib/router_hipmi/router_job"; import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
import { Button, Image, Stack, Text, TextInput, Textarea } from "@mantine/core"; import {
import { IconCamera } from "@tabler/icons-react"; Box,
Button,
Center,
FileButton,
Group,
Image,
Loader,
Modal,
Paper,
Stack,
Text,
TextInput,
Textarea,
Title,
} from "@mantine/core";
import { IconCamera, IconUpload, IconXboxX } from "@tabler/icons-react";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import _ from "lodash"; import _ from "lodash";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { gs_job_hot_menu, gs_job_status } from "../global_state"; import { gs_job_hot_menu, gs_job_status } from "../global_state";
import { MODEL_JOB } from "../model/interface";
import {
useDisclosure,
useShallowEffect,
useWindowScroll,
} from "@mantine/hooks";
export default function Job_Edit() { import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
const [value, setValue] = useState<any>(); import { Job_EditById } from "../fun/edit/fun_edit_by_id";
const [ambil, setAmbil] = useState<String[]>([]); import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import dynamic from "next/dynamic";
const ReactQuill = dynamic(
() => {
return import("react-quill");
},
{ ssr: false }
);
export default function Job_Edit({ dataJob }: { dataJob: MODEL_JOB }) {
const [value, setValue] = useState(dataJob);
const [reload, setReload] = useState(false);
const [file, setFile] = useState<File | null>(null);
const [images, setImages] = useState<any | null>();
const [maxFile, setMaxFile] = useState(false);
useShallowEffect(() => {
if (window && window.document) setReload(true);
}, []);
if (!reload)
return (
<>
<Center h={"50vh"}>
<Loader />
</Center>
</>
);
return ( return (
<> <>
<Stack px={"sm"}> {!reload ? (
<Stack align="center"> <Center h={"50vh"}>
<Image alt="" src={"/aset/no-file.png"} mah={500} maw={200} /> <Loader />
<Button radius={"xl"} w={100} color="teal"> </Center>
<IconCamera /> ) : (
</Button> <Stack px={"sm"} spacing={40}>
<Stack align="center">
{images ? (
<Image alt="" src={images} mah={500} maw={200} />
) : value.imagesId ? (
<Image
height={300}
width={200}
alt="Foto"
src={RouterJob.api_gambar + value.imagesId}
/>
) : (
<Paper h={300} w={200} withBorder shadow="lg" bg={"gray.1"}>
<Stack justify="center" align="center" h={"100%"}>
<IconUpload color="gray" />
<Text fz={10} fs={"italic"} c={"gray"} fw={"bold"}>
Upload Gambar
</Text>
</Stack>
</Paper>
)
// <Box>
// {value.imagesId ? (
// <Image
// height={300}
// width={200}
// alt="Foto"
// src={RouterJob.api_gambar + value.imagesId}
// />
// ) : (
// <Box>
// {maxFile ? (
// <Paper
// h={300}
// w={200}
// withBorder
// shadow="lg"
// bg={"gray.1"}
// >
// <Stack justify="center" align="center" h={"100%"}>
// <IconXboxX color="#ed5858" size={50} />
// <Text
// fz={10}
// fs={"italic"}
// c={"red.5"}
// w={150}
// fw={"bold"}
// >
// Maaf, Ukuran file terlalu besar, maximum 10mb
// </Text>
// </Stack>
// </Paper>
// ) : (
// <Box>
// {images ? (
// <Image alt="" src={images} mah={300} maw={200} />
// ) : (
// <Paper
// h={300}
// w={200}
// withBorder
// shadow="lg"
// bg={"gray.1"}
// >
// <Stack justify="center" align="center" h={"100%"}>
// <IconUpload color="gray" />
// <Text
// fz={10}
// fs={"italic"}
// c={"gray"}
// fw={"bold"}
// >
// Upload Gambar
// </Text>
// </Stack>
// </Paper>
// )}
// </Box>
// )}
// </Box>
// )}
// </Box>
}
<FileButton
onChange={async (files: any | null) => {
try {
const buffer = URL.createObjectURL(
new Blob([new Uint8Array(await files.arrayBuffer())])
);
if (files.size > 20000) {
// setMaxFile(true);
ComponentGlobal_NotifikasiPeringatan(
"File tidak lebih dari 20Mb",
3000
);
} else {
// console.log(buffer, "ini buffer");
// console.log(files, " ini file");
// setMaxFile(false);
setImages(buffer);
setFile(files);
}
} catch (error) {
console.log(error);
}
}}
accept="image/png,image/jpeg"
>
{(props) => (
<Button
compact
{...props}
radius={"xl"}
variant="outline"
w={150}
>
<IconCamera />
</Button>
)}
</FileButton>
</Stack>
<Stack spacing={"lg"}>
<TextInput
withAsterisk
label="Judul"
placeholder="Masukan judul lowongan kerja"
value={value.title}
onChange={(val) => {
setValue({
...value,
title: val.currentTarget.value,
});
}}
/>
<Stack spacing={3}>
<Text fz={"sm"}>
Syarat & Ketentuan
<Text inherit span c={"red"}>
{" "}
*
</Text>
</Text>
<ReactQuill
modules={{
toolbar: [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
["bold", "italic", "underline", "link"],
// [{ align: [] }],
[{ list: "ordered" }, { list: "bullet" }],
["clean"],
],
}}
theme="snow"
value={value.content}
onChange={(val) => {
setValue({
...value,
content: val,
});
}}
/>
</Stack>
<Stack spacing={3}>
<Text fz={"sm"}>
Deskripsi
<Text inherit span c={"red"}>
{" "}
*
</Text>
</Text>
<ReactQuill
modules={{
toolbar: [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
["bold", "italic", "underline", "link"],
// [{ align: [] }],
[{ list: "ordered" }, { list: "bullet" }],
["clean"],
],
}}
theme="snow"
value={value.deskripsi}
onChange={(val) => {
setValue({
...value,
deskripsi: val,
});
}}
/>
</Stack>
</Stack>
<ButtonAction value={value as any} file={file as any} />
</Stack> </Stack>
<Stack> )}
{ambil.map((v, k) => (
<Text key={k}> {v}</Text>
))}
</Stack>
<Stack>
<TextInput
withAsterisk
label="Judul"
placeholder="Masukan judul lowongan"
onChange={(val) => {}}
/>
<Textarea
minRows={5}
withAsterisk
label="Syarat dan Ketentuan"
placeholder={`Contoh ${"\n"}- Minimal lulusan SMA ${"\n"}- Pasif berbahasa inggris ${"\n"}- Dll,`}
onChange={(val) => {
const data = val.currentTarget.value.split("\n");
if (!_.isEmpty(data)) {
setAmbil(data);
}
}}
/>
<Textarea
minRows={5}
withAsterisk
label="Deskripsi"
placeholder="Lokasi, Alamat Email, Nomor yang dapat dihubungi"
onChange={(val) => {}}
/>
</Stack>
<ButtonAction />
</Stack>
</> </>
); );
} }
function ButtonAction() { function ButtonAction({ value, file }: { value: MODEL_JOB; file: FormData }) {
const router = useRouter(); const router = useRouter();
const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu); const [hotMenu, setHotMenu] = useAtom(gs_job_hot_menu);
const [status, setStatus] = useAtom(gs_job_status); const [status, setStatus] = useAtom(gs_job_status);
const [opened, { open, close }] = useDisclosure(false);
const [scroll, scrollTo] = useWindowScroll();
async function onUpdate() {
const gambar = new FormData();
gambar.append("file", file as any);
await Job_EditById(value, gambar).then((res) => {
if (res.status === 200) {
setHotMenu(2);
setStatus("Draft");
ComponentGlobal_NotifikasiBerhasil(res.message);
router.back();
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
});
}
return ( return (
<> <>
<Modal opened={opened} onClose={close} centered withCloseButton={false}>
<Stack>
<Title order={6}>Anda yakin menyimpan data ini ?</Title>
<Group position="center">
<Button radius={"xl"} onClick={() => close()}>
Batal
</Button>
<Button color="teal" radius={"xl"} onClick={() => onUpdate()}>
Simpan
</Button>
</Group>
</Stack>
</Modal>
<Button <Button
color="teal" color="teal"
radius={"xl"} radius={"xl"}
mt={"lg"} mt={"lg"}
mb={70} mb={70}
onClick={() => { onClick={() => {
router.replace(RouterJob.status); open();
setHotMenu(2); scrollTo({ y: 0 });
setStatus("Review");
ComponentGlobal_NotifikasiBerhasil("Tambah Lowongan Berhasil");
}} }}
> >
Update Update

View File

@@ -0,0 +1,67 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
import _ from "lodash";
import { v4 } from "uuid";
import fs from "fs";
import { revalidatePath } from "next/cache";
import { MODEL_JOB } from "../../model/interface";
export async function Job_funCreate(req: MODEL_JOB, file: FormData) {
const authorId = await User_getUserId();
const dataImage: any = file.get("file");
if (dataImage !== "null") {
const fileName = dataImage.name;
const fileExtension = _.lowerCase(dataImage.name.split(".").pop());
const fRandomName = v4(fileName) + "." + fileExtension;
const upload = await prisma.images.create({
data: {
url: fRandomName,
label: "JOB",
},
select: {
id: true,
url: true,
},
});
if (!upload) return { status: 400, message: "Gagal upload gambar" };
const uploadFolder = Buffer.from(await dataImage.arrayBuffer());
fs.writeFileSync(`./public/job/${upload.url}`, uploadFolder);
const create = await prisma.job.create({
data: {
title: req.title,
content: req.content,
deskripsi: req.deskripsi,
authorId: authorId,
imagesId: upload.id,
},
});
if (!create) return { status: 400, message: "Gagal Disimpan" };
revalidatePath("/dev/job/main/status");
return {
status: 201,
message: "Berhasil Disimpan",
};
} else {
const create = await prisma.job.create({
data: {
title: req.title,
content: req.content,
deskripsi: req.deskripsi,
authorId: authorId,
},
});
if (!create) return { status: 400, message: "Gagal Disimpan" };
revalidatePath("/dev/job/main/status");
return {
status: 201,
message: "Berhasil Disimpan",
};
}
}

View File

@@ -0,0 +1,19 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function Job_funDeleteById(jobId: string) {
const del = await prisma.job.update({
where: {
id: jobId,
},
data: {
isActive: false,
},
});
if (!del) return { status: 400, message: "Gagal hapus" };
revalidatePath("/dev/job/main/status");
return { status: 200, message: "Berhasil hapus" };
}

View File

@@ -0,0 +1,21 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function Job_funEditArsipById(jobId: string, aktifasi: boolean) {
const updt = await prisma.job.update({
where: {
id: jobId,
},
data: {
isArsip: aktifasi,
},
});
if (!updt) return { status: 400, message: "Gagal Arsip" };
revalidatePath("/dev/job/main/arsip");
revalidatePath("/dev/job/main/status");
revalidatePath("/dev/job/main/beranda");
return { status: 200, message: "Berhasil Arsip" };
}

View File

@@ -0,0 +1,73 @@
"use server";
import prisma from "@/app/lib/prisma";
import _ from "lodash";
import { v4 } from "uuid";
import fs from "fs";
import { MODEL_JOB } from "../../model/interface";
import { revalidatePath } from "next/cache";
export async function Job_EditById(req: MODEL_JOB, file: FormData) {
// console.log(file);
// console.log(req);
// return { status: 200 };
const dataImage: any = file.get("file");
if (dataImage !== "null") {
const fileName = dataImage.name;
const fileExtension = _.lowerCase(dataImage.name.split(".").pop());
const fRandomName = v4(fileName) + "." + fileExtension;
const upload = await prisma.images.create({
data: {
url: fRandomName,
label: "JOB",
},
select: {
id: true,
url: true,
},
});
if (!upload) return { status: 400, message: "Gagal upload gambar" };
const uploadFolder = Buffer.from(await dataImage.arrayBuffer());
fs.writeFileSync(`./public/job/${upload.url}`, uploadFolder);
const updt = await prisma.job.update({
where: {
id: req.id,
},
data: {
title: req.title,
content: req.content,
deskripsi: req.deskripsi,
imagesId: upload.id,
},
});
if (!updt) return { status: 400, message: "Gagal Update" };
revalidatePath("/dev/job/detail/draft");
return {
status: 200,
message: "Berhasil Disimpan",
};
} else {
const updt = await prisma.job.update({
where: {
id: req.id,
},
data: {
title: req.title,
content: req.content,
deskripsi: req.deskripsi,
},
});
if (!updt) return { status: 400, message: "Gagal Update" };
revalidatePath("/dev/job/detail/draft");
return {
status: 200,
message: "Berhasil Disimpan",
};
}
}

View File

@@ -0,0 +1,22 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
export async function Job_funEditStatusByStatusId(
jobId: string,
statusId: string
) {
const updt = await prisma.job.update({
where: {
id: jobId,
},
data: {
masterStatusId: statusId,
},
});
if (!updt) return { status: 400, message: "Gagal ganti status" };
revalidatePath("/dev/job/main/status");
return { status: 200, message: "Berhasil ganti status" };
}

View File

@@ -0,0 +1,17 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export async function Job_getListAllArsipById() {
const authorId = await User_getUserId();
const get = await prisma.job.findMany({
where: {
authorId: authorId,
isArsip: true,
},
});
return get;
}

View File

@@ -0,0 +1,28 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export async function Job_getAllListPublish() {
const data = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "1",
isActive: true,
isArsip: false,
},
select: {
id: true,
title: true,
Author: {
select: {
Profile: true
}
}
}
});
return data;
}

View File

@@ -0,0 +1,68 @@
"use server";
import prisma from "@/app/lib/prisma";
import { User_getUserId } from "@/app_modules/fun_global/get_user_token";
export async function Job_getListStatusByStatusId(statusId: string) {
const authorId = await User_getUserId();
if (statusId === "1") {
const data = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "1",
authorId: authorId,
isActive: true,
isArsip: false
},
});
return data;
}
if (statusId === "2") {
const data = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "2",
authorId: authorId,
isActive: true,
},
});
return data;
}
if (statusId === "3") {
const data = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "3",
authorId: authorId,
isActive: true,
},
});
return data;
}
if (statusId === "4") {
const data = await prisma.job.findMany({
orderBy: {
updatedAt: "desc",
},
where: {
masterStatusId: "4",
authorId: authorId,
isActive: true,
},
});
return data;
}
}

View File

@@ -0,0 +1,13 @@
"use server";
import prisma from "@/app/lib/prisma";
export async function Job_getOneById(jobId: any) {
const get = await prisma.job.findFirst({
where: {
id: jobId,
},
});
return get;
}

View File

@@ -4,14 +4,18 @@ import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/a
import { Stack, Card, Grid, Image, Text } from "@mantine/core"; import { Stack, Card, Grid, Image, Text } from "@mantine/core";
import ComponentJob_CardViewStatus from "../component/card_view_status"; import ComponentJob_CardViewStatus from "../component/card_view_status";
import { RouterJob } from "@/app/lib/router_hipmi/router_job"; import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import ComponentJob_CardPreview from "../component/card_preview";
import { MODEL_JOB } from "../model/interface";
export default function Job_Arsip() { export default function Job_Arsip({ dataJob }: { dataJob :MODEL_JOB[]}) {
return ( return (
<> <>
<ComponentJob_CardViewStatus <ComponentJob_CardViewStatus
listData={[{ id: 1 }, { id: 2 }]} listData={dataJob}
path={RouterJob.detail_arsip} path={RouterJob.detail_arsip}
/> />
</> </>
); );
} }

View File

@@ -8,6 +8,7 @@ import {
ActionIcon, ActionIcon,
Affix, Affix,
Card, Card,
Center,
Grid, Grid,
Image, Image,
Stack, Stack,
@@ -17,8 +18,13 @@ import {
} from "@mantine/core"; } from "@mantine/core";
import { IconCirclePlus } from "@tabler/icons-react"; import { IconCirclePlus } from "@tabler/icons-react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { MODEL_JOB } from "../model/interface";
import ComponentJob_DetailData from "../component/detail/detail_data";
import ComponentJob_CardViewStatus from "../component/card_view_status";
import _ from "lodash";
import ComponentJob_IsEmptyData from "../component/is_empty_data";
export default function Job_Beranda() { export default function Job_Beranda({ listJob }: { listJob: MODEL_JOB[] }) {
const router = useRouter(); const router = useRouter();
return ( return (
<> <>
@@ -36,38 +42,37 @@ export default function Job_Beranda() {
</ActionIcon> </ActionIcon>
</Affix> </Affix>
<Stack> {_.isEmpty(listJob) ? (
{Array(5) <ComponentJob_IsEmptyData text="Data tidak ada" />
.fill(0) ) : (
.map((e, i) => ( <Stack>
{listJob.map((e, i) => (
<Card key={i} shadow="lg" withBorder p={30} radius={"md"}> <Card key={i} shadow="lg" withBorder p={30} radius={"md"}>
<Card.Section> <Card.Section>
<ComponentGlobal_AuthorNameOnHeader /> <ComponentGlobal_AuthorNameOnHeader
authorName={e.Author.Profile.name}
imagesId={e.Author.Profile.imagesId}
profileId={e.Author.Profile.id}
/>
</Card.Section> </Card.Section>
<Card.Section onClick={() => router.push(RouterJob.main_detail)}> <Card.Section
onClick={() => router.push(RouterJob.main_detail + e.id)}
mt={"lg"}
>
<Grid> <Grid>
<Grid.Col span={6}> <Grid.Col span={"auto"}>
<Image alt="foto" src={"/aset/no-file.png"} /> <Center h={"100%"}>
</Grid.Col> <Text fw={"bold"} fz={"xl"} lineClamp={1}>
<Grid.Col span={6}> {e.title}
<Stack justify="center" h={"100%"}>
<Text fw={"bold"} fz={20} truncate>
Judul Lowongan Kerja
</Text> </Text>
<Text lineClamp={3}> </Center>
Lorem ipsum dolor sit amet consectetur, adipisicing
elit. Laboriosam est id neque iste voluptatem
consequuntur veritatis dolorem illo et, repellat
praesentium maiores amet omnis voluptas aliquid tenetur
nam sint obcaecati.
</Text>
</Stack>
</Grid.Col> </Grid.Col>
</Grid> </Grid>
</Card.Section> </Card.Section>
</Card> </Card>
))} ))}
</Stack> </Stack>
)}
</> </>
); );
} }

View File

@@ -16,6 +16,7 @@ import { useRouter } from "next/navigation";
import { RouterJob } from "@/app/lib/router_hipmi/router_job"; import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { gs_job_hot_menu } from "../global_state"; import { gs_job_hot_menu } from "../global_state";
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
export default function LayoutJob_Main({ export default function LayoutJob_Main({
children, children,
@@ -50,7 +51,12 @@ export default function LayoutJob_Main({
return ( return (
<> <>
<AppShell <AppShell
header={<ComponentJob_HeaderTamplate title="Job Vacancy" />} header={
<ComponentJob_HeaderTamplate
title="Job Vacancy"
route={RouterHome.main_home}
/>
}
footer={ footer={
<Footer height={70} bg={"dark"}> <Footer height={70} bg={"dark"}>
<Grid> <Grid>
@@ -62,7 +68,6 @@ export default function LayoutJob_Main({
onClick={() => { onClick={() => {
router.replace(e.path); router.replace(e.path);
setHotMenu(e.id); setHotMenu(e.id);
}} }}
> >
<Center> <Center>

View File

@@ -3,14 +3,12 @@
import { Stack, Card, Grid, Image, Text } from "@mantine/core"; import { Stack, Card, Grid, Image, Text } from "@mantine/core";
import ComponentJob_CardViewStatus from "../../component/card_view_status"; import ComponentJob_CardViewStatus from "../../component/card_view_status";
import { RouterJob } from "@/app/lib/router_hipmi/router_job"; import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import ComponentJob_CardPreview from "../../component/card_preview";
export default function Job_Draft() { export default function Job_Draft({ listDraft }: { listDraft : any}) {
return ( return (
<> <>
<ComponentJob_CardViewStatus <ComponentJob_CardViewStatus listData={listDraft} path={RouterJob.detail_draft} />
listData={[{ id: 1 }, { id: 2 }]}
path={RouterJob.detail_draft}
/>
</> </>
); );
} }

View File

@@ -4,12 +4,14 @@ import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/component_global/a
import { Stack, Card, Grid, Image, Text } from "@mantine/core"; import { Stack, Card, Grid, Image, Text } from "@mantine/core";
import ComponentJob_CardViewStatus from "../../component/card_view_status"; import ComponentJob_CardViewStatus from "../../component/card_view_status";
import { RouterJob } from "@/app/lib/router_hipmi/router_job"; import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import ComponentJob_CardPreview from "../../component/card_preview";
import { Job_getListStatusByStatusId } from "../../fun/get/get_list_status_by_status_id";
export default function Job_Publish() { export default function Job_Publish({ listPublish }: { listPublish : any}) {
return ( return (
<> <>
<ComponentJob_CardViewStatus <ComponentJob_CardViewStatus
listData={[{ id: 1 }, { id: 2 }]} listData={listPublish}
path={RouterJob.detail_publish} path={RouterJob.detail_publish}
/> />
{/* <Stack> {/* <Stack>

Some files were not shown because too many files have changed in this diff Show More