Portofolio
Add: - ervice/api-client/api-portofolio.ts - creens/Portofolio/BoxPortofolioView.tsx - screens/Portofolio/ButtonCreatePortofolio.tsx - create dan show ### No Issue
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import {
|
import {
|
||||||
BoxButtonOnFooter,
|
AvatarComp,
|
||||||
|
BaseBox,
|
||||||
ButtonCenteredOnly,
|
ButtonCenteredOnly,
|
||||||
ButtonCustom,
|
CenterCustom,
|
||||||
Grid,
|
|
||||||
InformationBox,
|
InformationBox,
|
||||||
LandscapeFrameUploaded,
|
|
||||||
SelectCustom,
|
SelectCustom,
|
||||||
Spacing,
|
Spacing,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
@@ -14,48 +14,106 @@ import {
|
|||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import dummyMasterBidangBisnis from "@/lib/dummy-data/master-bidang-bisnis";
|
import DUMMY_IMAGE from "@/constants/dummy-image-value";
|
||||||
import dummyMasterSubBidangBisnis from "@/lib/dummy-data/master-sub-bidang-bisnis";
|
import Portofolio_ButtonCreate from "@/screens/Portofolio/ButtonCreatePortofolio";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import {
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
apiMasterBidangBisnis,
|
||||||
import { useState } from "react";
|
apiMasterSubBidangBisnis,
|
||||||
import { Text, TouchableOpacity, View } from "react-native";
|
} from "@/service/api-client/api-master";
|
||||||
|
import {
|
||||||
|
IMasterBidangBisnis,
|
||||||
|
IMasterSubBidangBisnis,
|
||||||
|
} from "@/types/Type-Master";
|
||||||
|
import pickImage from "@/utils/pickImage";
|
||||||
|
import { Image } from "expo-image";
|
||||||
|
import { useLocalSearchParams } from "expo-router";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Text, View } from "react-native";
|
||||||
import PhoneInput, { ICountry } from "react-native-international-phone-number";
|
import PhoneInput, { ICountry } from "react-native-international-phone-number";
|
||||||
|
import { Avatar } from "react-native-paper";
|
||||||
|
|
||||||
export default function PortofolioCreate() {
|
export default function PortofolioCreate() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [selectedCountry, setSelectedCountry] = useState<null | ICountry>(null);
|
const [selectedCountry, setSelectedCountry] = useState<null | ICountry>(null);
|
||||||
const [inputValue, setInputValue] = useState<string>("");
|
const [inputValue, setInputValue] = useState<string>("");
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
name: "",
|
namaBisnis: "",
|
||||||
bidang_usaha: "",
|
masterBidangBisnisId: "",
|
||||||
sub_bidang_usaha: "",
|
// sub_bidang_usaha: "",
|
||||||
alamat: "",
|
alamatKantor: "",
|
||||||
nomor_telepon: "",
|
tlpn: "",
|
||||||
deskripsi: "",
|
deskripsi: "",
|
||||||
});
|
});
|
||||||
|
const [imageUri, setImageUri] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const [bidangBisnis, setBidangBisnis] = useState<IMasterBidangBisnis[]>([]);
|
||||||
|
const [selectBidangId, setSelectBidangId] = useState<string>("");
|
||||||
|
const [subBidangBisnis, setSubBidangBisnis] = useState<
|
||||||
|
IMasterSubBidangBisnis[]
|
||||||
|
>([]);
|
||||||
|
|
||||||
|
// const [subBidangSelected, setSubBidangSelected] = useState<string[]>([]);
|
||||||
|
const [listSubBidangSelected, setListSubBidangSelected] = useState([
|
||||||
|
{
|
||||||
|
id: "",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const [dataMedsos, setDataMedsos] = useState({
|
||||||
|
facebook: "",
|
||||||
|
twitter: "",
|
||||||
|
instagram: "",
|
||||||
|
youtube: "",
|
||||||
|
tiktok: "",
|
||||||
|
});
|
||||||
|
|
||||||
function handleInputValue(phoneNumber: string) {
|
function handleInputValue(phoneNumber: string) {
|
||||||
setInputValue(phoneNumber);
|
setInputValue(phoneNumber);
|
||||||
|
const callingCode = selectedCountry?.callingCode.replace(/^\+/, "") || "";
|
||||||
|
const fixNumber = inputValue.replace(/\s+/g, "");
|
||||||
|
const realNumber = callingCode + fixNumber;
|
||||||
|
setData({ ...data, tlpn: realNumber });
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSelectedCountry(country: ICountry) {
|
function handleSelectedCountry(country: ICountry) {
|
||||||
setSelectedCountry(country);
|
setSelectedCountry(country);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSave() {
|
useEffect(() => {
|
||||||
console.log("Selanjutnya");
|
onLoadMaster();
|
||||||
router.replace(`/maps/create`);
|
}, []);
|
||||||
}
|
|
||||||
|
|
||||||
const buttonSave = (
|
const onLoadMaster = async () => {
|
||||||
<BoxButtonOnFooter>
|
try {
|
||||||
<ButtonCustom onPress={handleSave}>Selanjutnya</ButtonCustom>
|
const response = await apiMasterBidangBisnis();
|
||||||
</BoxButtonOnFooter>
|
setBidangBisnis(response.data);
|
||||||
);
|
} catch (error) {
|
||||||
|
setBidangBisnis([]);
|
||||||
|
console.log("Error onLoadMasterBidangBisnis", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onLoadMasterSubBidangBisnis = async ({ id }: { id: string }) => {
|
||||||
|
try {
|
||||||
|
const response = await apiMasterSubBidangBisnis({ id: id });
|
||||||
|
setSubBidangBisnis(response.data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error onLoadMasterBidangBisnis", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewWrapper footerComponent={buttonSave}>
|
<ViewWrapper
|
||||||
|
footerComponent={
|
||||||
|
<Portofolio_ButtonCreate
|
||||||
|
id={id as string}
|
||||||
|
data={data}
|
||||||
|
dataMedsos={dataMedsos}
|
||||||
|
imageUri={imageUri}
|
||||||
|
subBidangSelected={listSubBidangSelected}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
{/* <TextCustom>Portofolio Create {id}</TextCustom> */}
|
{/* <TextCustom>Portofolio Create {id}</TextCustom> */}
|
||||||
<StackCustom gap={"xs"}>
|
<StackCustom gap={"xs"}>
|
||||||
<InformationBox text="Lengkapi data bisnis anda." />
|
<InformationBox text="Lengkapi data bisnis anda." />
|
||||||
@@ -63,51 +121,66 @@ export default function PortofolioCreate() {
|
|||||||
required
|
required
|
||||||
label="Nama Bisnis"
|
label="Nama Bisnis"
|
||||||
placeholder="Masukkan nama bisnis"
|
placeholder="Masukkan nama bisnis"
|
||||||
|
onChangeText={(value: any) => setData({ ...data, namaBisnis: value })}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SelectCustom
|
<SelectCustom
|
||||||
label="Bidang Usaha"
|
label="Bidang Usaha"
|
||||||
required
|
required
|
||||||
data={dummyMasterBidangBisnis.map((item) => ({
|
data={bidangBisnis.map((item) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
}))}
|
}))}
|
||||||
value={data.bidang_usaha}
|
value={data.masterBidangBisnisId}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
setData({ ...(data as any), bidang_usaha: value });
|
setData({ ...(data as any), masterBidangBisnisId: value });
|
||||||
|
setSelectBidangId(id as string);
|
||||||
|
onLoadMasterSubBidangBisnis({ id: value as string });
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Grid>
|
{/* {listSubBidangSelected.map((item, index) => (
|
||||||
<Grid.Col span={10}>
|
<Grid key={index}>
|
||||||
<SelectCustom
|
<Grid.Col span={10}>
|
||||||
// disabled
|
<SelectCustom
|
||||||
label="Sub Bidang Usaha"
|
disabled={selectBidangId === ""}
|
||||||
required
|
label="Sub Bidang Usaha"
|
||||||
data={dummyMasterSubBidangBisnis.map((item) => ({
|
required
|
||||||
label: item.name,
|
data={subBidangBisnis.map((item) => ({
|
||||||
value: item.id,
|
label: item.name,
|
||||||
}))}
|
value: item.id,
|
||||||
value={data.sub_bidang_usaha}
|
}))}
|
||||||
onChange={(value) => {
|
value={data.sub_bidang_usaha}
|
||||||
setData({ ...(data as any), sub_bidang_usaha: value });
|
onChange={(value) => {
|
||||||
}}
|
setData({ ...(data as any), sub_bidang_usaha: value });
|
||||||
/>
|
setListSubBidangSelected([
|
||||||
</Grid.Col>
|
...listSubBidangSelected,
|
||||||
<Grid.Col
|
{ id: value as string },
|
||||||
span={2}
|
]);
|
||||||
style={{ alignItems: "center", justifyContent: "center" }}
|
}}
|
||||||
>
|
/>
|
||||||
<TouchableOpacity onPress={() => console.log("delete")}>
|
</Grid.Col>
|
||||||
<Ionicons name="trash" size={24} color={MainColor.red} />
|
<Grid.Col
|
||||||
</TouchableOpacity>
|
span={2}
|
||||||
</Grid.Col>
|
style={{ alignItems: "center", justifyContent: "center" }}
|
||||||
</Grid>
|
>
|
||||||
|
<TouchableOpacity onPress={() => console.log("delete")}>
|
||||||
|
<Ionicons name="trash" size={24} color={MainColor.red} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
))}
|
||||||
|
|
||||||
<ButtonCenteredOnly onPress={() => console.log("add")}>
|
<ButtonCenteredOnly
|
||||||
|
onPress={() => {
|
||||||
|
setListSubBidangSelected([...listSubBidangSelected, { id: "" }]);
|
||||||
|
}}
|
||||||
|
>
|
||||||
Tambah Pilihan
|
Tambah Pilihan
|
||||||
</ButtonCenteredOnly>
|
</ButtonCenteredOnly>
|
||||||
<Spacing />
|
<Spacing /> */}
|
||||||
|
|
||||||
|
{/* <TextCustom>{JSON.stringify(bidangBisnis, null, 2)}</TextCustom> */}
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
||||||
@@ -132,6 +205,9 @@ export default function PortofolioCreate() {
|
|||||||
required
|
required
|
||||||
label="Alamat Bisnis"
|
label="Alamat Bisnis"
|
||||||
placeholder="Masukkan alamat bisnis"
|
placeholder="Masukkan alamat bisnis"
|
||||||
|
onChangeText={(value: any) =>
|
||||||
|
setData({ ...data, alamatKantor: value })
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextAreaCustom
|
<TextAreaCustom
|
||||||
@@ -150,12 +226,20 @@ export default function PortofolioCreate() {
|
|||||||
|
|
||||||
{/* Logo */}
|
{/* Logo */}
|
||||||
<InformationBox text="Upload logo bisnis anda untuk di tampilaka pada portofolio." />
|
<InformationBox text="Upload logo bisnis anda untuk di tampilaka pada portofolio." />
|
||||||
<LandscapeFrameUploaded />
|
|
||||||
|
<CenterCustom>
|
||||||
|
<Avatar.Image
|
||||||
|
source={imageUri ? { uri: imageUri } : DUMMY_IMAGE.dummy_image}
|
||||||
|
size={200}
|
||||||
|
/>
|
||||||
|
</CenterCustom>
|
||||||
|
<Spacing />
|
||||||
<ButtonCenteredOnly
|
<ButtonCenteredOnly
|
||||||
icon="upload"
|
icon="upload"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
console.log("Upload logo >>", id);
|
pickImage({
|
||||||
router.navigate(`/(application)/(image)/take-picture/${id}`);
|
setImageUri,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Upload
|
Upload
|
||||||
@@ -167,22 +251,37 @@ export default function PortofolioCreate() {
|
|||||||
<TextInputCustom
|
<TextInputCustom
|
||||||
label="Tiktok"
|
label="Tiktok"
|
||||||
placeholder="Masukkan username tiktok"
|
placeholder="Masukkan username tiktok"
|
||||||
|
onChangeText={(value: any) =>
|
||||||
|
setDataMedsos({ ...dataMedsos, tiktok: value })
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<TextInputCustom
|
<TextInputCustom
|
||||||
label="Facebook"
|
label="Facebook"
|
||||||
placeholder="Masukkan username facebook"
|
placeholder="Masukkan username facebook"
|
||||||
|
onChangeText={(value: any) =>
|
||||||
|
setDataMedsos({ ...dataMedsos, facebook: value })
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<TextInputCustom
|
<TextInputCustom
|
||||||
label="Instagram"
|
label="Instagram"
|
||||||
placeholder="Masukkan username instagram"
|
placeholder="Masukkan username instagram"
|
||||||
|
onChangeText={(value: any) =>
|
||||||
|
setDataMedsos({ ...dataMedsos, instagram: value })
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<TextInputCustom
|
<TextInputCustom
|
||||||
label="Twitter"
|
label="Twitter"
|
||||||
placeholder="Masukkan username twitter"
|
placeholder="Masukkan username twitter"
|
||||||
|
onChangeText={(value: any) =>
|
||||||
|
setDataMedsos({ ...dataMedsos, twitter: value })
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<TextInputCustom
|
<TextInputCustom
|
||||||
label="Youtube"
|
label="Youtube"
|
||||||
placeholder="Masukkan username youtube"
|
placeholder="Masukkan username youtube"
|
||||||
|
onChangeText={(value: any) =>
|
||||||
|
setDataMedsos({ ...dataMedsos, youtube: value })
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Spacing />
|
<Spacing />
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
BoxButtonOnFooter,
|
BoxButtonOnFooter,
|
||||||
ButtonCenteredOnly,
|
ButtonCenteredOnly,
|
||||||
ButtonCustom,
|
ButtonCustom,
|
||||||
Grid,
|
Grid,
|
||||||
SelectCustom,
|
SelectCustom,
|
||||||
Spacing,
|
Spacing,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextAreaCustom,
|
TextAreaCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
TextInputCustom,
|
TextInputCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import dummyMasterBidangBisnis from "@/lib/dummy-data/master-bidang-bisnis";
|
import dummyMasterBidangBisnis from "@/lib/dummy-data/master-bidang-bisnis";
|
||||||
@@ -26,7 +26,7 @@ export default function PortofolioEdit() {
|
|||||||
const [inputValue, setInputValue] = useState<string>("");
|
const [inputValue, setInputValue] = useState<string>("");
|
||||||
|
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
name: "",
|
namaBisnis: "",
|
||||||
bidang_usaha: "",
|
bidang_usaha: "",
|
||||||
sub_bidang_usaha: "",
|
sub_bidang_usaha: "",
|
||||||
alamat: "",
|
alamat: "",
|
||||||
|
|||||||
@@ -1,20 +1,32 @@
|
|||||||
import { AlertCustom, DrawerCustom } from "@/components";
|
import { AlertCustom, DrawerCustom, Spacing, StackCustom } from "@/components";
|
||||||
import LeftButtonCustom from "@/components/Button/BackButton";
|
import LeftButtonCustom from "@/components/Button/BackButton";
|
||||||
import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
|
import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
|
import Portofolio_BusinessLocation from "@/screens/Portofolio/BusinessLocationSection";
|
||||||
|
import Portofolio_ButtonDelete from "@/screens/Portofolio/ButtonDelete";
|
||||||
|
import Portofolio_Data from "@/screens/Portofolio/DataPortofolio";
|
||||||
import { drawerItemsPortofolio } from "@/screens/Portofolio/ListPage";
|
import { drawerItemsPortofolio } from "@/screens/Portofolio/ListPage";
|
||||||
import Portofolio_MenuDrawerSection from "@/screens/Portofolio/MenuDrawer";
|
import Portofolio_MenuDrawerSection from "@/screens/Portofolio/MenuDrawer";
|
||||||
import PorfofolioSection from "@/screens/Portofolio/PorfofolioSection";
|
import Portofolio_SocialMediaSection from "@/screens/Portofolio/SocialMediaSection";
|
||||||
|
import { apiGetOnePortofolio } from "@/service/api-client/api-portofolio";
|
||||||
import { GStyles } from "@/styles/global-styles";
|
import { GStyles } from "@/styles/global-styles";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { Stack, useLocalSearchParams, router } from "expo-router";
|
import {
|
||||||
import { useState } from "react";
|
router,
|
||||||
|
Stack,
|
||||||
|
useFocusEffect,
|
||||||
|
useLocalSearchParams,
|
||||||
|
} from "expo-router";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
import { TouchableOpacity } from "react-native";
|
import { TouchableOpacity } from "react-native";
|
||||||
|
|
||||||
export default function Portofolio() {
|
export default function Portofolio() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
|
const { user } = useAuth();
|
||||||
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
||||||
const [deleteAlert, setDeleteAlert] = useState(false);
|
const [deleteAlert, setDeleteAlert] = useState(false);
|
||||||
|
const [data, setData] = useState<any>();
|
||||||
|
|
||||||
const openDrawer = () => {
|
const openDrawer = () => {
|
||||||
setIsDrawerOpen(true);
|
setIsDrawerOpen(true);
|
||||||
@@ -22,28 +34,54 @@ export default function Portofolio() {
|
|||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
setIsDrawerOpen(false);
|
setIsDrawerOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData(id as string);
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
async function onLoadData(id: string) {
|
||||||
|
const response = await apiGetOnePortofolio({ id: id });
|
||||||
|
|
||||||
|
setData(response.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
const userId = user?.id;
|
||||||
|
const userLoginId = data?.Profile?.User?.id;
|
||||||
|
|
||||||
|
console.log("User ID >>", userId);
|
||||||
|
console.log("User Login ID >>", userLoginId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{/* Header */}
|
||||||
|
<Stack.Screen
|
||||||
|
options={{
|
||||||
|
title: "Portofolio",
|
||||||
|
headerLeft: () => <LeftButtonCustom />,
|
||||||
|
headerRight: () => (
|
||||||
|
<TouchableOpacity onPress={openDrawer}>
|
||||||
|
<Ionicons
|
||||||
|
name="ellipsis-vertical"
|
||||||
|
size={20}
|
||||||
|
color={MainColor.yellow}
|
||||||
|
/>
|
||||||
|
</TouchableOpacity>
|
||||||
|
),
|
||||||
|
headerStyle: GStyles.headerStyle,
|
||||||
|
headerTitleStyle: GStyles.headerTitleStyle,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
{/* Header */}
|
{/* <PorfofolioSection setShowDeleteAlert={setDeleteAlert} data={data} /> */}
|
||||||
<Stack.Screen
|
<StackCustom>
|
||||||
options={{
|
<Portofolio_Data data={data} />
|
||||||
title: "Portofolio",
|
<Portofolio_BusinessLocation />
|
||||||
headerLeft: () => <LeftButtonCustom />,
|
<Portofolio_SocialMediaSection data={data?.Portofolio_MediaSosial} />
|
||||||
headerRight: () => (
|
<Portofolio_ButtonDelete setShowDeleteAlert={setDeleteAlert} />
|
||||||
<TouchableOpacity onPress={openDrawer}>
|
<Spacing />
|
||||||
<Ionicons
|
</StackCustom>
|
||||||
name="ellipsis-vertical"
|
|
||||||
size={20}
|
|
||||||
color={MainColor.yellow}
|
|
||||||
/>
|
|
||||||
</TouchableOpacity>
|
|
||||||
),
|
|
||||||
headerStyle: GStyles.headerStyle,
|
|
||||||
headerTitleStyle: GStyles.headerTitleStyle,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<PorfofolioSection setShowDeleteAlert={setDeleteAlert} />
|
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|
||||||
{/* Drawer Komponen Eksternal */}
|
{/* Drawer Komponen Eksternal */}
|
||||||
|
|||||||
@@ -1,47 +1,28 @@
|
|||||||
import { BaseBox, Grid, TextCustom, ViewWrapper } from "@/components";
|
import { TextCustom, ViewWrapper } from "@/components";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import Portofolio_BoxView from "@/screens/Portofolio/BoxPortofolioView";
|
||||||
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
import { apiGetPortofolio } from "@/service/api-client/api-portofolio";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
export default function ListPortofolio() {
|
export default function ListPortofolio() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
|
const [data, setData] = useState<any[]>([]);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadPortofolio(id as string);
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadPortofolio = async (id: string) => {
|
||||||
|
const response = await apiGetPortofolio({ id: id });
|
||||||
|
setData(response.data);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
{Array.from({ length: 10 }).map((_, index) => (
|
{data ? data?.map((item: any, index: number) => (
|
||||||
<BaseBox
|
<Portofolio_BoxView key={index} data={item} />
|
||||||
key={index}
|
)) : <TextCustom>Tidak ada portofolio</TextCustom>}
|
||||||
style={{ backgroundColor: MainColor.darkblue }}
|
|
||||||
onPress={() => {
|
|
||||||
console.log("press to Portofolio");
|
|
||||||
router.push(`/portofolio/${id}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col
|
|
||||||
span={10}
|
|
||||||
style={{ justifyContent: "center", backgroundColor: "" }}
|
|
||||||
>
|
|
||||||
<TextCustom bold size="large" truncate={1}>
|
|
||||||
Nama usaha portofolio
|
|
||||||
</TextCustom>
|
|
||||||
<TextCustom size="small" color="yellow">
|
|
||||||
#id-porofolio12345
|
|
||||||
</TextCustom>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col
|
|
||||||
span={2}
|
|
||||||
style={{ alignItems: "flex-end", justifyContent: "center" }}
|
|
||||||
>
|
|
||||||
<Ionicons
|
|
||||||
name="caret-forward"
|
|
||||||
size={ICON_SIZE_SMALL}
|
|
||||||
color="white"
|
|
||||||
/>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</BaseBox>
|
|
||||||
))}
|
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,14 @@ import { MainColor } from "@/constants/color-palet";
|
|||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { drawerItemsProfile } from "@/screens/Profile/ListPage";
|
import { drawerItemsProfile } from "@/screens/Profile/ListPage";
|
||||||
import Profile_MenuDrawerSection from "@/screens/Profile/menuDrawerSection";
|
import Profile_MenuDrawerSection from "@/screens/Profile/menuDrawerSection";
|
||||||
|
import Profile_PortofolioSection from "@/screens/Profile/PortofolioSection";
|
||||||
import ProfileSection from "@/screens/Profile/ProfileSection";
|
import ProfileSection from "@/screens/Profile/ProfileSection";
|
||||||
|
import { apiGetPortofolio } from "@/service/api-client/api-portofolio";
|
||||||
import { apiProfile } from "@/service/api-client/api-profile";
|
import { apiProfile } from "@/service/api-client/api-profile";
|
||||||
import { GStyles } from "@/styles/global-styles";
|
import { GStyles } from "@/styles/global-styles";
|
||||||
import { IProfile } from "@/types/Type-Profile";
|
import { IProfile } from "@/types/Type-Profile";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import {
|
import { Stack, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
Stack,
|
|
||||||
useFocusEffect,
|
|
||||||
useLocalSearchParams
|
|
||||||
} from "expo-router";
|
|
||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useState } from "react";
|
||||||
import { TouchableOpacity } from "react-native";
|
import { TouchableOpacity } from "react-native";
|
||||||
|
|
||||||
@@ -22,6 +20,7 @@ export default function Profile() {
|
|||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
||||||
const [data, setData] = useState<IProfile>();
|
const [data, setData] = useState<IProfile>();
|
||||||
|
const [dataPortofolio, setDataPortofolio] = useState<any[]>();
|
||||||
|
|
||||||
const { logout, isAdmin } = useAuth();
|
const { logout, isAdmin } = useAuth();
|
||||||
|
|
||||||
@@ -36,13 +35,25 @@ export default function Profile() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadData(id as string);
|
onLoadData(id as string);
|
||||||
|
onLoadPortofolio(id as string);
|
||||||
}, [id])
|
}, [id])
|
||||||
);
|
);
|
||||||
|
|
||||||
async function onLoadData(id: string) {
|
const onLoadData = async (id: string) => {
|
||||||
const response = await apiProfile({ id: id });
|
const response = await apiProfile({ id: id });
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const onLoadPortofolio = async (id: string) => {
|
||||||
|
const response = await apiGetPortofolio({ id: id });
|
||||||
|
const lastTwoByDate = response.data
|
||||||
|
.sort(
|
||||||
|
(a: any, b: any) =>
|
||||||
|
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
||||||
|
) // urut desc
|
||||||
|
.slice(0, 2);
|
||||||
|
setDataPortofolio(lastTwoByDate);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -63,9 +74,14 @@ export default function Profile() {
|
|||||||
headerTitleStyle: GStyles.headerTitleStyle,
|
headerTitleStyle: GStyles.headerTitleStyle,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{/* Main View */}
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
{/* Header */}
|
|
||||||
<ProfileSection data={data as any} />
|
<ProfileSection data={data as any} />
|
||||||
|
|
||||||
|
<Profile_PortofolioSection
|
||||||
|
data={dataPortofolio as any}
|
||||||
|
profileId={id as string}
|
||||||
|
/>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|
||||||
{/* Drawer Komponen Eksternal */}
|
{/* Drawer Komponen Eksternal */}
|
||||||
|
|||||||
BIN
assets/images/dummy/dummy-image.jpg
Normal file
BIN
assets/images/dummy/dummy-image.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -16,6 +16,7 @@ const sizeMap = {
|
|||||||
|
|
||||||
interface AvatarCompProps {
|
interface AvatarCompProps {
|
||||||
fileId?: string;
|
fileId?: string;
|
||||||
|
fileIdDefault?: string;
|
||||||
size: Size;
|
size: Size;
|
||||||
onPress?: () => void | any;
|
onPress?: () => void | any;
|
||||||
href?: Href | undefined | any;
|
href?: Href | undefined | any;
|
||||||
@@ -23,6 +24,7 @@ interface AvatarCompProps {
|
|||||||
|
|
||||||
export default function AvatarComp({
|
export default function AvatarComp({
|
||||||
fileId,
|
fileId,
|
||||||
|
fileIdDefault,
|
||||||
size,
|
size,
|
||||||
onPress,
|
onPress,
|
||||||
href = `/(application)/(image)/preview-image/${fileId}`,
|
href = `/(application)/(image)/preview-image/${fileId}`,
|
||||||
@@ -34,7 +36,11 @@ export default function AvatarComp({
|
|||||||
<Avatar.Image
|
<Avatar.Image
|
||||||
size={dimension}
|
size={dimension}
|
||||||
source={
|
source={
|
||||||
fileId ? { uri: API_STRORAGE.GET({ fileId }) } : DUMMY_IMAGE.avatar
|
fileId
|
||||||
|
? { uri: API_STRORAGE.GET({ fileId }) }
|
||||||
|
: fileIdDefault
|
||||||
|
? fileIdDefault
|
||||||
|
: DUMMY_IMAGE.avatar
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const DUMMY_IMAGE = {
|
const DUMMY_IMAGE = {
|
||||||
avatar: require("@/assets/images/dummy/dummy-user.png"),
|
avatar: require("@/assets/images/dummy/dummy-user.png"),
|
||||||
background: require("@/assets/images/dummy/dummy-image-background.jpg"),
|
background: require("@/assets/images/dummy/dummy-image-background.jpg"),
|
||||||
|
dummy_image: require("@/assets/images/dummy/dummy-image.jpg"),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DUMMY_IMAGE;
|
export default DUMMY_IMAGE;
|
||||||
|
|||||||
42
screens/Portofolio/BoxPortofolioView.tsx
Normal file
42
screens/Portofolio/BoxPortofolioView.tsx
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import { BaseBox, Grid, TextCustom } from "@/components";
|
||||||
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
|
import { router } from "expo-router";
|
||||||
|
|
||||||
|
export default function Portofolio_BoxView({ data }: { data: any }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<BaseBox
|
||||||
|
style={{ backgroundColor: MainColor.darkblue }}
|
||||||
|
onPress={() => {
|
||||||
|
router.push(`/portofolio/${data?.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Grid>
|
||||||
|
<Grid.Col
|
||||||
|
span={10}
|
||||||
|
style={{ justifyContent: "center", backgroundColor: "" }}
|
||||||
|
>
|
||||||
|
<TextCustom bold size="large" truncate={1}>
|
||||||
|
{data && data?.namaBisnis ? data.namaBisnis : "-"}
|
||||||
|
</TextCustom>
|
||||||
|
<TextCustom size="small" color="yellow">
|
||||||
|
#{data && data?.id_Portofolio ? data.id_Portofolio : "-"}
|
||||||
|
</TextCustom>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col
|
||||||
|
span={2}
|
||||||
|
style={{ alignItems: "flex-end", justifyContent: "center" }}
|
||||||
|
>
|
||||||
|
<Ionicons
|
||||||
|
name="caret-forward"
|
||||||
|
size={ICON_SIZE_SMALL}
|
||||||
|
color="white"
|
||||||
|
/>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</BaseBox>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
121
screens/Portofolio/ButtonCreatePortofolio.tsx
Normal file
121
screens/Portofolio/ButtonCreatePortofolio.tsx
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
import { BoxButtonOnFooter, ButtonCustom } from "@/components";
|
||||||
|
import DIRECTORY_ID from "@/constants/directory-id";
|
||||||
|
import { apiPortofolioCreate } from "@/service/api-client/api-portofolio";
|
||||||
|
import { uploadImageService } from "@/service/upload-service";
|
||||||
|
import { router } from "expo-router";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
id: string;
|
||||||
|
data: any;
|
||||||
|
dataMedsos: any;
|
||||||
|
imageUri: string | null;
|
||||||
|
subBidangSelected: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICreatePortofolio {
|
||||||
|
id: string;
|
||||||
|
namaBisnis: string;
|
||||||
|
masterBidangBisnisId: string;
|
||||||
|
alamatKantor: string;
|
||||||
|
tlpn: string;
|
||||||
|
deskripsi: string;
|
||||||
|
fileId: string;
|
||||||
|
facebook: string;
|
||||||
|
twitter: string;
|
||||||
|
instagram: string;
|
||||||
|
tiktok: string;
|
||||||
|
youtube: string;
|
||||||
|
subBidang: any[];
|
||||||
|
}
|
||||||
|
export default function Portofolio_ButtonCreate({
|
||||||
|
id,
|
||||||
|
data,
|
||||||
|
dataMedsos,
|
||||||
|
imageUri,
|
||||||
|
subBidangSelected,
|
||||||
|
}: Props) {
|
||||||
|
const handleCreatePortofolio = async () => {
|
||||||
|
try {
|
||||||
|
let fileId = "";
|
||||||
|
if (imageUri) {
|
||||||
|
const response = await uploadImageService({
|
||||||
|
imageUri: imageUri,
|
||||||
|
dirId: DIRECTORY_ID.portofolio_logo,
|
||||||
|
});
|
||||||
|
|
||||||
|
fileId = response.data.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix Data
|
||||||
|
const newData: ICreatePortofolio = {
|
||||||
|
id: id,
|
||||||
|
namaBisnis: data.namaBisnis,
|
||||||
|
masterBidangBisnisId: data.masterBidangBisnisId,
|
||||||
|
alamatKantor: data.alamatKantor,
|
||||||
|
tlpn: data.tlpn,
|
||||||
|
deskripsi: data.deskripsi,
|
||||||
|
fileId: fileId,
|
||||||
|
facebook: dataMedsos.facebook,
|
||||||
|
twitter: dataMedsos.twitter,
|
||||||
|
instagram: dataMedsos.instagram,
|
||||||
|
tiktok: dataMedsos.tiktok,
|
||||||
|
youtube: dataMedsos.youtube,
|
||||||
|
subBidang: subBidangSelected,
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await apiPortofolioCreate({
|
||||||
|
data: newData,
|
||||||
|
});
|
||||||
|
console.log("Response >>", JSON.stringify(response, null, 2));
|
||||||
|
// return router.replace(`/maps/create`);
|
||||||
|
// return router.push(`/maps/create`);
|
||||||
|
return router.back();
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Error",
|
||||||
|
text2: error as string,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// const onCreatePortofolio = async ({ fileId }: { fileId: string }) => {
|
||||||
|
// const newData: ICreatePortofolio = {
|
||||||
|
// namaBisnis: data.namaBisnis,
|
||||||
|
// masterBidangBisnisId: data.masterBidangBisnisId,
|
||||||
|
// alamatKantor: data.alamatKantor,
|
||||||
|
// tlpn: data.tlpn,
|
||||||
|
// deskripsi: data.deskripsi,
|
||||||
|
// fileId: fileId,
|
||||||
|
// facebook: dataMedsos.facebook,
|
||||||
|
// twitter: dataMedsos.twitter,
|
||||||
|
// instagram: dataMedsos.instagram,
|
||||||
|
// tiktok: dataMedsos.tiktok,
|
||||||
|
// youtube: dataMedsos.youtube,
|
||||||
|
// };
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// const response = await apiPortofolioCreate({
|
||||||
|
// id: id,
|
||||||
|
// data: newData,
|
||||||
|
// });
|
||||||
|
// console.log("Response >>", JSON.stringify(response, null, 2));
|
||||||
|
// return response;
|
||||||
|
// } catch (error) {
|
||||||
|
// throw error;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // router.replace(`/maps/create`);
|
||||||
|
// };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BoxButtonOnFooter>
|
||||||
|
<ButtonCustom onPress={handleCreatePortofolio}>Selanjutnya</ButtonCustom>
|
||||||
|
</BoxButtonOnFooter>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import {
|
import {
|
||||||
|
AvatarComp,
|
||||||
AvatarCustom,
|
AvatarCustom,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
CenterCustom,
|
CenterCustom,
|
||||||
@@ -10,11 +12,12 @@ import {
|
|||||||
import DividerCustom from "@/components/Divider/DividerCustom";
|
import DividerCustom from "@/components/Divider/DividerCustom";
|
||||||
import { AccentColor } from "@/constants/color-palet";
|
import { AccentColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
|
import DUMMY_IMAGE from "@/constants/dummy-image-value";
|
||||||
import { FontAwesome, Ionicons } from "@expo/vector-icons";
|
import { FontAwesome, Ionicons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
|
||||||
export default function Portofolio_Data() {
|
export default function Portofolio_Data({ data }: { data: any }) {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
|
|
||||||
const listData = [
|
const listData = [
|
||||||
@@ -22,60 +25,63 @@ export default function Portofolio_Data() {
|
|||||||
icon: (
|
icon: (
|
||||||
<FontAwesome name="building-o" size={ICON_SIZE_SMALL} color="white" />
|
<FontAwesome name="building-o" size={ICON_SIZE_SMALL} color="white" />
|
||||||
),
|
),
|
||||||
label: "PT.Bali Interakrtif Perkasa",
|
label: data && data?.namaBisnis ? data.namaBisnis : "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: (
|
icon: (
|
||||||
<Ionicons name="call-outline" size={ICON_SIZE_SMALL} color="white" />
|
<Ionicons name="call-outline" size={ICON_SIZE_SMALL} color="white" />
|
||||||
),
|
),
|
||||||
label: "+6282340374412",
|
label: data && data?.tlpn ? data.tlpn : "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: (
|
icon: (
|
||||||
<Ionicons name="home-outline" size={ICON_SIZE_SMALL} color="white" />
|
<Ionicons name="home-outline" size={ICON_SIZE_SMALL} color="white" />
|
||||||
),
|
),
|
||||||
label: "Jl. Raya Kuta No. 123, Bandung, Indonesia",
|
label: data && data?.alamatKantor ? data.alamatKantor : "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: (
|
icon: (
|
||||||
<Ionicons name="list-outline" size={ICON_SIZE_SMALL} color="white" />
|
<Ionicons name="list-outline" size={ICON_SIZE_SMALL} color="white" />
|
||||||
),
|
),
|
||||||
label: "Teknologia",
|
label:
|
||||||
|
data && data?.MasterBidangBisnis?.name
|
||||||
|
? data.MasterBidangBisnis.name
|
||||||
|
: "-",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const listSubBidang = [
|
// const listSubBidang = [
|
||||||
{
|
// {
|
||||||
icon: (
|
// icon: (
|
||||||
<Ionicons
|
// <Ionicons
|
||||||
name="chevron-forward-outline"
|
// name="chevron-forward-outline"
|
||||||
size={ICON_SIZE_SMALL}
|
// size={ICON_SIZE_SMALL}
|
||||||
color="white"
|
// color="white"
|
||||||
/>
|
// />
|
||||||
),
|
// ),
|
||||||
label: "Security System",
|
// label: "Security System",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
icon: (
|
// icon: (
|
||||||
<Ionicons
|
// <Ionicons
|
||||||
name="chevron-forward-outline"
|
// name="chevron-forward-outline"
|
||||||
size={ICON_SIZE_SMALL}
|
// size={ICON_SIZE_SMALL}
|
||||||
color="white"
|
// color="white"
|
||||||
/>
|
// />
|
||||||
),
|
// ),
|
||||||
label: "Web Developers",
|
// label: "Web Developers",
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
icon: (
|
// icon: (
|
||||||
<Ionicons
|
// <Ionicons
|
||||||
name="chevron-forward-outline"
|
// name="chevron-forward-outline"
|
||||||
size={ICON_SIZE_SMALL}
|
// size={ICON_SIZE_SMALL}
|
||||||
color="white"
|
// color="white"
|
||||||
/>
|
// />
|
||||||
),
|
// ),
|
||||||
label: "Mobile Developers",
|
// label: "Mobile Developers",
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -86,7 +92,9 @@ export default function Portofolio_Data() {
|
|||||||
<TextCustom bold>Data Bisnis</TextCustom>
|
<TextCustom bold>Data Bisnis</TextCustom>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={6} style={{ alignItems: "flex-end" }}>
|
<Grid.Col span={6} style={{ alignItems: "flex-end" }}>
|
||||||
<TextCustom color="yellow">ID: {id}</TextCustom>
|
<TextCustom color="yellow" size={12} bold>
|
||||||
|
ID: {(data && data?.id_Portofolio) || "-"}
|
||||||
|
</TextCustom>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -106,7 +114,11 @@ export default function Portofolio_Data() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CenterCustom>
|
<CenterCustom>
|
||||||
<AvatarCustom size="xl" />
|
<AvatarComp
|
||||||
|
size="xl"
|
||||||
|
fileId={data?.logoId as any}
|
||||||
|
fileIdDefault={DUMMY_IMAGE.dummy_image}
|
||||||
|
/>
|
||||||
</CenterCustom>
|
</CenterCustom>
|
||||||
</ClickableCustom>
|
</ClickableCustom>
|
||||||
|
|
||||||
@@ -125,7 +137,7 @@ export default function Portofolio_Data() {
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
))}
|
))}
|
||||||
<View style={{ paddingLeft: 10 }}>
|
{/* <View style={{ paddingLeft: 10 }}>
|
||||||
{listSubBidang.map((item, index) => (
|
{listSubBidang.map((item, index) => (
|
||||||
<Grid key={index}>
|
<Grid key={index}>
|
||||||
<Grid.Col span={2} style={{ alignItems: "center" }}>
|
<Grid.Col span={2} style={{ alignItems: "center" }}>
|
||||||
@@ -138,7 +150,7 @@ export default function Portofolio_Data() {
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View> */}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<DividerCustom labelPosition="top" color={AccentColor.blue} />
|
<DividerCustom labelPosition="top" color={AccentColor.blue} />
|
||||||
@@ -160,10 +172,7 @@ export default function Portofolio_Data() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<TextCustom style={{ paddingInline: 10 }}>
|
<TextCustom style={{ paddingInline: 10 }}>
|
||||||
Lorem ipsum, dolor sit amet consectetur adipisicing elit.
|
{(data && data?.deskripsi) || "-"}
|
||||||
Doloremque, alias perspiciatis quis enim eos facilis sit est?
|
|
||||||
Doloremque, rerum. Cumque error asperiores harum temporibus
|
|
||||||
cupiditate ullam, id quibusdam! Harum, rerum!
|
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
</View>
|
</View>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
import { Spacing, StackCustom } from "@/components";
|
|
||||||
import Portofolio_BusinessLocation from "./BusinessLocationSection";
|
|
||||||
import Portofolio_Data from "./DataPortofolio";
|
|
||||||
import Portofolio_SocialMediaSection from "./SocialMediaSection";
|
|
||||||
import Portofolio_ButtonDelete from "./ButtonDelete";
|
|
||||||
|
|
||||||
export default function PorfofolioSection({
|
|
||||||
setShowDeleteAlert,
|
|
||||||
}: {
|
|
||||||
setShowDeleteAlert: (value: boolean) => void;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<StackCustom>
|
|
||||||
<Portofolio_Data />
|
|
||||||
<Portofolio_BusinessLocation />
|
|
||||||
<Portofolio_SocialMediaSection />
|
|
||||||
<Portofolio_ButtonDelete setShowDeleteAlert={setShowDeleteAlert}/>
|
|
||||||
<Spacing/>
|
|
||||||
</StackCustom>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -3,10 +3,10 @@ import { MainColor } from "@/constants/color-palet";
|
|||||||
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
|
|
||||||
export default function Portofolio_SocialMediaSection() {
|
export default function Portofolio_SocialMediaSection({ data }: { data: any }) {
|
||||||
const listData = [
|
const listData = [
|
||||||
{
|
{
|
||||||
label: "Facebook ku bagas",
|
label: data && data?.facebook ? data.facebook : "-",
|
||||||
icon: (
|
icon: (
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="logo-facebook"
|
name="logo-facebook"
|
||||||
@@ -16,7 +16,7 @@ export default function Portofolio_SocialMediaSection() {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Tiktok ku bagas",
|
label: data && data?.tiktok ? data.tiktok : "-",
|
||||||
icon: (
|
icon: (
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="logo-tiktok"
|
name="logo-tiktok"
|
||||||
@@ -26,7 +26,7 @@ export default function Portofolio_SocialMediaSection() {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Instagram ku bagas",
|
label: data && data?.instagram ? data.instagram : "-",
|
||||||
icon: (
|
icon: (
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="logo-instagram"
|
name="logo-instagram"
|
||||||
@@ -36,7 +36,7 @@ export default function Portofolio_SocialMediaSection() {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Twitter ku bagas",
|
label: data && data?.twitter ? data.twitter : "-",
|
||||||
icon: (
|
icon: (
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="logo-twitter"
|
name="logo-twitter"
|
||||||
@@ -46,7 +46,7 @@ export default function Portofolio_SocialMediaSection() {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Youtube ku bagas",
|
label: data && data?.youtube ? data.youtube : "-",
|
||||||
icon: (
|
icon: (
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="logo-youtube"
|
name="logo-youtube"
|
||||||
|
|||||||
45
screens/Profile/PortofolioSection.tsx
Normal file
45
screens/Profile/PortofolioSection.tsx
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import { BaseBox, CenterCustom, Spacing, TextCustom } from "@/components";
|
||||||
|
import { router } from "expo-router";
|
||||||
|
import { View } from "react-native";
|
||||||
|
import Portofolio_BoxView from "../Portofolio/BoxPortofolioView";
|
||||||
|
|
||||||
|
export default function Profile_PortofolioSection({
|
||||||
|
profileId,
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
profileId: string;
|
||||||
|
data: any[];
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<BaseBox>
|
||||||
|
<View>
|
||||||
|
<TextCustom bold size="large" align="center">
|
||||||
|
Portofolio
|
||||||
|
</TextCustom>
|
||||||
|
<Spacing />
|
||||||
|
|
||||||
|
{data?.length > 0 ? (
|
||||||
|
data?.map((item: any, index) => (
|
||||||
|
<Portofolio_BoxView key={index} data={item} />
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<CenterCustom>
|
||||||
|
<TextCustom>Tidak ada portofolio</TextCustom>
|
||||||
|
</CenterCustom>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{data?.length > 0 && (
|
||||||
|
<TextCustom
|
||||||
|
bold
|
||||||
|
align="right"
|
||||||
|
onPress={() => router.push(`/portofolio/${profileId}/list`)}
|
||||||
|
>
|
||||||
|
Lihat semua
|
||||||
|
</TextCustom>
|
||||||
|
)}
|
||||||
|
</BaseBox>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,16 +1,12 @@
|
|||||||
import { BaseBox, Grid, Spacing, TextCustom } from "@/components";
|
import { BaseBox, Grid, Spacing, TextCustom } from "@/components";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
|
||||||
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
|
import { IProfile } from "@/types/Type-Profile";
|
||||||
import { FontAwesome5, Ionicons } from "@expo/vector-icons";
|
import { FontAwesome5, Ionicons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import _ from "lodash";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import AvatarAndBackground from "./AvatarAndBackground";
|
import AvatarAndBackground from "./AvatarAndBackground";
|
||||||
import { IProfile } from "@/types/Type-Profile";
|
|
||||||
import _ from "lodash";
|
|
||||||
|
|
||||||
export default function ProfileSection({ data }: { data: IProfile }) {
|
export default function ProfileSection({ data }: { data: IProfile }) {
|
||||||
const { id } = useLocalSearchParams();
|
|
||||||
|
|
||||||
const listData = [
|
const listData = [
|
||||||
{
|
{
|
||||||
icon: (
|
icon: (
|
||||||
@@ -82,57 +78,7 @@ export default function ProfileSection({ data }: { data: IProfile }) {
|
|||||||
))}
|
))}
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
|
|
||||||
<BaseBox>
|
|
||||||
<View>
|
|
||||||
<TextCustom bold size="large" align="center">
|
|
||||||
Portofolio
|
|
||||||
</TextCustom>
|
|
||||||
<Spacing />
|
|
||||||
|
|
||||||
{Array.from({ length: 2 }).map((_, index) => (
|
|
||||||
<BaseBox
|
|
||||||
key={index}
|
|
||||||
style={{ backgroundColor: MainColor.darkblue }}
|
|
||||||
onPress={() => {
|
|
||||||
console.log("press to Portofolio");
|
|
||||||
router.push(`/portofolio/${id}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col
|
|
||||||
span={10}
|
|
||||||
style={{ justifyContent: "center", backgroundColor: "" }}
|
|
||||||
>
|
|
||||||
<TextCustom bold size="large" truncate={1}>
|
|
||||||
Nama usaha portofolio
|
|
||||||
</TextCustom>
|
|
||||||
<TextCustom size="small" color="yellow">
|
|
||||||
#id-porofolio12345
|
|
||||||
</TextCustom>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col
|
|
||||||
span={2}
|
|
||||||
style={{ alignItems: "flex-end", justifyContent: "center" }}
|
|
||||||
>
|
|
||||||
<Ionicons
|
|
||||||
name="caret-forward"
|
|
||||||
size={ICON_SIZE_SMALL}
|
|
||||||
color="white"
|
|
||||||
/>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</BaseBox>
|
|
||||||
))}
|
|
||||||
</View>
|
|
||||||
|
|
||||||
<TextCustom
|
|
||||||
bold
|
|
||||||
align="right"
|
|
||||||
onPress={() => router.push(`/portofolio/${id}/list`)}
|
|
||||||
>
|
|
||||||
Lihat semua
|
|
||||||
</TextCustom>
|
|
||||||
</BaseBox>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
20
service/api-client/api-master.ts
Normal file
20
service/api-client/api-master.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { apiConfig } from "../api-config";
|
||||||
|
|
||||||
|
export async function apiMasterBidangBisnis() {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/master/bidang-bisnis`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiMasterSubBidangBisnis({id}: {id: string}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/master/sub-bidang-bisnis/${id}`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
33
service/api-client/api-portofolio.ts
Normal file
33
service/api-client/api-portofolio.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { apiConfig } from "../api-config";
|
||||||
|
|
||||||
|
export async function apiPortofolioCreate({ data }: { data: any }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.post(`/mobile/portofolio`, {
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiGetPortofolio({ id }: { id: string }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/mobile/portofolio?id=${id}`);
|
||||||
|
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiGetOnePortofolio({ id }: { id: string }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/mobile/portofolio/${id}`);
|
||||||
|
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
17
types/Type-Master.ts
Normal file
17
types/Type-Master.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export interface IMasterBidangBisnis {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
slug: string;
|
||||||
|
active: boolean;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMasterSubBidangBisnis {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
slug: string;
|
||||||
|
isActive: boolean;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user