BIN
public/img/2eef80a1-f811-4769-980a-63bfe97e1a6e.webp
Normal file
BIN
public/img/2eef80a1-f811-4769-980a-63bfe97e1a6e.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
BIN
public/img/68adba2f-db46-4074-82ea-7d2ea5f5bd35.png
Normal file
BIN
public/img/68adba2f-db46-4074-82ea-7d2ea5f5bd35.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
BIN
public/img/77a5d35a-5bc0-46ca-857d-c4008c3a2f44.png
Normal file
BIN
public/img/77a5d35a-5bc0-46ca-857d-c4008c3a2f44.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 KiB |
BIN
public/img/f8e8f088-441a-4b7c-b081-7c2695399c09.jpeg
Normal file
BIN
public/img/f8e8f088-441a-4b7c-b081-7c2695399c09.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
@@ -6,6 +6,7 @@ import { sealData, unsealData } from "iron-session";
|
||||
import { getConfig } from "@/bin/config";
|
||||
import yaml from "yaml";
|
||||
import fs from "fs";
|
||||
import { revalidatePath } from "next/cache";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export async function POST(req: Request) {
|
||||
@@ -47,6 +48,8 @@ export async function POST(req: Request) {
|
||||
maxAge: 60 * 60 * 24 * 7,
|
||||
});
|
||||
|
||||
revalidatePath("/dev/home")
|
||||
|
||||
return NextResponse.json({ status: 200, data });
|
||||
}
|
||||
|
||||
|
||||
@@ -4,22 +4,23 @@ import { unsealData } from "iron-session";
|
||||
import _ from "lodash";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import yaml from "yaml";
|
||||
import fs from "fs";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export default async function Page() {
|
||||
const c = cookies().get("ssn");
|
||||
// const tkn = !c
|
||||
// ? null
|
||||
// : JSON.parse(
|
||||
// await unsealData(c.value as string, {
|
||||
// password: process.env.PWD as string,
|
||||
// })
|
||||
// );
|
||||
|
||||
// if (!c?.value) return redirect("/dev/auth/login");
|
||||
if (!c?.value) return redirect("/dev/auth/login");
|
||||
const usr = JSON.parse(
|
||||
await unsealData(c?.value as string, {
|
||||
password: config.server.password,
|
||||
})
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(tkn)} */}
|
||||
<HomeView />
|
||||
<HomeView user={usr} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { UploadFotoProfile } from "@/app_modules/katalog/profile";
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<UploadFotoProfile />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { KatalogLayout } from "@/app_modules/katalog/view";
|
||||
import { KatalogLayout } from "@/app_modules/katalog/main";
|
||||
|
||||
export default async function Layout({ children }: { children: any }) {
|
||||
return (
|
||||
|
||||
@@ -1,14 +1,34 @@
|
||||
import { loadListPortofolio } from "@/app_modules/katalog/portofolio/fun/fun_get_all_portofolio";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { getProfile } from "@/app_modules/katalog/profile";
|
||||
import { KatalogView } from "@/app_modules/katalog/view";
|
||||
import { KatalogView } from "@/app_modules/katalog/main";
|
||||
import { url } from "inspector";
|
||||
import { unsealData } from "iron-session";
|
||||
import _ from "lodash";
|
||||
import { cookies } from "next/headers";
|
||||
import { redirect } from "next/navigation";
|
||||
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
||||
import yaml from "yaml";
|
||||
import fs from "fs";
|
||||
import { funGetListPortofolio } from "@/app_modules/katalog/portofolio/fun/get_list_portofolio";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
export default async function Page() {
|
||||
const data = await getProfile();
|
||||
const listPorto = await loadListPortofolio(data?.id as string)
|
||||
|
||||
const u = cookies().get("ssn");
|
||||
const usr = JSON.parse(
|
||||
await unsealData(u?.value as string, {
|
||||
password: config.server.password,
|
||||
})
|
||||
);
|
||||
|
||||
const user = await funGetUserProfile(usr.id);
|
||||
|
||||
const listPorto = await funGetListPortofolio(user?.Profile?.id)
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(data)} */}
|
||||
<KatalogView data={data} porto={listPorto} />
|
||||
<KatalogView user={user as any} listPorto={listPorto as any} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { CreatePortofolio } from "@/app_modules/katalog/portofolio";
|
||||
import { getBidangBisnis } from "@/app_modules/katalog/portofolio/api/get-bidang-bisnis";
|
||||
import { getBidangBisnis } from "@/app_modules/katalog/portofolio/fun/get_list_bidang_bisnis";
|
||||
import { getProfile } from "@/app_modules/katalog/profile";
|
||||
|
||||
export default async function Page() {
|
||||
@@ -10,7 +10,6 @@ export default async function Page() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{JSON.stringify(profileId)}
|
||||
<CreatePortofolio data={bidangBisnis} profileId={profileId} />
|
||||
</>
|
||||
);
|
||||
29
src/app/dev/profile/upload/page.tsx
Normal file
29
src/app/dev/profile/upload/page.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { UploadFotoProfile } from "@/app_modules/katalog/profile";
|
||||
import { unsealData } from "iron-session";
|
||||
import { cookies } from "next/headers";
|
||||
import yaml from "yaml";
|
||||
import fs from "fs";
|
||||
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||
|
||||
|
||||
export default async function Page() {
|
||||
const c = cookies().get("ssn")
|
||||
const usr = JSON.parse(
|
||||
await unsealData(c?.value as string, {
|
||||
password: config.server.password,
|
||||
})
|
||||
);
|
||||
|
||||
console.log(usr)
|
||||
|
||||
const imageUrl = await funGetUserProfile(usr.id).then((res) => res?.Profile?.ImageProfile?.url)
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
<UploadFotoProfile imageUrl={imageUrl} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import { IconCircleLetterH } from "@tabler/icons-react";
|
||||
import toast from "react-simple-toasts";
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
||||
|
||||
export default function Validasi() {
|
||||
const router = useRouter();
|
||||
@@ -48,7 +49,8 @@ export default function Validasi() {
|
||||
myConsole(val);
|
||||
if (val.status == 200) {
|
||||
toast("Berhasil Login");
|
||||
return router.push("/dev/home");
|
||||
setTimeout(() => router.push("/dev/home"), 2000);
|
||||
funGetUserProfile(val.data.id);
|
||||
} else {
|
||||
toast("Silahkan Registrasi");
|
||||
return router.push("/dev/auth/register");
|
||||
|
||||
35
src/app_modules/fun/get_user_profile.ts
Normal file
35
src/app_modules/fun/get_user_profile.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
"use server";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function funGetUserProfile(userId: string) {
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
nomor: true,
|
||||
Profile: {
|
||||
select: {
|
||||
id: true,
|
||||
alamat: true,
|
||||
email: true,
|
||||
jenisKelamin: true,
|
||||
name: true,
|
||||
ImageProfile: {
|
||||
select: {
|
||||
url: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
revalidatePath("/dev/home");
|
||||
revalidatePath("/dev/katalog/view")
|
||||
|
||||
return user;
|
||||
}
|
||||
@@ -40,11 +40,11 @@ import {
|
||||
gs_fotoProfile,
|
||||
gs_profile,
|
||||
} from "../katalog/profile/state/global_state";
|
||||
import { loadListPortofolio } from "../katalog/portofolio/fun/fun_get_all_portofolio";
|
||||
import { gs_ListPortofolio } from "../katalog/portofolio/state/global_state";
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { getFotoProfile } from "../katalog/profile/api/get-foto-profile";
|
||||
import getListPortofolio from "../katalog/portofolio/api/get-portofolio";
|
||||
import { funGetUserProfile } from "../fun/get_user_profile";
|
||||
import { USER_PROFILE } from "../models/user_profile";
|
||||
|
||||
const listHalaman = [
|
||||
{
|
||||
@@ -89,64 +89,44 @@ const listHalaman = [
|
||||
},
|
||||
];
|
||||
|
||||
export default function HomeView() {
|
||||
// export const dynamic = "force-dynamic"
|
||||
// export const revalidate = 0
|
||||
|
||||
export default function HomeView({ user }: { user: USER_PROFILE }) {
|
||||
const router = useRouter();
|
||||
const [stateUser, setStateUser] = useState(user);
|
||||
|
||||
const [token, setToken] = useAtom(gs_token);
|
||||
useShallowEffect(() => {
|
||||
getUserId();
|
||||
}, []);
|
||||
async function getUserId() {
|
||||
const get = await getToken();
|
||||
if(!get) return myConsole("Data Kosong")
|
||||
setToken(get);
|
||||
}
|
||||
|
||||
const [profile, setProfile] = useAtom(gs_profile);
|
||||
useShallowEffect(() => {
|
||||
loadProfile();
|
||||
}, []);
|
||||
async function loadProfile() {
|
||||
const get = await getProfile();
|
||||
if(!get) return myConsole("Data Kosong")
|
||||
setProfile(get);
|
||||
}
|
||||
|
||||
const [foto, setFoto] = useAtom(gs_fotoProfile);
|
||||
useShallowEffect(() => {
|
||||
getFoto(profile?.imagesId);
|
||||
}, [profile?.imagesId]);
|
||||
|
||||
async function getFoto(id: string) {
|
||||
if(id === undefined){
|
||||
return myConsole("Waiting data")
|
||||
} else {
|
||||
const data = await getFotoProfile(id);
|
||||
setFoto(data?.url);
|
||||
}
|
||||
}
|
||||
|
||||
// const [listPorto, setListPorto] = useAtom(gs_ListPortofolio);
|
||||
// const [token, setToken] = useAtom(gs_token);
|
||||
// useShallowEffect(() => {
|
||||
// getListPorto(profile?.id);
|
||||
// }, [profile?.id]);
|
||||
// async function getListPorto(id: string) {
|
||||
// const data = await getListPortofolio(id);
|
||||
// setListPorto(data);
|
||||
// getUserId();
|
||||
// }, []);
|
||||
// async function getUserId() {
|
||||
// const get = await getToken();
|
||||
// if (!get) return myConsole("Data Kosong");
|
||||
// setToken(get);
|
||||
// }
|
||||
|
||||
// const [profile, setProfile] = useAtom(gs_profile);
|
||||
// useShallowEffect(() => {
|
||||
// loadProfile();
|
||||
// }, []);
|
||||
// async function loadProfile() {
|
||||
// const get = await getProfile();
|
||||
// if (!get) return myConsole("Data Kosong");
|
||||
// setProfile(get);
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <pre>{JSON.stringify(foto, null, 2)}</pre> */}
|
||||
<Center><Image src={ApiHipmi.get_foto + foto ?? ""} alt="" height={100} width={100}/></Center>
|
||||
{/* <Center><Image src={ApiHipmi.get_foto + foto ?? ""} alt="" height={100} width={100}/></Center> */}
|
||||
<Box>
|
||||
<Flex align={"center"} gap={"sm"}>
|
||||
<ActionIcon
|
||||
size={30}
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
if (profile === null) {
|
||||
return router.push("/dev/katalog/profile/create");
|
||||
if (stateUser.Profile === null) {
|
||||
return router.push("/dev/profile/create");
|
||||
} else {
|
||||
return router.push("/dev/katalog/view");
|
||||
}
|
||||
@@ -156,13 +136,17 @@ export default function HomeView() {
|
||||
</ActionIcon>
|
||||
|
||||
<Text>
|
||||
Welcome to I,{" "}
|
||||
{token?.username ? token?.username : <Loader size={"xs"} />}
|
||||
Welcome to ,{" "}
|
||||
{stateUser.username ? stateUser.username : <Loader size={"xs"} />}
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
<Paper bg={"dark"} radius={5} my={"xs"}>
|
||||
<Image alt="logo" src={"/aset/logo.png"} />
|
||||
</Paper>
|
||||
|
||||
{/* <pre>{JSON.stringify(stateUser, null, 2)}</pre> */}
|
||||
|
||||
<Box my={"sm"}>
|
||||
<SimpleGrid cols={2}>
|
||||
{listHalaman.map((e, i) => (
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function KatalogLayout({ children }: { children: any }) {
|
||||
Katalog
|
||||
</Text>
|
||||
<Group spacing={"sm"}>
|
||||
<ActionIcon variant="transparent" onClick={() => router.push("/dev/katalog/portofolio/create")}>
|
||||
<ActionIcon variant="transparent" onClick={() => router.push("/dev/portofolio/create")}>
|
||||
<IconPencilPlus />
|
||||
</ActionIcon>
|
||||
{/* <Logout /> */}
|
||||
@@ -32,14 +32,16 @@ import { useAtom } from "jotai";
|
||||
import { loadDataProfile } from "../profile/fun/fun_get_profile";
|
||||
import { getFotoProfile } from "../profile/api/get-foto-profile";
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { PortofolioView } from "../portofolio";
|
||||
import { ListPortofolioView } from "../portofolio";
|
||||
import { User } from "@prisma/client";
|
||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||
import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
|
||||
|
||||
export default function KatalogView({ data, porto }: { data: any, porto: any }) {
|
||||
export default function KatalogView({ user, listPorto }: { user: USER_PROFILE, listPorto: LIST_PORTOFOLIO }) {
|
||||
return (
|
||||
<>
|
||||
|
||||
<ProfileView data={data} />
|
||||
<PortofolioView profileId={data.id} porto={porto}/>
|
||||
<ProfileView user={user} />
|
||||
<ListPortofolioView listPorto={listPorto} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ export default function CreatePortofolio({
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(data)} */}
|
||||
|
||||
<Stack px={"sm"}>
|
||||
<TextInput
|
||||
label="Nama Bisnis"
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import toast from "react-simple-toasts";
|
||||
import getListPortofolio from "../api/get-portofolio";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id - profileId
|
||||
* @returns load list portofolio by Id
|
||||
*/
|
||||
export async function loadListPortofolio(id: string) {
|
||||
if (id === null) {
|
||||
return toast("Id null");
|
||||
} else {
|
||||
const data = await getListPortofolio(id).then((res) => res);
|
||||
return data
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,11 @@
|
||||
"use server";
|
||||
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id - profileId
|
||||
* @returns list portofolio by Id
|
||||
*/
|
||||
export default async function getListPortofolio(id: string) {
|
||||
// myConsole(id);
|
||||
|
||||
export async function funGetListPortofolio(profileId: any) {
|
||||
const data = await prisma.katalog.findMany({
|
||||
where: {
|
||||
profileId: id,
|
||||
profileId: profileId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
@@ -21,14 +13,10 @@ export default async function getListPortofolio(id: string) {
|
||||
alamatKantor: true,
|
||||
tlpn: true,
|
||||
deskripssi: true,
|
||||
active: true,
|
||||
masterBidangBisnisId: true,
|
||||
active: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!data) {
|
||||
throw new Error("Failed to fetch data");
|
||||
}
|
||||
|
||||
return data;
|
||||
return data
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import CreatePortofolio from "./create/view";
|
||||
import PortofolioLayout from "./create/layout";
|
||||
import PortofolioView from "./list_view/view";
|
||||
import ListPortofolioView from "./list_view/view";
|
||||
|
||||
export {CreatePortofolio, PortofolioLayout, PortofolioView}
|
||||
export {CreatePortofolio, PortofolioLayout, ListPortofolioView}
|
||||
@@ -2,48 +2,37 @@
|
||||
import { Box, Center, Grid, Paper, Text, Title } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useState } from "react";
|
||||
import { loadListPortofolio } from "../fun/fun_get_all_portofolio";
|
||||
import _ from "lodash";
|
||||
import { IconCaretRightFilled } from "@tabler/icons-react";
|
||||
import { loadDataProfile } from "../../profile/fun/fun_get_profile";
|
||||
import { useAtom } from "jotai";
|
||||
import { gs_profile } from "../../profile/state/global_state";
|
||||
import getListPortofolio from "../api/get-portofolio";
|
||||
import { gs_ListPortofolio } from "../state/global_state";
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
import { getProfile } from "../../profile";
|
||||
import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
|
||||
|
||||
export default function PortofolioView({
|
||||
profileId,
|
||||
porto,
|
||||
export default function ListPortofolioView({
|
||||
listPorto,
|
||||
}: {
|
||||
profileId: any;
|
||||
porto: any;
|
||||
listPorto: LIST_PORTOFOLIO;
|
||||
}) {
|
||||
const [profile, setProfile] = useAtom(gs_profile);
|
||||
useShallowEffect(() => {
|
||||
loadDataProfile(setProfile);
|
||||
}, []);
|
||||
|
||||
const [listPorto, setListPorto] = useAtom(gs_ListPortofolio)
|
||||
useShallowEffect(() => {
|
||||
loadListPortofolio(profile?.id).then((res) => setListPorto(res));
|
||||
}, [profile?.id]);
|
||||
|
||||
const [porto, setPorto] = useState(listPorto);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(profile.id)}
|
||||
<br />
|
||||
{JSON.stringify(listPorto)} */}
|
||||
{/* <pre>{JSON.stringify(porto, null, 2)}</pre> */}
|
||||
<Center>
|
||||
<Title order={4}>Portofolio</Title>
|
||||
</Center>
|
||||
<Box mt={"md"} >
|
||||
<Box mt={"md"}>
|
||||
{(() => {
|
||||
if (listPorto) {
|
||||
if (porto) {
|
||||
return (
|
||||
<>
|
||||
{_.map(listPorto).map((e: any) => (
|
||||
<Paper key={e.id} h={50} bg={"gray"} my={"md"} >
|
||||
{" "}
|
||||
{_.map(porto as any).map((e: any) => (
|
||||
<Paper key={e.id} h={50} bg={"gray"} my={"md"}>
|
||||
<Grid h={50} align="center" px={"md"}>
|
||||
<Grid.Col span={10}>
|
||||
<Text fw={"bold"}>{e.namaBisnis}</Text>
|
||||
|
||||
@@ -5,7 +5,7 @@ import EditProfileLayout from "./edit/layout";
|
||||
import EditProfileView from "./edit/view";
|
||||
import UploadFotoProfile from "./upload/view";
|
||||
import UploadFotoProfileLayout from "./upload/layout"
|
||||
import ProfileView from "./view/view";
|
||||
import ProfileView from "./main/view";
|
||||
|
||||
export {
|
||||
ProfileLayout,
|
||||
|
||||
@@ -31,25 +31,18 @@ import { ApiHipmi } from "@/app/lib/api";
|
||||
import { loadDataProfile } from "../fun/fun_get_profile";
|
||||
import { getFotoProfile } from "../api/get-foto-profile";
|
||||
import { gs_fotoProfile, gs_profile } from "../state/global_state";
|
||||
import { getProfile } from "..";
|
||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
||||
|
||||
export default function ProfileView({ data }: { data: any }) {
|
||||
export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
||||
const router = useRouter();
|
||||
|
||||
//Get data profile
|
||||
const [profile, setProfile] = useAtom(gs_profile);
|
||||
const [stateUser, setStateUser] = useState(user);
|
||||
useShallowEffect(() => {
|
||||
loadDataProfile(setProfile);
|
||||
funGetUserProfile(user.id ?? "").then(setStateUser as any);
|
||||
}, []);
|
||||
|
||||
const [foto, setFoto] = useAtom(gs_fotoProfile);
|
||||
useShallowEffect(() => {
|
||||
if (profile?.imagesId === undefined) {
|
||||
return myConsole("Waiting data");
|
||||
} else {
|
||||
getFotoProfile(profile?.imagesId).then((v) => setFoto(v?.url));
|
||||
}
|
||||
}, [profile?.imagesId]);
|
||||
|
||||
if (!stateUser) return <></>;
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(data)} */}
|
||||
@@ -74,18 +67,21 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
}}
|
||||
>
|
||||
<Center h={101}>
|
||||
<Image
|
||||
src={ApiHipmi.get_foto + foto ?? ""}
|
||||
alt=""
|
||||
radius={100}
|
||||
width={100}
|
||||
height={100}
|
||||
sx={
|
||||
{
|
||||
// position: "fixed",
|
||||
{/* {stateUser.Profile?.ImageProfile?.url} */}
|
||||
{stateUser.Profile?.ImageProfile?.url && (
|
||||
<Image
|
||||
src={"/img/" + stateUser.Profile?.ImageProfile?.url}
|
||||
alt=""
|
||||
radius={100}
|
||||
width={100}
|
||||
height={100}
|
||||
sx={
|
||||
{
|
||||
// position: "fixed",
|
||||
}
|
||||
}
|
||||
}
|
||||
/>
|
||||
/>
|
||||
)}
|
||||
</Center>
|
||||
</Paper>
|
||||
</Center>
|
||||
@@ -97,7 +93,7 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
variant="transparent"
|
||||
bg={"gray"}
|
||||
radius={50}
|
||||
onClick={() => router.push("/dev/katalog/profile/upload")}
|
||||
onClick={() => router.push("/dev/profile/upload")}
|
||||
sx={{ position: "relative" }}
|
||||
>
|
||||
<IconCamera color="black" size={20} />
|
||||
@@ -109,14 +105,14 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
<Group position="apart">
|
||||
<Flex direction={"column"} mt={"lg"}>
|
||||
<Text fz={"lg"} fw={"bold"}>
|
||||
{profile?.name}
|
||||
{stateUser.Profile?.name}
|
||||
</Text>
|
||||
<Text fz={"xs"}>@{profile?.User?.username}</Text>
|
||||
<Text fz={"xs"}>@{stateUser.username}</Text>
|
||||
</Flex>
|
||||
<ActionIcon
|
||||
variant="transparent"
|
||||
onClick={() => {
|
||||
router.push("/dev/katalog/profile/edit");
|
||||
router.push("/dev/profile/edit");
|
||||
}}
|
||||
>
|
||||
<IconEditCircle color={Warna.hijau_muda} size={20} />
|
||||
@@ -132,7 +128,7 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>
|
||||
{" "}
|
||||
<Text>+{profile?.User.nomor}</Text>
|
||||
<Text>+{stateUser.nomor}</Text>
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
@@ -144,7 +140,7 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text>
|
||||
{" "}
|
||||
<Text> {profile?.email}</Text>
|
||||
<Text> {stateUser.Profile?.email}</Text>
|
||||
</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
@@ -154,12 +150,12 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
<IconHome />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text> {profile?.alamat}</Text>
|
||||
<Text> {stateUser.Profile?.alamat}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
|
||||
{(() => {
|
||||
if (profile?.jenisKelamin === "Laki - laki") {
|
||||
if (stateUser.Profile?.jenisKelamin === "Laki - laki") {
|
||||
return (
|
||||
<>
|
||||
<Grid>
|
||||
@@ -167,7 +163,7 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
<IconGenderMale />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text> {profile?.jenisKelamin}</Text>
|
||||
<Text> {stateUser.Profile?.jenisKelamin}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</>
|
||||
@@ -180,7 +176,7 @@ export default function ProfileView({ data }: { data: any }) {
|
||||
<IconGenderFemale />
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<Text> {profile?.jenisKelamin}</Text>
|
||||
<Text> {stateUser.Profile?.jenisKelamin}</Text>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</>
|
||||
@@ -10,27 +10,15 @@ import { useState } from "react";
|
||||
import { ApiHipmi } from "@/app/lib/api";
|
||||
import { myConsole } from "@/app/fun/my_console";
|
||||
|
||||
export default function UploadFotoProfile() {
|
||||
const [profile, setProfile] = useAtom(gs_profile);
|
||||
useShallowEffect(() => {
|
||||
loadDataProfile(setProfile);
|
||||
}, []);
|
||||
|
||||
const [foto, setFoto] = useAtom(gs_fotoProfile)
|
||||
useShallowEffect(() => {
|
||||
if (profile?.imagesId === undefined || profile?.imagesId === null) {
|
||||
myConsole("Waiting data");
|
||||
} else {
|
||||
getFotoProfile(profile?.imagesId).then((res) => setFoto(res?.url));
|
||||
}
|
||||
}, [profile?.imagesId]);
|
||||
export default function UploadFotoProfile({imageUrl}: {imageUrl: any}) {
|
||||
const [img, setImg] = useState(imageUrl)
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(foto)} */}
|
||||
<AspectRatio ratio={1 / 1} >
|
||||
<Paper p={"lg"} shadow="xl">
|
||||
{foto ? <Image alt="" src={ApiHipmi.get_foto + `${foto}`} /> : <Image alt="" src={"/aset/avatar.png"} />}
|
||||
{img ? <Image alt="" src={`/img/${img}`} /> : <Image alt="" src={"/aset/avatar.png"} />}
|
||||
</Paper>
|
||||
</AspectRatio>
|
||||
{/* {JSON.stringify(profile)} */}
|
||||
|
||||
9
src/app_modules/models/portofolio.ts
Normal file
9
src/app_modules/models/portofolio.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface LIST_PORTOFOLIO {
|
||||
id: string;
|
||||
namaBisnis: string;
|
||||
alamatKantor: string;
|
||||
tlpn: string;
|
||||
deskripssi: string;
|
||||
masterBidangBisnisId: string;
|
||||
active: boolean;
|
||||
}
|
||||
15
src/app_modules/models/user_profile.ts
Normal file
15
src/app_modules/models/user_profile.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export interface USER_PROFILE {
|
||||
id: string;
|
||||
username: string;
|
||||
nomor: string;
|
||||
Profile: {
|
||||
id: string;
|
||||
alamat: string;
|
||||
email: string;
|
||||
jenisKelamin: string;
|
||||
name: string;
|
||||
ImageProfile: {
|
||||
url: string;
|
||||
} | null;
|
||||
} | null;
|
||||
}
|
||||
Reference in New Issue
Block a user