}
- compact
+ bg={MainColor.yellow}
+ color="yellow"
+ c={"black"}
>
Upload
@@ -94,6 +105,9 @@ export default function UploadFotoProfile({
onClick={() => {
onUpdate(router, profile.id, file as any, setLoading);
}}
+ bg={MainColor.yellow}
+ color="yellow"
+ c={"black"}
>
Update
diff --git a/src/app_modules/katalog/profile/upload/foto_profile/layout.tsx b/src/app_modules/katalog/profile/upload/foto_profile/layout.tsx
index 54797977..230e5397 100644
--- a/src/app_modules/katalog/profile/upload/foto_profile/layout.tsx
+++ b/src/app_modules/katalog/profile/upload/foto_profile/layout.tsx
@@ -1,38 +1,20 @@
-"use client";
-
-import {
- ActionIcon,
- AppShell,
- FileButton,
- Flex,
- Footer,
- Group,
- Header,
- Text,
-} from "@mantine/core";
-
-import { useRouter } from "next/navigation";
-import { useState } from "react";
-import ComponentKatalog_HeaderTamplate from "@/app_modules/katalog/component/header_tamplate";
-import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/component_layout_tamplate";
+import UIGlobal_LayoutHeaderTamplate from "@/app_modules/component_global/ui/ui_header_tamplate";
+import UIGlobal_LayoutTamplate from "@/app_modules/component_global/ui/ui_layout_tamplate";
export default function UploadFotoProfileLayout({
children,
- profileId,
}: {
children: any;
- profileId: any;
}) {
- const router = useRouter();
- const [profile, setProfile] = useState(profileId);
+
return (
<>
- }
+ }
>
{children}
-
+
>
);
}
diff --git a/src/app_modules/katalog/ui/ui_katalog.tsx b/src/app_modules/katalog/ui/ui_katalog.tsx
new file mode 100644
index 00000000..19ea9dea
--- /dev/null
+++ b/src/app_modules/katalog/ui/ui_katalog.tsx
@@ -0,0 +1,31 @@
+"use client"
+
+import { Stack } from "@mantine/core";
+import { Portofolio_UiListView } from "./ui_list_portofolio";
+import { Profile_UiView } from "./ui_profile";
+import { MODEL_PORTOFOLIO } from "../portofolio/model/interface";
+import { MODEL_PROFILE } from "../profile/model/interface";
+
+
+export function Katalog_UiView({
+ profile,
+ listPorto,
+ userLoginId,
+}: {
+ profile: MODEL_PROFILE;
+ listPorto: MODEL_PORTOFOLIO;
+ userLoginId: string;
+}) {
+ return (
+ <>
+
+
+
+
+ >
+ );
+}
\ No newline at end of file
diff --git a/src/app_modules/katalog/ui/ui_list_portofolio.tsx b/src/app_modules/katalog/ui/ui_list_portofolio.tsx
new file mode 100644
index 00000000..f63d9cbb
--- /dev/null
+++ b/src/app_modules/katalog/ui/ui_list_portofolio.tsx
@@ -0,0 +1,146 @@
+"use cleint";
+
+import { RouterPortofolio } from "@/app/lib/router_hipmi/router_katalog";
+import {
+ AccentColor,
+ MainColor,
+} from "@/app_modules/component_global/color/color_pallet";
+import ComponentGlobal_UI_Loader from "@/app_modules/component_global/ui/ui_loader";
+import {
+ ActionIcon,
+ Box,
+ Center,
+ Group,
+ Paper,
+ Stack,
+ Text,
+ Title,
+} from "@mantine/core";
+import { IconCaretRight, IconPencilPlus } from "@tabler/icons-react";
+import _ from "lodash";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import { MODEL_PORTOFOLIO } from "../portofolio/model/interface";
+import { MODEL_PROFILE } from "../profile/model/interface";
+
+export function Portofolio_UiListView({
+ listPorto,
+ profile,
+ userLoginId,
+}: {
+ listPorto: MODEL_PORTOFOLIO[];
+ profile: MODEL_PROFILE;
+ userLoginId: string;
+}) {
+ const router = useRouter();
+ const [loading, setLoading] = useState(false);
+ const [loadingPorto, setLoadingPorto] = useState(false);
+ const [idPorto, setIdPorto] = useState("");
+ return (
+ <>
+
+
+
+
+ Portofolio
+ {profile?.User.id === userLoginId ? (
+ {
+ router.push(RouterPortofolio.create + `${profile.id}`);
+ setLoading(true);
+ }}
+ >
+ {loading ? (
+
+ ) : (
+
+ )}
+
+ ) : (
+
+ )}
+
+
+
+ {_.isEmpty(listPorto) ? (
+
+
+ - Belum Ada Portofolio -
+
+
+ ) : (
+
+ {listPorto.map((e, i) => (
+ {
+ setIdPorto(e?.id);
+ setLoadingPorto(true);
+ router.push(RouterPortofolio.main_detail + e?.id);
+ }}
+ style={{
+ backgroundColor: MainColor.darkblue,
+ border: `2px solid ${AccentColor.blue}`,
+ borderRadius: "10px ",
+ padding: "15px",
+ color: "white",
+ }}
+ >
+
+
+ {e?.namaBisnis}
+
+
+ {idPorto === e?.id && loadingPorto ? (
+
+ ) : (
+
+ )}
+
+
+
+ ))}
+
+ )}
+ {_.isEmpty(listPorto) ? (
+ ""
+ ) : (
+
+
+ router.push(
+ RouterPortofolio.daftar_portofolio + profile.id,
+ { scroll: false }
+ )
+ }
+ fw={"bold"}
+ fz={"sm"}
+ >
+ Lihat semua
+
+
+ )}
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/katalog/ui/ui_profile.tsx b/src/app_modules/katalog/ui/ui_profile.tsx
new file mode 100644
index 00000000..26b30533
--- /dev/null
+++ b/src/app_modules/katalog/ui/ui_profile.tsx
@@ -0,0 +1,156 @@
+"use client";
+
+import {
+ MainColor,
+ AccentColor,
+} from "@/app_modules/component_global/color/color_pallet";
+import {
+ Avatar,
+ Box,
+ Center,
+ Group,
+ Image,
+ Paper,
+ Stack,
+ Text,
+ ThemeIcon,
+} from "@mantine/core";
+import { MODEL_PROFILE } from "../profile/model/interface";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
+import {
+ IconBrandGmail,
+ IconGenderFemale,
+ IconGenderMale,
+ IconHome,
+ IconPhone,
+} from "@tabler/icons-react";
+
+export function Profile_UiView({
+ profile,
+ userLoginId,
+}: {
+ profile: MODEL_PROFILE;
+ userLoginId: string;
+}) {
+ const router = useRouter();
+ const [loadingPP, setLoadingPP] = useState(false);
+ const [loadingBG, setLoadingBG] = useState(false);
+ const [loadingEdit, setLoadingEdit] = useState(false);
+
+ const listInformation = [
+ {
+ icon: ,
+ value: profile?.User.nomor,
+ },
+ {
+ icon: ,
+ value: profile?.email,
+ },
+ {
+ icon: ,
+ value: profile?.alamat,
+ },
+ {
+ icon:
+ profile.jenisKelamin === "Laki-laki" ? (
+
+ ) : (
+
+ ),
+ value: profile?.jenisKelamin,
+ },
+ ];
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+ {profile?.name}
+
+
+ @{profile?.User?.username}
+
+
+
+
+
+
+
+ {listInformation.map((e, i) => (
+
+
+ {e.icon}
+
+
+ {e?.value}
+
+
+ ))}
+
+
+ {/*
+ {JSON.stringify(profile, null, 2)}
+ */}
+
+ >
+ );
+}
diff --git a/src/app_modules/katalog/view_katalog.tsx b/src/app_modules/katalog/view_katalog.tsx
new file mode 100644
index 00000000..5829b0a3
--- /dev/null
+++ b/src/app_modules/katalog/view_katalog.tsx
@@ -0,0 +1,23 @@
+import { MODEL_PORTOFOLIO } from "./portofolio/model/interface";
+import { MODEL_PROFILE } from "./profile/model/interface";
+import { Katalog_UiView } from "./ui/ui_katalog";
+
+export async function Katalog_MainView({
+ profile,
+ listPorto,
+ userLoginId,
+}: {
+ profile: MODEL_PROFILE;
+ listPorto: MODEL_PORTOFOLIO;
+ userLoginId: string;
+}) {
+ return (
+ <>
+
+ >
+ );
+}
diff --git a/src/app_modules/notifikasi/component/card_view.tsx b/src/app_modules/notifikasi/component/card_view.tsx
new file mode 100644
index 00000000..7bed821c
--- /dev/null
+++ b/src/app_modules/notifikasi/component/card_view.tsx
@@ -0,0 +1,141 @@
+"use client";
+
+import { Badge, Card, Divider, Group, Stack, Text } from "@mantine/core";
+import { IconCheck, IconChecks } from "@tabler/icons-react";
+import { useRouter } from "next/navigation";
+import notifikasi_funUpdateIsReadById from "../fun/update/fun_update_is_read_by_user_id";
+import { MODEL_NOTIFIKASI } from "../model/interface";
+import { redirectDetailForumPage } from "./path/forum";
+import { redirectJobPage } from "./path/job";
+import {
+ AccentColor,
+ MainColor,
+} from "@/app_modules/component_global/color/color_pallet";
+import notifikasi_getByUserId from "../fun/get/get_notifiaksi_by_id";
+
+export function ComponentNotifiaksi_CardView({
+ data,
+ onLoadData,
+ activePage,
+ onSetJob,
+}: {
+ data: MODEL_NOTIFIKASI;
+ onLoadData: (val: any) => void;
+ activePage: number;
+ onSetJob: (val: any) => void;
+}) {
+ const router = useRouter();
+ return (
+ <>
+ {
+ data?.kategoriApp === "JOB" &&
+ redirectJobPage({
+ data: data,
+ router: router,
+ onSetPage(val) {
+ onSetJob(val);
+ },
+ });
+
+ data?.kategoriApp === "FORUM" &&
+ redirectDetailForumPage({
+ data: data,
+ router: router,
+ });
+
+ const updateIsRead = await notifikasi_funUpdateIsReadById({
+ notifId: data?.id,
+ });
+
+ if (updateIsRead.status === 200) {
+ // console.log(updateIsRead.status);
+ // const loadData = await notifikasi_getByUserId({ page: activePage });
+ // onLoadData(loadData);
+ // console.log("berhasil load")
+ }
+ }}
+ >
+ {/* {JSON.stringify(e, null, 2)} */}
+
+
+
+
+ # {data?.kategoriApp}
+
+ {data?.status ? (
+
+ {data?.status}
+
+ ) : (
+ ""
+ )}
+
+
+
+
+
+
+
+ {data?.title}
+
+ {data.kategoriApp === "FORUM" ? (
+
+ ) : (
+ {data?.pesan}
+ )}
+
+
+
+
+
+ {new Intl.DateTimeFormat("id-ID", {
+ dateStyle: "long",
+ }).format(data?.createdAt)}
+
+
+ {", "}
+ {new Intl.DateTimeFormat("id-ID", {
+ timeStyle: "short",
+ }).format(data?.createdAt)}
+
+
+ {data?.isRead ? (
+
+
+
+ Sudah dilihat
+
+
+ ) : (
+
+
+
+ Belum dilihat
+
+
+ )}
+
+
+
+ >
+ );
+}
diff --git a/src/app_modules/notifikasi/component/path/forum.ts b/src/app_modules/notifikasi/component/path/forum.ts
new file mode 100644
index 00000000..e31c9f88
--- /dev/null
+++ b/src/app_modules/notifikasi/component/path/forum.ts
@@ -0,0 +1,26 @@
+import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { MODEL_NOTIFIKASI } from "../../model/interface";
+
+export function redirectDetailForumPage({
+ data,
+ router,
+}: {
+ data: MODEL_NOTIFIKASI;
+ router: AppRouterInstance;
+}) {
+ if (data.status === null) {
+ const path = RouterForum.main_detail + data.appId;
+ router.push(path, { scroll: false });
+ }
+
+ if (data.status === "Report Komentar") {
+ const path = RouterForum.detail_report_komentar + data.appId;
+ router.push(path, { scroll: false });
+ }
+
+ if (data.status === "Report Posting") {
+ const path = RouterForum.detail_report_posting + data.appId;
+ router.push(path, { scroll: false });
+ }
+}
diff --git a/src/app_modules/notifikasi/component/path/job.ts b/src/app_modules/notifikasi/component/path/job.ts
new file mode 100644
index 00000000..03efdb2b
--- /dev/null
+++ b/src/app_modules/notifikasi/component/path/job.ts
@@ -0,0 +1,31 @@
+import { RouterJob } from "@/app/lib/router_hipmi/router_job";
+import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
+import { MODEL_NOTIFIKASI } from "../../model/interface";
+
+export function redirectJobPage({
+ data,
+ router,
+ onSetPage,
+}: {
+ data: MODEL_NOTIFIKASI;
+ router: AppRouterInstance;
+ onSetPage: (val: any) => void;
+}) {
+ const path = RouterJob.status;
+
+ if (data.status === "Publish") {
+ onSetPage({
+ menuId: 2,
+ status: data.status,
+ });
+ }
+
+ if (data.status === "Reject") {
+ onSetPage({
+ menuId: 2,
+ status: data.status,
+ });
+ }
+
+ router.push(path, {scroll: false});
+}
diff --git a/src/app_modules/notifikasi/component/ui_notifiaksi.tsx b/src/app_modules/notifikasi/component/ui_notifiaksi.tsx
new file mode 100644
index 00000000..827da9c2
--- /dev/null
+++ b/src/app_modules/notifikasi/component/ui_notifiaksi.tsx
@@ -0,0 +1,81 @@
+"use client";
+
+import ComponentGlobal_IsEmptyData from "@/app_modules/component_global/is_empty_data";
+import ComponentGlobal_UI_Loader from "@/app_modules/component_global/ui/ui_loader";
+import { gs_job_hot_menu, gs_job_status } from "@/app_modules/job/global_state";
+import { Box, Center } from "@mantine/core";
+import { useShallowEffect } from "@mantine/hooks";
+import { useAtom } from "jotai";
+import _ from "lodash";
+import { ScrollOnly } from "next-scroll-loader";
+import { useState } from "react";
+import notifikasi_getByUserId from "../fun/get/get_notifiaksi_by_id";
+import { MODEL_NOTIFIKASI } from "../model/interface";
+import { ComponentNotifiaksi_CardView } from "./card_view";
+
+export function Notifikasi_UiView({
+ listNotifikasi,
+}: {
+ listNotifikasi: MODEL_NOTIFIKASI[];
+}) {
+ const [data, setData] = useState(listNotifikasi);
+ const [activePage, setActivePage] = useState(1);
+
+ // JOB
+ const [jobMenuId, setJobMenuId] = useAtom(gs_job_hot_menu);
+ const [jobStatus, setJobStatus] = useAtom(gs_job_status);
+
+ useShallowEffect(() => {
+ onLoadData({
+ onLoad(val) {
+ setData(val);
+ },
+ });
+ }, []);
+
+ async function onLoadData({ onLoad }: { onLoad: (val: any) => void }) {
+ const loadData = await notifikasi_getByUserId({ page: 1 });
+ onLoad(loadData);
+ }
+
+ return (
+ <>
+
+ {_.isEmpty(data) ? (
+
+ ) : (
+ (
+
+
+
+ )}
+ data={data}
+ setData={setData}
+ moreData={async () => {
+ const loadData = await notifikasi_getByUserId({
+ page: activePage + 1,
+ });
+ setActivePage((val) => val + 1);
+
+ return loadData;
+ }}
+ >
+ {(item) => (
+ setData(val)}
+ activePage={activePage}
+ onSetJob={(val) => {
+ setJobMenuId(val.menuId);
+ setJobStatus(val.status);
+ }}
+ />
+ )}
+
+ )}
+
+ >
+ );
+}
diff --git a/src/app_modules/notifikasi/fun/get/get_notifiaksi_by_id.ts b/src/app_modules/notifikasi/fun/get/get_notifiaksi_by_id.ts
index 9ba18fb9..0d2d4d68 100644
--- a/src/app_modules/notifikasi/fun/get/get_notifiaksi_by_id.ts
+++ b/src/app_modules/notifikasi/fun/get/get_notifiaksi_by_id.ts
@@ -3,12 +3,16 @@
import prisma from "@/app/lib/prisma";
import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
-export default async function notifikasi_getByUserId() {
+export default async function notifikasi_getByUserId({page}: {page: number }) {
const userId = await user_getOneUserId();
+ const takeData = 10;
+ const skipData = page * takeData - takeData;
const data = await prisma.notifikasi.findMany({
+ take: takeData,
+ skip: skipData,
orderBy: {
- createdAt: "desc",
+ isRead: "asc"
},
where: {
userId: userId,
diff --git a/src/app_modules/notifikasi/index.ts b/src/app_modules/notifikasi/index.ts
index a347a8b2..25af39f6 100644
--- a/src/app_modules/notifikasi/index.ts
+++ b/src/app_modules/notifikasi/index.ts
@@ -1,3 +1,3 @@
-import Notifikasi_MainView from "./main";
+import Notifikasi_MainView from "./view_notifikasi";
export { Notifikasi_MainView };
\ No newline at end of file
diff --git a/src/app_modules/notifikasi/main/index.tsx b/src/app_modules/notifikasi/main/index.tsx
deleted file mode 100644
index 8ca7e69a..00000000
--- a/src/app_modules/notifikasi/main/index.tsx
+++ /dev/null
@@ -1,236 +0,0 @@
-"use client";
-
-import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/component_layout_tamplate";
-import ComponentGlobal_HeaderTamplate from "@/app_modules/component_global/header_tamplate";
-import {
- Badge,
- Card,
- Divider,
- Group,
- Paper,
- SimpleGrid,
- Stack,
- Text,
-} from "@mantine/core";
-import { MODEL_NOTIFIKASI } from "../model/interface";
-import { useState } from "react";
-import adminNotifikasi_countNotifikasi from "@/app_modules/admin/notifikasi/fun/count/count_is_read";
-import adminNotifikasi_getByUserId from "@/app_modules/admin/notifikasi/fun/get/get_notifikasi_by_user_id";
-import adminNotifikasi_funUpdateIsReadById from "@/app_modules/admin/notifikasi/fun/update/fun_update_is_read_by_id";
-import { IconChecks, IconCheck } from "@tabler/icons-react";
-import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
-import { useRouter } from "next/navigation";
-import { RouterJob } from "@/app/lib/router_hipmi/router_job";
-import notifikasi_funUpdateIsReadById from "../fun/update/fun_update_is_read_by_user_id";
-import { useAtom } from "jotai";
-import { gs_job_hot_menu, gs_job_status } from "@/app_modules/job/global_state";
-import _ from "lodash";
-import ComponentGlobal_IsEmptyData from "@/app_modules/component_global/is_empty_data";
-import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
-import notifikasi_getByUserId from "../fun/get/get_notifiaksi_by_id";
-import { useShallowEffect } from "@mantine/hooks";
-import { data } from "autoprefixer";
-
-export default function Notifikasi_MainView({
- listNotifikasi,
-}: {
- listNotifikasi: any[];
-}) {
- return (
- <>
- }
- >
-
-
- >
- );
-}
-
-function MainView({ listNotifikasi }: { listNotifikasi: MODEL_NOTIFIKASI[] }) {
- const router = useRouter();
- const [data, setData] = useState(listNotifikasi);
-
- // JOB
- const [jobMenuId, setJobMenuId] = useAtom(gs_job_hot_menu);
- const [jobStatus, setJobStatus] = useAtom(gs_job_status);
-
- useShallowEffect(() => {
- onLoadData({
- onLoad(val) {
- setData(val);
- },
- });
- }, []);
-
- async function onLoadData({ onLoad }: { onLoad: (val: any) => void }) {
- const loadData = await notifikasi_getByUserId();
- onLoad(loadData);
- }
-
- if (_.isEmpty(data)) {
- return ;
- }
- return (
- <>
-
- {data.map((e, i) => (
- {
- e?.kategoriApp === "JOB" &&
- redirectJobPage({
- data: e,
- router: router,
- onSetPage(val) {
- setJobMenuId(val.menuId);
- setJobStatus(val.status);
- },
- });
-
- e?.kategoriApp === "FORUM" &&
- redirectDetailForumPage({
- data: e,
- router: router,
- });
-
- const updateIsRead = await notifikasi_funUpdateIsReadById({
- notifId: e?.id,
- });
- if (updateIsRead.status === 200) return null;
- }}
- >
- {/* {JSON.stringify(e, null, 2)} */}
-
-
-
-
- # {e?.kategoriApp}
-
- {e?.status ? {e?.status} : ""}
-
-
-
-
-
-
-
- {e?.title}
-
- {e.kategoriApp === "FORUM" ? (
-
- ) : (
- //
- //
-
- {e?.pesan}
-
- )}
-
-
-
-
-
- {new Intl.DateTimeFormat("id-ID", {
- dateStyle: "long",
- }).format(e?.createdAt)}
-
-
- {", "}
- {new Intl.DateTimeFormat("id-ID", {
- timeStyle: "short",
- }).format(e?.createdAt)}
-
-
- {e?.isRead ? (
-
-
-
- Sudah dilihat
-
-
- ) : (
-
-
-
- Belum dilihat
-
-
- )}
-
-
-
- ))}
-
- >
- );
-}
-
-function redirectJobPage({
- data,
- router,
- onSetPage,
-}: {
- data: MODEL_NOTIFIKASI;
- router: AppRouterInstance;
- onSetPage: (val: any) => void;
-}) {
- const path = RouterJob.status;
-
- if (data.status === "Publish") {
- onSetPage({
- menuId: 2,
- status: data.status,
- });
- }
-
- if (data.status === "Reject") {
- onSetPage({
- menuId: 2,
- status: data.status,
- });
- }
-
- router.push(path);
-}
-
-function redirectDetailForumPage({
- data,
- router,
-}: {
- data: MODEL_NOTIFIKASI;
- router: AppRouterInstance;
-}) {
- if (data.status === null) {
- const path = RouterForum.main_detail + data.appId;
- router.push(path);
- }
-
- if (data.status === "Report Komentar") {
- const path = RouterForum.detail_report_komentar + data.appId;
- router.push(path);
- }
-
- if (data.status === "Report Posting") {
- const path = RouterForum.detail_report_posting + data.appId;
- router.push(path);
- }
-}
diff --git a/src/app_modules/notifikasi/view_notifikasi.tsx b/src/app_modules/notifikasi/view_notifikasi.tsx
new file mode 100644
index 00000000..901a9ecf
--- /dev/null
+++ b/src/app_modules/notifikasi/view_notifikasi.tsx
@@ -0,0 +1,19 @@
+import UIGlobal_LayoutHeaderTamplate from "../component_global/ui/ui_header_tamplate";
+import UIGlobal_LayoutTamplate from "../component_global/ui/ui_layout_tamplate";
+import { Notifikasi_UiView } from "./component/ui_notifiaksi";
+
+export default function Notifikasi_MainView({
+ listNotifikasi,
+}: {
+ listNotifikasi: any[];
+}) {
+ return (
+ <>
+ }
+ >
+
+
+ >
+ );
+}
diff --git a/src/app_modules/user_search/component/is_empty_data.tsx b/src/app_modules/user_search/component/is_empty_data.tsx
deleted file mode 100644
index ccfd8217..00000000
--- a/src/app_modules/user_search/component/is_empty_data.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-"use client";
-
-import { Center } from "@mantine/core";
-
-export default function ComponentUserSearch_IsEmptyData({ text }: { text: string }) {
- return (
- <>
-
- {text}
-
- >
- );
-}
diff --git a/src/app_modules/user_search/component/ui_user_search.tsx b/src/app_modules/user_search/component/ui_user_search.tsx
new file mode 100644
index 00000000..7803fb89
--- /dev/null
+++ b/src/app_modules/user_search/component/ui_user_search.tsx
@@ -0,0 +1,310 @@
+"use client";
+
+import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
+import ComponentGlobal_IsEmptyData from "@/app_modules/component_global/is_empty_data";
+import { MODEL_USER } from "@/app_modules/home/model/interface";
+import {
+ ActionIcon,
+ Avatar,
+ Box,
+ Center,
+ Grid,
+ Group,
+ Loader,
+ Stack,
+ Text,
+ TextInput,
+} from "@mantine/core";
+import { IconChevronRight, IconSearch } from "@tabler/icons-react";
+import _ from "lodash";
+import { ScrollOnly } from "next-scroll-loader";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+import { userSearch_getAllUser } from "../fun/get/get_all_user";
+import { MainColor } from "@/app_modules/component_global/color/color_pallet";
+import ComponentGlobal_UI_Loader from "@/app_modules/component_global/ui/ui_loader";
+
+export function UserSearch_UiView({ listUser }: { listUser: MODEL_USER[] }) {
+ const [data, setData] = useState(listUser);
+ const [activePage, setActivePage] = useState(1);
+ const [isSearch, setIsSearch] = useState("");
+
+ async function onSearch(name: string) {
+ setIsSearch(name);
+ const loadData = await userSearch_getAllUser({
+ page: activePage,
+ search: name,
+ });
+ setData(loadData as any);
+ setActivePage(1);
+ }
+
+ return (
+ <>
+
+ }
+ placeholder="Masukan username "
+ onChange={(val) => onSearch(val.target.value)}
+ />
+
+ {_.isEmpty(data) ? (
+
+ ) : (
+ (
+
+
+
+ )}
+ data={data}
+ setData={setData}
+ moreData={async () => {
+ const loadData = await userSearch_getAllUser({
+ page: activePage + 1,
+ search: isSearch,
+ });
+ setActivePage((val) => val + 1);
+
+ return loadData;
+ }}
+ >
+ {(item) => }
+
+ )}
+
+
+ {/* {JSON.stringify(data, null, 2)} */}
+ >
+ );
+}
+
+function CardView({ data }: { data: MODEL_USER }) {
+ const router = useRouter();
+ const [loading, setLoading] = useState(false);
+
+ return (
+ <>
+ {
+ setLoading(true);
+ router.push(RouterProfile.katalog + `${data?.Profile?.id}`);
+ }}
+ >
+
+
+
+
+
+ {data?.username}
+
+
+ +{data?.nomor}
+
+
+
+
+
+
+
+ {loading ? (
+
+ ) : (
+
+ )}
+
+
+
+
+
+ >
+ );
+}
+
+let dataDummy = [
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 1",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 2",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 1",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 2",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 1",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 2",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 1",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 2",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 1",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 2",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 1",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 2",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 1",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+ {
+ id: "clx8pl7r90005su4mldioo0v1",
+ username: "amalia 2",
+ nomor: "628980185458",
+ active: true,
+ masterUserRoleId: "1",
+ Profile: {
+ id: "clx8ptp7w000esu4ma275qnc8",
+ name: "Amalia Dwi",
+ imagesId: "clx8ptp7m000bsu4mwzbfvd9w",
+ },
+ },
+];
diff --git a/src/app_modules/user_search/fun/get/get_all_user.ts b/src/app_modules/user_search/fun/get/get_all_user.ts
new file mode 100644
index 00000000..0eb2ac43
--- /dev/null
+++ b/src/app_modules/user_search/fun/get/get_all_user.ts
@@ -0,0 +1,58 @@
+"use server";
+
+import prisma from "@/app/lib/prisma";
+import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
+
+export async function userSearch_getAllUser({
+ page,
+ search,
+}: {
+ page: number;
+ search?: string;
+}) {
+ const userLoginId = await user_getOneUserId();
+ const takeData = 20;
+ const skipData = page * takeData - takeData;
+
+ const data = await prisma.user.findMany({
+ take: takeData,
+ skip: skipData,
+ orderBy: {
+ username: "asc",
+ },
+ where: {
+ active: true,
+ masterUserRoleId: "1",
+ username: {
+ contains: search,
+ mode: "insensitive",
+ },
+ NOT: {
+ Profile: null,
+ },
+ OR: [
+ {
+ NOT: {
+ id: userLoginId,
+ },
+ },
+ ],
+ },
+ select: {
+ id: true,
+ username: true,
+ nomor: true,
+ active: true,
+ masterUserRoleId: true,
+ Profile: {
+ select: {
+ id: true,
+ name: true,
+ imagesId: true,
+ },
+ },
+ },
+ });
+
+ return data;
+}
diff --git a/src/app_modules/user_search/fun/get/get_list_user.ts b/src/app_modules/user_search/fun/get/get_list_user.ts
deleted file mode 100644
index 447332b3..00000000
--- a/src/app_modules/user_search/fun/get/get_list_user.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-"use server";
-
-import prisma from "@/app/lib/prisma";
-import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token";
-
-export async function UserSearch_getListUser({ name }: { name: string }) {
- const userLoginId = await user_getOneUserId();
-
- if (name === "") {
- const data = await prisma.user.findMany({
- where: {
- masterUserRoleId: "1",
- NOT: {
- id: userLoginId,
- },
- },
- select: {
- id: true,
- username: true,
- nomor: true,
- active: true,
- masterUserRoleId: true,
- Profile: {
- select: {
- id: true,
- name: true,
- imagesId: true,
- },
- },
- },
- });
- return data;
- }
-
- const getDataCari = await prisma.user.findMany({
- where: {
- masterUserRoleId: "1",
- Profile: {
- name: {
- contains: name,
- mode: "insensitive",
- },
- },
- NOT: {
- id: userLoginId,
- },
- },
- select: {
- id: true,
- username: true,
- nomor: true,
- active: true,
- masterUserRoleId: true,
- Profile: true,
- },
- });
-
- return getDataCari;
-}
diff --git a/src/app_modules/user_search/fun/search/fun_search_by_name.ts b/src/app_modules/user_search/fun/search/fun_search_by_name.ts
deleted file mode 100644
index cf7ed1fd..00000000
--- a/src/app_modules/user_search/fun/search/fun_search_by_name.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-"use server";
-
-import prisma from "@/app/lib/prisma";
-import { useSearchParams } from "next/navigation";
-import { NextRequest } from "next/server";
-
-export async function UserSearch_searchByName(name: string) {
- const data = await prisma.user.findMany({
- where: {
- Profile: {
- name: {
- contains: name,
- mode: "insensitive",
- },
- },
- },
- select: {
- id: true,
- username: true,
- nomor: true,
- active: true,
- masterUserRoleId: true,
- Profile: true,
- },
- });
-
- return data;
-}
diff --git a/src/app_modules/user_search/index.ts b/src/app_modules/user_search/index.ts
index 06d26ed9..a3b7ce39 100644
--- a/src/app_modules/user_search/index.ts
+++ b/src/app_modules/user_search/index.ts
@@ -1,7 +1,3 @@
-import UserSearch_MainView from "./main";
-import LayoutUserSearch_MainView from "./main/layout";
+import UserSearch_MainView from "./view_user_seach";
-export {
- UserSearch_MainView,
- LayoutUserSearch_MainView,
-}
\ No newline at end of file
+export { UserSearch_MainView };
diff --git a/src/app_modules/user_search/main/index.tsx b/src/app_modules/user_search/main/index.tsx
deleted file mode 100644
index 1ef06bf1..00000000
--- a/src/app_modules/user_search/main/index.tsx
+++ /dev/null
@@ -1,131 +0,0 @@
-"use client";
-
-import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
-import { MODEL_USER } from "@/app_modules/home/model/interface";
-import {
- ActionIcon,
- Avatar,
- Box,
- Center,
- Divider,
- Grid,
- Paper,
- Stack,
- Text,
- TextInput,
- Title,
-} from "@mantine/core";
-import { IconChevronRight, IconSearch } from "@tabler/icons-react";
-import { useState } from "react";
-import { UserSearch_searchByName } from "../fun/search/fun_search_by_name";
-import { useRouter } from "next/navigation";
-import ComponentGlobal_MaintenanceInformation from "@/app_modules/component_global/maintenance_information";
-import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2";
-import { data } from "autoprefixer";
-import { UserSearch_getListUser } from "../fun/get/get_list_user";
-import _ from "lodash";
-import ComponentUserSearch_IsEmptyData from "../component/is_empty_data";
-
-export default function UserSearch_MainView({
- listUser,
-}: {
- listUser: MODEL_USER[];
-}) {
- const router = useRouter();
- const [data, setData] = useState(listUser);
- const [loading, setLoading] = useState(false);
-
- async function onSearch(name: string) {
- await UserSearch_getListUser({ name: name }).then((res) =>
- setData(res as any)
- );
- }
-
- // return (
- // <>
- //
- //
- //
- // >
- // );
-
- if (loading) return ;
-
- return (
- <>
-
-
- }
- placeholder="Masukan nama pegguna"
- onChange={(val) => onSearch(val.target.value)}
- />
-
- {_.isEmpty(data) ? (
-
- ) : (
-
- {data?.map((e, i) =>
- e?.Profile === null ? (
- ""
- ) : (
-
-
-
-
-
-
-
-
-
-
- {e?.Profile?.name}
-
-
- +{e?.nomor}
-
-
-
-
-
- {
- setLoading(true);
- router.push(
- RouterProfile.katalog + `${e?.Profile?.id}`
- );
- }}
- >
-
-
-
-
-
-
-
- )
- )}
-
- )}
-
-
-
- {/* {JSON.stringify(data, null, 2)} */}
- >
- );
-}
diff --git a/src/app_modules/user_search/main/layout.tsx b/src/app_modules/user_search/main/layout.tsx
deleted file mode 100644
index 90a09ba4..00000000
--- a/src/app_modules/user_search/main/layout.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-"use client";
-
-import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/component_layout_tamplate";
-import ComponentGlobal_HeaderTamplate from "@/app_modules/component_global/header_tamplate";
-import { AppShell } from "@mantine/core";
-import React from "react";
-
-export default function LayoutUserSearch_MainView({
- children,
-}: {
- children: React.ReactNode;
-}) {
- return (
- <>
- }
- >
- {children}
-
- >
- );
-}
diff --git a/src/app_modules/user_search/view_user_seach.tsx b/src/app_modules/user_search/view_user_seach.tsx
new file mode 100644
index 00000000..c9cc9338
--- /dev/null
+++ b/src/app_modules/user_search/view_user_seach.tsx
@@ -0,0 +1,22 @@
+
+import { MODEL_USER } from "@/app_modules/home/model/interface";
+import UIGlobal_LayoutHeaderTamplate from "../component_global/ui/ui_header_tamplate";
+import UIGlobal_LayoutTamplate from "../component_global/ui/ui_layout_tamplate";
+import { UserSearch_UiView } from "./component/ui_user_search";
+
+export default function UserSearch_MainView({
+ listUser,
+}: {
+ listUser: MODEL_USER[];
+}) {
+ return (
+ <>
+ }
+ >
+
+
+ {/* {JSON.stringify(data, null, 2)} */}
+ >
+ );
+}
diff --git a/src/app_modules/zCoba/index.tsx b/src/app_modules/zCoba/index.tsx
index aabf6483..f6e2c0b8 100644
--- a/src/app_modules/zCoba/index.tsx
+++ b/src/app_modules/zCoba/index.tsx
@@ -2,36 +2,16 @@
import {
ActionIcon,
- Affix,
- BackgroundImage,
Box,
Button,
- Center,
- Group,
- LoadingOverlay,
- Paper,
- ScrollArea,
- SimpleGrid,
- Skeleton,
- Stack,
- Text,
- rem,
+ Stack
} from "@mantine/core";
import { useState } from "react";
-import useInfiniteScroll, {
- ScrollDirection,
-} from "react-easy-infinite-scroll-hook";
-import { createItems, loadMore } from "./utils";
-import { v4 as uuidv4 } from "uuid";
-import { useShallowEffect } from "@mantine/hooks";
-import { ScrollOnly } from "next-scroll-loader";
+import { IconPencilPlus } from "@tabler/icons-react";
import _ from "lodash";
-import ComponentGlobal_V2_LoadingPage from "../component_global/loading_page_v2";
-import ComponentGlobal_UI_LayoutTamplate from "../component_global/ui/ui_layout_tamplate";
-import ComponentGlobal_UI_HeaderTamplate from "../component_global/ui/ui_header_tamplate";
-import { Icon123, IconPencilPlus, IconX } from "@tabler/icons-react";
-import { AccentColor, MainColor } from "../component_global/color/color_pallet";
+import UIGlobal_LayoutTamplate from "../component_global/ui/ui_layout_tamplate";
+
const newData = Array(20)
.fill(0)
@@ -56,49 +36,16 @@ const data2 = [
];
export default function Coba_TestLoading() {
- // const [data, setData] = useState(newData);
- // const [isLoading, setIsLoading] = useState(false);
-
- // return (
- // <>
- // {
- // const newData = Array.from(
- // { length: 50 },
- // (_, i) => i + data.length + 1
- // );
- // await new Promise((resolve) => setTimeout(resolve, 2000));
- // return newData;
- // }}
- // >
- // {(item) => {item}
}
- //
- // >
- // );
-
const [data, setData] = useState(data2);
+ const [openDrawer, setOpenDrawer] = useState(false);
return (
<>
-
-
-
- >
- );
+
+ {/* */}
+
+
- return (
- <>
-
- {Array(50)
- .fill(0)
- .map((e, i) => (
- {i + 1}
- ))}
-
-
>
);
@@ -174,71 +121,3 @@ function CreateButton() {
>
);
}
-
-function BackgroundImageComponent() {
- const footer = (
-
- {Array.from({ length: 4 }).map((e, i) => (
-
-
-
-
-
- Apa
-
-
- ))}
-
- );
- return (
- <>
-
- {/* Header */}
-
-
-
-
- {/* Children */}
-
-
- {Array.from({ length: 10 }).map((e, i) => (
-
- {i + 1}
-
- ))}
-
-
-
- {/* Footer */}
-
-
- {footer}
-
-
-
- >
- );
-}