Update Versi 1.5.27 #32
@@ -2,6 +2,8 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
||||
|
||||
## [1.2.20](https://github.com/bipproduction/hipmi/compare/v1.2.19...v1.2.20) (2024-12-09)
|
||||
|
||||
## [1.2.19](https://github.com/bipproduction/hipmi/compare/v1.2.18...v1.2.19) (2024-12-06)
|
||||
|
||||
## [1.2.18](https://github.com/bipproduction/hipmi/compare/v1.2.17...v1.2.18) (2024-12-04)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hipmi",
|
||||
"version": "1.2.19",
|
||||
"version": "1.2.20",
|
||||
"private": true,
|
||||
"prisma": {
|
||||
"seed": "npx tsx prisma/seed.ts --yes"
|
||||
|
||||
@@ -32,22 +32,22 @@ export async function POST(req: Request) {
|
||||
user: createUser as any,
|
||||
});
|
||||
|
||||
try {
|
||||
const createUserSession = await prisma.userSession.create({
|
||||
data: {
|
||||
token: token as string,
|
||||
userId: createUser.id,
|
||||
},
|
||||
});
|
||||
// try {
|
||||
// const createUserSession = await prisma.userSession.create({
|
||||
// data: {
|
||||
// token: token as string,
|
||||
// userId: createUser.id,
|
||||
// },
|
||||
// });
|
||||
|
||||
if (!createUserSession)
|
||||
return NextResponse.json(
|
||||
{ success: false, message: "Gagal Membuat Session" },
|
||||
{ status: 400 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
// if (!createUserSession)
|
||||
// return NextResponse.json(
|
||||
// { success: false, message: "Gagal Membuat Session" },
|
||||
// { status: 400 }
|
||||
// );
|
||||
// } catch (error) {
|
||||
// console.log(error);
|
||||
// }
|
||||
|
||||
return NextResponse.json(
|
||||
{ success: true, message: "Berhasil Login", data: createUser },
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { MODEL_EVENT_PESERTA } from "@/app_modules/event/model/interface";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Center,
|
||||
Pagination,
|
||||
@@ -26,6 +27,7 @@ export function AdminEvent_ViewDetailPeserta({
|
||||
const [isNPage, setNPage] = useState(dataPeserta.nPage);
|
||||
const [isActivePage, setActivePage] = useState(1);
|
||||
|
||||
|
||||
async function onPageClick(p: any) {
|
||||
setActivePage(p);
|
||||
const loadData = await adminEvent_getListPesertaById({
|
||||
@@ -52,6 +54,15 @@ export function AdminEvent_ViewDetailPeserta({
|
||||
<td>
|
||||
<Center>{e?.User?.Profile?.email}</Center>
|
||||
</td>
|
||||
<td>
|
||||
<Center>
|
||||
{e.isPresent ? (
|
||||
<Badge color="green">Hadir</Badge>
|
||||
) : (
|
||||
<Badge color="red">Tidak Hadir</Badge>
|
||||
)}
|
||||
</Center>
|
||||
</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
@@ -81,6 +92,9 @@ export function AdminEvent_ViewDetailPeserta({
|
||||
<th>
|
||||
<Center>Email</Center>
|
||||
</th>
|
||||
<th>
|
||||
<Center>Konfirmasi Kehadiran</Center>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{tableRow}</tbody>
|
||||
|
||||
@@ -22,6 +22,7 @@ export async function adminEvent_getListPesertaById({
|
||||
eventId: eventId,
|
||||
},
|
||||
select: {
|
||||
isPresent: true,
|
||||
User: {
|
||||
include: {
|
||||
Profile: true,
|
||||
|
||||
@@ -41,7 +41,7 @@ export default function Register() {
|
||||
const res = await fetch(`/api/auth/check?id=${kodeId}`);
|
||||
const result = await res.json();
|
||||
|
||||
onSetData(result.data.nomor);
|
||||
onSetData(result.nomor);
|
||||
}
|
||||
|
||||
async function onRegistarsi() {
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function Validasi() {
|
||||
useShallowEffect(() => {
|
||||
const kodeId = localStorage.getItem("hipmi_auth_code_id");
|
||||
if (kodeId != null) {
|
||||
onCheckAuthCode({ kodeId: kodeId as string, onSetData: setData });
|
||||
onCheckAuthCode({ kodeId: kodeId as string });
|
||||
} else {
|
||||
console.log("code id not found");
|
||||
}
|
||||
@@ -51,25 +51,23 @@ export default function Validasi() {
|
||||
if (triggerOtp) {
|
||||
const kodeId = localStorage.getItem("hipmi_auth_code_id");
|
||||
if (kodeId != null) {
|
||||
onCheckAuthCode({ kodeId: kodeId as string, onSetData: setData });
|
||||
onCheckAuthCode({ kodeId: kodeId as string });
|
||||
} else {
|
||||
console.log("code id not found");
|
||||
}
|
||||
setTriggerOtp(false);
|
||||
}
|
||||
}, [triggerOtp, setData, setTriggerOtp]);
|
||||
}, [triggerOtp]);
|
||||
|
||||
async function onCheckAuthCode({
|
||||
kodeId,
|
||||
onSetData,
|
||||
}: {
|
||||
kodeId: string;
|
||||
onSetData: any;
|
||||
}) {
|
||||
const res = await fetch(`/api/auth/check?id=${kodeId}`);
|
||||
const result = await res.json();
|
||||
|
||||
onSetData({
|
||||
setData({
|
||||
nomor: result.nomor,
|
||||
code: result.otp,
|
||||
});
|
||||
|
||||
@@ -8,17 +8,8 @@ import {
|
||||
ComponentGlobal_NotifikasiBerhasil,
|
||||
ComponentGlobal_NotifikasiGagal,
|
||||
} from "@/app_modules/_global/notif_global";
|
||||
import {
|
||||
UIGlobal_LayoutDefault
|
||||
} from "@/app_modules/_global/ui";
|
||||
import {
|
||||
Button,
|
||||
Center,
|
||||
Group,
|
||||
Skeleton,
|
||||
Stack,
|
||||
Text
|
||||
} from "@mantine/core";
|
||||
import { UIGlobal_LayoutDefault } from "@/app_modules/_global/ui";
|
||||
import { Button, Center, Group, Skeleton, Stack, Text } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useAtom } from "jotai";
|
||||
import moment from "moment";
|
||||
@@ -28,6 +19,7 @@ import { event_funUpdateKehadiran } from "../fun";
|
||||
import { Event_funJoinAndConfirmEvent } from "../fun/create/fun_join_and_confirm";
|
||||
import { gs_event_hotMenu } from "../global_state";
|
||||
import { MODEL_EVENT } from "../model/interface";
|
||||
import { Event_funJoinEvent } from "../fun/create/fun_join_event";
|
||||
|
||||
export default function Ui_Konfirmasi({
|
||||
userLoginId,
|
||||
@@ -68,7 +60,7 @@ export default function Ui_Konfirmasi({
|
||||
setIsJoin(data);
|
||||
}
|
||||
|
||||
// CEK KEHADIRAN
|
||||
// =========== CEK KEHADIRAN ===========//
|
||||
useShallowEffect(() => {
|
||||
onLoadKehadiran();
|
||||
}, []);
|
||||
@@ -80,11 +72,14 @@ export default function Ui_Konfirmasi({
|
||||
const data = await res.json();
|
||||
setIsPresent(data);
|
||||
}
|
||||
// =========== CEK KEHADIRAN ===========//
|
||||
|
||||
// Jika data kosong
|
||||
if (data == null && isPresent == null) {
|
||||
return <SkeletonIsDataNull />;
|
||||
}
|
||||
|
||||
// Jika data tidak ada
|
||||
if (data == null) {
|
||||
return (
|
||||
<>
|
||||
@@ -93,6 +88,7 @@ export default function Ui_Konfirmasi({
|
||||
);
|
||||
}
|
||||
|
||||
// Jika tanggal acara lewat
|
||||
if (moment(data?.tanggalSelesai).diff(moment(), "minute") < 0) {
|
||||
return (
|
||||
<>
|
||||
@@ -101,10 +97,26 @@ export default function Ui_Konfirmasi({
|
||||
);
|
||||
}
|
||||
|
||||
if (isJoin == false) {
|
||||
// Jika belum join dan tanggal mulai acara belum lewat
|
||||
if (isJoin == false && moment(data?.tanggal).diff(moment(), "minute") > 0) {
|
||||
return (
|
||||
<>
|
||||
<UserNotJoin
|
||||
<UserAllowToJoin
|
||||
title={data?.title}
|
||||
tanggal={data?.tanggal}
|
||||
lokasi={data.lokasi}
|
||||
eventId={eventId}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
// Jika belum join dan tanggal mulai acara sudah lewat
|
||||
if (isJoin == false && moment(data?.tanggal).diff(moment(), "minute") < 0) {
|
||||
return (
|
||||
<>
|
||||
<UserNotJoinAndEventReady
|
||||
title={data?.title}
|
||||
eventId={eventId}
|
||||
userLoginId={userLoginId}
|
||||
@@ -113,7 +125,8 @@ export default function Ui_Konfirmasi({
|
||||
);
|
||||
}
|
||||
|
||||
if (isPresent && data) {
|
||||
// Jika sudah join, belum konfirm dan acara sudah mulai
|
||||
if (isPresent && moment(data?.tanggal).diff(moment(), "minute") < 0) {
|
||||
return <UserAlreadyConfirm title={data.title} />;
|
||||
}
|
||||
|
||||
@@ -126,16 +139,6 @@ export default function Ui_Konfirmasi({
|
||||
/>
|
||||
);
|
||||
}
|
||||
// const tgl = moment(data?.tanggal).diff(moment(), "minute") < 0;
|
||||
// return (
|
||||
// <>
|
||||
// <UIGlobal_LayoutDefault>
|
||||
// <Stack h={"100vh"} justify="center" c={"white"}>
|
||||
// {JSON.stringify(tgl)}
|
||||
// </Stack>
|
||||
// </UIGlobal_LayoutDefault>
|
||||
// </>
|
||||
// );
|
||||
}
|
||||
|
||||
function DataNotFound() {
|
||||
@@ -196,7 +199,91 @@ function SkeletonIsDataNull() {
|
||||
);
|
||||
}
|
||||
|
||||
function UserNotJoin({
|
||||
function UserAllowToJoin({
|
||||
title,
|
||||
tanggal,
|
||||
lokasi,
|
||||
eventId,
|
||||
userLoginId,
|
||||
}: {
|
||||
title: string;
|
||||
tanggal: Date;
|
||||
lokasi: string;
|
||||
eventId: string;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
|
||||
async function onJoinEvent() {
|
||||
setLoading(true);
|
||||
|
||||
const data = {
|
||||
userId: userLoginId,
|
||||
eventId: eventId,
|
||||
};
|
||||
|
||||
const res = await Event_funJoinEvent(data as any);
|
||||
if (res.status === 200) {
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
router.push(RouterEvent.detail_main + eventId);
|
||||
} else {
|
||||
setLoading(false);
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutDefault>
|
||||
<Stack h={"100vh"} justify="center">
|
||||
<ComponentGlobal_CardStyles>
|
||||
<Stack align="center" justify="center">
|
||||
<Text align="center">
|
||||
Halo, Bapak/Ibu. Kami dengan senang hati mengundang Anda untuk
|
||||
bergabung dalam acara
|
||||
<Text inherit span fw={"bold"}>
|
||||
{title}
|
||||
</Text>{" "}
|
||||
yang akan diselenggarakan pada{" "}
|
||||
<Text inherit span fw={"bold"}>
|
||||
{moment(tanggal).format("LL")}
|
||||
</Text>{" "}
|
||||
pukul
|
||||
<Text inherit span fw={"bold"}>
|
||||
{moment(tanggal).format("LT")}
|
||||
</Text>{" "}
|
||||
di
|
||||
<Text inherit span fw={"bold"}>
|
||||
{lokasi}
|
||||
</Text>{" "}
|
||||
. Pastikan Anda sudah melakukan registrasi melalui aplikasi
|
||||
[Nama Aplikasi] agar dapat berpartisipasi. Kami sangat
|
||||
menantikan kehadiran Anda. Sampai jumpa di acara ini.
|
||||
</Text>
|
||||
|
||||
<Button
|
||||
loading={isLoading}
|
||||
loaderPosition="center"
|
||||
radius={"xs"}
|
||||
bg={MainColor.yellow}
|
||||
color="yellow"
|
||||
c={"black"}
|
||||
onClick={() => {
|
||||
onJoinEvent();
|
||||
}}
|
||||
>
|
||||
Join Event
|
||||
</Button>
|
||||
</Stack>
|
||||
</ComponentGlobal_CardStyles>
|
||||
</Stack>
|
||||
</UIGlobal_LayoutDefault>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function UserNotJoinAndEventReady({
|
||||
title,
|
||||
eventId,
|
||||
userLoginId,
|
||||
@@ -373,8 +460,12 @@ function UserNotConfirm({
|
||||
{title}
|
||||
</Text>{" "}
|
||||
pada hari ini. Mohon untuk mengonfirmasi kehadiran Anda dengan
|
||||
menekan tombol {"Hadir"} atau fitur konfirmasi yang tersedia di
|
||||
bawah. Terima kasih dan selamat menikmati acara.
|
||||
menekan tombol{" "}
|
||||
<Text inherit span fw={"bold"}>
|
||||
Konfirmasi Kehadiran
|
||||
</Text>{" "}
|
||||
atau fitur konfirmasi yang tersedia di bawah. Terima kasih dan
|
||||
selamat menikmati acara.
|
||||
</Text>
|
||||
|
||||
<Button
|
||||
@@ -388,7 +479,7 @@ function UserNotConfirm({
|
||||
onUpdateKonfirmasi();
|
||||
}}
|
||||
>
|
||||
HADIR
|
||||
Konfirmasi Kehadiran
|
||||
</Button>
|
||||
</Stack>
|
||||
</ComponentGlobal_CardStyles>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import {
|
||||
ActionIcon,
|
||||
Avatar,
|
||||
Badge,
|
||||
Center,
|
||||
Grid,
|
||||
Group,
|
||||
@@ -136,11 +137,8 @@ function ComponentEvent_AvatarAndUsername({
|
||||
}
|
||||
}
|
||||
|
||||
const tglMulai = moment(tanggalMulai).diff(moment(), "minutes");
|
||||
const tglMulai = moment(tanggalMulai).diff(moment(), "minutes") < 0;
|
||||
|
||||
const tglSelesai = moment(tanggalSelesai).diff(moment(), "minutes");
|
||||
|
||||
// console.log("mulai:", tglMulai, "selesai:", tglSelesai);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -177,20 +175,12 @@ function ComponentEvent_AvatarAndUsername({
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
|
||||
{/* {component && (
|
||||
<Grid.Col span={"auto"} style={{ minHeight: 50 }}>
|
||||
<Stack justify="center" h={30}>
|
||||
{component}
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
)} */}
|
||||
|
||||
{tglMulai < 0 && (
|
||||
<Grid.Col span={3} style={{ minHeight: 50 }}>
|
||||
{tglMulai && (
|
||||
<Grid.Col span={4} style={{ minHeight: 50 }}>
|
||||
<Group position="right">
|
||||
<Stack justify="center" h={30}>
|
||||
<Text fw={"bold"} fz={fontSize ? fontSize : "sm"}>
|
||||
{isPresent ? "Hadir" : "-"}
|
||||
{isPresent ? <Badge color="green" >Hadir</Badge> : <Badge>-</Badge>}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Group>
|
||||
|
||||
@@ -47,40 +47,46 @@ export function Profile_ComponentCreateNewProfile({
|
||||
"Lengkapi background profile"
|
||||
);
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
setLoading(true);
|
||||
|
||||
const uploadPhoto = await funGlobal_UploadToStorage({
|
||||
file: filePP,
|
||||
dirId: DIRECTORY_ID.profile_foto,
|
||||
});
|
||||
if (!uploadPhoto.success) {
|
||||
setLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan("Gagal upload foto profile");
|
||||
}
|
||||
const uploadPhoto = await funGlobal_UploadToStorage({
|
||||
file: filePP,
|
||||
dirId: DIRECTORY_ID.profile_foto,
|
||||
});
|
||||
if (!uploadPhoto.success) {
|
||||
setLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan(
|
||||
"Gagal upload foto profile"
|
||||
);
|
||||
}
|
||||
|
||||
const uploadBackground = await funGlobal_UploadToStorage({
|
||||
file: fileBG,
|
||||
dirId: DIRECTORY_ID.profile_background,
|
||||
});
|
||||
if (!uploadBackground.success) {
|
||||
setLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan(
|
||||
"Gagal upload background profile"
|
||||
);
|
||||
}
|
||||
const uploadBackground = await funGlobal_UploadToStorage({
|
||||
file: fileBG,
|
||||
dirId: DIRECTORY_ID.profile_background,
|
||||
});
|
||||
if (!uploadBackground.success) {
|
||||
setLoading(false);
|
||||
return ComponentGlobal_NotifikasiPeringatan(
|
||||
"Gagal upload background profile"
|
||||
);
|
||||
}
|
||||
|
||||
const create = await funCreateNewProfile({
|
||||
data: newData as any,
|
||||
imageId: uploadPhoto.data.id,
|
||||
imageBackgroundId: uploadBackground.data.id,
|
||||
});
|
||||
const create = await funCreateNewProfile({
|
||||
data: newData as any,
|
||||
imageId: uploadPhoto.data.id,
|
||||
imageBackgroundId: uploadBackground.data.id,
|
||||
});
|
||||
|
||||
if (create.status === 201) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil membuat profile", 3000);
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(create.message);
|
||||
setLoading(false);
|
||||
if (create.status === 201) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil membuat profile", 3000);
|
||||
router.push(RouterHome.main_home, { scroll: false });
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(create.message);
|
||||
setLoading(false);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user