fix:
Deksripsi: - Progress investasi - Tampilan voting ## No issue
This commit is contained in:
@@ -20,10 +20,10 @@ export default function ComponentGlobal_BoxInformation({
|
||||
}}
|
||||
>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={10} fs={"italic"} c={"orange"} fw={"bold"}>
|
||||
<Text fz={12} fs={"italic"} c={"orange"} fw={"bold"}>
|
||||
* Report
|
||||
</Text>
|
||||
<Text fz={10} c={"white"}>
|
||||
<Text fz={12} c={"white"}>
|
||||
{informasi}
|
||||
</Text>
|
||||
</Stack>
|
||||
@@ -38,7 +38,7 @@ export default function ComponentGlobal_BoxInformation({
|
||||
}}
|
||||
>
|
||||
<Group>
|
||||
<Text fz={10} c={"red"} fw={"bold"}>
|
||||
<Text fz={12} c={"red"} fw={"bold"}>
|
||||
*{" "}
|
||||
<Text span inherit c={"white"} fw={"normal"}>
|
||||
{informasi}
|
||||
|
||||
11
src/app_modules/_global/ui/index.ts
Normal file
11
src/app_modules/_global/ui/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import UIGlobal_Drawer from "./ui_drawer";
|
||||
import UIGlobal_LayoutHeaderTamplate from "./ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "./ui_layout_tamplate";
|
||||
import UIGlobal_Modal from "./ui_modal";
|
||||
import UIGlobal_SplashScreen from "./ui_splash";
|
||||
|
||||
export { UIGlobal_LayoutTamplate };
|
||||
export { UIGlobal_LayoutHeaderTamplate };
|
||||
export { UIGlobal_Drawer };
|
||||
export { UIGlobal_Modal };
|
||||
export { UIGlobal_SplashScreen };
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterAdminColab } from "@/app/lib/router_admin/router_admin_colab";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export default async function adminColab_funReportProjectById({
|
||||
@@ -12,7 +12,7 @@ export default async function adminColab_funReportProjectById({
|
||||
colabId: string;
|
||||
report: string;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const projectUpdate = await prisma.projectCollaboration.update({
|
||||
where: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function adminNotifikasi_countNotifikasi() {
|
||||
const adminId = await user_getOneUserId();
|
||||
const adminId = await user_funGetOneUserId();
|
||||
|
||||
const data = await prisma.notifikasi.findMany({
|
||||
where: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { MODEL_NOTIFIKASI } from "@/app_modules/notifikasi/model/interface";
|
||||
|
||||
export default async function adminNotifikasi_funCreateToUser({
|
||||
@@ -9,7 +9,7 @@ export default async function adminNotifikasi_funCreateToUser({
|
||||
}: {
|
||||
data: MODEL_NOTIFIKASI;
|
||||
}) {
|
||||
const adminId = await user_getOneUserId();
|
||||
const adminId = await user_funGetOneUserId();
|
||||
|
||||
const create = await prisma.notifikasi.create({
|
||||
data: {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { NextRequest } from "next/server";
|
||||
|
||||
export default async function adminNotifikasi_getByUserId() {
|
||||
const adminId = await user_getOneUserId();
|
||||
const adminId = await user_funGetOneUserId();
|
||||
|
||||
const data = await prisma.notifikasi.findMany({
|
||||
orderBy: [
|
||||
|
||||
@@ -20,22 +20,20 @@ import {
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import { IconBan, IconEyeShare, IconSearch } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import { IconBan, IconCircleCheck, IconSearch } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import moment from "moment";
|
||||
import { useState } from "react";
|
||||
import { adminVote_funGetListReview } from "../../fun";
|
||||
import { AdminVote_funEditStatusPublishById } from "../../fun/edit/fun_edit_status_publish_by_id";
|
||||
import { AdminEvent_funEditCatatanById } from "../../fun/edit/fun_edit_status_reject_by_id";
|
||||
import { AdminVote_getListTableByStatusId } from "../../fun/get/get_list_table_by_status_id";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user";
|
||||
import { adminVote_funGetListReview } from "../../fun";
|
||||
import { IconCircleCheckFilled } from "@tabler/icons-react";
|
||||
|
||||
export default function AdminVote_TableReview({
|
||||
listVote,
|
||||
@@ -134,7 +132,7 @@ function TableStatus({ listData }: { listData: any }) {
|
||||
}
|
||||
w={120}
|
||||
color={"green"}
|
||||
leftIcon={<IconCircleCheckFilled />}
|
||||
leftIcon={<IconCircleCheck />}
|
||||
radius={"xl"}
|
||||
onClick={() =>
|
||||
onPublish(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||
import _ from "lodash";
|
||||
@@ -10,7 +10,7 @@ import _ from "lodash";
|
||||
export default async function colab_funCreateProyek(
|
||||
value: MODEL_COLLABORATION
|
||||
) {
|
||||
const AuthorId = await user_getOneUserId();
|
||||
const AuthorId = await user_funGetOneUserId();
|
||||
|
||||
const data = await prisma.projectCollaboration.create({
|
||||
data: {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function colab_funCreateRoomChat(
|
||||
nameRoom: string,
|
||||
value: any[],
|
||||
colabId: string
|
||||
) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const createRoom = await prisma.projectCollaboration_RoomChat.create({
|
||||
data: {
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export default async function colab_funCreateMessageByUserId(
|
||||
message: string,
|
||||
roomId: string
|
||||
) {
|
||||
const userLoginId = await user_getOneUserId();
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const msg = await prisma.projectCollaboration_Message.create({
|
||||
data: {
|
||||
userId: userLoginId,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function colab_CekNotifikasi() {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const cekNotif = await prisma.projectCollaboration_Notifikasi.findMany({
|
||||
where: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function colab_funCekPartisipasiById(colabId: string) {
|
||||
const UserLoginId = await user_getOneUserId();
|
||||
const UserLoginId = await user_funGetOneUserId();
|
||||
|
||||
const cek = await prisma.projectCollaboration_Partisipasi.findFirst({
|
||||
where: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function colab_getListByStatusId(statusId: number) {
|
||||
const AuthorId = await user_getOneUserId();
|
||||
const AuthorId = await user_funGetOneUserId();
|
||||
const data = await prisma.projectCollaboration.findMany({
|
||||
where: {
|
||||
userId: AuthorId,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function colab_getListNotifikasiByUserId() {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const get = await prisma.projectCollaboration_Notifikasi.findMany({
|
||||
orderBy: {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function colab_getListPartisipasiProyekByAuthorId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function colab_getListAllProyekSayaByAuthorId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function colab_getListRoomChatByAuthorId({page}: {page: number}) {
|
||||
const userLoginId = await user_getOneUserId();
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function donasi_funGetAllInvoiceByAuthorId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function donasi_funGetAllStatusDraft({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function donasi_funGetAllStatusPublish({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function donasi_funGetAllStatusReject({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server"
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function donasi_funGetAllStatusReview({page}: {page: number}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function event_getListKontibusiByUserId({page}: {page: number}) {
|
||||
const userLoginId = await user_getOneUserId();
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
|
||||
export async function event_getListRiwayatSaya({page}: {page: number}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function event_getAllDraft({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function event_getAllReject({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function event_getAllReview({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function event_funGetAllStatusPublish({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_forum_loading_edit_posting } from "../../global_state";
|
||||
import ComponentForum_LoadingDrawer from "../loading_drawer";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { forum_funDeleteKomentarById } from "../../fun/delete/fun_delete_komentar_by_id";
|
||||
|
||||
@@ -32,7 +32,7 @@ import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_forum_loading_edit_posting } from "../../global_state";
|
||||
import ComponentForum_LoadingDrawer from "../loading_drawer";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { IconSquareCheck } from "@tabler/icons-react";
|
||||
|
||||
@@ -33,7 +33,7 @@ import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_forum_loading_edit_posting } from "../../global_state";
|
||||
import ComponentForum_LoadingDrawer from "../loading_drawer";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import { forum_funEditStatusPostingById } from "../../fun/edit/fun_edit_status_posting_by_id";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_countPostingByAuthorId(authorId: string) {
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function forum_funCreate(value: string) {
|
||||
const AuthorId = await user_getOneUserId();
|
||||
const AuthorId = await user_funGetOneUserId();
|
||||
|
||||
const create = await prisma.forum_Posting.create({
|
||||
data: {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function forum_funCreateKomentar(
|
||||
postingId: string,
|
||||
komentar: string
|
||||
) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const create = await prisma.forum_Komentar.create({
|
||||
data: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportKomentar({
|
||||
komentarId,
|
||||
@@ -10,7 +10,7 @@ export async function forum_funCreateReportKomentar({
|
||||
komentarId: string;
|
||||
kategoriId: any;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
// console.log(kategoriId);
|
||||
|
||||
// const cekId = await prisma.forumMaster_KategoriReport.findFirst({
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportKomentarLainnya(
|
||||
komentarId: string,
|
||||
deskripsi: string
|
||||
) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const create = await prisma.forum_ReportKomentar.create({
|
||||
data: {
|
||||
forum_KomentarId: komentarId,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function forum_funCreateReportPosting({
|
||||
@@ -11,7 +11,7 @@ export async function forum_funCreateReportPosting({
|
||||
postingId: string;
|
||||
kategoriId: number;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const createReport = await prisma.forum_ReportPosting.create({
|
||||
data: {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function forum_funCreateReportPostingLainnya(
|
||||
postingId: string,
|
||||
deskripsi: string
|
||||
) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const create = await prisma.forum_ReportPosting.create({
|
||||
data: {
|
||||
forum_PostingId: postingId,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
|
||||
export async function forum_getAllPostingByAuhtorId({
|
||||
|
||||
@@ -8,7 +8,7 @@ import { redirect } from "next/navigation";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export async function user_getOneUserId() {
|
||||
export async function user_funGetOneUserId() {
|
||||
const c = cookies().get("ssn");
|
||||
if (!c?.value || c.value === "") return redirect(RouterAuth.login);
|
||||
|
||||
|
||||
3
src/app_modules/fun_global/index.ts
Normal file
3
src/app_modules/fun_global/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { user_funGetOneUserId } from "./get_user_token";
|
||||
|
||||
export { user_funGetOneUserId };
|
||||
@@ -1,6 +1,7 @@
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||
import { Card } from "@mantine/core";
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
|
||||
export function Investasi_ComponentStylesCard({
|
||||
children,
|
||||
@@ -13,9 +14,9 @@ export function Investasi_ComponentStylesCard({
|
||||
backgroundColor?: string;
|
||||
border?: string;
|
||||
marginBottom?: string | number;
|
||||
onClickHandler?: (val: any) => void;
|
||||
onClickHandler?: React.MouseEventHandler<HTMLDivElement>;
|
||||
}) {
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
@@ -24,9 +25,8 @@ export function Investasi_ComponentStylesCard({
|
||||
? backgroundColor
|
||||
: AccentColor.darkblue,
|
||||
border: `2px solid ${border ? border : AccentColor.blue}`,
|
||||
paddingInline: "20px",
|
||||
paddingTop: "15px",
|
||||
paddingBottom: "20px",
|
||||
paddingInline: "15px",
|
||||
paddingBlock: "15px",
|
||||
borderRadius: "10px",
|
||||
color: "white",
|
||||
marginBottom: marginBottom ? marginBottom : "0x",
|
||||
|
||||
@@ -9,17 +9,21 @@ import { Investasi_ComponentCardBeranda } from "./main/comp_card_beranda";
|
||||
import { Investasi_ComponentCardDaftarTransaksi } from "./main/comp_card_daftar_transaksi";
|
||||
import { Investasi_ComponentSahamSaya } from "./main/comp_card_saham_saya";
|
||||
import { Investasi_ComponentFooterMain } from "./main/comp_footer_main";
|
||||
import { Investasi_ComponentCardPortofolioPublish } from "./main/comp_card_portofolio_publish";
|
||||
import { Investasi_ComponentButtonUpdateBeranda } from "./main/comp_update_beranda";
|
||||
import { Investasi_ComponentCardPortofolio_NotPublish } from "./main/comp_card_portofolio_not_publish";
|
||||
|
||||
export { Investasi_ComponentFooterMain };
|
||||
export { Investasi_ComponentCardBeranda };
|
||||
export { Investasi_ComponentButtonUpdateBeranda };
|
||||
export { Investasi_ComponentCardDaftarTransaksi };
|
||||
export { Investasi_ComponentSahamSaya };
|
||||
export { Investasi_ComponentStylesCard as Investasasi_ComponentBoxBorderAndBackground };
|
||||
export { Investasi_ComponentStylesCard };
|
||||
export { Investasi_ComponentBoxProspektus };
|
||||
export { Investasi_ComponentBoxDaftarDokumen };
|
||||
export { Investasi_ComponentBoxDaftarBerita };
|
||||
export { Investasi_ComponentBoxHargaDanLembarSaham };
|
||||
export { Investasi_ComponentBoxProgress };
|
||||
export { Investasi_ComponentBoxDetailData };
|
||||
export { Investasi_ComponentCardPortofolioPublish };
|
||||
export { Investasi_ComponentCardPortofolio_NotPublish };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Warna } from "@/app/lib/warna";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import {
|
||||
Card,
|
||||
CardSection,
|
||||
@@ -70,14 +70,17 @@ export function Investasi_ComponentCardBeranda({
|
||||
<Title align="center" order={3}>
|
||||
{data?.title}
|
||||
</Title>
|
||||
{/* <Progress
|
||||
label={(+e.progress).toFixed(2) + " %"}
|
||||
value={+e.progress}
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/> */}
|
||||
<Progress
|
||||
label={(+data?.progress).toFixed(2) + " %"}
|
||||
value={+data?.progress}
|
||||
color={MainColor.yellow}
|
||||
size="xl"
|
||||
radius="xl"
|
||||
styles={{
|
||||
label:{color: MainColor.black}
|
||||
}}
|
||||
/>
|
||||
{/* <Progress
|
||||
label={
|
||||
"" +
|
||||
(
|
||||
@@ -97,7 +100,7 @@ export function Investasi_ComponentCardBeranda({
|
||||
color="teal"
|
||||
size="xl"
|
||||
radius="xl"
|
||||
/>
|
||||
/> */}
|
||||
</Stack>
|
||||
</CardSection>
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi";
|
||||
import { Grid, Stack, AspectRatio, Paper, Text, Image } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { Investasi_ComponentStylesCard } from "../comp_card_border_and_background";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||
|
||||
export function Investasi_ComponentCardPortofolio_NotPublish({
|
||||
data,
|
||||
path,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
path: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Investasi_ComponentStylesCard
|
||||
onClickHandler={() => {
|
||||
router.push(path + data?.id);
|
||||
setVisible(true);
|
||||
}}
|
||||
>
|
||||
<Grid>
|
||||
<Grid.Col span={8}>
|
||||
<Text fw={"bold"} lineClamp={1}>
|
||||
{" "}
|
||||
{_.startCase(data.title)}
|
||||
</Text>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={10}>Target Dana:</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+data.targetDana)}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={4}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
<Image
|
||||
alt=""
|
||||
src={RouterInvestasi_OLD.api_gambar + `${data.imagesId}`}
|
||||
/>
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||
</Investasi_ComponentStylesCard>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
import {
|
||||
NEW_RouterInvestasi,
|
||||
RouterInvestasi_OLD,
|
||||
} from "@/app/lib/router_hipmi/router_investasi";
|
||||
import {
|
||||
Grid,
|
||||
Stack,
|
||||
AspectRatio,
|
||||
Paper,
|
||||
Group,
|
||||
Box,
|
||||
Text,
|
||||
Image,
|
||||
} from "@mantine/core";
|
||||
import { IconCircleCheck, IconChecklist } from "@tabler/icons-react";
|
||||
import _ from "lodash";
|
||||
import moment from "moment";
|
||||
import { MODEL_INVESTASI } from "../../_lib/interface";
|
||||
import { Investasi_ComponentStylesCard } from "../comp_card_border_and_background";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||
|
||||
export function Investasi_ComponentCardPortofolioPublish({
|
||||
data,
|
||||
}: {
|
||||
data: MODEL_INVESTASI;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Investasi_ComponentStylesCard
|
||||
marginBottom={"15px"}
|
||||
onClickHandler={() => {
|
||||
router.push(NEW_RouterInvestasi.detail_publish + data?.id);
|
||||
setVisible(true);
|
||||
}}
|
||||
>
|
||||
<Grid>
|
||||
<Grid.Col span={8}>
|
||||
<Text fw={"bold"}> {_.capitalize(data?.title)}</Text>
|
||||
<Stack spacing={0}>
|
||||
<Text fz={10}>Target Dana:</Text>
|
||||
<Text>
|
||||
Rp.{" "}
|
||||
{new Intl.NumberFormat("id-ID", {
|
||||
maximumSignificantDigits: 10,
|
||||
}).format(+data?.targetDana)}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
|
||||
<Grid.Col span={4}>
|
||||
<AspectRatio ratio={16 / 9}>
|
||||
<Paper radius={"md"}>
|
||||
<Image
|
||||
alt=""
|
||||
src={NEW_RouterInvestasi.api_gambar + `${data?.imagesId}`}
|
||||
/>
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
<Group position="center" mt={"md"}>
|
||||
{Number(data?.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(new Date(data?.updatedAt), "days") <=
|
||||
0 ? (
|
||||
<Group position="right">
|
||||
<IconCircleCheck color="green" />
|
||||
<Text c={"green"}>Selesai</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Group
|
||||
position="center"
|
||||
style={{ fontSize: 10, fontWeight: "bold" }}
|
||||
>
|
||||
<Group>
|
||||
{Number(data?.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(new Date(data?.countDown), "days") <=
|
||||
0 ? (
|
||||
<Group>
|
||||
<IconChecklist />
|
||||
<Text>Selesai</Text>
|
||||
</Group>
|
||||
) : (
|
||||
<Box>
|
||||
Sisa Waktu : {}
|
||||
{Number(data?.MasterPencarianInvestor.name) -
|
||||
moment(new Date()).diff(
|
||||
new Date(data?.countDown),
|
||||
"days"
|
||||
)}{" "}
|
||||
hari
|
||||
</Box>
|
||||
)}
|
||||
</Group>
|
||||
</Group>
|
||||
)}
|
||||
</Group>
|
||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||
</Investasi_ComponentStylesCard>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
interface Model_Invoice_Masuk {
|
||||
total: number;
|
||||
@@ -14,7 +14,7 @@ export async function investasi_funCreateInvoice({
|
||||
}: {
|
||||
data: Model_Invoice_Masuk;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const create = await prisma.investasi_Invoice.create({
|
||||
data: {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function investasi_funGetAllPublishByUserId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.investasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
countDown: "desc",
|
||||
},
|
||||
where: {
|
||||
authorId: authorId,
|
||||
masterStatusInvestasiId: "1",
|
||||
},
|
||||
include: {
|
||||
MasterPencarianInvestor: true,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function investasi_funGetAllInvestasiNonPublishByUserId({
|
||||
page,
|
||||
statusId,
|
||||
}: {
|
||||
page: number;
|
||||
statusId: string;
|
||||
}) {
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const data = await prisma.investasi.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
orderBy: {
|
||||
updatedAt: "desc",
|
||||
},
|
||||
where: {
|
||||
authorId: authorId,
|
||||
masterStatusInvestasiId: statusId,
|
||||
},
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function investasi_funGetTransaksiByUserId({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"use server";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function investasi_funGetOneInvestasiById({investasiId}: {investasiId: string}) {
|
||||
export async function investasi_funGetOneInvestasiById({
|
||||
investasiId,
|
||||
}: {
|
||||
investasiId: string;
|
||||
}) {
|
||||
const data = await prisma.investasi.findUnique({
|
||||
where: {
|
||||
id: investasiId,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function investasi_funGetSuccessTransactionById({
|
||||
page,
|
||||
}: {
|
||||
page: number;
|
||||
}) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -3,9 +3,16 @@ import { investasi_funGetOneInvestasiById } from "./get/fun_get_one_investasi_by
|
||||
import { investasi_funGetTransaksiByUserId } from "./get/fun_get_all_transaksi_by_user_id";
|
||||
import { investasi_funUploadBuktiTransferById } from "./upload/fun_upload_bukti_transfer";
|
||||
import { investasi_funGetSuccessTransactionById } from "./get/fun_get_success_transaction_by_id";
|
||||
import { investasi_funGetAllPublishByUserId } from "./get/fun_get_all_investasi_by_user_id";
|
||||
import { investasi_funGetAllInvestasiNonPublishByUserId } from "./get/fun_get_all_investasi_non_publish_by_user_id";
|
||||
|
||||
// Get
|
||||
export { investasi_funGetOneInvestasiById };
|
||||
export { investasi_funGetProspekById };
|
||||
export { investasi_funUploadBuktiTransferById };
|
||||
export { investasi_funGetTransaksiByUserId };
|
||||
export { investasi_funGetSuccessTransactionById };
|
||||
export { investasi_funGetAllPublishByUserId };
|
||||
export { investasi_funGetAllInvestasiNonPublishByUserId };
|
||||
|
||||
// Upload
|
||||
export { investasi_funUploadBuktiTransferById };
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Investasi_UiTransaksiBerhasil } from "./status_transaksi/ui_transaksi_b
|
||||
import { Investasi_UiFileViewDokumen } from "./file_view/ui_file_view_dokumen";
|
||||
import { Investasi_UiSahamSaya } from "./main/ui_saham_saya";
|
||||
import { Investasi_UiDetailSahamSaya } from "./detail/ui_detail_saham_saya";
|
||||
import { Investasi_UiPortofolio } from "./main/ui_portofolio";
|
||||
|
||||
export { Investasi_UiProsesPembelian };
|
||||
export { Investasi_UiMetodePembayaran };
|
||||
@@ -23,3 +24,4 @@ export { Investasi_UiTransaksiBerhasil };
|
||||
export { Investasi_UiFileViewDokumen };
|
||||
export { Investasi_UiSahamSaya };
|
||||
export { Investasi_UiDetailSahamSaya };
|
||||
export { Investasi_UiPortofolio };
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
"use client"
|
||||
"use client";
|
||||
|
||||
export function Investasi_UiPortofolio() {
|
||||
return <>
|
||||
|
||||
|
||||
</>;
|
||||
}
|
||||
import { Investasi_ViewPortofolio } from "../../_view";
|
||||
export function Investasi_UiPortofolio({
|
||||
listStatus,
|
||||
listDataPublish,
|
||||
listDataReview,
|
||||
listDataDraft,
|
||||
listDataReject,
|
||||
}: {
|
||||
listStatus: any[];
|
||||
listDataPublish: any[];
|
||||
listDataReview: any[];
|
||||
listDataDraft: any[];
|
||||
listDataReject: any[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Investasi_ViewPortofolio
|
||||
listStatus={listStatus}
|
||||
listDataPublish={listDataPublish}
|
||||
listDataReview={listDataReview}
|
||||
listDataDraft={listDataDraft}
|
||||
listDataReject={listDataReject}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Investasi_ViewDetailSahamSaya } from "./detail/view_detail_saham_saya";
|
||||
import PdfToImage from "./file_view/view_file_viewer";
|
||||
import { Investasi_ViewBeranda } from "./main/view_beranda";
|
||||
import { Investasi_ViewPortofolio } from "./main/view_portofolio";
|
||||
import { Investasi_ViewPortofolioReview } from "./main/portofolio/view_portofolio_review";
|
||||
import { Investasi_ViewSahamSaya } from "./main/view_saham_saya";
|
||||
import { Investasi_ViewTransaksiBerhasil } from "./status_transaksi/view_invoice_berhasil";
|
||||
import { Investasi_ViewTransaksiGagal } from "./status_transaksi/view_transaksi_gagal";
|
||||
@@ -19,3 +21,5 @@ export { Investasi_ViewTransaksiBerhasil };
|
||||
export { PdfToImage as Investasi_ViewFileViewer };
|
||||
export { Investasi_ViewSahamSaya };
|
||||
export { Investasi_ViewDetailSahamSaya };
|
||||
export { Investasi_ViewPortofolio };
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import { data } from "autoprefixer";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { Investasi_ComponentCardPortofolio_NotPublish } from "../../../_component";
|
||||
import {
|
||||
investasi_funGetAllInvestasiNonPublishByUserId,
|
||||
investasi_funGetSuccessTransactionById,
|
||||
} from "../../../_fun";
|
||||
import { useState } from "react";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
|
||||
export function Investasi_ViewPortofolioDraft({
|
||||
listData,
|
||||
}: {
|
||||
listData: any[];
|
||||
}) {
|
||||
const [data, setData] = useState(listData);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<ScrollOnly
|
||||
height="75vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData =
|
||||
await investasi_funGetAllInvestasiNonPublishByUserId({
|
||||
page: activePage + 1,
|
||||
statusId: "3",
|
||||
});
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<Investasi_ComponentCardPortofolio_NotPublish
|
||||
data={item}
|
||||
path={NEW_RouterInvestasi.detail_draft}
|
||||
/>
|
||||
)}
|
||||
</ScrollOnly>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { useState } from "react";
|
||||
import { Investasi_ComponentCardPortofolioPublish } from "../../../_component";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { investasi_funGetSuccessTransactionById } from "../../../_fun";
|
||||
|
||||
export function Investasi_ViewPortofolioPublish({
|
||||
listData,
|
||||
}: {
|
||||
listData: any[];
|
||||
}) {
|
||||
const [data, setData] = useState(listData);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<ScrollOnly
|
||||
height="75vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData = await investasi_funGetSuccessTransactionById({
|
||||
page: activePage + 1,
|
||||
});
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<Investasi_ComponentCardPortofolioPublish data={item as any} />
|
||||
)}
|
||||
</ScrollOnly>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import { data } from "autoprefixer";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { Investasi_ComponentCardPortofolio_NotPublish } from "../../../_component";
|
||||
import {
|
||||
investasi_funGetAllInvestasiNonPublishByUserId,
|
||||
investasi_funGetSuccessTransactionById,
|
||||
} from "../../../_fun";
|
||||
import { useState } from "react";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
|
||||
export function Investasi_ViewPortofolioReject({
|
||||
listData,
|
||||
}: {
|
||||
listData: any[];
|
||||
}) {
|
||||
const [data, setData] = useState(listData);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<ScrollOnly
|
||||
height="75vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData =
|
||||
await investasi_funGetAllInvestasiNonPublishByUserId({
|
||||
page: activePage + 1,
|
||||
statusId: "4",
|
||||
});
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<Investasi_ComponentCardPortofolio_NotPublish
|
||||
data={item}
|
||||
path={NEW_RouterInvestasi.detail_reject}
|
||||
/>
|
||||
)}
|
||||
</ScrollOnly>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { Box, Center } from "@mantine/core";
|
||||
import { data } from "autoprefixer";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { Investasi_ComponentCardPortofolio_NotPublish } from "../../../_component";
|
||||
import {
|
||||
investasi_funGetAllInvestasiNonPublishByUserId,
|
||||
investasi_funGetSuccessTransactionById,
|
||||
} from "../../../_fun";
|
||||
import { useState } from "react";
|
||||
import { NEW_RouterInvestasi } from "@/app/lib/router_hipmi/router_investasi";
|
||||
|
||||
export function Investasi_ViewPortofolioReview({
|
||||
listData,
|
||||
}: {
|
||||
listData: any[];
|
||||
}) {
|
||||
const [data, setData] = useState(listData);
|
||||
const [activePage, setActivePage] = useState(1);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
{_.isEmpty(data) ? (
|
||||
<ComponentGlobal_IsEmptyData />
|
||||
) : (
|
||||
<ScrollOnly
|
||||
height="75vh"
|
||||
renderLoading={() => (
|
||||
<Center>
|
||||
<ComponentGlobal_Loader size={25} />
|
||||
</Center>
|
||||
)}
|
||||
data={data}
|
||||
setData={setData}
|
||||
moreData={async () => {
|
||||
const loadData =
|
||||
await investasi_funGetAllInvestasiNonPublishByUserId({
|
||||
page: activePage + 1,
|
||||
statusId: "2",
|
||||
});
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
return loadData;
|
||||
}}
|
||||
>
|
||||
{(item) => (
|
||||
<Investasi_ComponentCardPortofolio_NotPublish
|
||||
data={item}
|
||||
path={NEW_RouterInvestasi.detail_review}
|
||||
/>
|
||||
)}
|
||||
</ScrollOnly>
|
||||
)}
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
136
src/app_modules/investasi/_view/main/view_portofolio.tsx
Normal file
136
src/app_modules/investasi/_view/main/view_portofolio.tsx
Normal file
@@ -0,0 +1,136 @@
|
||||
import { AccentColor, MainColor } from "@/app_modules/_global/color";
|
||||
import { MODEL_NEW_DEFAULT_MASTER } from "@/app_modules/model_global/interface";
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Group,
|
||||
SimpleGrid,
|
||||
Space,
|
||||
Stack,
|
||||
Tabs,
|
||||
} from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { useState } from "react";
|
||||
import { gs_investasi_status } from "../../g_state";
|
||||
import { Investasi_ViewPortofolioPublish } from "./portofolio/view_portofolio_publish";
|
||||
import { Investasi_ViewPortofolioReview } from "./portofolio/view_portofolio_review";
|
||||
import { Investasi_ViewPortofolioDraft } from "./portofolio/view_portofolio_draft";
|
||||
import { Investasi_ViewPortofolioReject } from "./portofolio/view_portofolio_reject";
|
||||
|
||||
export function Investasi_ViewPortofolio({
|
||||
listStatus,
|
||||
listDataPublish,
|
||||
listDataReview,
|
||||
listDataDraft,
|
||||
listDataReject,
|
||||
}: {
|
||||
listStatus: any[];
|
||||
listDataPublish: any[];
|
||||
listDataReview: any[];
|
||||
listDataDraft: any[];
|
||||
listDataReject: any[];
|
||||
}) {
|
||||
const [activeTab, setActiveTab] = useAtom(gs_investasi_status);
|
||||
const [activeStatus, setActiveStatus] =
|
||||
useState<MODEL_NEW_DEFAULT_MASTER[]>(listStatus);
|
||||
|
||||
// return (
|
||||
// <>
|
||||
// <Box h={"82vh"}>
|
||||
// <Group grow h={"5vh"}>
|
||||
// {activeStatus.map((e) => (
|
||||
// <Box
|
||||
|
||||
// // component={Button}
|
||||
// // radius={"xl"}
|
||||
// key={e.id}
|
||||
// // onClick={() => setActiveTab(e.name)}
|
||||
// style={{
|
||||
// alignContent: "center",
|
||||
// justifyContent: "center",
|
||||
// transition: "0.5s",
|
||||
// backgroundColor:
|
||||
// activeTab === e.name ? MainColor.yellow : "gray",
|
||||
// border:
|
||||
// activeTab === e.name ? `1px solid ${AccentColor.yellow}` : "",
|
||||
// color: activeTab === e.name ? "black" : "white",
|
||||
// }}
|
||||
// >
|
||||
// {e.name}
|
||||
// </Box>
|
||||
// ))}
|
||||
// </Group>
|
||||
// <Space h={"1vh"} />
|
||||
// <Box h={"76vh"}>
|
||||
// {activeTab === "Publish" && (
|
||||
// <Investasi_ViewPortofolioPublish listData={listDataPublish} />
|
||||
// )}
|
||||
|
||||
// {activeTab === "Review" && <Investasi_ViewPortofolioReview />}
|
||||
// </Box>
|
||||
// </Box>
|
||||
// </>
|
||||
// );
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tabs
|
||||
variant="pills"
|
||||
radius="xl"
|
||||
defaultValue={activeTab}
|
||||
value={activeTab}
|
||||
onTabChange={setActiveTab}
|
||||
styles={{
|
||||
tabsList: {
|
||||
// backgroundColor: MainColor.black,
|
||||
position: "sticky",
|
||||
top: 0,
|
||||
zIndex: 99,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Stack>
|
||||
<Tabs.List grow mb={"xs"}>
|
||||
{activeStatus.map((e) => (
|
||||
<Tabs.Tab
|
||||
w={"20%"}
|
||||
key={e.id}
|
||||
value={e.name}
|
||||
fw={"bold"}
|
||||
style={{
|
||||
transition: "ease 0.5s ",
|
||||
backgroundColor:
|
||||
activeTab === e.name ? MainColor.yellow : AccentColor.blue,
|
||||
// border:
|
||||
// activeTab === e.name
|
||||
// ? `1px solid ${AccentColor.yellow}`
|
||||
// : "",
|
||||
|
||||
color: activeTab === e.name ? "black" : "white",
|
||||
}}
|
||||
>
|
||||
{e.name}
|
||||
</Tabs.Tab>
|
||||
))}
|
||||
</Tabs.List>
|
||||
|
||||
<Tabs.Panel value="Publish">
|
||||
<Investasi_ViewPortofolioPublish listData={listDataPublish} />
|
||||
</Tabs.Panel>
|
||||
|
||||
<Tabs.Panel value="Review">
|
||||
<Investasi_ViewPortofolioReview listData={listDataReview} />
|
||||
</Tabs.Panel>
|
||||
|
||||
<Tabs.Panel value="Draft">
|
||||
<Investasi_ViewPortofolioDraft listData={listDataDraft} />
|
||||
</Tabs.Panel>
|
||||
|
||||
<Tabs.Panel value="Reject">
|
||||
<Investasi_ViewPortofolioReject listData={listDataReject} />
|
||||
</Tabs.Panel>
|
||||
</Stack>
|
||||
</Tabs>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
import { v4 } from "uuid";
|
||||
import fs from "fs";
|
||||
@@ -11,7 +11,7 @@ import path from "path";
|
||||
const root = process.cwd();
|
||||
|
||||
export async function Job_funCreate(req: MODEL_JOB, file: FormData) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const dataImage: any = file.get("file");
|
||||
if (dataImage !== "null") {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function job_getAllArsipById({page}: {page: number}) {
|
||||
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function job_getAllListPublish({
|
||||
page,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function job_getAllStatusDraft({
|
||||
page,
|
||||
@@ -11,7 +11,7 @@ export default async function job_getAllStatusDraft({
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function job_getAllStatusPublish({
|
||||
page,
|
||||
@@ -11,7 +11,7 @@ export default async function job_getAllStatusPublish({
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function job_getAllStatusReject({
|
||||
page,
|
||||
@@ -11,7 +11,7 @@ export default async function job_getAllStatusReject({
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function job_getAllStatusReview({
|
||||
page,
|
||||
@@ -11,7 +11,7 @@ export default async function job_getAllStatusReview({
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const data = await prisma.job.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterMap } from "@/app/lib/router_hipmi/router_map";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { v4 } from "uuid";
|
||||
import fs from "fs";
|
||||
|
||||
export async function map_funCreatePin({ data }: { data: any }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const gambar: any = data.gambar.get("file");
|
||||
const fileName = gambar.name;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export default async function notifikasi_countUserNotifikasi() {
|
||||
const userId = await user_getOneUserId();
|
||||
const userId = await user_funGetOneUserId();
|
||||
|
||||
const count = await prisma.notifikasi.findMany({
|
||||
where: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import _ from "lodash";
|
||||
|
||||
export default async function notifikasi_getByUserId({
|
||||
@@ -11,7 +11,7 @@ export default async function notifikasi_getByUserId({
|
||||
page: number;
|
||||
kategoriApp?: string;
|
||||
}) {
|
||||
const userId = await user_getOneUserId();
|
||||
const userId = await user_funGetOneUserId();
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function userSearch_getAllUser({
|
||||
page,
|
||||
@@ -10,7 +10,7 @@ export async function userSearch_getAllUser({
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
const userLoginId = await user_getOneUserId();
|
||||
const userLoginId = await user_funGetOneUserId();
|
||||
const takeData = 20;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
UIGlobal_LayoutHeaderTamplate,
|
||||
UIGlobal_LayoutTamplate,
|
||||
} from "@/app_modules/_global/ui";
|
||||
import { Voting_ViewDetailKontributorVoting } from "../../_view";
|
||||
|
||||
export function Voting_UiDetailKontributorVoting({
|
||||
listKontributor,
|
||||
}: {
|
||||
listKontributor: any[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Daftar Kontributor" />}
|
||||
>
|
||||
<Voting_ViewDetailKontributorVoting listKontributor={listKontributor} />
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
3
src/app_modules/vote/_ui/index.ts
Normal file
3
src/app_modules/vote/_ui/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Voting_UiDetailKontributorVoting } from "./detail/ui_detail_kontributor_voting";
|
||||
|
||||
export { Voting_UiDetailKontributorVoting };
|
||||
3
src/app_modules/vote/_view/index.ts
Normal file
3
src/app_modules/vote/_view/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Voting_ViewDetailKontributorVoting } from "./view_detail_kontributor_voting";
|
||||
|
||||
export { Voting_ViewDetailKontributorVoting };
|
||||
@@ -0,0 +1,63 @@
|
||||
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
import { ComponentGlobal_AvatarAndAuthorName } from "@/app_modules/_global/component";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import {
|
||||
Card,
|
||||
Stack,
|
||||
Center,
|
||||
Title,
|
||||
Grid,
|
||||
Avatar,
|
||||
Badge,
|
||||
Divider,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import router from "next/router";
|
||||
import { MODEL_VOTE_KONTRIBUTOR } from "../model/interface";
|
||||
|
||||
export function Voting_ViewDetailKontributorVoting({
|
||||
listKontributor,
|
||||
}: {
|
||||
listKontributor: MODEL_VOTE_KONTRIBUTOR[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
p={30}
|
||||
style={{
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderRadius: "10px",
|
||||
border: `2px solid ${AccentColor.blue}`,
|
||||
color: "white",
|
||||
}}
|
||||
>
|
||||
<Card.Section>
|
||||
{_.isEmpty(listKontributor) ? (
|
||||
<ComponentGlobal_IsEmptyData text="Tidak ada kontributor" />
|
||||
) : (
|
||||
<Stack>
|
||||
{listKontributor?.map((e, i) => (
|
||||
<ComponentGlobal_AvatarAndAuthorName
|
||||
key={e.id}
|
||||
dataUser={e.Author}
|
||||
componentRight={
|
||||
<Badge w={130}>
|
||||
<Text
|
||||
lineClamp={1}
|
||||
fz={e.Voting_DaftarNamaVote.value.length > 10 ? 8 : 10}
|
||||
>
|
||||
{e.Voting_DaftarNamaVote.value}
|
||||
</Text>
|
||||
</Badge>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</Stack>
|
||||
)}
|
||||
</Card.Section>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -22,6 +22,8 @@ import { MODEL_VOTING } from "../model/interface";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||
import { AccentColor } from "@/app_modules/_global/color/color_pallet";
|
||||
import { toNumber } from "lodash";
|
||||
import { useState } from "react";
|
||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||
|
||||
export default function ComponentVote_CardViewPublish({
|
||||
data,
|
||||
@@ -29,14 +31,18 @@ export default function ComponentVote_CardViewPublish({
|
||||
pilihanSaya,
|
||||
authorName,
|
||||
namaPilihan,
|
||||
statusArsip,
|
||||
}: {
|
||||
data?: MODEL_VOTING;
|
||||
path: string;
|
||||
pilihanSaya?: boolean;
|
||||
authorName?: boolean;
|
||||
namaPilihan?: string;
|
||||
statusArsip?: boolean;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
@@ -70,8 +76,9 @@ export default function ComponentVote_CardViewPublish({
|
||||
py={authorName ? "sm" : 0}
|
||||
onClick={() => {
|
||||
if (data?.id === undefined) {
|
||||
ComponentGlobal_NotifikasiPeringatan("Path tidak ditemukan");
|
||||
ComponentGlobal_NotifikasiPeringatan("Halaman tidak ditemukan");
|
||||
} else {
|
||||
setVisible(true);
|
||||
router.push(path + data?.id);
|
||||
}
|
||||
}}
|
||||
@@ -112,21 +119,38 @@ export default function ComponentVote_CardViewPublish({
|
||||
</Stack>
|
||||
{data ? (
|
||||
<Stack>
|
||||
{data?.Voting_DaftarNamaVote.map((v, i) => (
|
||||
<Stack key={v.id} spacing={0}>
|
||||
<Group position="apart">
|
||||
<Text>{v.value}</Text>
|
||||
<Text>{v.jumlah}</Text>
|
||||
</Group>
|
||||
<Progress size={"xl"} radius={"xl"} value={v.jumlah} color="yellow" />
|
||||
</Stack>
|
||||
|
||||
))}
|
||||
<Center>
|
||||
<Title order={5}>Hasil Voting</Title>
|
||||
</Center>
|
||||
|
||||
<Grid justify="center">
|
||||
{data?.Voting_DaftarNamaVote.map((e) => (
|
||||
<Grid.Col
|
||||
key={e.id}
|
||||
span={data?.Voting_DaftarNamaVote?.length >= 4 ? 6 : 4}
|
||||
>
|
||||
<Stack align="center">
|
||||
<Avatar
|
||||
radius={100}
|
||||
size={70}
|
||||
variant="outline"
|
||||
color="yellow"
|
||||
>
|
||||
<Text>{e.jumlah}</Text>
|
||||
</Avatar>
|
||||
<Text fz={"xs"} align="center">
|
||||
{e.value}
|
||||
</Text>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
</Stack>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
{pilihanSaya ? (
|
||||
<Stack align="center" spacing={0} mt="md">
|
||||
<Text mb={"xs"} fw={"bold"} fz={"xs"}>
|
||||
@@ -141,6 +165,18 @@ export default function ComponentVote_CardViewPublish({
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{statusArsip ? (
|
||||
<Center mt="md">
|
||||
<Badge color={data?.isArsip ? "gray" : "green"}>
|
||||
{data?.isArsip ? "Arsip" : "Publish"}
|
||||
</Badge>
|
||||
</Center>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||
</Card.Section>
|
||||
</Card>
|
||||
</>
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import { AccentColor } from "@/app_modules/_global/color";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { UIGlobal_Modal } from "@/app_modules/_global/ui";
|
||||
import UIGlobal_Drawer from "@/app_modules/_global/ui/ui_drawer";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
Drawer,
|
||||
Group,
|
||||
SimpleGrid,
|
||||
Stack,
|
||||
Text,
|
||||
} from "@mantine/core";
|
||||
import { IconArchive, IconUsersGroup, IconX } from "@tabler/icons-react";
|
||||
import { IconDots, IconDotsVertical } from "@tabler/icons-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { voting_funGetOneVotingbyId } from "../../fun/get/fun_get_one_by_id";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
import { voting_funUpdateIsArsipById } from "../../fun";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
|
||||
export function Voting_ComponentLayoutHeaderDetailPublish({
|
||||
votingId,
|
||||
title,
|
||||
userLoginId,
|
||||
}: {
|
||||
votingId: string;
|
||||
title: string;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
const [data, setData] = useState<MODEL_VOTING>();
|
||||
const [openDrawer, setOpenDrawer] = useState(false);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
|
||||
useShallowEffect(() => {
|
||||
onLoadData({ onSetData: setData });
|
||||
}, [setData]);
|
||||
|
||||
async function onLoadData({ onSetData }: { onSetData: any }) {
|
||||
const dataVoting = await voting_funGetOneVotingbyId(votingId);
|
||||
onSetData(dataVoting);
|
||||
}
|
||||
|
||||
async function onUpdateStatusArsip({ isArsip }: { isArsip: boolean }) {
|
||||
const res = await voting_funUpdateIsArsipById({
|
||||
votingId,
|
||||
isArsip: isArsip,
|
||||
});
|
||||
if (res.status === 200) {
|
||||
setOpenModal(false);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutHeaderTamplate
|
||||
title={title}
|
||||
customButtonRight={
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
setOpenDrawer(true);
|
||||
}}
|
||||
>
|
||||
<IconDotsVertical color="white" />
|
||||
</ActionIcon>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Drawer */}
|
||||
<Drawer
|
||||
opened={openDrawer}
|
||||
onClose={() => setOpenDrawer(false)}
|
||||
position={"bottom"}
|
||||
size={"auto"}
|
||||
withCloseButton={false}
|
||||
styles={{
|
||||
content: {
|
||||
padding: 0,
|
||||
position: "absolute",
|
||||
margin: "auto",
|
||||
backgroundColor: "transparent",
|
||||
left: 0,
|
||||
right: 0,
|
||||
width: 500,
|
||||
},
|
||||
body: {
|
||||
backgroundColor: AccentColor.darkblue,
|
||||
borderTop: `2px solid ${AccentColor.blue}`,
|
||||
borderRight: `1px solid ${AccentColor.blue}`,
|
||||
borderLeft: `1px solid ${AccentColor.blue}`,
|
||||
borderRadius: "20px 20px 0px 0px",
|
||||
color: "white",
|
||||
paddingBottom: "5%",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Stack spacing={"xs"}>
|
||||
<Group position="right">
|
||||
<ActionIcon
|
||||
onClick={() => setOpenDrawer(false)}
|
||||
variant="transparent"
|
||||
>
|
||||
<IconX color="white" />
|
||||
</ActionIcon>
|
||||
</Group>
|
||||
|
||||
{/* Check Author */}
|
||||
{data?.authorId === userLoginId ? (
|
||||
<BoxIsAuthor
|
||||
votingId={votingId}
|
||||
onSetDrawer={(val: any) => {
|
||||
setOpenDrawer(val.drawer);
|
||||
setOpenModal(val.modal);
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<BoxNotAuthor votingId={votingId} />
|
||||
)}
|
||||
</Stack>
|
||||
</Drawer>
|
||||
|
||||
{/* Modal */}
|
||||
<UIGlobal_Modal
|
||||
opened={openModal}
|
||||
close={() => setOpenModal(false)}
|
||||
title={`Anda yakin ingin ${data?.isArsip ? "mempublish" : "mengarsipkan"} voting?`}
|
||||
buttonKanan={
|
||||
<Button
|
||||
onClick={() => {
|
||||
data?.isArsip
|
||||
? onUpdateStatusArsip({ isArsip: false })
|
||||
: onUpdateStatusArsip({ isArsip: true });
|
||||
|
||||
// ON UPDATE DISINI
|
||||
}}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
>
|
||||
Iya
|
||||
</Button>
|
||||
}
|
||||
buttonKiri={
|
||||
<Button onClick={() => setOpenModal(false)} radius={"xl"}>
|
||||
Batal
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function BoxIsAuthor({
|
||||
votingId,
|
||||
onSetDrawer,
|
||||
}: {
|
||||
votingId: string;
|
||||
onSetDrawer: (vaL: any) => void;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid cols={2}>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
{/* Daftar Kontributor */}
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
c="white"
|
||||
onClick={() => {
|
||||
setIsLoading(true);
|
||||
router.push(RouterVote.daftar_kontributor + votingId, {
|
||||
scroll: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{isLoading ? <ComponentGlobal_Loader /> : <IconUsersGroup />}
|
||||
</ActionIcon>
|
||||
<Text fz={"sm"} align="center" color="white">
|
||||
Daftar Kontributor
|
||||
</Text>
|
||||
</Stack>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
{/* Arsip button */}
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
c="white"
|
||||
onClick={() => {
|
||||
onSetDrawer({
|
||||
drawer: false,
|
||||
modal: true,
|
||||
});
|
||||
// setOpenModal(true);
|
||||
}}
|
||||
>
|
||||
<IconArchive />
|
||||
</ActionIcon>
|
||||
<Text fz={"sm"} align="center" color="white">
|
||||
Update Arsip
|
||||
</Text>
|
||||
</Stack>
|
||||
</SimpleGrid>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function BoxNotAuthor({ votingId }: { votingId: string }) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [pageId, setPageId] = useState("");
|
||||
|
||||
return (
|
||||
<>
|
||||
<SimpleGrid cols={1}>
|
||||
<Stack align="center" spacing={"xs"}>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
c="white"
|
||||
onClick={() => {
|
||||
setIsLoading(true);
|
||||
router.push(RouterVote.daftar_kontributor + votingId, {
|
||||
scroll: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{isLoading ? <ComponentGlobal_Loader /> : <IconUsersGroup />}
|
||||
</ActionIcon>
|
||||
<Text fz={"sm"} align="center" color="white">
|
||||
Daftar Kontributor
|
||||
</Text>
|
||||
</Stack>
|
||||
</SimpleGrid>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -10,18 +10,19 @@ import {
|
||||
Grid,
|
||||
Stack,
|
||||
Text,
|
||||
Title
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import _ from "lodash";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { MODEL_VOTE_KONTRIBUTOR } from "../../model/interface";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
|
||||
export default function ComponentVote_DaftarKontributorVoter({
|
||||
listKontributor,
|
||||
}: {
|
||||
listKontributor?: MODEL_VOTE_KONTRIBUTOR[];
|
||||
}) {
|
||||
const router = useRouter()
|
||||
const router = useRouter();
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
@@ -36,15 +37,14 @@ export default function ComponentVote_DaftarKontributorVoter({
|
||||
<Card.Section>
|
||||
<Stack>
|
||||
<Center>
|
||||
<Title order={5}>Daftar Voting</Title>
|
||||
<Title order={5}>Daftar Kontributor</Title>
|
||||
</Center>
|
||||
|
||||
{_.isEmpty(listKontributor) ? (
|
||||
<Center>
|
||||
<Text fz={"xs"} c={"gray"} fw={"bold"}>
|
||||
- Tidak ada voting -
|
||||
</Text>
|
||||
</Center>
|
||||
<ComponentGlobal_IsEmptyData
|
||||
height={20}
|
||||
text="Tidak ada kontributor"
|
||||
/>
|
||||
) : (
|
||||
<Stack>
|
||||
{listKontributor?.map((e, i) => (
|
||||
|
||||
3
src/app_modules/vote/component/index.tsx
Normal file
3
src/app_modules/vote/component/index.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Voting_ComponentLayoutHeaderDetailPublish } from "./detail/comp_layout_header_detail_publish";
|
||||
|
||||
export { Voting_ComponentLayoutHeaderDetailPublish };
|
||||
@@ -19,10 +19,8 @@ import ComponentVote_DetailDataSetelahPublish from "../../component/detail/detai
|
||||
|
||||
export default function Vote_DetailKontribusi({
|
||||
dataVote,
|
||||
listKontributor,
|
||||
}: {
|
||||
dataVote: MODEL_VOTING;
|
||||
listKontributor: any
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
@@ -32,12 +30,7 @@ export default function Vote_DetailKontribusi({
|
||||
authorName={true}
|
||||
/>
|
||||
<ComponentVote_HasilVoting data={dataVote.Voting_DaftarNamaVote} />
|
||||
<ComponentVote_DaftarKontributorVoter
|
||||
listKontributor={listKontributor}
|
||||
/>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { AppShell } from "@mantine/core";
|
||||
import React from "react";
|
||||
import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import React from "react";
|
||||
import { Voting_ComponentLayoutHeaderDetailPublish } from "../../component";
|
||||
|
||||
export default function LayoutVote_DetailKontribusi({
|
||||
children,
|
||||
votingId,
|
||||
userLoginId,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
votingId: string;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Detail Kontribusi" />}
|
||||
header={
|
||||
<Voting_ComponentLayoutHeaderDetailPublish
|
||||
title="Detail Kontribusi"
|
||||
userLoginId={userLoginId}
|
||||
votingId={votingId}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
|
||||
@@ -25,9 +25,11 @@ import { useState } from "react";
|
||||
import ComponentVote_DaftarKontributorVoter from "../../component/detail/detail_daftar_kontributor";
|
||||
import ComponentVote_HasilVoting from "../../component/detail/detail_hasil_voting";
|
||||
import { Vote_funCreateHasil } from "../../fun/create/create_hasil";
|
||||
import { Vote_getOnebyId } from "../../fun/get/get_one_by_id";
|
||||
import { voting_funGetOneVotingbyId } from "../../fun/get/fun_get_one_by_id";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import moment from "moment";
|
||||
import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information";
|
||||
|
||||
export default function Vote_MainDetail({
|
||||
dataVote,
|
||||
@@ -45,9 +47,16 @@ export default function Vote_MainDetail({
|
||||
userLoginId: string;
|
||||
}) {
|
||||
const [data, setData] = useState(dataVote);
|
||||
const today = new Date();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack py={"md"}>
|
||||
{moment(dataVote?.awalVote).diff(today, "hours") < 0 ? (
|
||||
""
|
||||
) : (
|
||||
<ComponentGlobal_BoxInformation informasi="Untuk sementara voting ini belum di buka. Voting akan dimulai sesuai dengan tanggal awal pemilihan, dan akan ditutup sesuai dengan tanggal akhir pemilihan." />
|
||||
)}
|
||||
<TampilanDataVoting
|
||||
dataVote={data}
|
||||
setData={setData}
|
||||
@@ -56,9 +65,6 @@ export default function Vote_MainDetail({
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
<ComponentVote_HasilVoting data={data.Voting_DaftarNamaVote} />
|
||||
<ComponentVote_DaftarKontributorVoter
|
||||
listKontributor={listKontributor}
|
||||
/>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
@@ -78,6 +84,8 @@ function TampilanDataVoting({
|
||||
userLoginId: string;
|
||||
}) {
|
||||
const [votingNameId, setVotingNameId] = useState("");
|
||||
const today = new Date();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card
|
||||
@@ -184,6 +192,11 @@ function TampilanDataVoting({
|
||||
{dataVote?.Voting_DaftarNamaVote.map((v) => (
|
||||
<Box key={v.id}>
|
||||
<Radio
|
||||
disabled={
|
||||
moment(dataVote?.awalVote).diff(today, "hours") < 0
|
||||
? false
|
||||
: true
|
||||
}
|
||||
color="yellow"
|
||||
styles={{ label: { color: "white" } }}
|
||||
label={v.value}
|
||||
@@ -233,11 +246,11 @@ async function onVote(
|
||||
) {
|
||||
const res = await Vote_funCreateHasil(pilihanVotingId, voteId);
|
||||
if (res.status === 201) {
|
||||
await Vote_getOnebyId(voteId).then((val) => {
|
||||
await voting_funGetOneVotingbyId(voteId).then((val) => {
|
||||
setData(val);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||
});
|
||||
|
||||
|
||||
if (userLoginId !== res?.data?.Voting?.authorId) {
|
||||
const dataNotif = {
|
||||
appId: res?.data?.Voting?.id,
|
||||
@@ -262,8 +275,6 @@ async function onVote(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { AppShell } from "@mantine/core";
|
||||
import React from "react";
|
||||
import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import React from "react";
|
||||
import { Voting_ComponentLayoutHeaderDetailPublish } from "../../component";
|
||||
|
||||
export default function LayoutVote_MainDetail({
|
||||
children,
|
||||
votingId,
|
||||
userLoginId,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
votingId: string;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Detail Voting" />}
|
||||
header={
|
||||
<Voting_ComponentLayoutHeaderDetailPublish
|
||||
title="Detail Voting"
|
||||
votingId={votingId}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
|
||||
@@ -1,81 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Badge,
|
||||
Card,
|
||||
Center,
|
||||
Grid,
|
||||
Group,
|
||||
Radio,
|
||||
Stack,
|
||||
Text,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import ComponentVote_DetailDataSebelumPublish from "../../component/detail/detail_data_sebelum_publish";
|
||||
import { Badge, Center, Stack } from "@mantine/core";
|
||||
import ComponentVote_DaftarKontributorVoter from "../../component/detail/detail_daftar_kontributor";
|
||||
import ComponentVote_HasilVoting from "../../component/detail/detail_hasil_voting";
|
||||
import moment from "moment";
|
||||
import { MODEL_VOTE_KONTRIBUTOR, MODEL_VOTING } from "../../model/interface";
|
||||
import ComponentVote_DetailDataSetelahPublish from "../../component/detail/detail_data_setelah_publish";
|
||||
import ComponentVote_HasilVoting from "../../component/detail/detail_hasil_voting";
|
||||
import { MODEL_VOTE_KONTRIBUTOR, MODEL_VOTING } from "../../model/interface";
|
||||
|
||||
export default function Vote_DetailPublish({
|
||||
dataVote,
|
||||
listKontributor,
|
||||
}: {
|
||||
dataVote: MODEL_VOTING;
|
||||
listKontributor: MODEL_VOTE_KONTRIBUTOR;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Stack py={"md"}>
|
||||
{/* <ComponentVote_DetailStatus /> */}
|
||||
<Center >
|
||||
<Badge color={dataVote?.isArsip ? "gray" : "green"}>
|
||||
{dataVote?.isArsip ? "Arsip" : "Publish"}
|
||||
</Badge>
|
||||
</Center>
|
||||
<ComponentVote_DetailDataSetelahPublish data={dataVote} />
|
||||
<ComponentVote_HasilVoting data={dataVote.Voting_DaftarNamaVote} />
|
||||
<ComponentVote_DaftarKontributorVoter
|
||||
listKontributor={listKontributor as any}
|
||||
/>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TampilanDataVoting({ data }: { data: MODEL_VOTING }) {
|
||||
return (
|
||||
<>
|
||||
<Card shadow="lg" withBorder p={30}>
|
||||
<Card.Section px={"xs"}>
|
||||
<Stack spacing={"lg"}>
|
||||
<Center>
|
||||
<Title order={5}>{data.title}</Title>
|
||||
</Center>
|
||||
<Text>{data.deskripsi}</Text>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
<Card.Section py={"lg"}>
|
||||
<Stack spacing={0}>
|
||||
<Center>
|
||||
<Text fz={10} fw={"bold"}>
|
||||
Batas Voting
|
||||
</Text>
|
||||
</Center>
|
||||
<Badge>
|
||||
<Group>
|
||||
<Text>
|
||||
{data.awalVote.toLocaleDateString(["id-ID"], {
|
||||
dateStyle: "long",
|
||||
})}
|
||||
</Text>
|
||||
<Text>-</Text>
|
||||
<Text>
|
||||
{data.akhirVote.toLocaleDateString(["id-ID"], {
|
||||
dateStyle: "long",
|
||||
})}
|
||||
</Text>
|
||||
</Group>
|
||||
</Badge>
|
||||
</Stack>
|
||||
</Card.Section>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import { AppShell } from "@mantine/core";
|
||||
import React from "react";
|
||||
import ComponentVote_HeaderTamplate from "../../component/header_tamplate";
|
||||
import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate";
|
||||
import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate";
|
||||
import React from "react";
|
||||
import { Voting_ComponentLayoutHeaderDetailPublish } from "../../component";
|
||||
|
||||
export default function LayoutVote_DetailPublish({
|
||||
children,
|
||||
votingId,
|
||||
userLoginId,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
votingId: string;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate
|
||||
header={<UIGlobal_LayoutHeaderTamplate title="Detail Publish" />}
|
||||
header={
|
||||
<Voting_ComponentLayoutHeaderDetailPublish
|
||||
title="Detail Publish"
|
||||
votingId={votingId}
|
||||
userLoginId={userLoginId}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{children}
|
||||
</UIGlobal_LayoutTamplate>
|
||||
|
||||
@@ -6,8 +6,12 @@ import React from "react";
|
||||
|
||||
export default function LayoutVote_DetailSemuaRiwayat({
|
||||
children,
|
||||
votingId,
|
||||
userLoginId,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
votingId: string;
|
||||
userLoginId: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function Vote_funCreateHasil(
|
||||
pilihanVotingId: string,
|
||||
votingId: string
|
||||
) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const get = await prisma.voting_DaftarNamaVote.findFirst({
|
||||
where: {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function Vote_funCreatePilihanVotingById(
|
||||
namaVotingId: string,
|
||||
votingId: string
|
||||
) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const create = await prisma.voting_Kontributor.create({
|
||||
data: {
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
"use server";
|
||||
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import _ from "lodash";
|
||||
|
||||
export async function Vote_funCreate(req: MODEL_VOTING, listVote: any[]) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const create = await prisma.voting.create({
|
||||
data: {
|
||||
title: req.title,
|
||||
title: _.startCase(req.title),
|
||||
deskripsi: req.deskripsi,
|
||||
awalVote: req.awalVote,
|
||||
akhirVote: req.akhirVote,
|
||||
|
||||
28
src/app_modules/vote/fun/edit/fun_update_is_arsip_by_id.ts
Normal file
28
src/app_modules/vote/fun/edit/fun_update_is_arsip_by_id.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function voting_funUpdateIsArsipById({
|
||||
votingId,
|
||||
isArsip,
|
||||
}: {
|
||||
votingId: string;
|
||||
isArsip: boolean;
|
||||
}) {
|
||||
const updt = await prisma.voting.update({
|
||||
where: {
|
||||
id: votingId,
|
||||
},
|
||||
data: {
|
||||
isArsip: isArsip,
|
||||
},
|
||||
});
|
||||
|
||||
if (!updt) return { status: 400, message: "Gagal Update" };
|
||||
revalidatePath(RouterVote.main_detail);
|
||||
revalidatePath(RouterVote.detail_publish);
|
||||
|
||||
return { status: 200, message: "Berhasil Update" };
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function Vote_cekKontributorById(votingId: string) {
|
||||
const UserId = await user_getOneUserId()
|
||||
const UserId = await user_funGetOneUserId()
|
||||
|
||||
const cek = await prisma.voting_Kontributor.count({
|
||||
where: {
|
||||
|
||||
@@ -2,23 +2,12 @@
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function Vote_getOnebyId(voteId: string) {
|
||||
export async function voting_funGetOneVotingbyId(voteId: string) {
|
||||
const data = await prisma.voting.findFirst({
|
||||
where: {
|
||||
id: voteId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
isActive: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
deskripsi: true,
|
||||
awalVote: true,
|
||||
akhirVote: true,
|
||||
catatan: true,
|
||||
authorId: true,
|
||||
voting_StatusId: true,
|
||||
include: {
|
||||
Voting_DaftarNamaVote: {
|
||||
orderBy: {
|
||||
createdAt: "asc",
|
||||
@@ -1,9 +1,15 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function vote_getAllListPublish({ page }: { page: number }) {
|
||||
export async function vote_getAllListPublish({
|
||||
page,
|
||||
search,
|
||||
}: {
|
||||
page: number;
|
||||
search?: string;
|
||||
}) {
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
@@ -15,10 +21,15 @@ export async function vote_getAllListPublish({ page }: { page: number }) {
|
||||
},
|
||||
where: {
|
||||
voting_StatusId: "1",
|
||||
isArsip: false,
|
||||
isActive: true,
|
||||
akhirVote: {
|
||||
gte: new Date(),
|
||||
},
|
||||
title: {
|
||||
contains: search,
|
||||
mode: "insensitive",
|
||||
},
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
@@ -36,6 +47,13 @@ export async function vote_getAllListPublish({ page }: { page: number }) {
|
||||
orderBy: {
|
||||
createdAt: "asc",
|
||||
},
|
||||
include: {
|
||||
Voting_Kontributor: {
|
||||
include: {
|
||||
Author: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Author: {
|
||||
select: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
export async function Vote_getAllListRiwayatSaya({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function vote_getAllListKontribusiByAuthorId({
|
||||
page,
|
||||
@@ -11,7 +11,7 @@ export async function vote_getAllListKontribusiByAuthorId({
|
||||
const takeData = 5;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
const data = await prisma.voting_Kontributor.findMany({
|
||||
take: takeData,
|
||||
skip: skipData,
|
||||
|
||||
@@ -7,10 +7,9 @@ export async function Vote_getListKontributorById(votingId: string) {
|
||||
where: {
|
||||
votingId: votingId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
include: {
|
||||
Author: {
|
||||
select: {
|
||||
include: {
|
||||
Profile: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function Vote_getOnePilihanVotingByUserId(votingId: string) {
|
||||
const userId = await user_getOneUserId();
|
||||
const userId = await user_funGetOneUserId();
|
||||
const get = await prisma.voting_Kontributor.findFirst({
|
||||
where: {
|
||||
authorId: userId,
|
||||
|
||||
3
src/app_modules/vote/fun/get/index.ts
Normal file
3
src/app_modules/vote/fun/get/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { voting_funGetOneVotingbyId } from "./fun_get_one_by_id";
|
||||
|
||||
export { voting_funGetOneVotingbyId as Voting_funGetOneVotingbyId };
|
||||
@@ -1,10 +1,10 @@
|
||||
"use server";
|
||||
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
import { user_funGetOneUserId } from "@/app_modules/fun_global/get_user_token";
|
||||
|
||||
export async function vote_getAllDraft({ page }: { page: number }) {
|
||||
const authorId = await user_getOneUserId();
|
||||
const authorId = await user_funGetOneUserId();
|
||||
|
||||
const takeData = 10;
|
||||
const skipData = page * takeData - takeData;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user