Notifikas Job

# fix
- Notifikasi to admin
- Notifikasi to user
- Perubahan tampilan admin
## No issue
This commit is contained in:
2024-06-12 14:25:04 +08:00
parent 76f0396005
commit 3b11b30473
62 changed files with 2209 additions and 527 deletions

View File

@@ -1,60 +1,98 @@
"use client";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { RouterAdminJob } from "@/app/lib/router_admin/router_admin_job";
import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component_global/header_tamplate";
import { MODEL_JOB } from "@/app_modules/job/model/interface";
import {
Avatar,
Badge,
Box,
Button,
Card,
Center,
Divider,
Grid,
Group,
Image,
Modal,
Pagination,
Paper,
ScrollArea,
Spoiler,
Stack,
Table,
Text,
Title,
TextInput,
Title
} from "@mantine/core";
import { useDisclosure } from "@mantine/hooks";
import { IconBan, IconEyeCheck, IconEyeShare } from "@tabler/icons-react";
import _ from "lodash";
import {
IconEyeCheck,
IconSearch
} from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import adminJob_getListPublish from "../../fun/get/get_list_publish";
import { IconPhotoCheck } from "@tabler/icons-react";
export default function AdminJob_TablePublish({
dataVote,
dataPublish,
}: {
dataVote?: any;
dataPublish: any;
}) {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy: Table Publish" />
<TableStatus listReview={dataVote} />
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy" />
<TableStatus dataPublish={dataPublish} />
</Stack>
</>
);
}
function TableStatus({ listReview }: { listReview: MODEL_JOB[] }) {
function TableStatus({ dataPublish }: { dataPublish: any }) {
const router = useRouter();
const [opened, { open, close }] = useDisclosure(false);
const [data, setData] = useState(listReview);
const [img, setImg] = useState("");
const [data, setData] = useState<MODEL_JOB[]>(dataPublish.data);
const [nPage, setNPage] = useState(dataPublish.nPage);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
async function onSearch(s: string) {
setSearch(s);
setActivePage(1);
const loadData = await adminJob_getListPublish({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminJob_getListPublish({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
const TableRows = data?.map((e, i) => (
<tr key={i}>
<td>
<Center w={150}>
<Text>{e?.Author?.username}</Text>
</Center>
</td>
<td>
<Center w={150}>
<Text>
{e?.isArsip ? (
<Badge variant="light">Arsip</Badge>
) : (
<Badge color="green">Publish</Badge>
)}
</Text>
</Center>
</td>
<td>
<Spoiler
w={200}
w={300}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
@@ -63,21 +101,20 @@ function TableStatus({ listReview }: { listReview: MODEL_JOB[] }) {
</Spoiler>
</td>
<td>
<Center w={150}>
<Center w={200}>
{e.imagesId ? (
<Button
color="green"
radius={"xl"}
leftIcon={<IconEyeCheck />}
leftIcon={<IconPhotoCheck />}
onClick={() => {
setImg(e.imagesId);
open();
router.push(RouterAdminJob.detail_poster + e?.imagesId);
}}
>
Lihat
</Button>
) : (
<Center w={150}>
<Center w={200}>
<Text fw={"bold"} fz={"xs"} fs={"italic"}>
Tidak ada poster
</Text>
@@ -110,62 +147,78 @@ function TableStatus({ listReview }: { listReview: MODEL_JOB[] }) {
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
<Stack spacing={"xs"} h={"100%"}>
{/* <pre>{JSON.stringify(listUser, null, 2)}</pre> */}
<Group
position="apart"
bg={"green.4"}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4} c={"white"}>
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> */}
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
placeholder="Masukan judul"
onChange={(val) => {
onSearch(val.currentTarget.value);
}}
/>
</Group>
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={1500}
h={"100%"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Author</Center>
</th>
<th>
<Center>Status</Center>
</th>
<th>
<Text>Judul</Text>
</th>
<th>
<Center>Poster</Center>
</th>
<th>
<Text>Syarat Ketentuan</Text>
</th>
<th>
<Text>Deskripsi</Text>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={nPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
</Stack>
</>
);
}