#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

@@ -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_tipe_acara from "../../../bin/seeder/event/master_tipe_acara.json";
import voting_status from "../../../bin/seeder/voting/master_status.json";
import master_status from "../../../bin/seeder/master_status.json";
export async function GET(req: Request) {
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 });
}

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 { HomeLayout } from "@/app_modules/home";
import { User_getOneById } from "@/app_modules/home/fun/get/get_one_user_by_id";
import { redirect } from "next/navigation";
export default async function Layout({ children }: { children: any }) {
const userId = await User_getUserId();
const dataUser = await User_getOneById(userId);
return (
<>
<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({
children,
params
}: {
children: React.ReactNode;
params: {id: string}
}) {
let jobId = params.id
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_getListAllArsipById } from "@/app_modules/job/fun/get/get_list_all_arsip";
export default async function Page() {
const dataJob = await Job_getListAllArsipById()
return (
<>
<Job_Arsip />
<Job_Arsip dataJob={dataJob as any}/>
</>
);
}

View File

@@ -1,9 +1,12 @@
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() {
const listJob = await Job_getAllListPublish();
return (
<>
<Job_Beranda />
<Job_Beranda listJob={listJob as any} />
</>
);
}

View File

@@ -1,13 +1,21 @@
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() {
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 (
<>
<Job_Status
listDraft={[]}
listPublish={[]}
listReject={[]}
listReview={[]}
listDraft={listDraft as any}
listPublish={listPublish as any}
listReject={listReject as any}
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 = {
//api
api_gambar: "/api/job/gambar/",
//spalsh
spalsh: "/dev/job/splash",
// main
@@ -8,16 +12,16 @@ export const RouterJob = {
// create & edit
create: "/dev/job/create",
edit: "/dev/job/edit",
edit: "/dev/job/edit/",
// detail
main_detail: "/dev/job/detail/main",
detail_publish: "/dev/job/detail/publish",
detail_review: "/dev/job/detail/review",
detail_draft: "/dev/job/detail/draft",
detail_reject: "/dev/job/detail/reject",
detail_arsip: "/dev/job/detail/arsip",
main_detail: "/dev/job/detail/main/",
detail_publish: "/dev/job/detail/publish/",
detail_review: "/dev/job/detail/review/",
detail_draft: "/dev/job/detail/draft/",
detail_reject: "/dev/job/detail/reject/",
detail_arsip: "/dev/job/detail/arsip/",
// non user
non_user_view: "/dev/job/non_user_view",
non_user_view: "/dev/job/non_user_view/",
};