fix
Desc: - Perubahan metode pengambilan data dari API ke use server
This commit is contained in:
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 |
@@ -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 }) {
|
export default async function Layout({ children }: { children: any }) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
import { loadListPortofolio } from "@/app_modules/katalog/portofolio/fun/fun_get_all_portofolio";
|
|
||||||
import { getProfile } from "@/app_modules/katalog/profile";
|
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 { url } from "inspector";
|
||||||
import { unsealData } from "iron-session";
|
import { unsealData } from "iron-session";
|
||||||
import _, { get } from "lodash";
|
import _ from "lodash";
|
||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
||||||
import yaml from "yaml";
|
import yaml from "yaml";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
import { funGetListPortofolio } from "@/app_modules/katalog/portofolio/fun/get_list_portofolio";
|
||||||
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
const config = yaml.parse(fs.readFileSync("config.yaml").toString());
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const data = await getProfile();
|
const data = await getProfile();
|
||||||
|
|
||||||
const u = cookies().get("ssn");
|
const u = cookies().get("ssn");
|
||||||
const usr = JSON.parse(
|
const usr = JSON.parse(
|
||||||
await unsealData(u?.value as string, {
|
await unsealData(u?.value as string, {
|
||||||
@@ -24,10 +24,11 @@ export default async function Page() {
|
|||||||
|
|
||||||
const user = await funGetUserProfile(usr.id);
|
const user = await funGetUserProfile(usr.id);
|
||||||
|
|
||||||
|
const listPorto = await funGetListPortofolio(user?.Profile?.id)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* {JSON.stringify(data)} */}
|
<KatalogView user={user as any} listPorto={listPorto as any} />
|
||||||
<KatalogView user={user as any} />
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { myConsole } from "@/app/fun/my_console";
|
import { myConsole } from "@/app/fun/my_console";
|
||||||
import { CreatePortofolio } from "@/app_modules/katalog/portofolio";
|
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";
|
import { getProfile } from "@/app_modules/katalog/profile";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
@@ -10,7 +10,6 @@ export default async function Page() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{JSON.stringify(profileId)}
|
|
||||||
<CreatePortofolio data={bidangBisnis} profileId={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} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ export async function funGetUserProfile(userId: string) {
|
|||||||
nomor: true,
|
nomor: true,
|
||||||
Profile: {
|
Profile: {
|
||||||
select: {
|
select: {
|
||||||
|
id: true,
|
||||||
alamat: true,
|
alamat: true,
|
||||||
email: true,
|
email: true,
|
||||||
jenisKelamin: true,
|
jenisKelamin: true,
|
||||||
|
|||||||
@@ -40,11 +40,9 @@ import {
|
|||||||
gs_fotoProfile,
|
gs_fotoProfile,
|
||||||
gs_profile,
|
gs_profile,
|
||||||
} from "../katalog/profile/state/global_state";
|
} 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 { gs_ListPortofolio } from "../katalog/portofolio/state/global_state";
|
||||||
import { myConsole } from "@/app/fun/my_console";
|
import { myConsole } from "@/app/fun/my_console";
|
||||||
import { getFotoProfile } from "../katalog/profile/api/get-foto-profile";
|
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 { funGetUserProfile } from "../fun/get_user_profile";
|
||||||
import { USER_PROFILE } from "../models/user_profile";
|
import { USER_PROFILE } from "../models/user_profile";
|
||||||
|
|
||||||
@@ -128,7 +126,7 @@ export default function HomeView({ user }: { user: USER_PROFILE }) {
|
|||||||
variant="transparent"
|
variant="transparent"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (stateUser.Profile === null) {
|
if (stateUser.Profile === null) {
|
||||||
return router.push("/dev/katalog/profile/create");
|
return router.push("/dev/profile/create");
|
||||||
} else {
|
} else {
|
||||||
return router.push("/dev/katalog/view");
|
return router.push("/dev/katalog/view");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default function KatalogLayout({ children }: { children: any }) {
|
|||||||
Katalog
|
Katalog
|
||||||
</Text>
|
</Text>
|
||||||
<Group spacing={"sm"}>
|
<Group spacing={"sm"}>
|
||||||
<ActionIcon variant="transparent" onClick={() => router.push("/dev/katalog/portofolio/create")}>
|
<ActionIcon variant="transparent" onClick={() => router.push("/dev/portofolio/create")}>
|
||||||
<IconPencilPlus />
|
<IconPencilPlus />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
{/* <Logout /> */}
|
{/* <Logout /> */}
|
||||||
@@ -32,15 +32,16 @@ import { useAtom } from "jotai";
|
|||||||
import { loadDataProfile } from "../profile/fun/fun_get_profile";
|
import { loadDataProfile } from "../profile/fun/fun_get_profile";
|
||||||
import { getFotoProfile } from "../profile/api/get-foto-profile";
|
import { getFotoProfile } from "../profile/api/get-foto-profile";
|
||||||
import { ApiHipmi } from "@/app/lib/api";
|
import { ApiHipmi } from "@/app/lib/api";
|
||||||
import { PortofolioView } from "../portofolio";
|
import { ListPortofolioView } from "../portofolio";
|
||||||
import { User } from "@prisma/client";
|
import { User } from "@prisma/client";
|
||||||
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
import { USER_PROFILE } from "@/app_modules/models/user_profile";
|
||||||
|
import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
|
||||||
|
|
||||||
export default function KatalogView({ user }: { user: USER_PROFILE }) {
|
export default function KatalogView({ user, listPorto }: { user: USER_PROFILE, listPorto: LIST_PORTOFOLIO }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProfileView user={user} />
|
<ProfileView user={user} />
|
||||||
<PortofolioView />
|
<ListPortofolioView listPorto={listPorto} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ export default function CreatePortofolio({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* {JSON.stringify(data)} */}
|
|
||||||
<Stack px={"sm"}>
|
<Stack px={"sm"}>
|
||||||
<TextInput
|
<TextInput
|
||||||
label="Nama Bisnis"
|
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";
|
"use server";
|
||||||
|
|
||||||
import { myConsole } from "@/app/fun/my_console";
|
|
||||||
import prisma from "@/app/lib/prisma";
|
import prisma from "@/app/lib/prisma";
|
||||||
|
|
||||||
/**
|
export async function funGetListPortofolio(profileId: any) {
|
||||||
*
|
|
||||||
* @param id - profileId
|
|
||||||
* @returns list portofolio by Id
|
|
||||||
*/
|
|
||||||
export default async function getListPortofolio(id: string) {
|
|
||||||
// myConsole(id);
|
|
||||||
|
|
||||||
const data = await prisma.katalog.findMany({
|
const data = await prisma.katalog.findMany({
|
||||||
where: {
|
where: {
|
||||||
profileId: id,
|
profileId: profileId,
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
@@ -21,14 +13,10 @@ export default async function getListPortofolio(id: string) {
|
|||||||
alamatKantor: true,
|
alamatKantor: true,
|
||||||
tlpn: true,
|
tlpn: true,
|
||||||
deskripssi: true,
|
deskripssi: true,
|
||||||
active: true,
|
|
||||||
masterBidangBisnisId: true,
|
masterBidangBisnisId: true,
|
||||||
|
active: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
return data
|
||||||
throw new Error("Failed to fetch data");
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import CreatePortofolio from "./create/view";
|
import CreatePortofolio from "./create/view";
|
||||||
import PortofolioLayout from "./create/layout";
|
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,46 +2,36 @@
|
|||||||
import { Box, Center, Grid, Paper, Text, Title } from "@mantine/core";
|
import { Box, Center, Grid, Paper, Text, Title } from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { loadListPortofolio } from "../fun/fun_get_all_portofolio";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { IconCaretRightFilled } from "@tabler/icons-react";
|
import { IconCaretRightFilled } from "@tabler/icons-react";
|
||||||
import { loadDataProfile } from "../../profile/fun/fun_get_profile";
|
import { loadDataProfile } from "../../profile/fun/fun_get_profile";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { gs_profile } from "../../profile/state/global_state";
|
import { gs_profile } from "../../profile/state/global_state";
|
||||||
import getListPortofolio from "../api/get-portofolio";
|
|
||||||
import { gs_ListPortofolio } from "../state/global_state";
|
import { gs_ListPortofolio } from "../state/global_state";
|
||||||
import { myConsole } from "@/app/fun/my_console";
|
import { myConsole } from "@/app/fun/my_console";
|
||||||
import { getProfile } from "../../profile";
|
import { getProfile } from "../../profile";
|
||||||
|
import { LIST_PORTOFOLIO } from "@/app_modules/models/portofolio";
|
||||||
|
|
||||||
export default function PortofolioView() {
|
export default function ListPortofolioView({
|
||||||
const [profile, setProfile] = useAtom(gs_profile);
|
listPorto,
|
||||||
useShallowEffect(() => {
|
}: {
|
||||||
loadProfile();
|
listPorto: LIST_PORTOFOLIO;
|
||||||
}, []);
|
}) {
|
||||||
async function loadProfile() {
|
const [porto, setPorto] = useState(listPorto);
|
||||||
const get = await getProfile();
|
|
||||||
if (!get) return myConsole("Data Kosong");
|
|
||||||
setProfile(get);
|
|
||||||
}
|
|
||||||
const [listPorto, setListPorto] = useAtom(gs_ListPortofolio);
|
|
||||||
useShallowEffect(() => {
|
|
||||||
loadListPortofolio(profile?.id).then((res) => setListPorto(res));
|
|
||||||
}, [profile?.id]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* {JSON.stringify(profile.id)}
|
{/* <pre>{JSON.stringify(porto, null, 2)}</pre> */}
|
||||||
<br />
|
|
||||||
{JSON.stringify(listPorto)} */}
|
|
||||||
<Center>
|
<Center>
|
||||||
<Title order={4}>Portofolio</Title>
|
<Title order={4}>Portofolio</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Box mt={"md"}>
|
<Box mt={"md"}>
|
||||||
{(() => {
|
{(() => {
|
||||||
if (listPorto) {
|
if (porto) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{_.map(listPorto).map((e: any) => (
|
{" "}
|
||||||
|
{_.map(porto as any).map((e: any) => (
|
||||||
<Paper key={e.id} h={50} bg={"gray"} my={"md"}>
|
<Paper key={e.id} h={50} bg={"gray"} my={"md"}>
|
||||||
<Grid h={50} align="center" px={"md"}>
|
<Grid h={50} align="center" px={"md"}>
|
||||||
<Grid.Col span={10}>
|
<Grid.Col span={10}>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import EditProfileLayout from "./edit/layout";
|
|||||||
import EditProfileView from "./edit/view";
|
import EditProfileView from "./edit/view";
|
||||||
import UploadFotoProfile from "./upload/view";
|
import UploadFotoProfile from "./upload/view";
|
||||||
import UploadFotoProfileLayout from "./upload/layout"
|
import UploadFotoProfileLayout from "./upload/layout"
|
||||||
import ProfileView from "./view/view";
|
import ProfileView from "./main/view";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
ProfileLayout,
|
ProfileLayout,
|
||||||
|
|||||||
@@ -38,27 +38,6 @@ import { funGetUserProfile } from "@/app_modules/fun/get_user_profile";
|
|||||||
export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [stateUser, setStateUser] = useState(user);
|
const [stateUser, setStateUser] = useState(user);
|
||||||
|
|
||||||
//Get data profile
|
|
||||||
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(() => {
|
|
||||||
// if (profile?.imagesId === undefined) {
|
|
||||||
// return myConsole("Waiting data");
|
|
||||||
// } else {
|
|
||||||
// getFotoProfile(profile?.imagesId).then((v) => setFoto(v?.url));
|
|
||||||
// }
|
|
||||||
// }, [profile?.imagesId]);
|
|
||||||
|
|
||||||
useShallowEffect(() => {
|
useShallowEffect(() => {
|
||||||
funGetUserProfile(user.id ?? "").then(setStateUser as any);
|
funGetUserProfile(user.id ?? "").then(setStateUser as any);
|
||||||
}, []);
|
}, []);
|
||||||
@@ -114,7 +93,7 @@ export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
|||||||
variant="transparent"
|
variant="transparent"
|
||||||
bg={"gray"}
|
bg={"gray"}
|
||||||
radius={50}
|
radius={50}
|
||||||
onClick={() => router.push("/dev/katalog/profile/upload")}
|
onClick={() => router.push("/dev/profile/upload")}
|
||||||
sx={{ position: "relative" }}
|
sx={{ position: "relative" }}
|
||||||
>
|
>
|
||||||
<IconCamera color="black" size={20} />
|
<IconCamera color="black" size={20} />
|
||||||
@@ -126,14 +105,14 @@ export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
|||||||
<Group position="apart">
|
<Group position="apart">
|
||||||
<Flex direction={"column"} mt={"lg"}>
|
<Flex direction={"column"} mt={"lg"}>
|
||||||
<Text fz={"lg"} fw={"bold"}>
|
<Text fz={"lg"} fw={"bold"}>
|
||||||
{profile?.name}
|
{stateUser.Profile?.name}
|
||||||
</Text>
|
</Text>
|
||||||
<Text fz={"xs"}>@{profile?.User?.username}</Text>
|
<Text fz={"xs"}>@{stateUser.username}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
router.push("/dev/katalog/profile/edit");
|
router.push("/dev/profile/edit");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconEditCircle color={Warna.hijau_muda} size={20} />
|
<IconEditCircle color={Warna.hijau_muda} size={20} />
|
||||||
@@ -149,7 +128,7 @@ export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
|||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text>
|
<Text>
|
||||||
{" "}
|
{" "}
|
||||||
<Text>+{profile?.User.nomor}</Text>
|
<Text>+{stateUser.nomor}</Text>
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -161,7 +140,7 @@ export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
|||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text>
|
<Text>
|
||||||
{" "}
|
{" "}
|
||||||
<Text> {profile?.email}</Text>
|
<Text> {stateUser.Profile?.email}</Text>
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -171,12 +150,12 @@ export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
|||||||
<IconHome />
|
<IconHome />
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text> {profile?.alamat}</Text>
|
<Text> {stateUser.Profile?.alamat}</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{(() => {
|
{(() => {
|
||||||
if (profile?.jenisKelamin === "Laki - laki") {
|
if (stateUser.Profile?.jenisKelamin === "Laki - laki") {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -184,7 +163,7 @@ export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
|||||||
<IconGenderMale />
|
<IconGenderMale />
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text> {profile?.jenisKelamin}</Text>
|
<Text> {stateUser.Profile?.jenisKelamin}</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
</>
|
</>
|
||||||
@@ -197,7 +176,7 @@ export default function ProfileView({ user }: { user: USER_PROFILE }) {
|
|||||||
<IconGenderFemale />
|
<IconGenderFemale />
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text> {profile?.jenisKelamin}</Text>
|
<Text> {stateUser.Profile?.jenisKelamin}</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
</>
|
</>
|
||||||
@@ -10,27 +10,15 @@ import { useState } from "react";
|
|||||||
import { ApiHipmi } from "@/app/lib/api";
|
import { ApiHipmi } from "@/app/lib/api";
|
||||||
import { myConsole } from "@/app/fun/my_console";
|
import { myConsole } from "@/app/fun/my_console";
|
||||||
|
|
||||||
export default function UploadFotoProfile() {
|
export default function UploadFotoProfile({imageUrl}: {imageUrl: any}) {
|
||||||
const [profile, setProfile] = useAtom(gs_profile);
|
const [img, setImg] = useState(imageUrl)
|
||||||
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]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* {JSON.stringify(foto)} */}
|
{/* {JSON.stringify(foto)} */}
|
||||||
<AspectRatio ratio={1 / 1} >
|
<AspectRatio ratio={1 / 1} >
|
||||||
<Paper p={"lg"} shadow="xl">
|
<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>
|
</Paper>
|
||||||
</AspectRatio>
|
</AspectRatio>
|
||||||
{/* {JSON.stringify(profile)} */}
|
{/* {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;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ export interface USER_PROFILE {
|
|||||||
username: string;
|
username: string;
|
||||||
nomor: string;
|
nomor: string;
|
||||||
Profile: {
|
Profile: {
|
||||||
|
id: string;
|
||||||
alamat: string;
|
alamat: string;
|
||||||
email: string;
|
email: string;
|
||||||
jenisKelamin: string;
|
jenisKelamin: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user