Notifikas Job
# fix - Notifikasi to admin - Notifikasi to user - Perubahan tampilan admin ## No issue
This commit is contained in:
@@ -14,11 +14,11 @@ export let defaultDeskripsi = `
|
||||
<p>Atau kunjungi website kami:</p>
|
||||
<p>
|
||||
<a
|
||||
href="https://test-hipmi.wibudev.com/"
|
||||
href="https://www.google.co.id/?hl=id"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
https://test-hipmi.wibudev.com/
|
||||
https://www.google.co.id/?hl=id
|
||||
</a>
|
||||
</p>
|
||||
`;
|
||||
|
||||
@@ -36,7 +36,7 @@ import { defaultDeskripsi, defaultSyarat } from "../component/default_value";
|
||||
import ComponentJob_NotedBox from "../component/detail/noted_box";
|
||||
import { MODEL_JOB } from "../model/interface";
|
||||
import { Job_funCreate } from "../fun/create/fun_create";
|
||||
import notifikasi_funCreate from "@/app_modules/notifikasi/fun/create/create_notif";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif";
|
||||
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";
|
||||
@@ -229,7 +229,7 @@ function ButtonAction({ value, file }: { value: MODEL_JOB; file: FormData }) {
|
||||
|
||||
const create = await Job_funCreate(value as any, gambar);
|
||||
if (create.status === 201) {
|
||||
const dataNotif = {
|
||||
const dataNotif : any = {
|
||||
appId: create.data?.id as any,
|
||||
kategoriApp: "JOB",
|
||||
status: create.data?.MasterStatus?.name as any,
|
||||
@@ -237,7 +237,8 @@ function ButtonAction({ value, file }: { value: MODEL_JOB; file: FormData }) {
|
||||
pesan: create.data?.title as any,
|
||||
title: "Job baru",
|
||||
};
|
||||
const notif = await notifikasi_funCreate({ data: dataNotif as any });
|
||||
const notif = await notifikasiToAdmin_funCreate({ data: dataNotif as any });
|
||||
console.log(notif)
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish(
|
||||
|
||||
@@ -14,6 +14,8 @@ import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/
|
||||
import { Job_funDeleteById } from "../../fun/delete/fun_delete_by_id";
|
||||
import ComponentJob_NotedBox from "../../component/detail/noted_box";
|
||||
import { MODEL_JOB } from "../../model/interface";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif";
|
||||
|
||||
export default function Job_DetailDraft({ dataJob }: { dataJob: MODEL_JOB }) {
|
||||
return (
|
||||
@@ -37,15 +39,31 @@ function ButtonAction({ jobId }: { jobId: string }) {
|
||||
const [opened, { open, close }] = useDisclosure();
|
||||
|
||||
async function onAction() {
|
||||
await Job_funEditStatusByStatusId(jobId, "2").then((res) => {
|
||||
if (res.status === 200) {
|
||||
setStatus("Review");
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan");
|
||||
router.push(RouterJob.status);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
const update = await Job_funEditStatusByStatusId(jobId, "2");
|
||||
if (update.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: update.data?.id as any,
|
||||
status: update.data?.MasterStatus?.name as any,
|
||||
userId: update.data?.authorId as any,
|
||||
pesan: update.data?.title as any,
|
||||
kategoriApp: "JOB",
|
||||
title: "Mengajukan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
}
|
||||
});
|
||||
|
||||
setStatus("Review");
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Diajukan");
|
||||
router.push(RouterJob.status);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(update.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function onDelete() {
|
||||
|
||||
@@ -16,6 +16,7 @@ import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/
|
||||
import { Job_funDeleteById } from "../../fun/delete/fun_delete_by_id";
|
||||
|
||||
export default function Job_DetailReject({ dataJob }: { dataJob: MODEL_JOB }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack>
|
||||
|
||||
@@ -10,6 +10,8 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob
|
||||
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 notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
|
||||
export default function Job_DetailReview({ dataJob }: { dataJob: MODEL_JOB }) {
|
||||
return (
|
||||
@@ -27,15 +29,31 @@ function ButtonAction({ jobId }: { jobId: string }) {
|
||||
const [status, setStatus] = useAtom(gs_job_status);
|
||||
|
||||
async function onAction() {
|
||||
await Job_funEditStatusByStatusId(jobId, "3").then((res) => {
|
||||
if (res.status === 200) {
|
||||
setStatus("Draft");
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Dibatalkan");
|
||||
router.push(RouterJob.status);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
const update = await Job_funEditStatusByStatusId(jobId, "3");
|
||||
if (update.status === 200) {
|
||||
const dataNotif = {
|
||||
appId: update.data?.id as any,
|
||||
kategoriApp: "JOB",
|
||||
status: update.data?.MasterStatus?.name as any,
|
||||
userId: update.data?.authorId as any,
|
||||
pesan: update.data?.title as any,
|
||||
title: "Membatalkan review",
|
||||
};
|
||||
|
||||
const notif = await notifikasiToAdmin_funCreate({
|
||||
data: dataNotif as any,
|
||||
});
|
||||
|
||||
if (notif.status === 201) {
|
||||
mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 }));
|
||||
}
|
||||
});
|
||||
|
||||
setStatus("Draft");
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Dibatalkan");
|
||||
router.push(RouterJob.status);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(update.message);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function Job_funCreate(req: MODEL_JOB, file: FormData) {
|
||||
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({
|
||||
const createDataWithImg = await prisma.job.create({
|
||||
data: {
|
||||
title: req.title,
|
||||
content: req.content,
|
||||
@@ -39,16 +39,27 @@ export async function Job_funCreate(req: MODEL_JOB, file: FormData) {
|
||||
authorId: authorId,
|
||||
imagesId: upload.id,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
authorId: true,
|
||||
MasterStatus: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
title: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!create) return { status: 400, message: "Gagal Disimpan" };
|
||||
if (!createDataWithImg) return { status: 400, message: "Gagal Disimpan" };
|
||||
revalidatePath("/dev/job/main/status");
|
||||
return {
|
||||
data: createDataWithImg,
|
||||
status: 201,
|
||||
message: "Berhasil Disimpan",
|
||||
};
|
||||
} else {
|
||||
const create = await prisma.job.create({
|
||||
const createDataWithoutImg = await prisma.job.create({
|
||||
data: {
|
||||
title: req.title,
|
||||
content: req.content,
|
||||
@@ -67,10 +78,11 @@ export async function Job_funCreate(req: MODEL_JOB, file: FormData) {
|
||||
},
|
||||
});
|
||||
|
||||
if (!create) return { status: 400, message: "Gagal Disimpan" };
|
||||
if (!createDataWithoutImg)
|
||||
return { status: 400, message: "Gagal Disimpan" };
|
||||
revalidatePath("/dev/job/main/status");
|
||||
return {
|
||||
data: create,
|
||||
data: createDataWithoutImg,
|
||||
status: 201,
|
||||
message: "Berhasil Disimpan",
|
||||
};
|
||||
|
||||
@@ -14,9 +14,19 @@ export async function Job_funEditStatusByStatusId(
|
||||
data: {
|
||||
masterStatusId: statusId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
authorId: true,
|
||||
MasterStatus: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
title: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal ganti status" };
|
||||
revalidatePath("/dev/job/main/status");
|
||||
return { status: 200, message: "Berhasil ganti status" };
|
||||
return { data: updt, status: 200, message: "Berhasil ganti status" };
|
||||
}
|
||||
|
||||
20
src/app_modules/job/fun/get/status/new_get_list_reject.ts
Normal file
20
src/app_modules/job/fun/get/status/new_get_list_reject.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function job_getListReject({}: {}) {
|
||||
const userId = await user_getOneUserId();
|
||||
const data = await prisma.job.findMany({
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
masterStatusId: "2",
|
||||
authorId: userId,
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Card, Center, Image, Stack, Text } from "@mantine/core";
|
||||
import { Card, Center, Image, Overlay, Stack, Text, Title } from "@mantine/core";
|
||||
import ComponentJob_DetailData from "../component/detail/detail_data";
|
||||
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
|
||||
import { data } from "autoprefixer";
|
||||
@@ -46,6 +46,18 @@ export default function Job_NonUserView({ data }: { data: MODEL_JOB }) {
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
{data?.isArsip === true && (
|
||||
<Overlay color="gray" opacity={0.5} blur={1}>
|
||||
<Stack align="center" h={"100%"} justify="center">
|
||||
<Title c={"red"} fw={"bold"} order={3}>
|
||||
Mohon Maaf !
|
||||
</Title>
|
||||
<Title c={"red"} fw={"bold"} order={3}>
|
||||
Lowongan Kerja Ini Sudah Ditutup{" "}
|
||||
</Title>
|
||||
</Stack>
|
||||
</Overlay>
|
||||
)}
|
||||
</Card>
|
||||
</Center>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user