fix admin job
- new page detail review
This commit is contained in:
@@ -1,13 +1,9 @@
|
|||||||
import { AdminJob_TablePublish } from "@/app_modules/admin/job";
|
import { AdminJob_TablePublish } from "@/app_modules/admin/job";
|
||||||
import adminJob_getListPublish from "@/app_modules/admin/job/fun/get/get_list_publish";
|
|
||||||
import { AdminJob_getListTableByStatusId } from "@/app_modules/admin/job/fun/get/get_list_table_by_status_id";
|
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
return (
|
<AdminJob_TablePublish />
|
||||||
<>
|
</>
|
||||||
<AdminJob_TablePublish />
|
);
|
||||||
</>
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { AdminJob_TableReview } from "@/app_modules/admin/job";
|
import { AdminJob_TableReview } from "@/app_modules/admin/job";
|
||||||
import adminJob_getListReview from "@/app_modules/admin/job/fun/get/get_list_review";
|
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
|
|
||||||
|
|||||||
33
src/app_modules/admin/job/_components/detail/image_view.tsx
Normal file
33
src/app_modules/admin/job/_components/detail/image_view.tsx
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||||
|
import { Admin_ComponentBoxStyle } from "@/app_modules/admin/_admin_global/_component/comp_admin_boxstyle";
|
||||||
|
import { APIs } from "@/lib";
|
||||||
|
import { Center, Image } from "@mantine/core";
|
||||||
|
import { data } from "autoprefixer";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export function AdminJob_ComponentImageView({ imageId }: { imageId: string }) {
|
||||||
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Admin_ComponentBoxStyle>
|
||||||
|
<Center h={"100%"}>
|
||||||
|
<Image
|
||||||
|
onLoad={() => setLoading(false)}
|
||||||
|
alt="Foto"
|
||||||
|
src={APIs.GET({ fileId: imageId })}
|
||||||
|
mah={500}
|
||||||
|
maw={300}
|
||||||
|
/>
|
||||||
|
</Center>
|
||||||
|
{isLoading ? (
|
||||||
|
<Center h={"100%"}>
|
||||||
|
<ComponentGlobal_Loader size={30} variant="dots" />
|
||||||
|
</Center>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
|
</Admin_ComponentBoxStyle>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -7,9 +7,11 @@ import { APIs } from "@/lib";
|
|||||||
import { Badge, Center, Grid, Image, SimpleGrid, Text } from "@mantine/core";
|
import { Badge, Center, Grid, Image, SimpleGrid, Text } from "@mantine/core";
|
||||||
import { IconImageInPicture } from "@tabler/icons-react";
|
import { IconImageInPicture } from "@tabler/icons-react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { AdminJob_ComponentImageView } from "./image_view";
|
||||||
|
|
||||||
export function AdminJob_DetailPublish({ data }: { data: MODEL_JOB }) {
|
export function AdminJob_DetailPublish({ data }: { data: MODEL_JOB }) {
|
||||||
const [isLoading, setLoading] = useState(false);
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
const listData = [
|
const listData = [
|
||||||
{
|
{
|
||||||
title: "Username",
|
title: "Username",
|
||||||
@@ -58,21 +60,9 @@ export function AdminJob_DetailPublish({ data }: { data: MODEL_JOB }) {
|
|||||||
</Admin_ComponentBoxStyle>
|
</Admin_ComponentBoxStyle>
|
||||||
|
|
||||||
{data.imageId && (
|
{data.imageId && (
|
||||||
<Admin_ComponentBoxStyle>
|
<AdminJob_ComponentImageView imageId={data.imageId}/>
|
||||||
<Center>
|
|
||||||
<Image
|
|
||||||
onLoad={() => setLoading(false)}
|
|
||||||
alt="Foto"
|
|
||||||
src={APIs.GET({ fileId: data.imageId })}
|
|
||||||
mah={500}
|
|
||||||
maw={300}
|
|
||||||
/>
|
|
||||||
</Center>
|
|
||||||
</Admin_ComponentBoxStyle>
|
|
||||||
)}
|
)}
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
|
|
||||||
{/* <pre style={{ color: "white" }}>{JSON.stringify(data, null, 2)}</pre> */}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
291
src/app_modules/admin/job/_components/detail/review.tsx
Normal file
291
src/app_modules/admin/job/_components/detail/review.tsx
Normal file
@@ -0,0 +1,291 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { MainColor } from "@/app_modules/_global/color";
|
||||||
|
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import { ComponentGlobal_InputCountDown } from "@/app_modules/_global/component";
|
||||||
|
import {
|
||||||
|
ComponentGlobal_NotifikasiBerhasil,
|
||||||
|
ComponentGlobal_NotifikasiGagal,
|
||||||
|
} from "@/app_modules/_global/notif_global";
|
||||||
|
import { Admin_ComponentBoxStyle } from "@/app_modules/admin/_admin_global/_component/comp_admin_boxstyle";
|
||||||
|
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
||||||
|
import { MODEL_JOB } from "@/app_modules/job/model/interface";
|
||||||
|
import { IRealtimeData } from "@/lib/global_state";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Grid,
|
||||||
|
Group,
|
||||||
|
Modal,
|
||||||
|
SimpleGrid,
|
||||||
|
Stack,
|
||||||
|
Text,
|
||||||
|
Textarea,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import { IconBan, IconCircleCheck } from "@tabler/icons-react";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { WibuRealtime } from "wibu-pkg";
|
||||||
|
import { AdminJob_funEditCatatanById } from "../../fun/edit/fun_edit_catatan_by_id";
|
||||||
|
import { AdminJob_funEditStatusPublishById } from "../../fun/edit/fun_edit_status_publish_by_id";
|
||||||
|
import { AdminJob_ComponentImageView } from "./image_view";
|
||||||
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
|
export function AdminJob_DetailReview({ data }: { data: MODEL_JOB }) {
|
||||||
|
const router = useRouter();
|
||||||
|
const [publish, setPublish] = useState(false);
|
||||||
|
const [reject, setReject] = useState(false);
|
||||||
|
const [catatan, setCatatan] = useState("");
|
||||||
|
const [isLoadingPublish, setLoadingPublish] = useState(false);
|
||||||
|
const [isLoadingReject, setLoadingReject] = useState(false);
|
||||||
|
|
||||||
|
const listData = [
|
||||||
|
{
|
||||||
|
title: "Username",
|
||||||
|
value: data.Author.username,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Judul",
|
||||||
|
value: data.title,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Konten",
|
||||||
|
value: <div dangerouslySetInnerHTML={{ __html: data.content }} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Deskripsi",
|
||||||
|
value: <div dangerouslySetInnerHTML={{ __html: data.deskripsi }} />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
async function onPublish() {
|
||||||
|
try {
|
||||||
|
setLoadingPublish(true);
|
||||||
|
const publish = await AdminJob_funEditStatusPublishById(data.id);
|
||||||
|
if (publish.status === 200) {
|
||||||
|
const dataNotifikasi: IRealtimeData = {
|
||||||
|
appId: publish.data?.id as any,
|
||||||
|
status: publish.data?.MasterStatus?.name as any,
|
||||||
|
userId: publish.data?.authorId as any,
|
||||||
|
pesan: publish.data?.title as any,
|
||||||
|
kategoriApp: "JOB",
|
||||||
|
title: "Job publish",
|
||||||
|
};
|
||||||
|
|
||||||
|
const createNotifikasi = await adminNotifikasi_funCreateToUser({
|
||||||
|
data: dataNotifikasi as any,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (createNotifikasi.status === 201) {
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "notification",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "trigger",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setPublish(false);
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(publish.message);
|
||||||
|
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(publish.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error,", error);
|
||||||
|
} finally {
|
||||||
|
setLoadingPublish(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onReject() {
|
||||||
|
try {
|
||||||
|
setLoadingReject(true);
|
||||||
|
const reject = await AdminJob_funEditCatatanById(data.id, catatan);
|
||||||
|
|
||||||
|
if (reject.status === 200) {
|
||||||
|
ComponentGlobal_NotifikasiBerhasil(reject.message);
|
||||||
|
const dataNotifikasi: IRealtimeData = {
|
||||||
|
appId: reject.data?.id as any,
|
||||||
|
status: reject.data?.MasterStatus?.name as any,
|
||||||
|
userId: reject.data?.authorId as any,
|
||||||
|
pesan: reject.data?.title as any,
|
||||||
|
kategoriApp: "JOB",
|
||||||
|
title: "Job reject",
|
||||||
|
};
|
||||||
|
|
||||||
|
const createRejectNotifikasi = await adminNotifikasi_funCreateToUser({
|
||||||
|
data: dataNotifikasi as any,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (createRejectNotifikasi.status === 201) {
|
||||||
|
WibuRealtime.setData({
|
||||||
|
type: "notification",
|
||||||
|
pushNotificationTo: "USER",
|
||||||
|
dataMessage: dataNotifikasi,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setReject(false);
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
ComponentGlobal_NotifikasiGagal(reject.message);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error reject", error);
|
||||||
|
} finally {
|
||||||
|
setLoadingReject(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<SimpleGrid cols={2}>
|
||||||
|
<Admin_ComponentBoxStyle>
|
||||||
|
{listData.map((item, index) => (
|
||||||
|
<Grid key={index}>
|
||||||
|
<Grid.Col span={2}>
|
||||||
|
<Text>{item.title}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={1}>
|
||||||
|
<Text>:</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Text>{item.value}</Text>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<Grid mt={"xl"}>
|
||||||
|
<Grid.Col span={2}></Grid.Col>
|
||||||
|
<Grid.Col span={1}></Grid.Col>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
|
<Group spacing={"xl"}>
|
||||||
|
<Button
|
||||||
|
color={"green"}
|
||||||
|
leftIcon={<IconCircleCheck />}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
setPublish(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Publish
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
color={"red"}
|
||||||
|
leftIcon={<IconBan />}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
setReject(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Reject
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</Admin_ComponentBoxStyle>
|
||||||
|
|
||||||
|
{data.imageId && <AdminJob_ComponentImageView imageId={data.imageId} />}
|
||||||
|
</SimpleGrid>
|
||||||
|
|
||||||
|
{/* PUBLISH MODAL */}
|
||||||
|
<Modal
|
||||||
|
styles={{
|
||||||
|
header: { backgroundColor: AdminColor.softBlue },
|
||||||
|
body: { backgroundColor: AdminColor.softBlue },
|
||||||
|
title: { color: AdminColor.white },
|
||||||
|
}}
|
||||||
|
title={"Apakah anda yakin ingin mem-publish job ini ?"}
|
||||||
|
withCloseButton={false}
|
||||||
|
opened={publish}
|
||||||
|
onClose={() => {
|
||||||
|
setPublish(false);
|
||||||
|
}}
|
||||||
|
size={"sm"}
|
||||||
|
centered
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Group position="center">
|
||||||
|
<Button radius={"xl"} onClick={() => setPublish(false)}>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
loading={isLoadingPublish}
|
||||||
|
loaderPosition="center"
|
||||||
|
style={{ transition: "0.5s", backgroundColor: MainColor.green }}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
onPublish();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
{/* REJECT MODAL */}
|
||||||
|
<Modal
|
||||||
|
styles={{
|
||||||
|
header: { backgroundColor: AdminColor.softBlue },
|
||||||
|
body: { backgroundColor: AdminColor.softBlue },
|
||||||
|
title: { color: AdminColor.white },
|
||||||
|
}}
|
||||||
|
opened={reject}
|
||||||
|
onClose={() => {
|
||||||
|
setReject(false);
|
||||||
|
}}
|
||||||
|
withCloseButton={false}
|
||||||
|
size={"sm"}
|
||||||
|
centered
|
||||||
|
>
|
||||||
|
<Stack>
|
||||||
|
<Stack spacing={5}>
|
||||||
|
<Textarea
|
||||||
|
minRows={3}
|
||||||
|
maxRows={5}
|
||||||
|
maxLength={300}
|
||||||
|
autosize
|
||||||
|
label={
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>
|
||||||
|
Alasan Penolakan
|
||||||
|
</Text>
|
||||||
|
}
|
||||||
|
placeholder="Masukkan alasan penolakan lowongan ini"
|
||||||
|
onChange={(val) => setCatatan(val.currentTarget.value)}
|
||||||
|
/>
|
||||||
|
<ComponentGlobal_InputCountDown
|
||||||
|
maxInput={300}
|
||||||
|
lengthInput={catatan.length}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<Group position="right">
|
||||||
|
<Button radius={"xl"} onClick={() => setReject(false)}>
|
||||||
|
Batal
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
loading={isLoadingReject}
|
||||||
|
loaderPosition="center"
|
||||||
|
style={{ transition: "0.5s" }}
|
||||||
|
bg={MainColor.green}
|
||||||
|
color="green"
|
||||||
|
disabled={catatan === "" ? true : false}
|
||||||
|
radius={"xl"}
|
||||||
|
onClick={() => {
|
||||||
|
onReject();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Simpan
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
|
</Stack>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
{/* <pre style={{ color: "white" }}>{JSON.stringify(data, null, 2)}</pre> */}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -9,11 +9,13 @@ import { useShallowEffect } from "@mantine/hooks";
|
|||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import { apiGetOneJobById } from "../lib/api_fetch_admin_job";
|
import { apiGetOneJobById } from "../lib/api_fetch_admin_job";
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
import { AdminJob_DetailPublish } from "../_components/detail_status";
|
import { AdminJob_DetailPublish } from "../_components/detail/publish";
|
||||||
|
import { MODEL_JOB } from "@/app_modules/job/model/interface";
|
||||||
|
import { AdminJob_DetailReview } from "../_components/detail/review";
|
||||||
|
|
||||||
export function AdminJob_ViewDetailPublish() {
|
export function AdminJob_ViewDetailPublish() {
|
||||||
const param = useParams<{ id: string; status: string }>();
|
const param = useParams<{ id: string }>();
|
||||||
const [data, setData] = useState();
|
const [data, setData] = useState<MODEL_JOB>();
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
handleLoadData();
|
handleLoadData();
|
||||||
@@ -37,16 +39,19 @@ export function AdminJob_ViewDetailPublish() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Stack>
|
||||||
<ComponentAdminGlobal_HeaderTamplate name={`Detail ${param.status} `} />
|
<ComponentAdminGlobal_HeaderTamplate name={`Detail data`} />
|
||||||
<AdminGlobal_ComponentBackButton />
|
<AdminGlobal_ComponentBackButton />
|
||||||
|
|
||||||
{!data ? (
|
{!data ? (
|
||||||
<SimpleGrid cols={2}>
|
<SimpleGrid cols={2}>
|
||||||
<CustomSkeleton height={500} width={"100%"} />
|
<CustomSkeleton height={500} width={"100%"} />
|
||||||
<CustomSkeleton height={500} width={"100%"} />
|
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
) : (
|
) : data.MasterStatus.name === "Publish" ? (
|
||||||
<AdminJob_DetailPublish data={data} />
|
<AdminJob_DetailPublish data={data} />
|
||||||
|
) : data.MasterStatus.name === "Review" ? (
|
||||||
|
<AdminJob_DetailReview data={data} />
|
||||||
|
) : (
|
||||||
|
""
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import { RouterAdminGlobal } from "@/lib";
|
import { RouterAdminGlobal } from "@/lib";
|
||||||
import {
|
import { gs_adminJob_triggerReview, IRealtimeData } from "@/lib/global_state";
|
||||||
gs_adminJob_triggerReview,
|
|
||||||
IRealtimeData,
|
|
||||||
} from "@/lib/global_state";
|
|
||||||
import { ComponentGlobal_InputCountDown } from "@/app_modules/_global/component";
|
import { ComponentGlobal_InputCountDown } from "@/app_modules/_global/component";
|
||||||
import {
|
import {
|
||||||
ComponentGlobal_NotifikasiBerhasil,
|
ComponentGlobal_NotifikasiBerhasil,
|
||||||
@@ -25,6 +22,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Affix,
|
Affix,
|
||||||
rem,
|
rem,
|
||||||
|
Box,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import {
|
import {
|
||||||
@@ -45,10 +43,15 @@ import { AdminJob_funEditStatusPublishById } from "../fun/edit/fun_edit_status_p
|
|||||||
import adminJob_getListReview from "../fun/get/get_list_review";
|
import adminJob_getListReview from "../fun/get/get_list_review";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { AccentColor } from "@/app_modules/_global/color";
|
import { AccentColor } from "@/app_modules/_global/color";
|
||||||
import { AdminColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
import {
|
||||||
|
AdminColor,
|
||||||
|
MainColor,
|
||||||
|
} from "@/app_modules/_global/color/color_pallet";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import { apiGetAdminJobByStatus } from "../lib/api_fetch_admin_job";
|
import { apiGetAdminJobByStatus } from "../lib/api_fetch_admin_job";
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
|
import Admin_DetailButton from "../../_admin_global/_component/button/detail_button";
|
||||||
|
import { RouterAdminJob } from "@/lib/router_admin/router_admin_job";
|
||||||
|
|
||||||
export default function AdminJob_ViewTavleReview() {
|
export default function AdminJob_ViewTavleReview() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -61,6 +64,8 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
const [jobId, setJobId] = useState("");
|
const [jobId, setJobId] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [catatan, setCatatan] = useState("");
|
const [catatan, setCatatan] = useState("");
|
||||||
|
const [isLoadingShowImage, setLoadingShowImage] = useState(false);
|
||||||
|
const [dataId, setDataId] = useState("");
|
||||||
|
|
||||||
// Realtime
|
// Realtime
|
||||||
const [isAdminJob_TriggerReview, setIsAdminJob_TriggerReview] = useAtom(
|
const [isAdminJob_TriggerReview, setIsAdminJob_TriggerReview] = useAtom(
|
||||||
@@ -72,28 +77,26 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
loadInitialData();
|
loadInitialData();
|
||||||
}, [activePage, isSearch]);
|
}, [activePage, isSearch]);
|
||||||
|
|
||||||
|
|
||||||
const loadInitialData = async () => {
|
const loadInitialData = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await apiGetAdminJobByStatus({
|
const response = await apiGetAdminJobByStatus({
|
||||||
name: "Review",
|
name: "Review",
|
||||||
page: `${activePage}`,
|
page: `${activePage}`,
|
||||||
search: isSearch
|
search: isSearch,
|
||||||
})
|
});
|
||||||
|
|
||||||
|
|
||||||
if (response?.success && response?.data.data) {
|
if (response?.success && response?.data.data) {
|
||||||
setData(response.data.data);
|
setData(response.data.data);
|
||||||
setNPage(response.data.nPage || 1);
|
setNPage(response.data.nPage || 1);
|
||||||
} else {
|
} else {
|
||||||
console.error("Invliad data format recieved", response)
|
console.error("Invliad data format recieved", response);
|
||||||
setData([]);
|
setData([]);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
clientLogger.error("Error get data table publish", error);
|
clientLogger.error("Error get data table publish", error);
|
||||||
setData([]);
|
setData([]);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
async function onLoadData() {
|
async function onLoadData() {
|
||||||
loadInitialData();
|
loadInitialData();
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@@ -104,11 +107,11 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
const onSearch = async (searchTerm: string) => {
|
const onSearch = async (searchTerm: string) => {
|
||||||
setSearch(searchTerm);
|
setSearch(searchTerm);
|
||||||
setActivePage(1);
|
setActivePage(1);
|
||||||
}
|
};
|
||||||
|
|
||||||
const onPageClick = (page: number) => {
|
const onPageClick = (page: number) => {
|
||||||
setActivePage(page);
|
setActivePage(page);
|
||||||
}
|
};
|
||||||
|
|
||||||
const renderTableBody = () => {
|
const renderTableBody = () => {
|
||||||
if (!Array.isArray(data) || data.length === 0) {
|
if (!Array.isArray(data) || data.length === 0) {
|
||||||
@@ -120,45 +123,46 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
return data.map((e, i) => (
|
return data?.map((e, i) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>
|
<td>
|
||||||
<Center w={150}>
|
<Center>
|
||||||
<Text c={AdminColor.white}>{e?.Author?.username}</Text>
|
<Text c={AdminColor.white}>{e?.Author?.username}</Text>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<Spoiler
|
<Center>
|
||||||
c={AdminColor.white}
|
<Box w={150}>
|
||||||
w={150}
|
<Text c={"white"} truncate>
|
||||||
maxHeight={50}
|
{e.title}
|
||||||
hideLabel="sembunyikan"
|
</Text>
|
||||||
showLabel="tampilkan"
|
</Box>
|
||||||
>
|
</Center>
|
||||||
{e.title}
|
|
||||||
</Spoiler>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center w={150}>
|
<Center>
|
||||||
{e.imageId ? (
|
{e.imageId ? (
|
||||||
<Button
|
<Button
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
loading={isLoading && jobId == e?.id}
|
loading={isLoadingShowImage && e.id === dataId}
|
||||||
color="green"
|
color="green"
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
leftIcon={<IconPhotoCheck />}
|
leftIcon={<IconPhotoCheck />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setJobId(e?.id);
|
setLoadingShowImage(true);
|
||||||
setIsLoading(true);
|
setDataId(e.id);
|
||||||
router.push(RouterAdminGlobal.preview_image({ id: e.imageId }));
|
router.push(
|
||||||
|
RouterAdminGlobal.preview_image({ id: e.imageId })
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Lihat
|
Lihat
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<Center w={150}>
|
<Center>
|
||||||
<Text c={AdminColor.white} fw={"bold"} fz={"xs"} fs={"italic"}>
|
<Text c={AdminColor.white} fw={"bold"} fz={"xs"} fs={"italic"}>
|
||||||
Tidak ada poster
|
Tidak ada poster
|
||||||
</Text>
|
</Text>
|
||||||
@@ -167,66 +171,121 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Spoiler
|
<Center>
|
||||||
style={{ color: AdminColor.white }}
|
<Admin_DetailButton path={RouterAdminJob.detail({ id: e.id })} />
|
||||||
hideLabel="sembunyikan"
|
</Center>
|
||||||
w={250}
|
|
||||||
maxHeight={50}
|
|
||||||
showLabel="tampilkan"
|
|
||||||
>
|
|
||||||
<div dangerouslySetInnerHTML={{ __html: e.content }} />
|
|
||||||
</Spoiler>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Spoiler
|
|
||||||
style={{ color: AdminColor.white }}
|
|
||||||
hideLabel="sembunyikan"
|
|
||||||
w={400}
|
|
||||||
maxHeight={50}
|
|
||||||
showLabel="tampilkan"
|
|
||||||
>
|
|
||||||
<div dangerouslySetInnerHTML={{ __html: e.deskripsi }} />
|
|
||||||
</Spoiler>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<Stack>
|
|
||||||
<Stack align="center">
|
|
||||||
<Button
|
|
||||||
color={"green"}
|
|
||||||
leftIcon={<IconCircleCheck />}
|
|
||||||
radius={"xl"}
|
|
||||||
onClick={() => {
|
|
||||||
setJobId(e?.id);
|
|
||||||
setPublish(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Publish
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
color={"red"}
|
|
||||||
leftIcon={<IconBan />}
|
|
||||||
radius={"xl"}
|
|
||||||
onClick={() => {
|
|
||||||
setReject(true);
|
|
||||||
setJobId(e.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Reject
|
|
||||||
</Button>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
|
||||||
|
// return data.map((e, i) => (
|
||||||
|
// <tr key={i}>
|
||||||
|
// <td>
|
||||||
|
// <Center w={150}>
|
||||||
|
// <Text c={AdminColor.white}>{e?.Author?.username}</Text>
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Spoiler
|
||||||
|
// c={AdminColor.white}
|
||||||
|
// w={150}
|
||||||
|
// maxHeight={50}
|
||||||
|
// hideLabel="sembunyikan"
|
||||||
|
// showLabel="tampilkan"
|
||||||
|
// >
|
||||||
|
// {e.title}
|
||||||
|
// </Spoiler>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Center w={150}>
|
||||||
|
// {e.imageId ? (
|
||||||
|
// <Button
|
||||||
|
// loaderPosition="center"
|
||||||
|
// loading={isLoading && jobId == e?.id}
|
||||||
|
// color="green"
|
||||||
|
// radius={"xl"}
|
||||||
|
// leftIcon={<IconPhotoCheck />}
|
||||||
|
// onClick={() => {
|
||||||
|
// setJobId(e?.id);
|
||||||
|
// setIsLoading(true);
|
||||||
|
// router.push(RouterAdminGlobal.preview_image({ id: e.imageId }));
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// Lihat
|
||||||
|
// </Button>
|
||||||
|
// ) : (
|
||||||
|
// <Center w={150}>
|
||||||
|
// <Text c={AdminColor.white} fw={"bold"} fz={"xs"} fs={"italic"}>
|
||||||
|
// Tidak ada poster
|
||||||
|
// </Text>
|
||||||
|
// </Center>
|
||||||
|
// )}
|
||||||
|
// </Center>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Spoiler
|
||||||
|
// style={{ color: AdminColor.white }}
|
||||||
|
// hideLabel="sembunyikan"
|
||||||
|
// w={250}
|
||||||
|
// maxHeight={50}
|
||||||
|
// showLabel="tampilkan"
|
||||||
|
// >
|
||||||
|
// <div dangerouslySetInnerHTML={{ __html: e.content }} />
|
||||||
|
// </Spoiler>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Spoiler
|
||||||
|
// style={{ color: AdminColor.white }}
|
||||||
|
// hideLabel="sembunyikan"
|
||||||
|
// w={400}
|
||||||
|
// maxHeight={50}
|
||||||
|
// showLabel="tampilkan"
|
||||||
|
// >
|
||||||
|
// <div dangerouslySetInnerHTML={{ __html: e.deskripsi }} />
|
||||||
|
// </Spoiler>
|
||||||
|
// </td>
|
||||||
|
// <td>
|
||||||
|
// <Stack>
|
||||||
|
// <Stack align="center">
|
||||||
|
// <Button
|
||||||
|
// color={"green"}
|
||||||
|
// leftIcon={<IconCircleCheck />}
|
||||||
|
// radius={"xl"}
|
||||||
|
// onClick={() => {
|
||||||
|
// setJobId(e?.id);
|
||||||
|
// setPublish(true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// >
|
||||||
|
// Publish
|
||||||
|
// </Button>
|
||||||
|
// <Button
|
||||||
|
// color={"red"}
|
||||||
|
// leftIcon={<IconBan />}
|
||||||
|
// radius={"xl"}
|
||||||
|
// onClick={() => {
|
||||||
|
// setReject(true);
|
||||||
|
// setJobId(e.id);
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
|
// Reject
|
||||||
|
// </Button>
|
||||||
|
// </Stack>
|
||||||
|
// </Stack>
|
||||||
|
// </td>
|
||||||
|
// </tr>
|
||||||
|
// ));
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
styles={{ header: { backgroundColor: AdminColor.softBlue }, body: { backgroundColor: AdminColor.softBlue}, title: { color: AdminColor.white } }}
|
styles={{
|
||||||
|
header: { backgroundColor: AdminColor.softBlue },
|
||||||
|
body: { backgroundColor: AdminColor.softBlue },
|
||||||
|
title: { color: AdminColor.white },
|
||||||
|
}}
|
||||||
title={"Apakah anda yakin ingin mempublish job ini?"}
|
title={"Apakah anda yakin ingin mempublish job ini?"}
|
||||||
withCloseButton={false}
|
withCloseButton={false}
|
||||||
opened={publish}
|
opened={publish}
|
||||||
@@ -251,7 +310,7 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
setData(val.data);
|
setData(val.data);
|
||||||
setNPage(val.nPage);
|
setNPage(val.nPage);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
setPublish(false);
|
setPublish(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -262,7 +321,11 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
<Modal
|
<Modal
|
||||||
styles={{ header: { backgroundColor: AdminColor.softBlue }, body: { backgroundColor: AdminColor.softBlue}, title: { color: AdminColor.white } }}
|
styles={{
|
||||||
|
header: { backgroundColor: AdminColor.softBlue },
|
||||||
|
body: { backgroundColor: AdminColor.softBlue },
|
||||||
|
title: { color: AdminColor.white },
|
||||||
|
}}
|
||||||
opened={reject}
|
opened={reject}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
setReject(false);
|
setReject(false);
|
||||||
@@ -278,7 +341,11 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
maxRows={5}
|
maxRows={5}
|
||||||
maxLength={300}
|
maxLength={300}
|
||||||
autosize
|
autosize
|
||||||
label={<Text c={AdminColor.white} fw={"bold"}>Alasan Penolakan</Text>}
|
label={
|
||||||
|
<Text c={AdminColor.white} fw={"bold"}>
|
||||||
|
Alasan Penolakan
|
||||||
|
</Text>
|
||||||
|
}
|
||||||
placeholder="Masukkan alasan penolakan lowongan ini"
|
placeholder="Masukkan alasan penolakan lowongan ini"
|
||||||
onChange={(val) => setCatatan(val.currentTarget.value)}
|
onChange={(val) => setCatatan(val.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
@@ -292,7 +359,7 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
Batal
|
Batal
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
style={{ transition: "0.5s", }}
|
style={{ transition: "0.5s" }}
|
||||||
bg={MainColor.green}
|
bg={MainColor.green}
|
||||||
disabled={catatan === "" ? true : false}
|
disabled={catatan === "" ? true : false}
|
||||||
radius={"xl"}
|
radius={"xl"}
|
||||||
@@ -314,7 +381,6 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
<Stack spacing={"xs"} h={"100%"}>
|
<Stack spacing={"xs"} h={"100%"}>
|
||||||
<ComponentAdminGlobal_TitlePage
|
<ComponentAdminGlobal_TitlePage
|
||||||
name="Review"
|
name="Review"
|
||||||
@@ -365,7 +431,6 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
p={"md"}
|
p={"md"}
|
||||||
w={"100%"}
|
w={"100%"}
|
||||||
h={"100%"}
|
h={"100%"}
|
||||||
|
|
||||||
>
|
>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -373,17 +438,11 @@ export default function AdminJob_ViewTavleReview() {
|
|||||||
<Center c={AdminColor.white}>Author</Center>
|
<Center c={AdminColor.white}>Author</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Text c={AdminColor.white}>Judul</Text>
|
<Center c={AdminColor.white}>Judul</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Poster</Center>
|
<Center c={AdminColor.white}>Poster</Center>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
|
||||||
<Text c={AdminColor.white}>Syarat Ketentuan</Text>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<Text c={AdminColor.white}>Deskripsi</Text>
|
|
||||||
</th>
|
|
||||||
<th>
|
<th>
|
||||||
<Center c={AdminColor.white}>Aksi</Center>
|
<Center c={AdminColor.white}>Aksi</Center>
|
||||||
</th>
|
</th>
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import { useRouter } from "next/navigation";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { apiGetAdminJobByStatus } from "../../lib/api_fetch_admin_job";
|
import { apiGetAdminJobByStatus } from "../../lib/api_fetch_admin_job";
|
||||||
import Admin_DetailButton from "@/app_modules/admin/_admin_global/_component/button/detail_button";
|
import Admin_DetailButton from "@/app_modules/admin/_admin_global/_component/button/detail_button";
|
||||||
|
import { RouterAdminJob } from "@/lib/router_admin/router_admin_job";
|
||||||
|
|
||||||
export default function AdminJob_TablePublish() {
|
export default function AdminJob_TablePublish() {
|
||||||
return (
|
return (
|
||||||
@@ -155,7 +156,9 @@ function TableStatus() {
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Center>
|
<Center>
|
||||||
<Admin_DetailButton path={`/dev/admin/job/${e.id}/publish`} />
|
<Admin_DetailButton
|
||||||
|
path={String(RouterAdminJob.detail({ id: e.id }))}
|
||||||
|
/>
|
||||||
</Center>
|
</Center>
|
||||||
</td>
|
</td>
|
||||||
{/* <td>
|
{/* <td>
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ export const RouterAdminJob = {
|
|||||||
reject: "/dev/admin/job/child/reject",
|
reject: "/dev/admin/job/child/reject",
|
||||||
arsip: "/dev/admin/job/child/arsip",
|
arsip: "/dev/admin/job/child/arsip",
|
||||||
detail_poster: "/dev/admin/job/detail/poster/",
|
detail_poster: "/dev/admin/job/detail/poster/",
|
||||||
|
detail: ({ id }: { id: string }) => `/dev/admin/job/${id}`,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user