Update Versi 1.5.27 #32

Merged
bagasbanuna merged 1009 commits from staging into main 2025-12-17 12:22:28 +08:00
798 changed files with 37674 additions and 10596 deletions
Showing only changes of commit b1faf3d745 - Show all commits

View File

@@ -54,6 +54,11 @@
"date": 1738709515069,
"name": "logs/backend/combined-2025-02-05.log",
"hash": "04d27d0d5708dfb4655dbb708eb49f663c063c8f571ea5aa4da9e5bee9daa0f3"
},
{
"date": 1738810141028,
"name": "logs/backend/combined-2025-02-06.log",
"hash": "01ef70a59eea8cd8275ffaf46470ff1d320bf0cfca9a327e5111b6c58f344af3"
}
],
"hashType": "sha256"

View File

@@ -54,6 +54,11 @@
"date": 1738709515065,
"name": "logs/backend/error-2025-02-05.log",
"hash": "b76580b2a8b76ee8941e0d913ff1b38d66ad7bd45f154ed371c913ff898e5dfd"
},
{
"date": 1738810141026,
"name": "logs/backend/error-2025-02-06.log",
"hash": "b32b8fb983ef9dc575cacef2eb1e62c8d1bf022726922c804a6c6d0aea875cf4"
}
],
"hashType": "sha256"

View File

View File

View File

@@ -0,0 +1,5 @@
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/lukman/Documents/projects/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-02-06T02:49:36.302Z"}
{"level":"info","message":"Server status code: 201","timestamp":"2025-02-06T04:29:03.189Z"}
{"level":"info","message":"Success upload job_image: {\"id\":\"cm6su8iqb003dhcxkig4t2tpt\",\"name\":\"cr.jpeg\",\"path\":\"/cm0ur1yxw000056nsjlr6187p/2025/02/06/cr.jpeg\",\"mime\":\"image/jpeg\",\"ext\":\".jpeg\",\"desc\":null,\"size\":187018,\"active\":true,\"createdAt\":\"2025-02-06T04:29:03.057Z\",\"updatedAt\":\"2025-02-06T04:29:03.059Z\",\"userId\":\"cm0ur1yxw000056nsjlr6187p\",\"dirId\":\"cm0ypp6zl0003kp7jf59zuvjy\"}","timestamp":"2025-02-06T04:29:03.208Z"}
{"clientVersion":"6.3.0","level":"error","message":"Eror get data \nInvalid `prisma.job.findMany()` invocation:\n\n{\n orderBy: {\n updatedAt: \"desc\"\n },\n where: {\n masterStatusId: \"2\",\n isActive: true,\n title: {\n mode: \"insensitive\",\n+ contains: String\n }\n },\n include: {\n Author: true\n }\n}\n\nArgument `contains` must not be null.","name":"PrismaClientValidationError","originalColumn":12,"originalLine":10682,"stack":"PrismaClientValidationError: \nInvalid `prisma.job.findMany()` invocation:\n\n{\n orderBy: {\n updatedAt: \"desc\"\n },\n where: {\n masterStatusId: \"2\",\n isActive: true,\n title: {\n mode: \"insensitive\",\n+ contains: String\n }\n },\n include: {\n Author: true\n }\n}\n\nArgument `contains` must not be null.\n at new PrismaClientValidationError (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:148:2395)\n at Hl (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:156:1379)\n at handleRequestError (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:7006)\n at handleAndLogRequestError (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6687)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6394)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-06T04:39:51.823Z"}
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/lukman/Documents/projects/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-02-06T09:29:21.573Z"}

View File

View File

View File

@@ -0,0 +1,3 @@
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/lukman/Documents/projects/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-02-06T02:49:36.302Z"}
{"clientVersion":"6.3.0","level":"error","message":"Eror get data \nInvalid `prisma.job.findMany()` invocation:\n\n{\n orderBy: {\n updatedAt: \"desc\"\n },\n where: {\n masterStatusId: \"2\",\n isActive: true,\n title: {\n mode: \"insensitive\",\n+ contains: String\n }\n },\n include: {\n Author: true\n }\n}\n\nArgument `contains` must not be null.","name":"PrismaClientValidationError","originalColumn":12,"originalLine":10682,"stack":"PrismaClientValidationError: \nInvalid `prisma.job.findMany()` invocation:\n\n{\n orderBy: {\n updatedAt: \"desc\"\n },\n where: {\n masterStatusId: \"2\",\n isActive: true,\n title: {\n mode: \"insensitive\",\n+ contains: String\n }\n },\n include: {\n Author: true\n }\n}\n\nArgument `contains` must not be null.\n at new PrismaClientValidationError (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:148:2395)\n at Hl (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:156:1379)\n at handleRequestError (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:7006)\n at handleAndLogRequestError (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6687)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6394)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-06T04:39:51.823Z"}
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","originalColumn":16,"originalLine":1069,"stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at new eS (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:26724)\n at e_ (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27574)\n at i (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32507)\n at get (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32603)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1217)\n at GET (/Users/lukman/Documents/projects/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1084)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39714)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:33303)\n at <anonymous> (/Users/lukman/Documents/projects/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36)\n at run (node:async_hooks:64:22)","timestamp":"2025-02-06T09:29:21.573Z"}

View File

@@ -0,0 +1,44 @@
import { prisma } from "@/app/lib";
import backendLogger from "@/util/backendLogger";
import { NextResponse } from "next/server";
export async function GET(request: Request) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json({
success: false,
message: "Method nol allowed"
},
{ status: 405 }
)
}
try {
const data = await prisma.donasiMaster_Kategori.findMany({
orderBy: {
createdAt: 'asc'
},
where: {
active: true
}
})
return NextResponse.json({
success: true,
message: "Success get kategori",
data: data
})
} catch (error) {
backendLogger.error("Error get kategori", error);
return NextResponse.json({
success: false,
message: "Failed get kategori",
reason: (error as Error).message
},
{ status: 500 }
)
} finally {
await prisma.$disconnect
}
}

View File

@@ -0,0 +1,112 @@
import { Job_Status } from '@/app_modules/job';
import { prisma } from "@/app/lib";
import _, { take } from "lodash";
import { NextResponse } from "next/server";
import backendLogger from '@/util/backendLogger';
import moment from 'moment';
export async function GET(request: Request, { params }: {
params: { status: string }
}
) {
const method = request.method;
if (method !== 'GET') {
return NextResponse.json({
success: false,
message: "Method not allowed"
},
{ status: 405 }
)
}
const { status } = params;
const { searchParams } = new URL(request.url);
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10
const skipData = Number(page) * takeData - takeData;
try {
let fixData;
const fixStatus = _.startCase(status);
if (!page) {
fixData = await prisma.job.findMany({
orderBy: {
updatedAt: "desc"
},
where: {
isActive: true,
isArsip: false,
MasterStatus: {
name: fixStatus
},
title: {
contains: search ? search : "",
mode: "insensitive"
}
},
include: {
Author: true,
},
})
} else {
fixData = await prisma.job.findMany({
take: takeData,
skip: skipData,
orderBy: {
updatedAt: "desc"
},
where: {
isActive: true,
isArsip: false,
MasterStatus: {
name: fixStatus
},
title: {
contains: search ? search : "",
mode: "insensitive"
}
},
include: {
Author: true,
},
})
const nCount = await prisma.job.count({
where: {
isActive: true,
isArsip: false,
title: {
contains: search ? search : "",
mode: "insensitive"
}
}
})
fixData = {
data: fixData,
nPage: _.ceil(nCount / takeData)
}
}
return NextResponse.json({
success: true,
message: "Data found",
data: fixData,
},
{ status: 200 }
)
} catch (error) {
backendLogger.error("Eror get data", error)
return NextResponse.json({
success: false,
message: "Data not found",
reason: (error as Error).message
},
{ status: 500 }
)
}
}

View File

@@ -0,0 +1,109 @@
import { prisma } from "@/app/lib";
import _ from "lodash";
import moment from "moment";
import { NextResponse } from "next/server";
export async function GET(request: Request,
{ params }: { params: { status: string } }
) {
const method = request.method;
if (method !== "GET") {
return NextResponse.json({
success: false,
message: "Method not allowed"
},
{ status: 405 }
)
}
const { status } = params;
const { searchParams } = new URL(request.url);
const search = searchParams.get("search");
const page = searchParams.get("page");
const takeData = 10;
const skipData = Number(page) * takeData - takeData;
try {
let fixData;
const fixStatus = _.startCase(status);
if (!page && !search) {
fixData = await prisma.voting.findMany({
orderBy: {
updatedAt: "desc"
},
where: {
isActive: true,
isArsip: false,
Voting_Status: {
name: fixStatus
}
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true
}
}
}
},
Voting_Status: true,
Voting_Kontributor: true,
Voting_DaftarNamaVote: true,
}
})
} else if (!page && search) {
fixData = await prisma.voting.findMany({
orderBy: {
updatedAt: "desc"
},
where: {
isActive: true,
isArsip: false,
Voting_Status: {
name: fixStatus
},
title: {
contains: search,
mode: "insensitive"
}
},
include: {
Author: {
select: {
id: true,
username: true,
Profile: {
select: {
name: true
}
}
}
},
Voting_Status: true,
Voting_Kontributor: true,
Voting_DaftarNamaVote: true,
}
})
} else if (page && !search) {
if (fixStatus === "Publish") {
const getAllData = await prisma.voting.findMany({
where: {
isActive: true,
Voting_Status: {
name: fixStatus
},
isArsip: false
}
});
}
}
} catch (error) {
}
}

View File

@@ -2,11 +2,11 @@ import { AdminDonasi_TableKategori } from "@/app_modules/admin/donasi";
import adminDonasi_getMasterKategori from "@/app_modules/admin/donasi/fun/master/get_list_kategori";
export default async function Page() {
const listKategori = await adminDonasi_getMasterKategori();
// const listKategori = await adminDonasi_getMasterKategori();
return (
<>
<AdminDonasi_TableKategori listKategori={listKategori} />
<AdminDonasi_TableKategori />
</>
);
}

View File

@@ -3,11 +3,11 @@ import adminJob_getListPublish from "@/app_modules/admin/job/fun/get/get_list_pu
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_getListPublish({page: 1})
return (
<>
<AdminJob_TablePublish dataPublish={listPublish as any} />
<AdminJob_TablePublish />
</>
);
}

View File

@@ -2,11 +2,10 @@ 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() {
const dataReview = await adminJob_getListReview({ page: 1 });
return (
<>
<AdminJob_TableReview dataReview={dataReview} />
<AdminJob_TableReview />
</>
);
}

View File

@@ -6,9 +6,11 @@ import { update } from "lodash";
export default async function adminDonasi_funUpdatekategoriById({
kategoriId,
name,
}: {
kategoriId: string;
name: string;
}) {
const updt = await prisma.donasiMaster_Kategori.update({
where: {
@@ -16,6 +18,7 @@ export default async function adminDonasi_funUpdatekategoriById({
},
data: {
name: name,
},
});

View File

@@ -1,7 +1,8 @@
export {
apiGetAdminDonasiStatusCountDashboard,
apiGetAdminDonasiKategoriCountDashboard,
apiGetAdminDonasiByStatus
apiGetAdminDonasiByStatus,
apiGetAdminDonasiKategori
};
const apiGetAdminDonasiStatusCountDashboard = async ({ name }:
{ name: "Publish" | "Review" | "Reject" }) => {
@@ -66,3 +67,20 @@ const apiGetAdminDonasiByStatus = async ({
console.log("Ini response", response)
return await response.json().catch(() => null);
}
const apiGetAdminDonasiKategori = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
console.log("ini token", token)
const response = await fetch(`/api/admin/donasi/kategori`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`
}
})
return await response.json().catch(() => null);
}

View File

@@ -32,25 +32,23 @@ import _ from "lodash";
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
import { AccentColor } from "@/app_modules/_global/color";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
import { useShallowEffect } from "@mantine/hooks";
import { apiGetAdminDonasiKategori } from "../lib/api_fetch_admin_donasi";
import { clientLogger } from "@/util/clientLogger";
export default function AdminDonasi_TableKategori({
listKategori,
}: {
listKategori: MODEL_NEW_DEFAULT_MASTER[];
}) {
export default function AdminDonasi_TableKategori() {
return (
<>
<Stack h={"100%"}>
<ComponentAdminGlobal_HeaderTamplate name="Donasi" />
<TableView list={listKategori} />
<TableView />
</Stack>
</>
);
}
function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
const [data, setData] = useState(list);
function TableView() {
const [data, setData] = useState<MODEL_NEW_DEFAULT_MASTER[] | null>(null);
const [create, setCreate] = useState("");
const [isCreate, setIsCreate] = useState(false);
@@ -67,6 +65,22 @@ function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
});
const [isChangeStatus, setIsChangeStatus] = useState(false);
useShallowEffect(() => {
onLoadData();
}, []);
async function onLoadData() {
try {
const response = await apiGetAdminDonasiKategori();
if (response) {
console.log("ini response", response)
setData(response.data)
}
} catch (error) {
clientLogger.error("Error get kategori" , error)
}
}
async function onCreateNewKategori() {
const tambahData = await adminDonasi_funCreateKategori({
newKategori: create,
@@ -114,49 +128,63 @@ function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
}
}
const rowTable = data.map((e, i) => (
<tr key={i}>
<td>
<Center c={AccentColor.white}>
<Text>{e?.name}</Text>
</Center>
</td>
<td>
<Center>
<Switch
color="orange"
onLabel="ON"
offLabel="OFF"
checked={e?.active}
onChange={(val) => {
const status = val.currentTarget.checked;
setIsChangeStatus(true);
setUpdateStatus({
kategoriId: e?.id,
isActive: status as any,
});
}}
/>
</Center>
</td>
<td>
<Group position="center">
<ActionIcon
onClick={() => {
setIsUpdate(true);
setIsCreate(false);
setUpdateKategori({
kategoriId: e?.id,
name: e?.name,
});
}}
>
<IconEdit color={AdminColor.green} />
</ActionIcon>
</Group>
</td>
</tr>
));
const renderTableBody = () => {
if (!Array.isArray(data) || data.length === 0) {
return (
<tr>
<td colSpan={12}>
<Center>
<Text color="gray">Tidak ada data</Text>
</Center>
</td>
</tr>
)
}
return data.map((e, i) => (
<tr key={i}>
<td>
<Center c={AccentColor.white}>
<Text>{e?.name}</Text>
</Center>
</td>
<td>
<Center>
<Switch
color="orange"
onLabel="ON"
offLabel="OFF"
checked={e?.active}
onChange={(val) => {
const status = val.currentTarget.checked;
setIsChangeStatus(true);
setUpdateStatus({
kategoriId: e?.id,
isActive: status as any,
});
}}
/>
</Center>
</td>
<td>
<Group position="center">
<ActionIcon
onClick={() => {
setIsUpdate(true);
setIsCreate(false);
setUpdateKategori({
kategoriId: e?.id,
name: e?.name,
});
}}
>
<IconEdit color={AdminColor.green} />
</ActionIcon>
</Group>
</td>
</tr>
));
}
return (
<>
@@ -167,16 +195,16 @@ function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
color={AdminColor.softBlue}
component={
<Button
w={120}
leftIcon={<IconCirclePlus />}
radius={"xl"}
onClick={() => {
setIsCreate(true);
setIsUpdate(false);
}}
>
Tambah
</Button>
w={120}
leftIcon={<IconCirclePlus />}
radius={"xl"}
onClick={() => {
setIsCreate(true);
setIsUpdate(false);
}}
>
Tambah
</Button>
}
/>
{/* <Group
@@ -208,7 +236,7 @@ function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
>
<thead>
<tr>
@@ -223,7 +251,7 @@ function TableView({ list }: { list: MODEL_NEW_DEFAULT_MASTER[] }) {
</th>
</tr>
</thead>
<tbody>{rowTable}</tbody>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
{/* <Center mt={"xl"}>

View File

@@ -24,6 +24,7 @@ import { useState } from "react";
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
import { apiGetAdminEventRiwayat } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
export default function AdminEvent_Riwayat() {
return (
@@ -112,28 +113,28 @@ function DetailRiwayat() {
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text>{e?.Author?.username}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text lineClamp={2}>{e.title}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text>{e.lokasi}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text>{e.EventMaster_TipeAcara.name}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text align="center">
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
@@ -148,7 +149,7 @@ function DetailRiwayat() {
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text align="center">
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
@@ -164,7 +165,7 @@ function DetailRiwayat() {
</td>
<td>
<Center w={400}>
<Center c={AdminColor.white} w={400}>
<Spoiler
hideLabel="sembunyikan"
maxHeight={50}
@@ -183,11 +184,11 @@ function DetailRiwayat() {
<Stack spacing={"xs"} h={"100%"}>
<Group
position="apart"
bg={"gray.4"}
bg={AdminColor.softBlue}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4}>Riwayat</Title>
<Title c={AdminColor.white} order={4}>Riwayat</Title>
<TextInput
icon={<IconSearch size={20} />}
radius={"xl"}
@@ -201,41 +202,40 @@ function DetailRiwayat() {
{!data ? (
<CustomSkeleton height={"80vh"} width="100%" />
) : (
<Paper p={"md"} withBorder shadow="lg" h={"80vh"}>
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>Aksi</Center>
<Center c={AdminColor.white}>Aksi</Center>
</th>
<th>
<Center>Username</Center>
<Center c={AdminColor.white}>Username</Center>
</th>
<th>
<Center>Judul</Center>
<Center c={AdminColor.white}>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
<Center c={AdminColor.white}>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
<Center c={AdminColor.white}>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
<Center c={AdminColor.white}>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
<Center c={AdminColor.white}>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Deskripsi</Center>
<Center c={AdminColor.white}>Deskripsi</Center>
</th>
</tr>
</thead>

View File

@@ -28,6 +28,7 @@ import { AdminEvent_getListTipeAcara } from "../fun/get/get_list_tipe_acara";
import { apiGetAdminEventTipeAcara } from "@/app/dev/admin/event/_lib/api_fecth_admin_event";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
import { clientLogger } from "@/util/clientLogger";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
export default function AdminEvent_DetailTipeAcara() {
return (
@@ -92,11 +93,11 @@ function DetailTipeAcara() {
<Group
position="apart"
bg={"gray.4"}
bg={AdminColor.softBlue}
p={"xs"}
style={{ borderRadius: "6px" }}
>
<Title order={4}>Tipe Acara</Title>
<Title c={AdminColor.white} order={4}>Tipe Acara</Title>
<Button
leftIcon={<IconCirclePlus />}
radius={"xl"}
@@ -123,14 +124,14 @@ function DetailTipeAcara() {
]}
>
<div>
<Paper p={"md"} shadow="lg" withBorder>
<Paper p={"md"} bg={AdminColor.softBlue}>
<Stack>
<Title order={3}>Tipe Acara Yang Tersedia </Title>
<Title c={AdminColor.white} order={3}>Tipe Acara Yang Tersedia </Title>
<Stack px={"md"}>
{tipe.map((e, i) => (
<Stack key={e.id} spacing={"xs"}>
<Group position="apart">
<Text>{e.name}</Text>
<Text c={AdminColor.white}>{e.name}</Text>
<Group>
<ActionIcon
variant="transparent"
@@ -202,9 +203,10 @@ function DetailTipeAcara() {
<div>
{openEditor ? (
<Paper p={"sm"} shadow="lg" withBorder>
<Paper p={"sm"} bg={AdminColor.softBlue}>
<Stack>
<TextInput
styles={{ label: { color: AdminColor.white } }}
value={edit?.name ? edit?.name : ""}
label="Edit Tipe"
placeholder="Contoh: Ramah Tamah, dll"

View File

@@ -24,6 +24,7 @@ import { useState } from "react";
import QRCode from "react-qr-code";
import { ComponentAdminGlobal_TitlePage } from "../../_admin_global/_component";
import ComponentAdminGlobal_HeaderTamplate from "../../_admin_global/header_tamplate";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
export default function AdminEvent_TablePublish() {
return (
@@ -135,28 +136,28 @@ function TableStatus() {
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text>{e?.Author?.username}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text lineClamp={2}>{e.title}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text>{e.lokasi}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text>{e.EventMaster_TipeAcara?.name}</Text>
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text align="center">
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
@@ -171,7 +172,7 @@ function TableStatus() {
</Center>
</td>
<td>
<Center w={200}>
<Center c={AdminColor.white} w={200}>
<Text align="center">
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "full",
@@ -187,7 +188,7 @@ function TableStatus() {
</td>
<td>
<Center w={400}>
<Center c={AdminColor.white} w={400}>
<Spoiler
hideLabel="sembunyikan"
maxHeight={50}
@@ -222,7 +223,7 @@ function TableStatus() {
<Stack spacing="xs" h="100%">
<ComponentAdminGlobal_TitlePage
name="Publish"
color="green"
color={AdminColor.softBlue}
component={
<TextInput
disabled={!data}
@@ -238,47 +239,45 @@ function TableStatus() {
{!data ? (
<CustomSkeleton height={"80vh"} width="100%" />
) : (
<Paper p="md" withBorder shadow="lg" h="80vh">
<Paper p="md" bg={AdminColor.softBlue} h="80vh">
<ScrollArea w="100%" h="90%">
<Table
verticalSpacing="md"
horizontalSpacing="md"
p="md"
w={1500}
striped
highlightOnHover
>
<thead>
<tr>
<th>
<Center>QR Code</Center>
<Center c={AdminColor.white}>QR Code</Center>
</th>
<th>
<Center>Download QR</Center>
<Center c={AdminColor.white}>Download QR</Center>
</th>
<th>
<Center>Username</Center>
<Center c={AdminColor.white}>Username</Center>
</th>
<th>
<Center>Judul</Center>
<Center c={AdminColor.white}>Judul</Center>
</th>
<th>
<Center>Lokasi</Center>
<Center c={AdminColor.white}>Lokasi</Center>
</th>
<th>
<Center>Tipe Acara</Center>
<Center c={AdminColor.white}>Tipe Acara</Center>
</th>
<th>
<Center>Tanggal & Waktu Mulai</Center>
<Center c={AdminColor.white}>Tanggal & Waktu Mulai</Center>
</th>
<th>
<Center>Tanggal & Waktu Selesai</Center>
<Center c={AdminColor.white}>Tanggal & Waktu Selesai</Center>
</th>
<th>
<Center>Deskripsi</Center>
<Center c={AdminColor.white}>Deskripsi</Center>
</th>
<th>
<Center>Aksi</Center>
<Center c={AdminColor.white}>Aksi</Center>
</th>
</tr>
</thead>

View File

@@ -47,7 +47,7 @@ export default function AdminEvent_TableReject() {
function TableStatus() {
const router = useRouter();
const [data, setData] = useState<MODEL_EVENT[] | null>(null);
const [isNPage, setNPage] = useState(1);
const [isNPage, setNPage] = useState<number>(1);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");

View File

@@ -46,15 +46,14 @@ import adminJob_getListReview from "../fun/get/get_list_review";
import { useAtom } from "jotai";
import { AccentColor } from "@/app_modules/_global/color";
import { AdminColor, MainColor } from "@/app_modules/_global/color/color_pallet";
import { clientLogger } from "@/util/clientLogger";
import { apiGetAdminJobByStatus } from "../lib/api_fetch_admin_job";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
export default function AdminJob_ViewTavleReview({
listReview,
}: {
listReview: any;
}) {
export default function AdminJob_ViewTavleReview() {
const router = useRouter();
const [data, setData] = useState<MODEL_JOB[]>(listReview.data);
const [nPage, setNPage] = useState(listReview.nPage);
const [data, setData] = useState<MODEL_JOB[] | null>(null);
const [nPage, setNPage] = useState<number>(1);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
const [publish, setPublish] = useState(false);
@@ -70,153 +69,159 @@ export default function AdminJob_ViewTavleReview({
const [isShowReload, setIsShowReload] = useState(false);
useShallowEffect(() => {
if (isAdminJob_TriggerReview) {
setIsShowReload(true);
loadInitialData();
}, [activePage, isSearch]);
const loadInitialData = async () => {
try {
const response = await apiGetAdminJobByStatus({
status: "Review",
page: `${activePage}`,
search: isSearch
})
if (response?.success && response?.data.data) {
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error("Invliad data format recieved", response)
setData([]);
}
} catch (error) {
clientLogger.error("Error get data table publish", error);
setData([]);
}
}, [isAdminJob_TriggerReview, setIsShowReload]);
// useShallowEffect(() => {
// onLoadData({
// onSuccessLoad(val) {
// setData(val.data);
// setNPage(val.nPage);
// },
// });
// }, [setData, setNPage]);
// async function onLoadData({
// onSuccessLoad,
// }: {
// onSuccessLoad: (val: any) => any;
// }) {
// const loadData = await adminJob_getListReview({ page: 1 });
// onSuccessLoad(loadData);
// }
}
async function onLoadData() {
const loadData = await adminJob_getListReview({ page: 1 });
setData(loadData.data as any);
setNPage(loadData.nPage);
loadInitialData();
setIsLoading(false);
setIsShowReload(false);
setIsAdminJob_TriggerReview(false);
}
async function onSearch(s: string) {
setSearch(s);
const onSearch = async (searchTerm: string) => {
setSearch(searchTerm);
setActivePage(1);
const loadData = await adminJob_getListReview({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
}
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminJob_getListReview({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
const onPageClick = (page: number) => {
setActivePage(page);
}
const rowTable = data?.map((e, i) => (
<tr key={i}>
<td>
<Center w={150}>
<Text c={AdminColor.white}>{e?.Author?.username}</Text>
</Center>
</td>
<td>
<Spoiler
w={200}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={200}>
{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>
const renderTableBody = () => {
if (!Array.isArray(data) || data.length === 0) {
return (
<tr>
<td colSpan={12}>
<Center>
<Text color="gray">Tidak ada data</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={<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>
</td>
</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={200}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={200}>
{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={400}
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>
</Stack>
</td>
</tr>
));
</td>
</tr>
));
}
return (
<>
@@ -306,7 +311,7 @@ export default function AdminJob_ViewTavleReview({
</Group>
</Stack>
</Modal>
<Stack spacing={"xs"} h={"100%"}>
<ComponentAdminGlobal_TitlePage
@@ -323,76 +328,79 @@ export default function AdminJob_ViewTavleReview({
/>
}
/>
{!data ? (
<CustomSkeleton height={"80vh"} width={"100%"} />
) : (
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
{isShowReload && (
<Paper bg={"red"} w={"50%"}>
<Affix position={{ top: rem(200) }} w={"100%"}>
<Center>
<Button
style={{
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
}}
bg={AccentColor.blue}
loaderPosition="center"
loading={isLoading}
radius={"xl"}
opacity={0.8}
onClick={() => onLoadData()}
leftIcon={<IconRefresh />}
>
Update Data
</Button>
</Center>
</Affix>
</Paper>
)}
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
{isShowReload && (
<Paper bg={"red"} w={"50%"}>
<Affix position={{ top: rem(200) }} w={"100%"}>
<Center>
<Button
style={{
transition: "0.5s",
border: `1px solid ${AccentColor.skyblue}`,
}}
bg={AccentColor.blue}
loaderPosition="center"
loading={isLoading}
radius={"xl"}
opacity={0.8}
onClick={() => onLoadData()}
leftIcon={<IconRefresh />}
>
Update Data
</Button>
</Center>
</Affix>
</Paper>
)}
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
h={"100%"}
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
h={"100%"}
>
<thead>
<tr>
<th>
<Center c={AdminColor.white}>Author</Center>
</th>
<th>
<Text c={AdminColor.white}>Judul</Text>
</th>
<th>
<Center c={AdminColor.white}>Poster</Center>
</th>
<th>
<Text c={AdminColor.white}>Syarat Ketentuan</Text>
</th>
<th>
<Text c={AdminColor.white}>Deskripsi</Text>
</th>
<th>
<Center c={AdminColor.white}>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{rowTable}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={nPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
>
<thead>
<tr>
<th>
<Center c={AdminColor.white}>Author</Center>
</th>
<th>
<Text c={AdminColor.white}>Judul</Text>
</th>
<th>
<Center c={AdminColor.white}>Poster</Center>
</th>
<th>
<Text c={AdminColor.white}>Syarat Ketentuan</Text>
</th>
<th>
<Text c={AdminColor.white}>Deskripsi</Text>
</th>
<th>
<Center c={AdminColor.white}>Aksi</Center>
</th>
</tr>
</thead>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={nPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
)}
</Stack>
</>
);

View File

@@ -17,135 +17,163 @@ import {
Text,
TextInput,
} from "@mantine/core";
import { IconPhotoCheck, IconSearch } from "@tabler/icons-react";
import { IconPhotoCheck, IconSearch, IconSettingsSearch } from "@tabler/icons-react";
import { useRouter } from "next/navigation";
import { useState } from "react";
import adminJob_getListPublish from "../../fun/get/get_list_publish";
import { RouterAdminGlobal } from "@/app/lib";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
import { useShallowEffect } from "@mantine/hooks";
import { apiGetAdminJobByStatus } from "../../lib/api_fetch_admin_job";
import { clientLogger } from "@/util/clientLogger";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
export default function AdminJob_TablePublish({
dataPublish,
}: {
dataPublish: any;
}) {
export default function AdminJob_TablePublish() {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy" />
<TableStatus dataPublish={dataPublish} />
<TableStatus />
</Stack>
</>
);
}
function TableStatus({ dataPublish }: { dataPublish: any }) {
function TableStatus() {
const router = useRouter();
const [data, setData] = useState<MODEL_JOB[]>(dataPublish.data);
const [nPage, setNPage] = useState(dataPublish.nPage);
const [data, setData] = useState<MODEL_JOB[] | null>(null);
const [nPage, setNPage] = useState<number>(1);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
const [isLoadingShowImage, setLoadingShowImage] = useState(false);
const [dataId, setDataId] = useState("");
async function onSearch(s: string) {
setSearch(s);
useShallowEffect(() => {
loadInitialData();
}, [activePage, isSearch])
const loadInitialData = async () => {
try {
const response = await apiGetAdminJobByStatus({
status: "Publish",
page: `${activePage}`,
search: isSearch
})
if (response?.success && response?.data.data) {
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error("Invalid data format recieved", response)
setData([])
}
} catch (error) {
clientLogger.error("Invalid data format recieved:", error)
setData([])
}
}
const onSearch = async (searchTerm: string) => {
setSearch(searchTerm);
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 onPageClick = (page: number) => {
setActivePage(page);
}
const TableRows = data?.map((e, i) => (
<tr key={i}>
<td>
<Center w={150}>
<Text c={AdminColor.white}>{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={300}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={200}>
{e.imageId ? (
<Button
loaderPosition="center"
loading={isLoadingShowImage && e.id === dataId}
color="green"
radius={"xl"}
leftIcon={<IconPhotoCheck />}
onClick={() => {
setLoadingShowImage(true);
setDataId(e.id);
router.push(RouterAdminGlobal.preview_image({ id: e.imageId }));
}}
>
Lihat
</Button>
) : (
<Center w={200}>
<Text c={AdminColor.white} fw={"bold"} fz={"xs"} fs={"italic"}>
Tidak ada poster
</Text>
const renderTableBody = () => {
if (!Array.isArray(data) || data.length === 0) {
return (
<tr>
<td colSpan={12}>
<Center>
<Text color="gray">Tidak ada data</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>
));
</td>
</tr>
)
}
return data?.map((e, i) => (
<tr key={i}>
<td>
<Center w={150}>
<Text c={AdminColor.white}>{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
c={AdminColor.white}
w={300}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={200}>
{e.imageId ? (
<Button
loaderPosition="center"
loading={isLoadingShowImage && e.id === dataId}
color="green"
radius={"xl"}
leftIcon={<IconPhotoCheck />}
onClick={() => {
setLoadingShowImage(true);
setDataId(e.id);
router.push(RouterAdminGlobal.preview_image({ id: e.imageId }));
}}
>
Lihat
</Button>
) : (
<Center w={200}>
<Text c={AdminColor.white} fw={"bold"} fz={"xs"} fs={"italic"}>
Tidak ada poster
</Text>
</Center>
)}
</Center>
</td>
<td>
<Spoiler
c={AdminColor.white}
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.content }} />
</Spoiler>
</td>
<td>
<Spoiler
c={AdminColor.white}
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.deskripsi }} />
</Spoiler>
</td>
</tr>
));
}
return (
<>
@@ -165,52 +193,55 @@ function TableStatus({ dataPublish }: { dataPublish: any }) {
/>
}
/>
{!data ? (
<CustomSkeleton height={"80vh"} width="100%" />
) : (
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
h={"100%"}
<Paper p={"md"} bg={AdminColor.softBlue} h={"80vh"}>
<ScrollArea w={"100%"} h={"90%"}>
<Table
verticalSpacing={"md"}
horizontalSpacing={"md"}
p={"md"}
w={"100%"}
h={"100%"}
>
<thead>
<tr>
<th>
<Center c={AdminColor.white}>Author</Center>
</th>
<th>
<Center c={AdminColor.white}>Status</Center>
</th>
<th>
<Text c={AdminColor.white}>Judul</Text>
</th>
<th>
<Center c={AdminColor.white}>Poster</Center>
</th>
<th>
<Text c={AdminColor.white}>Syarat Ketentuan</Text>
</th>
<th>
<Text c={AdminColor.white}>Deskripsi</Text>
</th>
</tr>
</thead>
<tbody>{TableRows}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={nPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
>
<thead>
<tr>
<th>
<Center c={AdminColor.white}>Author</Center>
</th>
<th>
<Center c={AdminColor.white}>Status</Center>
</th>
<th>
<Text c={AdminColor.white}>Judul</Text>
</th>
<th>
<Center c={AdminColor.white}>Poster</Center>
</th>
<th>
<Text c={AdminColor.white}>Syarat Ketentuan</Text>
</th>
<th>
<Text c={AdminColor.white}>Deskripsi</Text>
</th>
</tr>
</thead>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>
<Pagination
value={activePage}
total={nPage}
onChange={(val) => {
onPageClick(val);
}}
/>
</Center>
</Paper>
)}
</Stack>
</>
);

View File

@@ -31,6 +31,9 @@ import { WibuRealtime } from "wibu-pkg";
import { AdminJob_funEditCatatanById } from "../../fun/edit/fun_edit_catatan_by_id";
import adminJob_getListReject from "../../fun/get/get_list_reject";
import { AdminColor } from "@/app_modules/_global/color/color_pallet";
import { apiGetAdminJobByStatus } from "../../lib/api_fetch_admin_job";
import { clientLogger } from "@/util/clientLogger";
import { useShallowEffect } from "@mantine/hooks";
export default function AdminJob_TableReject({
dataReject,
@@ -41,16 +44,16 @@ export default function AdminJob_TableReject({
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy" />
<TableStatus listReject={dataReject} />
<TableStatus />
</Stack>
</>
);
}
function TableStatus({ listReject }: { listReject: any }) {
function TableStatus() {
const router = useRouter();
const [data, setData] = useState<MODEL_JOB[]>(listReject.data);
const [nPage, setNPage] = useState(listReject.nPage);
const [data, setData] = useState<MODEL_JOB[] | null>(null);
const [nPage, setNPage] = useState<number>(1);
const [activePage, setActivePage] = useState(1);
const [isSearch, setSearch] = useState("");
@@ -59,119 +62,148 @@ function TableStatus({ listReject }: { listReject: any }) {
const [isLoading, setIsLoading] = useState(false);
const [catatan, setCatatan] = useState("");
async function onSearch(s: string) {
setSearch(s);
const loadData = await adminJob_getListReject({
page: 1,
search: s,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
useShallowEffect(() => {
loadInitialData();
}, [activePage, isSearch]);
const loadInitialData = async () => {
try {
const response = await apiGetAdminJobByStatus({
status: "Reject",
page: `${activePage}`,
search: isSearch
});
if (response?.success && response?.data.data) {
setData(response.data.data);
setNPage(response.data.nPage || 1);
} else {
console.error('Invalid data format recieved:', response)
setData([]);
}
} catch (error) {
clientLogger.error("Invalid data format recieced:", error);
setData([])
}
}
const onSearch = async (searchTerm: string) => {
setSearch(searchTerm);
setActivePage(1);
}
async function onPageClick(p: any) {
setActivePage(p);
const loadData = await adminJob_getListReject({
search: isSearch,
page: p,
});
setData(loadData.data as any);
setNPage(loadData.nPage);
const onPageClick = (page: number) => {
setActivePage(page);
}
const rowTable = data?.map((e, i) => (
<tr key={i}>
<td>
<Center w={150}>
<Text c={AdminColor.white}>{e?.Author?.username}</Text>
</Center>
</td>
<td>
<Spoiler
w={200}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={150}>
{e.imageId ? (
<Button
loading={isLoading && e?.imageId === jobId}
loaderPosition="center"
color="green"
radius={"xl"}
leftIcon={<IconPhotoCheck />}
onClick={() => {
setJobId(e?.imageId);
setIsLoading(true);
router.push(RouterAdminJob.detail_poster + e?.imageId);
}}
>
Lihat
</Button>
) : (
<Center w={150}>
<Text c={AdminColor.white} fw={"bold"} fz={"xs"} fs={"italic"}>
Tidak ada poster
</Text>
const renderTableBody = () => {
if (!Array.isArray(data) || data.length === 0) {
return (
<tr>
<td colSpan={12}>
<Center>
<Text color="gray">Tidak ada data</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);
}}
>
<Stack spacing={0}>
<Text fz={10}>Tambah</Text>
<Text fz={10}>Catatan</Text>
</Stack>
</Button>
</td>
</tr>
));
</td>
</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
w={200}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
c={AdminColor.white}
>
{e.title}
</Spoiler>
</td>
<td>
<Center w={150}>
{e.imageId ? (
<Button
loading={isLoading && e?.imageId === jobId}
loaderPosition="center"
color="green"
radius={"xl"}
leftIcon={<IconPhotoCheck />}
onClick={() => {
setJobId(e?.imageId);
setIsLoading(true);
router.push(RouterAdminJob.detail_poster + 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
c={AdminColor.white}
w={400}
maxHeight={50}
hideLabel="sembunyikan"
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.content }} />
</Spoiler>
</td>
<td>
<Spoiler
c={AdminColor.white}
hideLabel="sembunyikan"
w={400}
maxHeight={50}
showLabel="tampilkan"
>
<div dangerouslySetInnerHTML={{ __html: e.deskripsi }} />
</Spoiler>
</td>
<td>
<Spoiler
c={AdminColor.white}
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);
}}
>
<Stack spacing={0} c={AdminColor.white}>
<Text fz={10}>Tambah</Text>
<Text fz={10}>Catatan</Text>
</Stack>
</Button>
</td>
</tr>
));
}
return (
<>
@@ -253,7 +285,7 @@ function TableStatus({ listReject }: { listReject: any }) {
p={"md"}
w={"100%"}
h={"100%"}
>
<thead>
<tr>
@@ -280,7 +312,7 @@ function TableStatus({ listReject }: { listReject: any }) {
</th>
</tr>
</thead>
<tbody>{rowTable}</tbody>
<tbody>{renderTableBody()}</tbody>
</Table>
</ScrollArea>
<Center mt={"xl"}>

View File

@@ -4,16 +4,12 @@ import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/_admin_glob
import { Stack } from "@mantine/core";
import { AdminJob_ViewTavleReview } from "../../_view";
export default function AdminJob_TableReview({
dataReview,
}: {
dataReview: any;
}) {
export default function AdminJob_TableReview() {
return (
<>
<Stack>
<ComponentAdminGlobal_HeaderTamplate name="Job Vacancy" />
<AdminJob_ViewTavleReview listReview={dataReview} />
<AdminJob_ViewTavleReview />
</Stack>
</>
);

View File

@@ -1,9 +1,10 @@
export {
apiGetJobStatusCountDashboard,
apiGetJobArsipCount
apiGetAdminJobStatusCountDashboard as apiGetJobStatusCountDashboard ,
apiGetAdminJobArsipCount as apiGetJobArsipCount,
apiGetAdminJobByStatus
}
const apiGetJobStatusCountDashboard = async ({ name }: {
const apiGetAdminJobStatusCountDashboard = async ({ name }: {
name: "Publish" | "Review" | "Reject";
}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
@@ -21,7 +22,7 @@ const apiGetJobStatusCountDashboard = async ({ name }: {
return await response.json().catch(() => null)
}
const apiGetJobArsipCount = async () => {
const apiGetAdminJobArsipCount = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
@@ -36,4 +37,31 @@ const apiGetJobArsipCount = async () => {
});
return await response.json().catch(() => null)
};
};
const apiGetAdminJobByStatus = async ({
status,
page,
search
}: {
status: "Publish" | "Review" | "Reject";
page: string;
search: string;
}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const isPage = page ? `?page=${page}` : "";
const isSearch = search ? `&search=${search}` : "";
const response = await fetch(
`/api/admin/job/${status}${isPage}${isSearch}`,
{
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`
}
}
)
return await response.json().catch(() => null)
}

View File

@@ -85,7 +85,7 @@ export default function HomeViewNew() {
<ActionIcon radius={"xl"} variant={"transparent"}>
<IconUserSearch color={MainColor.white} />
</ActionIcon>
) : dataUser.profile === undefined ? (
) : dataUser?.profile === undefined ? (
<ActionIcon
radius={"xl"}
variant={"transparent"}
@@ -112,7 +112,7 @@ export default function HomeViewNew() {
<ActionIcon radius={"xl"} variant={"transparent"}>
<IconBell color={MainColor.white} />
</ActionIcon>
) : dataUser.profile === undefined ? (
) : dataUser?.profile === undefined ? (
<ActionIcon
radius={"xl"}
variant={"transparent"}

View File

@@ -39,10 +39,11 @@ const middlewareConfig: MiddlewareConfig = {
// ADMIN API
// "/api/admin/event/*",
// "/api/admin/investasi/*",
"/api/admin/donasi/*",
// "/api/admin/donasi/*",
// "/api/admin/voting/dashboard/*",
// "/api/admin/job/dashboard/*",
// "/api/admin/forum/dashboard/*",
// "/api/admin/job/*",
// Akses awal
"/api/get-cookie",