Compare commits
23 Commits
notificati
...
loaddata/2
| Author | SHA1 | Date | |
|---|---|---|---|
| 48196cd46b | |||
| ec79a1fbcd | |||
| ed16f1b204 | |||
| d693550a1f | |||
| b3bfbc0f7e | |||
| 71e45d06cc | |||
| 07e64c335e | |||
| 1aebc9b4e8 | |||
| 5665dc88ba | |||
| da82a02a45 | |||
| 14c0f0e499 | |||
| 0262423c50 | |||
| c2682246d6 | |||
| 465e01015e | |||
| 3b15871ad4 | |||
| 9123e73606 | |||
| 6e2046467f | |||
| ca33dd83bb | |||
| ea3fbdc541 | |||
| 33cd47aaed | |||
| 57ac1eb45e | |||
| 145ad73616 | |||
| 7c85e35c61 |
@@ -100,7 +100,7 @@ packagingOptions {
|
|||||||
applicationId 'com.bip.hipmimobileapp'
|
applicationId 'com.bip.hipmimobileapp'
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 3
|
versionCode 4
|
||||||
versionName "1.0.1"
|
versionName "1.0.1"
|
||||||
|
|
||||||
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
|
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<manifest
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
@@ -17,36 +15,13 @@ xmlns:tools="http://schemas.android.com/tools">
|
|||||||
<data android:scheme="https"/>
|
<data android:scheme="https"/>
|
||||||
</intent>
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
<application
|
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true" android:enableOnBackInvokedCallback="false" android:fullBackupContent="@xml/secure_store_backup_rules" android:dataExtractionRules="@xml/secure_store_data_extraction_rules">
|
||||||
android:name=".MainApplication"
|
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/notification_icon_color" tools:replace="android:resource"/>
|
||||||
android:label="@string/app_name"
|
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon"/>
|
||||||
android:icon="@mipmap/ic_launcher"
|
<meta-data android:name="expo.modules.notifications.default_notification_color" android:resource="@color/notification_icon_color"/>
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
<meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/notification_icon"/>
|
||||||
android:allowBackup="true"
|
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
|
||||||
android:theme="@style/AppTheme"
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
|
||||||
android:supportsRtl="true"
|
|
||||||
android:enableOnBackInvokedCallback="false"
|
|
||||||
android:fullBackupContent="@xml/secure_store_backup_rules"
|
|
||||||
android:dataExtractionRules="@xml/secure_store_data_extraction_rules">
|
|
||||||
<meta-data
|
|
||||||
android:name="com.google.firebase.messaging.default_notification_color"
|
|
||||||
android:resource="@color/notification_icon_color"
|
|
||||||
tools:replace="android:resource"/>
|
|
||||||
<meta-data
|
|
||||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
|
||||||
android:resource="@drawable/notification_icon"/>
|
|
||||||
<meta-data
|
|
||||||
android:name="expo.modules.notifications.default_notification_color"
|
|
||||||
android:resource="@color/notification_icon_color"/>
|
|
||||||
<meta-data
|
|
||||||
android:name="expo.modules.notifications.default_notification_icon"
|
|
||||||
android:resource="@drawable/notification_icon"/>
|
|
||||||
<meta-data
|
|
||||||
android:name="expo.modules.updates.ENABLED"
|
|
||||||
android:value="false"/>
|
|
||||||
<meta-data
|
|
||||||
android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH"
|
|
||||||
android:value="ALWAYS"/>
|
|
||||||
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
|
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
|
||||||
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
|
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default {
|
|||||||
"Aplikasi membutuhkan akses lokasi untuk menampilkan peta.",
|
"Aplikasi membutuhkan akses lokasi untuk menampilkan peta.",
|
||||||
},
|
},
|
||||||
associatedDomains: ["applinks:cld-dkr-staging-hipmi.wibudev.com"],
|
associatedDomains: ["applinks:cld-dkr-staging-hipmi.wibudev.com"],
|
||||||
buildNumber: "17",
|
buildNumber: "20",
|
||||||
},
|
},
|
||||||
|
|
||||||
android: {
|
android: {
|
||||||
@@ -32,7 +32,7 @@ export default {
|
|||||||
},
|
},
|
||||||
edgeToEdgeEnabled: true,
|
edgeToEdgeEnabled: true,
|
||||||
package: "com.bip.hipmimobileapp",
|
package: "com.bip.hipmimobileapp",
|
||||||
versionCode: 3,
|
versionCode: 4,
|
||||||
// softwareKeyboardLayoutMode: 'resize', // option: untuk mengatur keyboard pada room chst collaboration
|
// softwareKeyboardLayoutMode: 'resize', // option: untuk mengatur keyboard pada room chst collaboration
|
||||||
intentFilters: [
|
intentFilters: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { CenterCustom, TextCustom, ViewWrapper } from "@/components";
|
import { CenterCustom, TextCustom, ViewWrapper } from "@/components";
|
||||||
import API_STRORAGE from "@/constants/base-url-api-strorage";
|
import API_STRORAGE from "@/constants/base-url-api-strorage";
|
||||||
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { Image } from "expo-image";
|
import { Image } from "expo-image";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
import { View } from "react-native";
|
||||||
|
|
||||||
export default function PreviewImage() {
|
export default function PreviewImage() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
@@ -11,18 +13,48 @@ export default function PreviewImage() {
|
|||||||
return (
|
return (
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
{id ? (
|
{id ? (
|
||||||
<Image
|
<View
|
||||||
onLoad={() => {
|
style={{
|
||||||
setIsLoading(false);
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
source={
|
>
|
||||||
isLoading
|
{/* Main Image */}
|
||||||
? require("@/assets/images/loading.gif")
|
<Image
|
||||||
: API_STRORAGE.GET({ fileId: id as string })
|
onLoad={() => {
|
||||||
}
|
setIsLoading(false);
|
||||||
contentFit="contain"
|
}}
|
||||||
style={{ width: "100%", height: "100%" }}
|
source={API_STRORAGE.GET({ fileId: id as string })}
|
||||||
/>
|
contentFit="contain"
|
||||||
|
style={{ width: "100%", height: "100%" }}
|
||||||
|
// placeholder={require("@/assets/images/loading.gif")}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Custom Loader Overlay */}
|
||||||
|
{isLoading && (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
backgroundColor: MainColor.darkblue,
|
||||||
|
zIndex: 1,
|
||||||
|
opacity: 0.5,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Image
|
||||||
|
source={require("@/assets/images/loading.gif")}
|
||||||
|
contentFit="contain"
|
||||||
|
style={{ width: 60, height: 60 }}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<CenterCustom>
|
<CenterCustom>
|
||||||
<TextCustom>File not found</TextCustom>
|
<TextCustom>File not found</TextCustom>
|
||||||
|
|||||||
@@ -53,30 +53,35 @@ export default function UserLayout() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{/* ========== Notification Section ========= */}
|
{/* ========== Notification Section ========= */}
|
||||||
<Stack.Screen
|
|
||||||
|
{/* DIPINDAH DI FILE NOTIFICATION USER */}
|
||||||
|
{/* <Stack.Screen
|
||||||
name="notifications/index"
|
name="notifications/index"
|
||||||
options={{
|
options={{
|
||||||
title: "Notifikasi",
|
title: "Notifikasi",
|
||||||
headerLeft: () => <BackButton />,
|
headerLeft: () => <BackButton />,
|
||||||
headerRight: () => (
|
// headerRight: () => (
|
||||||
<IconPlus
|
// <IconPlus
|
||||||
color={MainColor.yellow}
|
// color={MainColor.yellow}
|
||||||
onPress={() => router.push("/test-notifications")}
|
// onPress={() => router.push("/test-notifications")}
|
||||||
/>
|
// />
|
||||||
),
|
// ),
|
||||||
}}
|
}}
|
||||||
/>
|
/> */}
|
||||||
|
|
||||||
{/* ========== Event Section ========= */}
|
{/* ========== Event Section ========= */}
|
||||||
|
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="event/(tabs)"
|
name="event/(tabs)"
|
||||||
options={{
|
options={{
|
||||||
title: "Event",
|
title: "Event",
|
||||||
headerLeft: () => (
|
// NOTE: DIPINDAH DI FILE /Event/(Tabs)/_layout.tsx
|
||||||
<LeftButtonCustom path="/(application)/(user)/home" />
|
// headerLeft: () => (
|
||||||
),
|
// <LeftButtonCustom path="/(application)/(user)/home" />
|
||||||
|
// ),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="event/create"
|
name="event/create"
|
||||||
options={{
|
options={{
|
||||||
@@ -519,7 +524,8 @@ export default function UserLayout() {
|
|||||||
name="job/(tabs)"
|
name="job/(tabs)"
|
||||||
options={{
|
options={{
|
||||||
title: "Job Vacancy",
|
title: "Job Vacancy",
|
||||||
headerLeft: () => <BackButton path="/home" />,
|
// headerLeft: () => <BackButton path="/home" />,
|
||||||
|
// NOTE: headerLeft di pindahkan ke Tabs Layout
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -610,6 +616,20 @@ export default function UserLayout() {
|
|||||||
headerLeft: () => <BackButton />,
|
headerLeft: () => <BackButton />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Stack.Screen
|
||||||
|
name="forum/[id]/preview-report-posting"
|
||||||
|
options={{
|
||||||
|
title: "Laporan Postingan",
|
||||||
|
headerLeft: () => <BackButton />,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Stack.Screen
|
||||||
|
name="forum/[id]/preview-report-comment"
|
||||||
|
options={{
|
||||||
|
title: "Laporan Komentar",
|
||||||
|
headerLeft: () => <BackButton />,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* ========== Maps Section ========= */}
|
{/* ========== Maps Section ========= */}
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ export default function DonationBeranda() {
|
|||||||
const response = await apiDonationGetAll({
|
const response = await apiDonationGetAll({
|
||||||
category: "beranda"
|
category: "beranda"
|
||||||
});
|
});
|
||||||
console.log("[RES GET ALL]", JSON.stringify(response.data, null, 2));
|
|
||||||
|
|
||||||
setList(response.data);
|
setList(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { Href, router, useFocusEffect } from "expo-router";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function DonationMyDonation() {
|
export default function DonationMyDonation() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
@@ -25,20 +26,25 @@ export default function DonationMyDonation() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
}, [user?.id])
|
}, [user?.id]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
|
if (!user?.id) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Load data gagal, user tidak ditemukan",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setLoadList(true);
|
setLoadList(true);
|
||||||
const response = await apiDonationGetAll({
|
const response = await apiDonationGetAll({
|
||||||
category: "my-donation",
|
category: "my-donation",
|
||||||
authorId: user?.id,
|
authorId: user?.id,
|
||||||
});
|
});
|
||||||
console.log(
|
|
||||||
"[RES GET MY DONATION]",
|
|
||||||
JSON.stringify(response.data, null, 2)
|
|
||||||
);
|
|
||||||
|
|
||||||
setList(response.data);
|
setList(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -9,14 +9,16 @@ import { useAuth } from "@/hooks/use-auth";
|
|||||||
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
||||||
import Donasi_BoxStatus from "@/screens/Donation/BoxStatus";
|
import Donasi_BoxStatus from "@/screens/Donation/BoxStatus";
|
||||||
import { apiDonationGetByStatus } from "@/service/api-client/api-donation";
|
import { apiDonationGetByStatus } from "@/service/api-client/api-donation";
|
||||||
import { useFocusEffect } from "expo-router";
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
export default function DonationStatus() {
|
export default function DonationStatus() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
|
const { status } = useLocalSearchParams<{ status?: string }>();
|
||||||
|
|
||||||
const [activeCategory, setActiveCategory] = useState<string | null>(
|
const [activeCategory, setActiveCategory] = useState<string | null>(
|
||||||
"publish"
|
status || "publish",
|
||||||
);
|
);
|
||||||
const [listData, setListData] = useState<any[] | null>(null);
|
const [listData, setListData] = useState<any[] | null>(null);
|
||||||
const [loadList, setLoadList] = useState(false);
|
const [loadList, setLoadList] = useState(false);
|
||||||
@@ -24,7 +26,7 @@ export default function DonationStatus() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadList();
|
onLoadList();
|
||||||
}, [activeCategory])
|
}, [activeCategory]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadList = async () => {
|
const onLoadList = async () => {
|
||||||
|
|||||||
@@ -10,21 +10,32 @@ import {
|
|||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
import { LOCAL_STORAGE_KEY } from "@/constants/local-storage-key";
|
import { LOCAL_STORAGE_KEY } from "@/constants/local-storage-key";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function InvestmentInputDonation() {
|
export default function InvestmentInputDonation() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [nominal, setNominal] = useState<number>(0);
|
const [nominal, setNominal] = useState<number>(0);
|
||||||
|
|
||||||
const handlerSubmit = async () => {
|
const handlerSubmit = async () => {
|
||||||
|
if (!user?.id) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "User tidak ditemukan",
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await AsyncStorage.setItem(
|
await AsyncStorage.setItem(
|
||||||
LOCAL_STORAGE_KEY.transactionDonation,
|
LOCAL_STORAGE_KEY.transactionDonation,
|
||||||
JSON.stringify({ nominal: nominal.toString() })
|
JSON.stringify({ nominal: nominal.toString() }),
|
||||||
);
|
);
|
||||||
router.replace(`/donation/${id}/select-bank`);
|
router.replace(`/donation/${id}/select-bank`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import Donation_ComponentBoxDetailData from "@/screens/Donation/ComponentBoxDeta
|
|||||||
import Donation_ComponentStoryFunrising from "@/screens/Donation/ComponentStoryFunrising";
|
import Donation_ComponentStoryFunrising from "@/screens/Donation/ComponentStoryFunrising";
|
||||||
import Donation_ProgressSection from "@/screens/Donation/ProgressSection";
|
import Donation_ProgressSection from "@/screens/Donation/ProgressSection";
|
||||||
import { apiDonationGetOne } from "@/service/api-client/api-donation";
|
import { apiDonationGetOne } from "@/service/api-client/api-donation";
|
||||||
|
import { countDownAndCondition } from "@/utils/countDownAndCondition";
|
||||||
import { FontAwesome6 } from "@expo/vector-icons";
|
import { FontAwesome6 } from "@expo/vector-icons";
|
||||||
import {
|
import {
|
||||||
router,
|
router,
|
||||||
@@ -24,7 +25,7 @@ import {
|
|||||||
useLocalSearchParams,
|
useLocalSearchParams,
|
||||||
} from "expo-router";
|
} from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function DonasiDetailStatus() {
|
export default function DonasiDetailStatus() {
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
@@ -58,6 +59,27 @@ export default function DonasiDetailStatus() {
|
|||||||
setOpenDrawer(false);
|
setOpenDrawer(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [value, setValue] = useState({
|
||||||
|
sisa: 0,
|
||||||
|
reminder: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
updateCountDown();
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
const updateCountDown = () => {
|
||||||
|
const countDown = countDownAndCondition({
|
||||||
|
duration: data?.DonasiMaster_Durasi?.name,
|
||||||
|
publishTime: data?.publishTime,
|
||||||
|
});
|
||||||
|
|
||||||
|
setValue({
|
||||||
|
sisa: countDown.durationDay,
|
||||||
|
reminder: countDown.reminder,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -74,10 +96,15 @@ export default function DonasiDetailStatus() {
|
|||||||
/>
|
/>
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
<Donation_ComponentBoxDetailData
|
<Donation_ComponentBoxDetailData
|
||||||
|
sisaHari={value.sisa}
|
||||||
|
reminder={value.reminder}
|
||||||
data={data}
|
data={data}
|
||||||
bottomSection={
|
bottomSection={
|
||||||
status === "publish" && (
|
status === "publish" && (
|
||||||
<Donation_ProgressSection id={id as string} />
|
<Donation_ProgressSection
|
||||||
|
id={id as string}
|
||||||
|
progres={Number(data?.progres) || 0}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default function DonationCreateStory() {
|
|||||||
type: "success",
|
type: "success",
|
||||||
text1: "Donasi berhasil disimpan",
|
text1: "Donasi berhasil disimpan",
|
||||||
});
|
});
|
||||||
router.replace("/donation/status");
|
router.replace("/donation/status?status=review");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -4,10 +4,34 @@ import {
|
|||||||
IconHome,
|
IconHome,
|
||||||
IconStatus,
|
IconStatus,
|
||||||
} from "@/components/_Icon";
|
} from "@/components/_Icon";
|
||||||
|
import BackButtonFromNotification from "@/components/Button/BackButtonFromNotification";
|
||||||
import { TabsStyles } from "@/styles/tabs-styles";
|
import { TabsStyles } from "@/styles/tabs-styles";
|
||||||
import { Tabs } from "expo-router";
|
import { router, Tabs, useLocalSearchParams, useNavigation } from "expo-router";
|
||||||
|
import { useLayoutEffect } from "react";
|
||||||
|
|
||||||
export default function EventTabsLayout() {
|
export default function EventTabsLayout() {
|
||||||
|
const navigation = useNavigation();
|
||||||
|
|
||||||
|
const { from, category } = useLocalSearchParams<{
|
||||||
|
from?: string;
|
||||||
|
category?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
console.log("from", from);
|
||||||
|
console.log("category", category);
|
||||||
|
|
||||||
|
// Atur header secara dinamis
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
navigation.setOptions({
|
||||||
|
headerLeft: () => (
|
||||||
|
<BackButtonFromNotification
|
||||||
|
from={from as string}
|
||||||
|
category={category as string}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}, [from, router, navigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs screenOptions={TabsStyles}>
|
<Tabs screenOptions={TabsStyles}>
|
||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
|
|||||||
@@ -11,15 +11,17 @@ import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
|
|||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
||||||
import { apiEventGetByStatus } from "@/service/api-client/api-event";
|
import { apiEventGetByStatus } from "@/service/api-client/api-event";
|
||||||
import { useFocusEffect } from "expo-router";
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
export default function EventStatus() {
|
export default function EventStatus() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
|
const { status } = useLocalSearchParams<{ status?: string }>();
|
||||||
|
|
||||||
const id = user?.id || "";
|
const id = user?.id || "";
|
||||||
const [activeCategory, setActiveCategory] = useState<string | null>(
|
const [activeCategory, setActiveCategory] = useState<string | null>(
|
||||||
"publish"
|
status || "publish"
|
||||||
);
|
);
|
||||||
const [listData, setListData] = useState([]);
|
const [listData, setListData] = useState([]);
|
||||||
const [loadingGetData, setLoadingGetData] = useState(false);
|
const [loadingGetData, setLoadingGetData] = useState(false);
|
||||||
@@ -73,7 +75,7 @@ export default function EventStatus() {
|
|||||||
listData.map((item: any, i) => (
|
listData.map((item: any, i) => (
|
||||||
<BoxWithHeaderSection
|
<BoxWithHeaderSection
|
||||||
key={i}
|
key={i}
|
||||||
href={`/event/${item.id }/${activeCategory}/detail-event`}
|
href={`/event/${item.id}/${activeCategory}/detail-event`}
|
||||||
>
|
>
|
||||||
<StackCustom gap={"xs"}>
|
<StackCustom gap={"xs"}>
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export default function EventDetailHistory() {
|
|||||||
<DrawerCustom
|
<DrawerCustom
|
||||||
isVisible={openDrawer}
|
isVisible={openDrawer}
|
||||||
closeDrawer={() => setOpenDrawer(false)}
|
closeDrawer={() => setOpenDrawer(false)}
|
||||||
height={250}
|
height={"auto"}
|
||||||
>
|
>
|
||||||
<MenuDrawerDynamicGrid
|
<MenuDrawerDynamicGrid
|
||||||
data={menuDrawerPublishEvent({ id: id as string })}
|
data={menuDrawerPublishEvent({ id: id as string })}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
|
BackButton,
|
||||||
ButtonCustom,
|
ButtonCustom,
|
||||||
DotButton,
|
DotButton,
|
||||||
DrawerCustom,
|
DrawerCustom,
|
||||||
LoaderCustom,
|
|
||||||
MenuDrawerDynamicGrid,
|
MenuDrawerDynamicGrid,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
||||||
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
||||||
import LeftButtonCustom from "@/components/Button/BackButton";
|
import LeftButtonCustom from "@/components/Button/BackButton";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import Event_BoxDetailPublishSection from "@/screens/Event/BoxDetailPublishSection";
|
import Event_BoxDetailPublishSection from "@/screens/Event/BoxDetailPublishSection";
|
||||||
@@ -18,23 +19,26 @@ import {
|
|||||||
apiEventGetOne,
|
apiEventGetOne,
|
||||||
apiEventJoin,
|
apiEventJoin,
|
||||||
} from "@/service/api-client/api-event";
|
} from "@/service/api-client/api-event";
|
||||||
|
import dayjs from "dayjs";
|
||||||
import {
|
import {
|
||||||
|
Redirect,
|
||||||
router,
|
router,
|
||||||
Stack,
|
Stack,
|
||||||
useFocusEffect,
|
useFocusEffect,
|
||||||
useLocalSearchParams,
|
useLocalSearchParams,
|
||||||
} from "expo-router";
|
} from "expo-router";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function EventDetailPublish() {
|
export default function EventDetailPublish() {
|
||||||
const { id } = useLocalSearchParams();
|
const now = new Date().toISOString();
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
|
const { id } = useLocalSearchParams();
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
const [isLoadingData, setIsLoadingData] = useState(false);
|
const [isLoadingData, setIsLoadingData] = useState(false);
|
||||||
const [isLoadingJoin, setIsLoadingJoin] = useState(false);
|
const [isLoadingJoin, setIsLoadingJoin] = useState(false);
|
||||||
|
|
||||||
const [data, setData] = useState();
|
const [data, setData] = useState<any>();
|
||||||
const [isParticipant, setIsParticipant] = useState<boolean | null>(null);
|
const [isParticipant, setIsParticipant] = useState<boolean | null>(null);
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
@@ -55,8 +59,6 @@ export default function EventDetailPublish() {
|
|||||||
userId: user?.id as string,
|
userId: user?.id as string,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RES CHECK PARTICIPANTS]", responseCheckParticipants);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
responseCheckParticipants.success &&
|
responseCheckParticipants.success &&
|
||||||
responseCheckParticipants.data
|
responseCheckParticipants.data
|
||||||
@@ -108,7 +110,24 @@ export default function EventDetailPublish() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const footerButton = () => {
|
const isEventFinished =
|
||||||
|
id && data?.tanggalSelesai && dayjs(data.tanggalSelesai).isBefore(now);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isEventFinished) {
|
||||||
|
router.replace(`/(application)/(user)/event/${id}/history`);
|
||||||
|
}
|
||||||
|
}, [isEventFinished, id]);
|
||||||
|
|
||||||
|
if (isEventFinished) {
|
||||||
|
return (
|
||||||
|
<ViewWrapper>
|
||||||
|
<CustomSkeleton />
|
||||||
|
</ViewWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const FooterButton = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
@@ -138,17 +157,17 @@ export default function EventDetailPublish() {
|
|||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
title: `Event Publish`,
|
title: `Event Publish`,
|
||||||
headerLeft: () => <LeftButtonCustom />,
|
headerLeft: () => <BackButton onPress={() => router.back()} />,
|
||||||
headerRight: () => <DotButton onPress={() => setOpenDrawer(true)} />,
|
headerRight: () => <DotButton onPress={() => setOpenDrawer(true)} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
{isLoadingData ? (
|
{isLoadingData ? (
|
||||||
<LoaderCustom />
|
<CustomSkeleton height={400} />
|
||||||
) : (
|
) : (
|
||||||
<Event_BoxDetailPublishSection
|
<Event_BoxDetailPublishSection
|
||||||
data={data}
|
data={data}
|
||||||
footerButton={footerButton()}
|
footerButton={FooterButton()}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { apiEventCreate } from "@/service/api-client/api-event";
|
|||||||
import { apiMasterEventType } from "@/service/api-client/api-master";
|
import { apiMasterEventType } from "@/service/api-client/api-master";
|
||||||
import { DateTimePickerEvent } from "@react-native-community/datetimepicker";
|
import { DateTimePickerEvent } from "@react-native-community/datetimepicker";
|
||||||
import { router } from "expo-router";
|
import { router } from "expo-router";
|
||||||
import React, { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
interface EventCreateProps {
|
interface EventCreateProps {
|
||||||
@@ -78,23 +78,6 @@ export default function EventCreate() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (selectedDate) {
|
|
||||||
// console.log("Tanggal yang dipilih:", selectedDate);
|
|
||||||
// console.log(`ISO Format ${Platform.OS}:`, selectedDate.toString());
|
|
||||||
|
|
||||||
// // Kirim ke API atau proses lanjutan
|
|
||||||
// } else {
|
|
||||||
// console.log("Tanggal belum dipilih");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (selectedEndDate) {
|
|
||||||
// console.log("Tanggal yang dipilih:", selectedEndDate);
|
|
||||||
// console.log(`ISO Format ${Platform.OS}:`, selectedEndDate.toString());
|
|
||||||
// // Kirim ke API atau proses lanjutan
|
|
||||||
// } else {
|
|
||||||
// console.log("Tanggal berakhir belum dipilih");
|
|
||||||
// }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
@@ -110,7 +93,7 @@ export default function EventCreate() {
|
|||||||
const response = await apiEventCreate(newData);
|
const response = await apiEventCreate(newData);
|
||||||
console.log("Response", JSON.stringify(response, null, 2));
|
console.log("Response", JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
router.replace("/event/status");
|
router.replace("/event/status?status=review");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -1,271 +1,11 @@
|
|||||||
import {
|
import DetailForum from "@/screens/Forum/DetailForum";
|
||||||
ButtonCustom,
|
import DetailForum2 from "@/screens/Forum/DetailForum2";
|
||||||
DrawerCustom,
|
|
||||||
LoaderCustom,
|
|
||||||
Spacing,
|
|
||||||
TextAreaCustom,
|
|
||||||
TextCustom,
|
|
||||||
ViewWrapper,
|
|
||||||
} from "@/components";
|
|
||||||
import AlertWarning from "@/components/Alert/AlertWarning";
|
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
|
||||||
import Forum_CommentarBoxSection from "@/screens/Forum/CommentarBoxSection";
|
|
||||||
import Forum_BoxDetailSection from "@/screens/Forum/DiscussionBoxSection";
|
|
||||||
import Forum_MenuDrawerBerandaSection from "@/screens/Forum/MenuDrawerSection.tsx/MenuBeranda";
|
|
||||||
import Forum_MenuDrawerCommentar from "@/screens/Forum/MenuDrawerSection.tsx/MenuCommentar";
|
|
||||||
import {
|
|
||||||
apiForumCreateComment,
|
|
||||||
apiForumGetComment,
|
|
||||||
apiForumGetOne,
|
|
||||||
apiForumUpdateStatus,
|
|
||||||
} from "@/service/api-client/api-forum";
|
|
||||||
import { isBadContent } from "@/utils/badWordsIndonesia";
|
|
||||||
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useCallback, useEffect, useState } from "react";
|
|
||||||
import { Alert } from "react-native";
|
|
||||||
|
|
||||||
interface CommentProps {
|
|
||||||
id: string;
|
|
||||||
isActive: boolean;
|
|
||||||
komentar: string;
|
|
||||||
createdAt: Date;
|
|
||||||
authorId: string;
|
|
||||||
Author: {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
Profile: {
|
|
||||||
id: string;
|
|
||||||
imageId: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function ForumDetail() {
|
export default function ForumDetail() {
|
||||||
const { id } = useLocalSearchParams();
|
|
||||||
const { user } = useAuth();
|
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
|
||||||
const [data, setData] = useState<any | null>(null);
|
|
||||||
const [listComment, setListComment] = useState<CommentProps[] | null>(null);
|
|
||||||
const [isLoadingComment, setLoadingComment] = useState(false);
|
|
||||||
|
|
||||||
// Status
|
|
||||||
const [status, setStatus] = useState("");
|
|
||||||
const [text, setText] = useState("");
|
|
||||||
const [authorId, setAuthorId] = useState("");
|
|
||||||
const [dataId, setDataId] = useState("");
|
|
||||||
|
|
||||||
// Comentar
|
|
||||||
const [openDrawerCommentar, setOpenDrawerCommentar] = useState(false);
|
|
||||||
const [commentId, setCommentId] = useState("");
|
|
||||||
const [commentAuthorId, setCommentAuthorId] = useState("");
|
|
||||||
|
|
||||||
useFocusEffect(
|
|
||||||
useCallback(() => {
|
|
||||||
onLoadData(id as string);
|
|
||||||
}, [id])
|
|
||||||
);
|
|
||||||
|
|
||||||
const onLoadData = async (id: string) => {
|
|
||||||
try {
|
|
||||||
const response = await apiForumGetOne({ id });
|
|
||||||
setData(response.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("[ERROR]", error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
onLoadListComment(id as string);
|
|
||||||
}, [id]);
|
|
||||||
|
|
||||||
const onLoadListComment = async (id: string) => {
|
|
||||||
try {
|
|
||||||
const response = await apiForumGetComment({
|
|
||||||
id: id as string,
|
|
||||||
});
|
|
||||||
setListComment(response.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("[ERROR]", error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Update Status
|
|
||||||
const handlerUpdateStatus = async (value: any) => {
|
|
||||||
try {
|
|
||||||
const response = await apiForumUpdateStatus({
|
|
||||||
id: id as string,
|
|
||||||
data: value,
|
|
||||||
});
|
|
||||||
if (response.success) {
|
|
||||||
setStatus(response.data);
|
|
||||||
setData({
|
|
||||||
...data,
|
|
||||||
ForumMaster_StatusPosting: {
|
|
||||||
status: response.data,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log("[ERROR]", error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create Commentar
|
|
||||||
const handlerCreateCommentar = async () => {
|
|
||||||
if (isBadContent(text)) {
|
|
||||||
AlertWarning({});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newData = {
|
|
||||||
comment: text,
|
|
||||||
authorId: user?.id,
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
setLoadingComment(true);
|
|
||||||
const response = await apiForumCreateComment({
|
|
||||||
id: id as string,
|
|
||||||
data: newData,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.success) {
|
|
||||||
setText("");
|
|
||||||
const newComment = {
|
|
||||||
id: response.data.id,
|
|
||||||
isActive: response.data.isActive,
|
|
||||||
komentar: response.data.komentar,
|
|
||||||
createdAt: response.data.createdAt,
|
|
||||||
authorId: response.data.authorId,
|
|
||||||
Author: response.data.Author,
|
|
||||||
};
|
|
||||||
setListComment((prev) => [newComment, ...(prev || [])]);
|
|
||||||
setData({
|
|
||||||
...data,
|
|
||||||
count: data.count + 1,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log("[ERROR]", error);
|
|
||||||
} finally {
|
|
||||||
setLoadingComment(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper>
|
{/* <DetailForum />; */}
|
||||||
{!data && !listComment ? (
|
<DetailForum2 />
|
||||||
<LoaderCustom />
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
{/* Box Posting */}
|
|
||||||
<Forum_BoxDetailSection
|
|
||||||
data={data}
|
|
||||||
onSetData={() => {
|
|
||||||
setOpenDrawer(true);
|
|
||||||
setStatus(data.ForumMaster_StatusPosting?.status);
|
|
||||||
setAuthorId(data.Author?.id);
|
|
||||||
setDataId(data.id);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Area Commentar */}
|
|
||||||
{data?.ForumMaster_StatusPosting?.status === "Open" && (
|
|
||||||
<>
|
|
||||||
<TextAreaCustom
|
|
||||||
placeholder="Ketik diskusi anda..."
|
|
||||||
maxLength={1000}
|
|
||||||
showCount
|
|
||||||
value={text}
|
|
||||||
onChangeText={setText}
|
|
||||||
style={{
|
|
||||||
marginBottom: 0,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<ButtonCustom
|
|
||||||
isLoading={isLoadingComment}
|
|
||||||
style={{
|
|
||||||
alignSelf: "flex-end",
|
|
||||||
}}
|
|
||||||
onPress={() => {
|
|
||||||
handlerCreateCommentar();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Balas
|
|
||||||
</ButtonCustom>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Spacing height={40} />
|
|
||||||
|
|
||||||
{/* List Commentar */}
|
|
||||||
{_.isEmpty(listComment) ? (
|
|
||||||
<TextCustom align="center" color="gray" size={"small"}>
|
|
||||||
Tidak ada komentar
|
|
||||||
</TextCustom>
|
|
||||||
) : (
|
|
||||||
<TextCustom color="gray">Komentar :</TextCustom>
|
|
||||||
)}
|
|
||||||
<Spacing height={5} />
|
|
||||||
{listComment?.map((item: any, index: number) => (
|
|
||||||
<Forum_CommentarBoxSection
|
|
||||||
key={index}
|
|
||||||
data={item}
|
|
||||||
onSetData={(value) => {
|
|
||||||
setCommentId(value.setCommentId);
|
|
||||||
setOpenDrawerCommentar(value.setOpenDrawer);
|
|
||||||
setCommentAuthorId(value.setCommentAuthorId);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</ViewWrapper>
|
|
||||||
|
|
||||||
{/* Posting Drawer */}
|
|
||||||
<DrawerCustom
|
|
||||||
height={"auto"}
|
|
||||||
isVisible={openDrawer}
|
|
||||||
closeDrawer={() => setOpenDrawer(false)}
|
|
||||||
>
|
|
||||||
<Forum_MenuDrawerBerandaSection
|
|
||||||
id={dataId}
|
|
||||||
authorUsername={data?.Author?.username as string}
|
|
||||||
status={status}
|
|
||||||
setIsDrawerOpen={() => {
|
|
||||||
setOpenDrawer(false);
|
|
||||||
}}
|
|
||||||
authorId={authorId}
|
|
||||||
handlerUpdateStatus={(value: any) => {
|
|
||||||
handlerUpdateStatus(value);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</DrawerCustom>
|
|
||||||
|
|
||||||
{/* Commentar Drawer */}
|
|
||||||
<DrawerCustom
|
|
||||||
height={"auto"}
|
|
||||||
isVisible={openDrawerCommentar}
|
|
||||||
closeDrawer={() => setOpenDrawerCommentar(false)}
|
|
||||||
>
|
|
||||||
<Forum_MenuDrawerCommentar
|
|
||||||
id={commentId as string}
|
|
||||||
commentId={commentId}
|
|
||||||
commentAuthorId={commentAuthorId}
|
|
||||||
setIsDrawerOpen={() => {
|
|
||||||
setOpenDrawerCommentar(false);
|
|
||||||
}}
|
|
||||||
listComment={listComment}
|
|
||||||
setListComment={setListComment}
|
|
||||||
countComment={data?.count}
|
|
||||||
setCountComment={(val: any) => {
|
|
||||||
setData((prev: any) => ({
|
|
||||||
...prev,
|
|
||||||
count: val,
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</DrawerCustom>
|
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { apiForumCreateReportCommentar } from "@/service/api-client/api-master";
|
import { apiForumCreateReportCommentar } from "@/service/api-client/api-forum";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { apiForumCreateReportPosting } from "@/service/api-client/api-master";
|
import { apiForumCreateReportPosting } from "@/service/api-client/api-forum";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
import {
|
||||||
|
BaseBox,
|
||||||
|
NewWrapper,
|
||||||
|
Spacing,
|
||||||
|
StackCustom,
|
||||||
|
TextCustom,
|
||||||
|
} from "@/components";
|
||||||
|
import ListSkeletonComponent from "@/components/_ShareComponent/ListSkeletonComponent";
|
||||||
|
import NoDataText from "@/components/_ShareComponent/NoDataText";
|
||||||
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
||||||
|
import { apiForumGetReportComment } from "@/service/api-client/api-forum";
|
||||||
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
|
export default function ForumPreviewReportComment() {
|
||||||
|
const { id } = useLocalSearchParams();
|
||||||
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
const [listData, setListData] = useState<any | null>(null);
|
||||||
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
// Status
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData(id as string);
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async (id: string) => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await apiForumGetReportComment({ id });
|
||||||
|
setData(response.data);
|
||||||
|
setListData(response?.data?.Forum_ReportKomentar);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<NewWrapper>
|
||||||
|
<StackCustom>
|
||||||
|
<TextCustom color="red" bold>
|
||||||
|
Komentar anda telah melanggar aturan forum ! Admin mengambil
|
||||||
|
tindakan untuk menghapus komentar anda!
|
||||||
|
</TextCustom>
|
||||||
|
{loading ? (
|
||||||
|
<CustomSkeleton height={100} />
|
||||||
|
) : (
|
||||||
|
<BaseBox>
|
||||||
|
<TextCustom>"{data?.komentar ? data?.komentar : "-"}"</TextCustom>
|
||||||
|
</BaseBox>
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
|
|
||||||
|
<Spacing height={10} />
|
||||||
|
<TextCustom bold>Beberapa laporan yang telah diterima</TextCustom>
|
||||||
|
<Spacing height={10} />
|
||||||
|
|
||||||
|
{loading ? (
|
||||||
|
<ListSkeletonComponent />
|
||||||
|
) : _.isEmpty(listData) ? (
|
||||||
|
<NoDataText />
|
||||||
|
) : (
|
||||||
|
listData?.map((e: any, index: number) => (
|
||||||
|
<BaseBox key={index}>
|
||||||
|
{e?.deskripsi ? (
|
||||||
|
<StackCustom gap={"sm"}>
|
||||||
|
<TextCustom bold>Laporan Lainnya</TextCustom>
|
||||||
|
<TextCustom>{e?.deskripsi}</TextCustom>
|
||||||
|
</StackCustom>
|
||||||
|
) : (
|
||||||
|
<StackCustom gap={"sm"}>
|
||||||
|
<TextCustom bold>
|
||||||
|
{e?.ForumMaster_KategoriReport?.title}
|
||||||
|
</TextCustom>
|
||||||
|
<TextCustom>
|
||||||
|
{e?.ForumMaster_KategoriReport?.deskripsi}
|
||||||
|
</TextCustom>
|
||||||
|
</StackCustom>
|
||||||
|
)}
|
||||||
|
</BaseBox>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</NewWrapper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
import {
|
||||||
|
BaseBox,
|
||||||
|
NewWrapper,
|
||||||
|
Spacing,
|
||||||
|
StackCustom,
|
||||||
|
TextCustom,
|
||||||
|
} from "@/components";
|
||||||
|
import ListSkeletonComponent from "@/components/_ShareComponent/ListSkeletonComponent";
|
||||||
|
import NoDataText from "@/components/_ShareComponent/NoDataText";
|
||||||
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
||||||
|
import { apiForumGetReportPosting } from "@/service/api-client/api-forum";
|
||||||
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
|
export default function ForumPreviewReportPosting() {
|
||||||
|
const { id } = useLocalSearchParams();
|
||||||
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
const [listData, setListData] = useState<any | null>(null);
|
||||||
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
// Status
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData(id as string);
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async (id: string) => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await apiForumGetReportPosting({ id });
|
||||||
|
setData(response.data);
|
||||||
|
setListData(response?.data?.Forum_ReportPosting);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<NewWrapper>
|
||||||
|
<StackCustom>
|
||||||
|
<TextCustom color="red" bold>
|
||||||
|
Postingan anda telah melanggar aturan forum ! Admin mengambil
|
||||||
|
tindakan untuk menghapus komentar anda!
|
||||||
|
</TextCustom>
|
||||||
|
{loading ? (
|
||||||
|
<CustomSkeleton height={100} />
|
||||||
|
) : (
|
||||||
|
<BaseBox>
|
||||||
|
<TextCustom>"{data?.diskusi ? data?.diskusi : "-"}"</TextCustom>
|
||||||
|
</BaseBox>
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
|
|
||||||
|
<Spacing height={10} />
|
||||||
|
<TextCustom bold>Beberapa laporan yang telah diterima</TextCustom>
|
||||||
|
<Spacing height={10} />
|
||||||
|
|
||||||
|
{loading ? (
|
||||||
|
<ListSkeletonComponent />
|
||||||
|
) : _.isEmpty(listData) ? (
|
||||||
|
<NoDataText />
|
||||||
|
) : (
|
||||||
|
listData?.map((e: any) => (
|
||||||
|
<BaseBox key={e?.id}>
|
||||||
|
{e?.deskripsi ? (
|
||||||
|
<StackCustom gap={"sm"}>
|
||||||
|
<TextCustom bold>Laporan Lainnya</TextCustom>
|
||||||
|
<TextCustom>{e?.deskripsi}</TextCustom>
|
||||||
|
</StackCustom>
|
||||||
|
) : (
|
||||||
|
<StackCustom gap={"sm"}>
|
||||||
|
<TextCustom bold>
|
||||||
|
{e?.ForumMaster_KategoriReport?.title}
|
||||||
|
</TextCustom>
|
||||||
|
<TextCustom>
|
||||||
|
{e?.ForumMaster_KategoriReport?.deskripsi}
|
||||||
|
</TextCustom>
|
||||||
|
</StackCustom>
|
||||||
|
)}
|
||||||
|
</BaseBox>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</NewWrapper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,7 +8,8 @@ import {
|
|||||||
import { AccentColor, MainColor } from "@/constants/color-palet";
|
import { AccentColor, MainColor } from "@/constants/color-palet";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import Forum_ReportListSection from "@/screens/Forum/ReportListSection";
|
import Forum_ReportListSection from "@/screens/Forum/ReportListSection";
|
||||||
import { apiForumCreateReportCommentar, apiMasterForumReportList } from "@/service/api-client/api-master";
|
import { apiForumCreateReportCommentar } from "@/service/api-client/api-forum";
|
||||||
|
import { apiMasterForumReportList } from "@/service/api-client/api-master";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import {
|
|||||||
import { AccentColor, MainColor } from "@/constants/color-palet";
|
import { AccentColor, MainColor } from "@/constants/color-palet";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import Forum_ReportListSection from "@/screens/Forum/ReportListSection";
|
import Forum_ReportListSection from "@/screens/Forum/ReportListSection";
|
||||||
|
import { apiForumCreateReportPosting } from "@/service/api-client/api-forum";
|
||||||
import {
|
import {
|
||||||
apiForumCreateReportPosting,
|
|
||||||
apiMasterForumReportList,
|
apiMasterForumReportList,
|
||||||
} from "@/service/api-client/api-master";
|
} from "@/service/api-client/api-master";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ import {
|
|||||||
BoxButtonOnFooter,
|
BoxButtonOnFooter,
|
||||||
ButtonCustom,
|
ButtonCustom,
|
||||||
TextAreaCustom,
|
TextAreaCustom,
|
||||||
ViewWrapper
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AlertWarning from "@/components/Alert/AlertWarning";
|
import AlertWarning from "@/components/Alert/AlertWarning";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { apiForumCreate } from "@/service/api-client/api-forum";
|
import { apiForumCreate } from "@/service/api-client/api-forum";
|
||||||
import { isBadContent } from "@/utils/badWordsIndonesia";
|
import { censorText, isBadContent } from "@/utils/badWordsIndonesia";
|
||||||
import { router } from "expo-router";
|
import { router } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert } from "react-native";
|
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function ForumCreate() {
|
export default function ForumCreate() {
|
||||||
@@ -19,16 +18,22 @@ export default function ForumCreate() {
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const handlerSubmit = async () => {
|
const handlerSubmit = async () => {
|
||||||
|
if (text.trim() === "") {
|
||||||
if (isBadContent(text)) {
|
AlertWarning({
|
||||||
AlertWarning({})
|
title: "Lengkapi Data",
|
||||||
|
description: "Postingan tidak boleh kosong",
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bisa di sensor atau return dan tidak bisa di post
|
||||||
|
const cencorContent = censorText(text)
|
||||||
|
|
||||||
const newData = {
|
const newData = {
|
||||||
diskusi: text,
|
diskusi: cencorContent,
|
||||||
authorId: user?.id,
|
authorId: user?.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const response = await apiForumCreate({ data: newData });
|
const response = await apiForumCreate({ data: newData });
|
||||||
@@ -50,6 +55,7 @@ export default function ForumCreate() {
|
|||||||
const buttonFooter = (
|
const buttonFooter = (
|
||||||
<BoxButtonOnFooter>
|
<BoxButtonOnFooter>
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
|
disabled={!text.trim() || isLoading}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handlerSubmit();
|
handlerSubmit();
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import Forum_ViewBeranda from "@/screens/Forum/ViewBeranda";
|
import Forum_ViewBeranda from "@/screens/Forum/ViewBeranda";
|
||||||
import Forum_ViewBeranda2 from "@/screens/Forum/ViewBeranda2";
|
import Forum_ViewBeranda2 from "@/screens/Forum/ViewBeranda2";
|
||||||
|
import Forum_ViewBeranda3 from "@/screens/Forum/ViewBeranda3";
|
||||||
|
|
||||||
export default function Forum() {
|
export default function Forum() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* <Forum_ViewBeranda /> */}
|
{/* <Forum_ViewBeranda /> */}
|
||||||
<Forum_ViewBeranda2 />
|
{/* <Forum_ViewBeranda2 /> */}
|
||||||
|
<Forum_ViewBeranda3 />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import { ButtonCustom, StackCustom, ViewWrapper } from "@/components";
|
import { StackCustom, ViewWrapper } from "@/components";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { useNotificationStore } from "@/hooks/use-notification-store";
|
import { useNotificationStore } from "@/hooks/use-notification-store";
|
||||||
@@ -23,14 +23,12 @@ export default function Application() {
|
|||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
const { syncUnreadCount } = useNotificationStore();
|
const { syncUnreadCount } = useNotificationStore();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
checkVersion();
|
checkVersion();
|
||||||
userData(token as string);
|
userData(token as string);
|
||||||
syncUnreadCount()
|
syncUnreadCount();
|
||||||
}, [user?.id, token])
|
}, [user?.id, token])
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -56,10 +54,10 @@ export default function Application() {
|
|||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (user && user?.termsOfServiceAccepted === false) {
|
// if (user && user?.termsOfServiceAccepted === false) {
|
||||||
console.log("User is not accept term service");
|
// console.log("User is not accept term service");
|
||||||
return <Redirect href={`/terms-agreement`} />;
|
// return <Redirect href={`/terms-agreement`} />;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (data && data?.active === false) {
|
if (data && data?.active === false) {
|
||||||
console.log("User is not active");
|
console.log("User is not active");
|
||||||
|
|||||||
@@ -1,9 +1,33 @@
|
|||||||
|
import BackButtonFromNotification from "@/components/Button/BackButtonFromNotification";
|
||||||
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
import { TabsStyles } from "@/styles/tabs-styles";
|
import { TabsStyles } from "@/styles/tabs-styles";
|
||||||
import { Feather, FontAwesome6, Ionicons } from "@expo/vector-icons";
|
import { Feather, FontAwesome6, Ionicons } from "@expo/vector-icons";
|
||||||
import { Tabs } from "expo-router";
|
import { router, Tabs, useLocalSearchParams, useNavigation } from "expo-router";
|
||||||
|
import { useLayoutEffect } from "react";
|
||||||
|
|
||||||
export default function InvestmentTabsLayout() {
|
export default function InvestmentTabsLayout() {
|
||||||
|
// const navigation = useNavigation();
|
||||||
|
|
||||||
|
// const { from, category } = useLocalSearchParams<{
|
||||||
|
// from?: string;
|
||||||
|
// category?: string;
|
||||||
|
// }>();
|
||||||
|
|
||||||
|
// console.log("from", from);
|
||||||
|
// console.log("category", category);
|
||||||
|
|
||||||
|
// // Atur header secara dinamis
|
||||||
|
// useLayoutEffect(() => {
|
||||||
|
// navigation.setOptions({
|
||||||
|
// headerLeft: () => (
|
||||||
|
// <BackButtonFromNotification
|
||||||
|
// from={from as string}
|
||||||
|
// category={category as string}
|
||||||
|
// />
|
||||||
|
// ),
|
||||||
|
// });
|
||||||
|
// }, [from, router, navigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs screenOptions={TabsStyles}>
|
<Tabs screenOptions={TabsStyles}>
|
||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import NoDataText from "@/components/_ShareComponent/NoDataText";
|
import NoDataText from "@/components/_ShareComponent/NoDataText";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import {
|
import { apiInvestmentGetAll } from "@/service/api-client/api-investment";
|
||||||
apiInvestmentGetAll
|
|
||||||
} from "@/service/api-client/api-investment";
|
|
||||||
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
||||||
import { router, useFocusEffect } from "expo-router";
|
import { router, useFocusEffect } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@@ -63,37 +61,20 @@ export default function InvestmentMyHolding() {
|
|||||||
router.push(`/investment/${item?.id}/(my-holding)/${item?.id}`)
|
router.push(`/investment/${item?.id}/(my-holding)/${item?.id}`)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Grid>
|
<StackCustom>
|
||||||
<Grid.Col span={6}>
|
<TextCustom truncate={2}>{item?.title}</TextCustom>
|
||||||
<StackCustom gap={"xs"}>
|
<TextCustom>
|
||||||
<TextCustom truncate={2}>{item?.title}</TextCustom>
|
Rp. {formatCurrencyDisplay(item?.nominal)}
|
||||||
|
</TextCustom>
|
||||||
<Spacing height={5} />
|
<TextCustom>{item?.lembarTerbeli} Lembar</TextCustom>
|
||||||
<TextCustom size="small">
|
<ProgressCustom
|
||||||
Rp. {formatCurrencyDisplay(item?.nominal)}
|
label={`${item.progress}%`}
|
||||||
</TextCustom>
|
value={Number(item.progress)}
|
||||||
<TextCustom size="small">
|
size="lg"
|
||||||
{item?.lembarTerbeli} Lembar
|
animated
|
||||||
</TextCustom>
|
color="primary"
|
||||||
</StackCustom>
|
/>
|
||||||
</Grid.Col>
|
</StackCustom>
|
||||||
<Grid.Col span={1}>
|
|
||||||
<View />
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col
|
|
||||||
span={5}
|
|
||||||
style={{
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProgressCustom
|
|
||||||
value={item?.progress}
|
|
||||||
label={`${item?.progress}%`}
|
|
||||||
size="lg"
|
|
||||||
/>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -9,14 +9,16 @@ import { useAuth } from "@/hooks/use-auth";
|
|||||||
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
||||||
import Investment_StatusBox from "@/screens/Invesment/StatusBox";
|
import Investment_StatusBox from "@/screens/Invesment/StatusBox";
|
||||||
import { apiInvestmentGetByStatus } from "@/service/api-client/api-investment";
|
import { apiInvestmentGetByStatus } from "@/service/api-client/api-investment";
|
||||||
import { useFocusEffect } from "expo-router";
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
export default function InvestmentPortofolio() {
|
export default function InvestmentPortofolio() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
|
const { status } = useLocalSearchParams<{ status?: string }>();
|
||||||
|
|
||||||
const [activeCategory, setActiveCategory] = useState<string | null>(
|
const [activeCategory, setActiveCategory] = useState<string | null>(
|
||||||
"publish"
|
status || "publish"
|
||||||
);
|
);
|
||||||
|
|
||||||
const [listData, setListData] = useState<any[]>([]);
|
const [listData, setListData] = useState<any[]>([]);
|
||||||
|
|||||||
@@ -115,7 +115,11 @@ export default function InvestmentAddNews() {
|
|||||||
onChangeText={(value) => setData({ ...data, deskripsi: value })}
|
onChangeText={(value) => setData({ ...data, deskripsi: value })}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ButtonCustom isLoading={isLoading} onPress={handlerSubmit}>
|
<ButtonCustom
|
||||||
|
disabled={!data.title || !data.deskripsi || isLoading}
|
||||||
|
isLoading={isLoading}
|
||||||
|
onPress={handlerSubmit}
|
||||||
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</ButtonCustom>
|
</ButtonCustom>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import Toast from "react-native-toast-message";
|
|||||||
|
|
||||||
export default function InvestmentInvoice() {
|
export default function InvestmentInvoice() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
console.log("[ID]", id);
|
|
||||||
const [data, setData] = useState<any>({});
|
const [data, setData] = useState<any>({});
|
||||||
const [image, setImage] = useState<IFileData>({
|
const [image, setImage] = useState<IFileData>({
|
||||||
name: "",
|
name: "",
|
||||||
@@ -49,7 +48,6 @@ export default function InvestmentInvoice() {
|
|||||||
category: "invoice",
|
category: "invoice",
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RES INVOICE]", JSON.stringify(response.data, null, 2));
|
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
@@ -64,8 +62,6 @@ export default function InvestmentInvoice() {
|
|||||||
imageUri: image?.uri,
|
imageUri: image?.uri,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RESPONSE UPLOAD IMAGE]", responseUploadImage);
|
|
||||||
|
|
||||||
if (!responseUploadImage?.data?.id) {
|
if (!responseUploadImage?.data?.id) {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -83,10 +79,6 @@ export default function InvestmentInvoice() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
console.log(
|
|
||||||
"[RESPONSE UPDATE]",
|
|
||||||
JSON.stringify(response.data, null, 2)
|
|
||||||
);
|
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "success",
|
type: "success",
|
||||||
text1: "Berhasil mengunggah bukti transfer",
|
text1: "Berhasil mengunggah bukti transfer",
|
||||||
@@ -210,7 +202,6 @@ export default function InvestmentInvoice() {
|
|||||||
pickFile({
|
pickFile({
|
||||||
allowedType: "image",
|
allowedType: "image",
|
||||||
setImageUri(file: any) {
|
setImageUri(file: any) {
|
||||||
console.log("[IMAGE]", file);
|
|
||||||
setImage(file);
|
setImage(file);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -224,7 +215,7 @@ export default function InvestmentInvoice() {
|
|||||||
|
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
disabled={!image}
|
disabled={!image || isLoading}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handlerSubmitUpdate();
|
handlerSubmitUpdate();
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import Investment_ButtonInvestasiSection from "@/screens/Invesment/ButtonInvesta
|
|||||||
import Invesment_ComponentBoxOnBottomDetail from "@/screens/Invesment/ComponentBoxOnBottomDetail";
|
import Invesment_ComponentBoxOnBottomDetail from "@/screens/Invesment/ComponentBoxOnBottomDetail";
|
||||||
import Invesment_DetailDataPublishSection from "@/screens/Invesment/DetailDataPublishSection";
|
import Invesment_DetailDataPublishSection from "@/screens/Invesment/DetailDataPublishSection";
|
||||||
import { apiInvestmentGetOne } from "@/service/api-client/api-investment";
|
import { apiInvestmentGetOne } from "@/service/api-client/api-investment";
|
||||||
|
import { countDownAndCondition } from "@/utils/countDownAndCondition";
|
||||||
import { AntDesign, MaterialIcons } from "@expo/vector-icons";
|
import { AntDesign, MaterialIcons } from "@expo/vector-icons";
|
||||||
import {
|
import {
|
||||||
router,
|
router,
|
||||||
@@ -23,7 +24,7 @@ import {
|
|||||||
useLocalSearchParams,
|
useLocalSearchParams,
|
||||||
} from "expo-router";
|
} from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function InvestmentDetailStatus() {
|
export default function InvestmentDetailStatus() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
@@ -63,6 +64,29 @@ export default function InvestmentDetailStatus() {
|
|||||||
setOpenDrawerPublish(false);
|
setOpenDrawerPublish(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [value, setValue] = useState({
|
||||||
|
sisa: 0,
|
||||||
|
reminder: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
updateCountDown();
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
console.log("[DATA DETAIL]", JSON.stringify(data, null, 2));
|
||||||
|
|
||||||
|
const updateCountDown = () => {
|
||||||
|
const countDown = countDownAndCondition({
|
||||||
|
duration: data?.MasterPencarianInvestor.name,
|
||||||
|
publishTime: data?.countDown,
|
||||||
|
});
|
||||||
|
|
||||||
|
setValue({
|
||||||
|
sisa: countDown.durationDay,
|
||||||
|
reminder: countDown.reminder,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const bottomSection = (
|
const bottomSection = (
|
||||||
<Invesment_ComponentBoxOnBottomDetail
|
<Invesment_ComponentBoxOnBottomDetail
|
||||||
id={data?.id}
|
id={data?.id}
|
||||||
@@ -72,7 +96,11 @@ export default function InvestmentDetailStatus() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const buttonSection = (
|
const buttonSection = (
|
||||||
<Investment_ButtonInvestasiSection id={id as string} isMine={user?.id === data?.author?.id} />
|
<Investment_ButtonInvestasiSection
|
||||||
|
id={id as string}
|
||||||
|
isMine={user?.id === data?.author?.id}
|
||||||
|
reminder={value.reminder}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ import {
|
|||||||
apiInvestmentUpdateData,
|
apiInvestmentUpdateData,
|
||||||
} from "@/service/api-client/api-investment";
|
} from "@/service/api-client/api-investment";
|
||||||
import { apiMasterInvestment } from "@/service/api-client/api-master";
|
import { apiMasterInvestment } from "@/service/api-client/api-master";
|
||||||
import {
|
import { deleteFileService, uploadFileService } from "@/service/upload-service";
|
||||||
deleteFileService,
|
|
||||||
uploadFileService,
|
|
||||||
} from "@/service/upload-service";
|
|
||||||
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
||||||
import pickFile from "@/utils/pickFile";
|
import pickFile from "@/utils/pickFile";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
@@ -70,7 +67,7 @@ export default function InvestmentEdit() {
|
|||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadMaster();
|
onLoadMaster();
|
||||||
onLoadData();
|
onLoadData();
|
||||||
}, [id])
|
}, [id]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadMaster = async () => {
|
const onLoadMaster = async () => {
|
||||||
@@ -178,7 +175,7 @@ export default function InvestmentEdit() {
|
|||||||
const responseUpdate = await apiInvestmentUpdateData({
|
const responseUpdate = await apiInvestmentUpdateData({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
data: newData,
|
data: newData,
|
||||||
category: "data"
|
category: "data",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (responseUpdate.success) {
|
if (responseUpdate.success) {
|
||||||
@@ -256,6 +253,7 @@ export default function InvestmentEdit() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<TextInputCustom
|
<TextInputCustom
|
||||||
|
disabled
|
||||||
required
|
required
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
label="Total Lembar"
|
label="Total Lembar"
|
||||||
|
|||||||
@@ -63,30 +63,28 @@ export default function InvestmentDetail() {
|
|||||||
setOpenDrawerPublish(false);
|
setOpenDrawerPublish(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const [value, setValue] = useState({
|
const [value, setValue] = useState({
|
||||||
sisa: 0,
|
sisa: 0,
|
||||||
reminder: false,
|
reminder: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
updateCountDown();
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
console.log("[DATA DETAIL]", JSON.stringify(data, null, 2));
|
||||||
|
|
||||||
|
const updateCountDown = () => {
|
||||||
|
const countDown = countDownAndCondition({
|
||||||
|
duration: data?.MasterPencarianInvestor.name,
|
||||||
|
publishTime: data?.countDown,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
updateCountDown();
|
|
||||||
}, [data]);
|
|
||||||
|
|
||||||
console.log("[DATA DETAIL]", JSON.stringify(data, null, 2));
|
|
||||||
|
|
||||||
const updateCountDown = () => {
|
|
||||||
const countDown = countDownAndCondition({
|
|
||||||
duration: data?.MasterPencarianInvestor.name,
|
|
||||||
publishTime: data?.countDown,
|
|
||||||
});
|
|
||||||
|
|
||||||
setValue({
|
|
||||||
sisa: countDown.durationDay,
|
|
||||||
reminder: countDown.reminder,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
setValue({
|
||||||
|
sisa: countDown.durationDay,
|
||||||
|
reminder: countDown.reminder,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const bottomSection = (
|
const bottomSection = (
|
||||||
<Invesment_ComponentBoxOnBottomDetail
|
<Invesment_ComponentBoxOnBottomDetail
|
||||||
@@ -97,7 +95,11 @@ export default function InvestmentDetail() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const buttonSection = (
|
const buttonSection = (
|
||||||
<Investment_ButtonInvestasiSection id={id as string} isMine={user?.id === data?.author?.id} reminder={value.reminder} />
|
<Investment_ButtonInvestasiSection
|
||||||
|
id={id as string}
|
||||||
|
isMine={user?.id === data?.author?.id}
|
||||||
|
reminder={value.reminder}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default function InvestmentCreate() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadMaster();
|
onLoadMaster();
|
||||||
}, [])
|
}, []),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadMaster = async () => {
|
const onLoadMaster = async () => {
|
||||||
@@ -167,7 +167,7 @@ export default function InvestmentCreate() {
|
|||||||
text1: "Berhasil",
|
text1: "Berhasil",
|
||||||
text2: response.message,
|
text2: response.message,
|
||||||
});
|
});
|
||||||
router.replace("/investment/portofolio");
|
router.replace("/investment/portofolio?status=review");
|
||||||
} else {
|
} else {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -224,7 +224,6 @@ export default function InvestmentCreate() {
|
|||||||
onPress={() => {
|
onPress={() => {
|
||||||
pickFile({
|
pickFile({
|
||||||
setPdfUri: ({ uri, name, size }) => {
|
setPdfUri: ({ uri, name, size }) => {
|
||||||
|
|
||||||
setPdf({ uri, name, size });
|
setPdf({ uri, name, size });
|
||||||
},
|
},
|
||||||
allowedType: "pdf",
|
allowedType: "pdf",
|
||||||
@@ -265,6 +264,7 @@ export default function InvestmentCreate() {
|
|||||||
|
|
||||||
<StackCustom gap={0}>
|
<StackCustom gap={0}>
|
||||||
<TextInputCustom
|
<TextInputCustom
|
||||||
|
disabled
|
||||||
required
|
required
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
label="Total Lembar"
|
label="Total Lembar"
|
||||||
@@ -357,7 +357,11 @@ export default function InvestmentCreate() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<Spacing />
|
<Spacing />
|
||||||
<ButtonCustom isLoading={isLoading} onPress={() => handleSubmit()}>
|
<ButtonCustom
|
||||||
|
disabled={isLoading}
|
||||||
|
isLoading={isLoading}
|
||||||
|
onPress={() => handleSubmit()}
|
||||||
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</ButtonCustom>
|
</ButtonCustom>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
|
|||||||
@@ -1,34 +1,61 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
|
import { BackButton } from "@/components";
|
||||||
import { IconHome, IconStatus } from "@/components/_Icon";
|
import { IconHome, IconStatus } from "@/components/_Icon";
|
||||||
|
import BackButtonFromNotification from "@/components/Button/BackButtonFromNotification";
|
||||||
import { TabsStyles } from "@/styles/tabs-styles";
|
import { TabsStyles } from "@/styles/tabs-styles";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { Tabs } from "expo-router";
|
import {
|
||||||
|
router,
|
||||||
|
Tabs,
|
||||||
|
useLocalSearchParams,
|
||||||
|
useNavigation
|
||||||
|
} from "expo-router";
|
||||||
|
import { useLayoutEffect } from "react";
|
||||||
|
|
||||||
export default function JobTabsLayout() {
|
export default function JobTabsLayout() {
|
||||||
|
const navigation = useNavigation();
|
||||||
|
|
||||||
|
const { from, category } = useLocalSearchParams<{
|
||||||
|
from?: string;
|
||||||
|
category?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
// Atur header secara dinamis
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
navigation.setOptions({
|
||||||
|
headerLeft: () => (
|
||||||
|
<BackButtonFromNotification from={from as string} category={category as string} />
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}, [from, router, navigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs screenOptions={TabsStyles}>
|
<>
|
||||||
<Tabs.Screen
|
<Tabs screenOptions={TabsStyles}>
|
||||||
name="index"
|
<Tabs.Screen
|
||||||
options={{
|
name="index"
|
||||||
title: "Beranda",
|
options={{
|
||||||
tabBarIcon: ({ color }) => <IconHome color={color} />,
|
title: "Beranda",
|
||||||
}}
|
tabBarIcon: ({ color }) => <IconHome color={color} />,
|
||||||
/>
|
}}
|
||||||
<Tabs.Screen
|
/>
|
||||||
name="status"
|
<Tabs.Screen
|
||||||
options={{
|
name="status"
|
||||||
title: "Status",
|
options={{
|
||||||
tabBarIcon: ({ color }) => <IconStatus color={color} />,
|
title: "Status",
|
||||||
}}
|
tabBarIcon: ({ color }) => <IconStatus color={color} />,
|
||||||
/>
|
}}
|
||||||
<Tabs.Screen
|
/>
|
||||||
name="archive"
|
<Tabs.Screen
|
||||||
options={{
|
name="archive"
|
||||||
title: "Arsip",
|
options={{
|
||||||
tabBarIcon: ({ color }) => (
|
title: "Arsip",
|
||||||
<Ionicons size={20} name="archive" color={color} />
|
tabBarIcon: ({ color }) => (
|
||||||
),
|
<Ionicons size={20} name="archive" color={color} />
|
||||||
}}
|
),
|
||||||
/>
|
}}
|
||||||
</Tabs>
|
/>
|
||||||
|
</Tabs>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,57 +1,10 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import { BaseBox, LoaderCustom, TextCustom, ViewWrapper } from "@/components";
|
import Job_ScreenArchive2 from "@/screens/Job/ScreenArchive2";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
|
||||||
import { apiJobGetAll } from "@/service/api-client/api-job";
|
|
||||||
import { useFocusEffect } from "expo-router";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useCallback, useState } from "react";
|
|
||||||
|
|
||||||
export default function JobArchive() {
|
export default function JobArchive() {
|
||||||
const { user } = useAuth();
|
|
||||||
const [listData, setListData] = useState<any[]>([]);
|
|
||||||
const [isLoadData, setIsLoadData] = useState(false);
|
|
||||||
|
|
||||||
useFocusEffect(
|
|
||||||
useCallback(() => {
|
|
||||||
onLoadData();
|
|
||||||
}, [user?.id])
|
|
||||||
);
|
|
||||||
|
|
||||||
const onLoadData = async () => {
|
|
||||||
try {
|
|
||||||
setIsLoadData(true);
|
|
||||||
const response = await apiJobGetAll({
|
|
||||||
category: "archive",
|
|
||||||
authorId: user?.id,
|
|
||||||
});
|
|
||||||
setListData(response.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("[ERROR]", error);
|
|
||||||
} finally {
|
|
||||||
setIsLoadData(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewWrapper hideFooter>
|
<>
|
||||||
{isLoadData ? (
|
<Job_ScreenArchive2 />
|
||||||
<LoaderCustom />
|
</>
|
||||||
) : _.isEmpty(listData) ? (
|
|
||||||
<TextCustom align="center">Anda tidak memiliki arsip</TextCustom>
|
|
||||||
) : (
|
|
||||||
listData.map((item, index) => (
|
|
||||||
<BaseBox
|
|
||||||
key={index}
|
|
||||||
paddingTop={20}
|
|
||||||
paddingBottom={20}
|
|
||||||
href={`/job/${item.id}/archive`}
|
|
||||||
>
|
|
||||||
<TextCustom align="center" bold truncate size="large">
|
|
||||||
{item?.title || "-"}
|
|
||||||
</TextCustom>
|
|
||||||
</BaseBox>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</ViewWrapper>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,83 +1,10 @@
|
|||||||
import {
|
import Job_ScreenBeranda from "@/screens/Job/ScreenBeranda";
|
||||||
AvatarUsernameAndOtherComponent,
|
import Job_ScreenBeranda2 from "@/screens/Job/ScreenBeranda2";
|
||||||
BoxWithHeaderSection,
|
|
||||||
FloatingButton,
|
|
||||||
LoaderCustom,
|
|
||||||
SearchInput,
|
|
||||||
Spacing,
|
|
||||||
StackCustom,
|
|
||||||
TextCustom,
|
|
||||||
ViewWrapper,
|
|
||||||
} from "@/components";
|
|
||||||
import { apiJobGetAll } from "@/service/api-client/api-job";
|
|
||||||
import { router, useFocusEffect } from "expo-router";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useCallback, useState } from "react";
|
|
||||||
|
|
||||||
export default function JobBeranda() {
|
export default function JobBeranda() {
|
||||||
const [listData, setListData] = useState<any[]>([]);
|
|
||||||
const [isLoadData, setIsLoadData] = useState(false);
|
|
||||||
const [search, setSearch] = useState("");
|
|
||||||
|
|
||||||
useFocusEffect(
|
|
||||||
useCallback(() => {
|
|
||||||
onLoadData(search);
|
|
||||||
}, [search])
|
|
||||||
);
|
|
||||||
|
|
||||||
const onLoadData = async (search: string) => {
|
|
||||||
try {
|
|
||||||
setIsLoadData(true);
|
|
||||||
const response = await apiJobGetAll({ search, category: "beranda" });
|
|
||||||
setListData(response.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("[ERROR]", error);
|
|
||||||
} finally {
|
|
||||||
setIsLoadData(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSearch = (search: string) => {
|
|
||||||
setSearch(search);
|
|
||||||
onLoadData(search);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewWrapper
|
<>
|
||||||
hideFooter
|
<Job_ScreenBeranda2 />
|
||||||
floatingButton={
|
</>
|
||||||
<FloatingButton onPress={() => router.push("/job/create")} />
|
|
||||||
}
|
|
||||||
headerComponent={
|
|
||||||
<SearchInput placeholder="Cari pekerjaan" onChangeText={handleSearch} />
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{isLoadData ? (
|
|
||||||
<LoaderCustom />
|
|
||||||
) : _.isEmpty(listData) ? (
|
|
||||||
<TextCustom align="center">Belum ada lowongan</TextCustom>
|
|
||||||
) : (
|
|
||||||
listData.map((item, index) => (
|
|
||||||
<BoxWithHeaderSection
|
|
||||||
key={index}
|
|
||||||
onPress={() => router.push(`/job/${item.id}`)}
|
|
||||||
>
|
|
||||||
<StackCustom>
|
|
||||||
<AvatarUsernameAndOtherComponent
|
|
||||||
avatar={item?.Author?.Profile?.imageId}
|
|
||||||
avatarHref={`/profile/${item?.Author?.Profile?.id}`}
|
|
||||||
name={item?.Author?.username}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextCustom truncate={2} align="center" bold size="large">
|
|
||||||
{item?.title || "-"}
|
|
||||||
</TextCustom>
|
|
||||||
</StackCustom>
|
|
||||||
<Spacing />
|
|
||||||
</BoxWithHeaderSection>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
<Spacing />
|
|
||||||
</ViewWrapper>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,84 +1,12 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import Job_MainViewStatus from "@/screens/Job/MainViewStatus";
|
||||||
BaseBox,
|
import Job_MainViewStatus2 from "@/screens/Job/MainViewStatus2";
|
||||||
LoaderCustom,
|
|
||||||
ScrollableCustom,
|
|
||||||
TextCustom,
|
|
||||||
ViewWrapper,
|
|
||||||
} from "@/components";
|
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
|
||||||
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
|
||||||
import { apiJobGetByStatus } from "@/service/api-client/api-job";
|
|
||||||
import { useFocusEffect } from "expo-router";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useCallback, useState } from "react";
|
|
||||||
|
|
||||||
export default function JobStatus() {
|
export default function JobStatus() {
|
||||||
const { user } = useAuth();
|
|
||||||
const [activeCategory, setActiveCategory] = useState<string | null>(
|
|
||||||
"publish"
|
|
||||||
);
|
|
||||||
const [listData, setListData] = useState<any[]>([]);
|
|
||||||
const [isLoadList, setIsLoadList] = useState(false);
|
|
||||||
|
|
||||||
useFocusEffect(
|
|
||||||
useCallback(() => {
|
|
||||||
onLoadData();
|
|
||||||
}, [user?.id, activeCategory])
|
|
||||||
);
|
|
||||||
|
|
||||||
const onLoadData = async () => {
|
|
||||||
try {
|
|
||||||
setIsLoadList(true);
|
|
||||||
const response = await apiJobGetByStatus({
|
|
||||||
authorId: user?.id as string,
|
|
||||||
status: activeCategory as string,
|
|
||||||
});
|
|
||||||
setListData(response.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("[ERROR]", error);
|
|
||||||
} finally {
|
|
||||||
setIsLoadList(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handlePress = (item: any) => {
|
|
||||||
setActiveCategory(item.value);
|
|
||||||
// tambahkan logika lain seperti filter dsb.
|
|
||||||
};
|
|
||||||
|
|
||||||
const scrollComponent = (
|
|
||||||
<ScrollableCustom
|
|
||||||
data={dummyMasterStatus.map((e, i) => ({
|
|
||||||
id: i,
|
|
||||||
label: e.label,
|
|
||||||
value: e.value,
|
|
||||||
}))}
|
|
||||||
onButtonPress={handlePress}
|
|
||||||
activeId={activeCategory as any}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewWrapper headerComponent={scrollComponent} hideFooter>
|
<>
|
||||||
{isLoadList ? (
|
{/* <Job_MainViewStatus /> */}
|
||||||
<LoaderCustom />
|
<Job_MainViewStatus2 />
|
||||||
) : _.isEmpty(listData) ? (
|
</>
|
||||||
<TextCustom align="center">Tidak ada data {activeCategory}</TextCustom>
|
|
||||||
) : (
|
|
||||||
listData.map((e, i) => (
|
|
||||||
<BaseBox
|
|
||||||
key={i}
|
|
||||||
paddingTop={20}
|
|
||||||
paddingBottom={20}
|
|
||||||
href={`/job/${e?.id}/${activeCategory}/detail`}
|
|
||||||
>
|
|
||||||
<TextCustom align="center" bold truncate size="large">
|
|
||||||
{e?.title}
|
|
||||||
</TextCustom>
|
|
||||||
</BaseBox>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</ViewWrapper>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export default function JobDetailStatus() {
|
|||||||
<StackCustom gap={"xs"}>
|
<StackCustom gap={"xs"}>
|
||||||
{data &&
|
{data &&
|
||||||
data?.catatan &&
|
data?.catatan &&
|
||||||
(status === "draft" || status === "rejected") && (
|
(status === "draft" || status === "reject") && (
|
||||||
<ReportBox text={data?.catatan} />
|
<ReportBox text={data?.catatan} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ export default function JobDetail() {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const response = await apiJobGetOne({ id: id as string });
|
const response = await apiJobGetOne({ id: id as string });
|
||||||
|
|
||||||
|
console.log("DATA", JSON.stringify(response.data, null,2));
|
||||||
|
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import {
|
import {
|
||||||
|
BoxButtonOnFooter,
|
||||||
ButtonCenteredOnly,
|
ButtonCenteredOnly,
|
||||||
ButtonCustom,
|
ButtonCustom,
|
||||||
InformationBox,
|
InformationBox,
|
||||||
LandscapeFrameUploaded,
|
LandscapeFrameUploaded,
|
||||||
|
NewWrapper,
|
||||||
Spacing,
|
Spacing,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextAreaCustom,
|
TextAreaCustom,
|
||||||
TextInputCustom,
|
TextInputCustom
|
||||||
ViewWrapper
|
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import DIRECTORY_ID from "@/constants/directory-id";
|
import DIRECTORY_ID from "@/constants/directory-id";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
@@ -19,7 +20,7 @@ import { useState } from "react";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function JobCreate() {
|
export default function JobCreate() {
|
||||||
const nextUrl = "/(application)/(user)/job/(tabs)/status";
|
const nextUrl = "/(application)/(user)/job/(tabs)/status?status=review";
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [image, setImage] = useState<string | null>(null);
|
const [image, setImage] = useState<string | null>(null);
|
||||||
@@ -99,16 +100,17 @@ export default function JobCreate() {
|
|||||||
const buttonSubmit = () => {
|
const buttonSubmit = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonCustom isLoading={isLoading} onPress={() => handlerOnSubmit()}>
|
<BoxButtonOnFooter>
|
||||||
Simpan
|
<ButtonCustom isLoading={isLoading} onPress={() => handlerOnSubmit()}>
|
||||||
</ButtonCustom>
|
Simpan
|
||||||
<Spacing />
|
</ButtonCustom>
|
||||||
|
</BoxButtonOnFooter>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewWrapper>
|
<NewWrapper footerComponent={buttonSubmit()}>
|
||||||
<StackCustom gap={"xs"}>
|
<StackCustom gap={"xs"}>
|
||||||
<InformationBox text="Poster atau gambar lowongan kerja bersifat opsional, tidak wajib untuk dimasukkan dan upload lah gambar yang sesuai dengan deskripsi lowongan kerja." />
|
<InformationBox text="Poster atau gambar lowongan kerja bersifat opsional, tidak wajib untuk dimasukkan dan upload lah gambar yang sesuai dengan deskripsi lowongan kerja." />
|
||||||
|
|
||||||
@@ -160,9 +162,7 @@ export default function JobCreate() {
|
|||||||
value={data.deskripsi}
|
value={data.deskripsi}
|
||||||
onChangeText={(value) => setData({ ...data, deskripsi: value })}
|
onChangeText={(value) => setData({ ...data, deskripsi: value })}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{buttonSubmit()}
|
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</NewWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,133 +1,9 @@
|
|||||||
import {
|
import ScreenNotification from "@/screens/Notification/ScreenNotification";
|
||||||
BaseBox,
|
|
||||||
NewWrapper,
|
|
||||||
ScrollableCustom,
|
|
||||||
StackCustom,
|
|
||||||
TextCustom
|
|
||||||
} from "@/components";
|
|
||||||
import ListSkeletonComponent from "@/components/_ShareComponent/ListSkeletonComponent";
|
|
||||||
import { AccentColor } from "@/constants/color-palet";
|
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
|
||||||
import { useNotificationStore } from "@/hooks/use-notification-store";
|
|
||||||
import { apiGetNotificationsById } from "@/service/api-notifications";
|
|
||||||
import { listOfcategoriesAppNotification } from "@/types/type-notification-category";
|
|
||||||
import { formatChatTime } from "@/utils/formatChatTime";
|
|
||||||
import { router, useFocusEffect } from "expo-router";
|
|
||||||
import { useCallback, useState } from "react";
|
|
||||||
import { RefreshControl, View } from "react-native";
|
|
||||||
|
|
||||||
const selectedCategory = (value: string) => {
|
export default function Notification() {
|
||||||
const category = listOfcategoriesAppNotification.find((c) => c.value === value);
|
|
||||||
return category?.label;
|
|
||||||
};
|
|
||||||
|
|
||||||
const BoxNotification = ({
|
|
||||||
data,
|
|
||||||
activeCategory,
|
|
||||||
}: {
|
|
||||||
data: any;
|
|
||||||
activeCategory: string | null;
|
|
||||||
}) => {
|
|
||||||
const { markAsRead } = useNotificationStore();
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BaseBox
|
<ScreenNotification />
|
||||||
backgroundColor={data.isRead ? AccentColor.darkblue : AccentColor.blue}
|
|
||||||
onPress={() => {
|
|
||||||
console.log(
|
|
||||||
"Notification >",
|
|
||||||
selectedCategory(activeCategory as string)
|
|
||||||
);
|
|
||||||
router.push(data.deepLink);
|
|
||||||
markAsRead(data.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<StackCustom>
|
|
||||||
<TextCustom truncate={2} bold>
|
|
||||||
{data.title}
|
|
||||||
</TextCustom>
|
|
||||||
|
|
||||||
<TextCustom truncate={2}>{data.pesan}</TextCustom>
|
|
||||||
|
|
||||||
<TextCustom size="small" color="gray">
|
|
||||||
{formatChatTime(data.createdAt)}
|
|
||||||
</TextCustom>
|
|
||||||
</StackCustom>
|
|
||||||
</BaseBox>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
export default function Notifications() {
|
|
||||||
const { user } = useAuth();
|
|
||||||
const [activeCategory, setActiveCategory] = useState<string | null>("event");
|
|
||||||
const [listData, setListData] = useState<any[]>([]);
|
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
|
||||||
const [loading, setLoading] = useState(false);
|
|
||||||
|
|
||||||
const handlePress = (item: any) => {
|
|
||||||
setActiveCategory(item.value);
|
|
||||||
// tambahkan logika lain seperti filter dsb.
|
|
||||||
};
|
|
||||||
|
|
||||||
useFocusEffect(
|
|
||||||
useCallback(() => {
|
|
||||||
fecthData();
|
|
||||||
}, [activeCategory])
|
|
||||||
);
|
|
||||||
|
|
||||||
const fecthData = async () => {
|
|
||||||
try {
|
|
||||||
setLoading(true);
|
|
||||||
const response = await apiGetNotificationsById({
|
|
||||||
id: user?.id as any,
|
|
||||||
category: activeCategory as any,
|
|
||||||
});
|
|
||||||
// console.log("Response Notification", JSON.stringify(response, null, 2));
|
|
||||||
if (response.success) {
|
|
||||||
setListData(response.data);
|
|
||||||
} else {
|
|
||||||
setListData([]);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log("Error Notification", error);
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onRefresh = () => {
|
|
||||||
setRefreshing(true);
|
|
||||||
fecthData();
|
|
||||||
setRefreshing(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<NewWrapper
|
|
||||||
headerComponent={
|
|
||||||
<ScrollableCustom
|
|
||||||
data={listOfcategoriesAppNotification.map((e, i) => ({
|
|
||||||
id: i,
|
|
||||||
label: e.label,
|
|
||||||
value: e.value,
|
|
||||||
}))}
|
|
||||||
onButtonPress={handlePress}
|
|
||||||
activeId={activeCategory as string}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
refreshControl={
|
|
||||||
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{loading ? (
|
|
||||||
<ListSkeletonComponent/>
|
|
||||||
) : (
|
|
||||||
listData.map((e, i) => (
|
|
||||||
<View key={i}>
|
|
||||||
<BoxNotification data={e} activeCategory={activeCategory as any} />
|
|
||||||
</View>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</NewWrapper>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
CenterCustom,
|
CenterCustom,
|
||||||
Grid,
|
Grid,
|
||||||
InformationBox,
|
InformationBox,
|
||||||
|
NewWrapper,
|
||||||
SelectCustom,
|
SelectCustom,
|
||||||
Spacing,
|
Spacing,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
@@ -120,7 +121,7 @@ export default function PortofolioCreate() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewWrapper
|
<NewWrapper
|
||||||
footerComponent={
|
footerComponent={
|
||||||
<Portofolio_ButtonCreate
|
<Portofolio_ButtonCreate
|
||||||
id={id as string}
|
id={id as string}
|
||||||
@@ -357,8 +358,8 @@ export default function PortofolioCreate() {
|
|||||||
setDataMedsos({ ...dataMedsos, youtube: value })
|
setDataMedsos({ ...dataMedsos, youtube: value })
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Spacing />
|
{/* <Spacing /> */}
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</NewWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,15 @@ import {
|
|||||||
BoxButtonOnFooter,
|
BoxButtonOnFooter,
|
||||||
ButtonCustom,
|
ButtonCustom,
|
||||||
CenterCustom,
|
CenterCustom,
|
||||||
|
NewWrapper,
|
||||||
SelectCustom,
|
SelectCustom,
|
||||||
Spacing,
|
Spacing,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextAreaCustom,
|
TextAreaCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
TextInputCustom,
|
TextInputCustom,
|
||||||
ViewWrapper,
|
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
|
import ListSkeletonComponent from "@/components/_ShareComponent/ListSkeletonComponent";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_XLARGE } from "@/constants/constans-value";
|
import { ICON_SIZE_XLARGE } from "@/constants/constans-value";
|
||||||
import {
|
import {
|
||||||
@@ -238,7 +239,7 @@ export default function PortofolioEdit() {
|
|||||||
return !dataArray.some(
|
return !dataArray.some(
|
||||||
(item: any) =>
|
(item: any) =>
|
||||||
!item.MasterSubBidangBisnis.id ||
|
!item.MasterSubBidangBisnis.id ||
|
||||||
item.MasterSubBidangBisnis.id.trim() === ""
|
item.MasterSubBidangBisnis.id.trim() === "",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,16 +320,16 @@ export default function PortofolioEdit() {
|
|||||||
if (!bidangBisnis || !subBidangBisnis) {
|
if (!bidangBisnis || !subBidangBisnis) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper>
|
<NewWrapper>
|
||||||
<ActivityIndicator size="large" color={MainColor.yellow} />
|
<ListSkeletonComponent height={80} />
|
||||||
</ViewWrapper>
|
</NewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper footerComponent={buttonUpdate}>
|
<NewWrapper footerComponent={buttonUpdate}>
|
||||||
<StackCustom gap={"xs"}>
|
<StackCustom gap={"xs"}>
|
||||||
<TextInputCustom
|
<TextInputCustom
|
||||||
required
|
required
|
||||||
@@ -471,7 +472,7 @@ export default function PortofolioEdit() {
|
|||||||
/>
|
/>
|
||||||
<Spacing />
|
<Spacing />
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</NewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,9 @@
|
|||||||
import { TextCustom, ViewWrapper } from "@/components";
|
import ViewListPortofolio from "@/screens/Portofolio/ViewListPortofolio";
|
||||||
import Portofolio_BoxView from "@/screens/Portofolio/BoxPortofolioView";
|
|
||||||
import { apiGetPortofolio } from "@/service/api-client/api-portofolio";
|
|
||||||
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
|
||||||
import { useCallback, useState } from "react";
|
|
||||||
|
|
||||||
export default function ListPortofolio() {
|
export default function ListPortofolio() {
|
||||||
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>
|
<>
|
||||||
{data ? data?.map((item: any, index: number) => (
|
<ViewListPortofolio />
|
||||||
<Portofolio_BoxView key={index} data={item} />
|
</>
|
||||||
)) : <TextCustom>Tidak ada portofolio</TextCustom>}
|
|
||||||
</ViewWrapper>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,9 @@ const ButtonnDot = ({
|
|||||||
isUserCheck: boolean;
|
isUserCheck: boolean;
|
||||||
logout: () => Promise<void>;
|
logout: () => Promise<void>;
|
||||||
}) => {
|
}) => {
|
||||||
const isId = id === undefined || id === null;
|
console.log("[ID] >>", id);
|
||||||
|
|
||||||
|
const isId = id === undefined || id === "undefined";
|
||||||
|
|
||||||
if (isId) {
|
if (isId) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default function ProfileLayout() {
|
|||||||
|
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="[id]/blocked-list"
|
name="[id]/blocked-list"
|
||||||
options={{ title: "Blocked List", headerLeft: () => <BackButton /> }}
|
options={{ title: "Daftar Blokir", headerLeft: () => <BackButton /> }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
|
|||||||
@@ -1,115 +1,11 @@
|
|||||||
import {
|
import UserSearchMainView from "@/screens/UserSeach/MainView";
|
||||||
AvatarComp,
|
import UserSearchMainView_V2 from "@/screens/UserSeach/MainView_V2";
|
||||||
ClickableCustom,
|
|
||||||
Grid,
|
|
||||||
LoaderCustom,
|
|
||||||
Spacing,
|
|
||||||
StackCustom,
|
|
||||||
TextCustom,
|
|
||||||
TextInputCustom,
|
|
||||||
ViewWrapper,
|
|
||||||
} from "@/components";
|
|
||||||
import { MainColor } from "@/constants/color-palet";
|
|
||||||
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
|
||||||
import { apiAllUser } from "@/service/api-client/api-user";
|
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
|
||||||
import { router } from "expo-router";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
export default function UserSearch() {
|
export default function UserSearch() {
|
||||||
const [data, setData] = useState<any[]>([]);
|
|
||||||
const [search, setSearch] = useState<string>("");
|
|
||||||
const [isLoadList, setIsLoadList] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
onLoadData(search);
|
|
||||||
}, [search]);
|
|
||||||
|
|
||||||
const onLoadData = async (search: string) => {
|
|
||||||
try {
|
|
||||||
setIsLoadList(true);
|
|
||||||
const response = await apiAllUser({ search: search });
|
|
||||||
console.log("[DATA USER] >", JSON.stringify(response.data, null, 2));
|
|
||||||
setData(response.data);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("Error fetching data", error);
|
|
||||||
} finally {
|
|
||||||
setIsLoadList(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSearch = (search: string) => {
|
|
||||||
setSearch(search);
|
|
||||||
onLoadData(search);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper
|
{/* <UserSearchMainView /> */}
|
||||||
headerComponent={
|
<UserSearchMainView_V2 />
|
||||||
<TextInputCustom
|
|
||||||
value={search}
|
|
||||||
onChangeText={handleSearch}
|
|
||||||
iconLeft={
|
|
||||||
<Ionicons
|
|
||||||
name="search"
|
|
||||||
size={ICON_SIZE_SMALL}
|
|
||||||
color={MainColor.placeholder}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
placeholder="Cari Pengguna"
|
|
||||||
borderRadius={50}
|
|
||||||
containerStyle={{ marginBottom: 0 }}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<StackCustom>
|
|
||||||
{isLoadList ? (
|
|
||||||
<LoaderCustom />
|
|
||||||
) : !_.isEmpty(data) ? (
|
|
||||||
data?.map((e, index) => {
|
|
||||||
return (
|
|
||||||
<ClickableCustom
|
|
||||||
key={index}
|
|
||||||
onPress={() => {
|
|
||||||
console.log("Ke Profile");
|
|
||||||
router.push(`/profile/${e?.Profile?.id}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col span={2}>
|
|
||||||
<AvatarComp fileId={e?.Profile?.imageId} size="base" />
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={9}>
|
|
||||||
<StackCustom gap={"sm"}>
|
|
||||||
<TextCustom size="large">{e?.username}</TextCustom>
|
|
||||||
<TextCustom size="small">+{e?.nomor}</TextCustom>
|
|
||||||
</StackCustom>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col
|
|
||||||
span={1}
|
|
||||||
style={{
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "flex-end",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Ionicons
|
|
||||||
name="chevron-forward"
|
|
||||||
size={ICON_SIZE_SMALL}
|
|
||||||
color={MainColor.white}
|
|
||||||
/>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
</ClickableCustom>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
) : (
|
|
||||||
<TextCustom align="center">Tidak ditemukan</TextCustom>
|
|
||||||
)}
|
|
||||||
</StackCustom>
|
|
||||||
<Spacing height={50} />
|
|
||||||
</ViewWrapper>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,37 @@
|
|||||||
import {
|
import {
|
||||||
IconContribution,
|
IconContribution,
|
||||||
IconHistory,
|
IconHistory,
|
||||||
IconHome,
|
IconHome,
|
||||||
IconStatus,
|
IconStatus,
|
||||||
} from "@/components/_Icon";
|
} from "@/components/_Icon";
|
||||||
|
import BackButtonFromNotification from "@/components/Button/BackButtonFromNotification";
|
||||||
import { TabsStyles } from "@/styles/tabs-styles";
|
import { TabsStyles } from "@/styles/tabs-styles";
|
||||||
import { Tabs } from "expo-router";
|
import { Tabs, useLocalSearchParams, useNavigation, router } from "expo-router";
|
||||||
|
import { useLayoutEffect } from "react";
|
||||||
|
|
||||||
export default function VotingTabsLayout() {
|
export default function VotingTabsLayout() {
|
||||||
|
const navigation = useNavigation();
|
||||||
|
|
||||||
|
const { from, category } = useLocalSearchParams<{
|
||||||
|
from?: string;
|
||||||
|
category?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
console.log("from", from);
|
||||||
|
console.log("category", category);
|
||||||
|
|
||||||
|
// Atur header secara dinamis
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
navigation.setOptions({
|
||||||
|
headerLeft: () => (
|
||||||
|
<BackButtonFromNotification
|
||||||
|
from={from as string}
|
||||||
|
category={category as string}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
});
|
||||||
|
}, [from, router, navigation]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tabs screenOptions={TabsStyles}>
|
<Tabs screenOptions={TabsStyles}>
|
||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
|
|||||||
@@ -12,15 +12,17 @@ import { useAuth } from "@/hooks/use-auth";
|
|||||||
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
import { dummyMasterStatus } from "@/lib/dummy-data/_master/status";
|
||||||
import { apiVotingGetByStatus } from "@/service/api-client/api-voting";
|
import { apiVotingGetByStatus } from "@/service/api-client/api-voting";
|
||||||
import { dateTimeView } from "@/utils/dateTimeView";
|
import { dateTimeView } from "@/utils/dateTimeView";
|
||||||
import { useFocusEffect } from "expo-router";
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
export default function VotingStatus() {
|
export default function VotingStatus() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
|
const { status } = useLocalSearchParams<{ status?: string }>();
|
||||||
|
|
||||||
const id = user?.id || "";
|
const id = user?.id || "";
|
||||||
const [activeCategory, setActiveCategory] = useState<string | null>(
|
const [activeCategory, setActiveCategory] = useState<string | null>(
|
||||||
"publish"
|
status || "publish"
|
||||||
);
|
);
|
||||||
|
|
||||||
const [listData, setListData] = useState([]);
|
const [listData, setListData] = useState([]);
|
||||||
@@ -86,8 +88,14 @@ export default function VotingStatus() {
|
|||||||
style={{ width: "70%", alignSelf: "center" }}
|
style={{ width: "70%", alignSelf: "center" }}
|
||||||
variant="light"
|
variant="light"
|
||||||
>
|
>
|
||||||
{item?.awalVote && dateTimeView({date: item?.awalVote, withoutTime: true})} -{" "}
|
{item?.awalVote &&
|
||||||
{item?.akhirVote && dateTimeView({date: item?.akhirVote, withoutTime: true})}
|
dateTimeView({
|
||||||
|
date: item?.awalVote,
|
||||||
|
withoutTime: true,
|
||||||
|
})}{" "}
|
||||||
|
-{" "}
|
||||||
|
{item?.akhirVote &&
|
||||||
|
dateTimeView({ date: item?.akhirVote, withoutTime: true })}
|
||||||
</BadgeCustom>
|
</BadgeCustom>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IconArchive, IconContribution } from "@/components/_Icon";
|
import { IconArchive, IconContribution } from "@/components/_Icon";
|
||||||
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
import { IMenuDrawerItem } from "@/components/_Interface/types";
|
||||||
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import Voting_BoxDetailHasilVotingSection from "@/screens/Voting/BoxDetailHasilVotingSection";
|
import Voting_BoxDetailHasilVotingSection from "@/screens/Voting/BoxDetailHasilVotingSection";
|
||||||
import { Voting_BoxDetailPublishSection } from "@/screens/Voting/BoxDetailPublishSection";
|
import { Voting_BoxDetailPublishSection } from "@/screens/Voting/BoxDetailPublishSection";
|
||||||
@@ -22,13 +23,14 @@ import {
|
|||||||
apiVotingUpdateData,
|
apiVotingUpdateData,
|
||||||
} from "@/service/api-client/api-voting";
|
} from "@/service/api-client/api-voting";
|
||||||
import { today } from "@/utils/dateTimeView";
|
import { today } from "@/utils/dateTimeView";
|
||||||
|
import dayjs from "dayjs";
|
||||||
import {
|
import {
|
||||||
router,
|
router,
|
||||||
Stack,
|
Stack,
|
||||||
useFocusEffect,
|
useFocusEffect,
|
||||||
useLocalSearchParams,
|
useLocalSearchParams,
|
||||||
} from "expo-router";
|
} from "expo-router";
|
||||||
import React, { useCallback, useState } from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function VotingDetail() {
|
export default function VotingDetail() {
|
||||||
@@ -119,6 +121,23 @@ export default function VotingDetail() {
|
|||||||
setOpenDrawerPublish(false);
|
setOpenDrawerPublish(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const now = new Date().toISOString();
|
||||||
|
const isEventFinished = id && data?.akhirVote && dayjs(data.akhirVote).isBefore(now);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isEventFinished) {
|
||||||
|
router.replace(`/(application)/(user)/voting/${id}/history`);
|
||||||
|
}
|
||||||
|
}, [isEventFinished, id]);
|
||||||
|
|
||||||
|
if (isEventFinished) {
|
||||||
|
return (
|
||||||
|
<ViewWrapper>
|
||||||
|
<CustomSkeleton />
|
||||||
|
</ViewWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export default function VotingCreate() {
|
|||||||
type: "success",
|
type: "success",
|
||||||
text1: "Data berhasil disimpan",
|
text1: "Data berhasil disimpan",
|
||||||
});
|
});
|
||||||
router.replace("/(application)/(user)/voting/(tabs)/status");
|
router.replace("/(application)/(user)/voting/(tabs)/status?status=review");
|
||||||
} else {
|
} else {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "error",
|
type: "error",
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
BoxButtonOnFooter,
|
BoxButtonOnFooter,
|
||||||
ButtonCenteredOnly,
|
|
||||||
ButtonCustom,
|
ButtonCustom,
|
||||||
InformationBox,
|
InformationBox,
|
||||||
NewWrapper,
|
NewWrapper,
|
||||||
StackCustom,
|
StackCustom
|
||||||
ViewWrapper,
|
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
AlertDefaultSystem,
|
||||||
BadgeCustom,
|
BadgeCustom,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
BoxButtonOnFooter,
|
BoxButtonOnFooter,
|
||||||
@@ -9,6 +10,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import {
|
import {
|
||||||
apiAdminDonationInvoiceDetailById,
|
apiAdminDonationInvoiceDetailById,
|
||||||
apiAdminDonationInvoiceUpdateById,
|
apiAdminDonationInvoiceUpdateById,
|
||||||
@@ -22,6 +24,7 @@ import { useCallback, useState } from "react";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminDonasiTransactionDetail() {
|
export default function AdminDonasiTransactionDetail() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
console.log("[STATUS]", id, status);
|
console.log("[STATUS]", id, status);
|
||||||
|
|
||||||
@@ -33,7 +36,7 @@ export default function AdminDonasiTransactionDetail() {
|
|||||||
onLoadData();
|
onLoadData();
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [id])
|
}, [id]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
@@ -57,6 +60,7 @@ export default function AdminDonasiTransactionDetail() {
|
|||||||
const newData = {
|
const newData = {
|
||||||
donationId: data?.donasiId,
|
donationId: data?.donasiId,
|
||||||
nominal: data?.nominal,
|
nominal: data?.nominal,
|
||||||
|
senderId: user?.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await apiAdminDonationInvoiceUpdateById({
|
const response = await apiAdminDonationInvoiceUpdateById({
|
||||||
@@ -97,7 +101,15 @@ export default function AdminDonasiTransactionDetail() {
|
|||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handlerSubmit();
|
AlertDefaultSystem({
|
||||||
|
title: "Konfirmasi transaksi",
|
||||||
|
message: "Apakah anda yakin ingin menyetujui transaksi ini?",
|
||||||
|
textLeft: "Tidak",
|
||||||
|
textRight: "Ya",
|
||||||
|
onPressRight: () => {
|
||||||
|
handlerSubmit();
|
||||||
|
},
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Terima donasi
|
Terima donasi
|
||||||
@@ -109,7 +121,7 @@ export default function AdminDonasiTransactionDetail() {
|
|||||||
return (
|
return (
|
||||||
<BoxButtonOnFooter>
|
<BoxButtonOnFooter>
|
||||||
<ButtonCustom disabled>
|
<ButtonCustom disabled>
|
||||||
{data?.DonasiMaster_StatusInvoice?.name}
|
{data?.DonasiMaster_StatusInvoice?.name}
|
||||||
</ButtonCustom>
|
</ButtonCustom>
|
||||||
</BoxButtonOnFooter>
|
</BoxButtonOnFooter>
|
||||||
);
|
);
|
||||||
@@ -140,7 +152,7 @@ export default function AdminDonasiTransactionDetail() {
|
|||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{_.startCase(
|
{_.startCase(
|
||||||
(data?.DonasiMaster_StatusInvoice?.name as any) || "-"
|
(data?.DonasiMaster_StatusInvoice?.name as any) || "-",
|
||||||
)}
|
)}
|
||||||
</BadgeCustom>
|
</BadgeCustom>
|
||||||
)) ||
|
)) ||
|
||||||
@@ -157,7 +169,7 @@ export default function AdminDonasiTransactionDetail() {
|
|||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
onPress={() =>
|
onPress={() =>
|
||||||
router.push(
|
router.push(
|
||||||
`/(application)/(image)/preview-image/${data?.imageId}`
|
`/(application)/(image)/preview-image/${data?.imageId}`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import DIRECTORY_ID from "@/constants/directory-id";
|
import DIRECTORY_ID from "@/constants/directory-id";
|
||||||
import { apiAdminDonationDetailById, apiAdminDonationDisbursementOfFundsCreated } from "@/service/api-admin/api-admin-donation";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
|
import {
|
||||||
|
apiAdminDonationDetailById,
|
||||||
|
apiAdminDonationDisbursementOfFundsCreated,
|
||||||
|
} from "@/service/api-admin/api-admin-donation";
|
||||||
import { uploadFileService } from "@/service/upload-service";
|
import { uploadFileService } from "@/service/upload-service";
|
||||||
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
||||||
import pickFile from "@/utils/pickFile";
|
import pickFile from "@/utils/pickFile";
|
||||||
@@ -25,7 +29,7 @@ import Toast from "react-native-toast-message";
|
|||||||
|
|
||||||
export default function AdminDonationDisbursementOfFunds() {
|
export default function AdminDonationDisbursementOfFunds() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
|
const { user } = useAuth();
|
||||||
const [data, setData] = React.useState<any | null>(null);
|
const [data, setData] = React.useState<any | null>(null);
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
|
|
||||||
@@ -40,7 +44,7 @@ export default function AdminDonationDisbursementOfFunds() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
}, [id])
|
}, [id]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
@@ -94,6 +98,7 @@ export default function AdminDonationDisbursementOfFunds() {
|
|||||||
|
|
||||||
const newData = {
|
const newData = {
|
||||||
...value,
|
...value,
|
||||||
|
authorId: user?.id,
|
||||||
imageId: imageId,
|
imageId: imageId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { funUpdateStatusDonation } from "@/screens/Admin/Donation/funDonationUpdateStatus";
|
import { funUpdateStatusDonation } from "@/screens/Admin/Donation/funDonationUpdateStatus";
|
||||||
import {
|
import { apiAdminDonationDetailById } from "@/service/api-admin/api-admin-donation";
|
||||||
apiAdminDonationDetailById
|
|
||||||
} from "@/service/api-admin/api-admin-donation";
|
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminDonationRejectInput() {
|
export default function AdminDonationRejectInput() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
|
|
||||||
const [data, setData] = React.useState<any | null>(null);
|
const [data, setData] = React.useState<any | null>(null);
|
||||||
@@ -24,7 +24,7 @@ export default function AdminDonationRejectInput() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
}, [id])
|
}, [id]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
@@ -48,11 +48,23 @@ export default function AdminDonationRejectInput() {
|
|||||||
changeStatus: "publish" | "review" | "reject";
|
changeStatus: "publish" | "review" | "reject";
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
|
if (!user?.id) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "User tidak ditemukan",
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const response = await funUpdateStatusDonation({
|
const response = await funUpdateStatusDonation({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
data: data,
|
data: {
|
||||||
|
senderId: user?.id as string,
|
||||||
|
catatan: data,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
@@ -61,7 +73,7 @@ export default function AdminDonationRejectInput() {
|
|||||||
text1: "Report gagal",
|
text1: "Report gagal",
|
||||||
});
|
});
|
||||||
|
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Toast.show({
|
Toast.show({
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ export default function AdminEventDetail() {
|
|||||||
const deepLinkURL = `${DEEP_LINK_URL}/event/${id}/confirmation?userId=${user?.id}`;
|
const deepLinkURL = `${DEEP_LINK_URL}/event/${id}/confirmation?userId=${user?.id}`;
|
||||||
const deepLinkURLDEV = `${DEEP_LINK_URL}/--/event/${id}/confirmation?userId=${user?.id}`;
|
const deepLinkURLDEV = `${DEEP_LINK_URL}/--/event/${id}/confirmation?userId=${user?.id}`;
|
||||||
|
|
||||||
const isDevLink = process.env.NODE_ENV === "development" ? deepLinkURLDEV : deepLinkURL;
|
const isDevLink =
|
||||||
|
process.env.NODE_ENV === "development" ? deepLinkURLDEV : deepLinkURL;
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
@@ -126,6 +126,7 @@ export default function AdminEventDetail() {
|
|||||||
const response = await funUpdateStatusEvent({
|
const response = await funUpdateStatusEvent({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus: "publish",
|
changeStatus: "publish",
|
||||||
|
data: { catatan: "", senderId: user?.id as string },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { funUpdateStatusEvent } from "@/screens/Admin/Event/funUpdateStatus";
|
import { funUpdateStatusEvent } from "@/screens/Admin/Event/funUpdateStatus";
|
||||||
import { apiAdminEventById } from "@/service/api-admin/api-admin-event";
|
import { apiAdminEventById } from "@/service/api-admin/api-admin-event";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
@@ -14,9 +15,13 @@ import { useCallback, useState } from "react";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminEventRejectInput() {
|
export default function AdminEventRejectInput() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
|
|
||||||
const [data, setData] = useState<any>("");
|
const [data, setData] = useState<any>({
|
||||||
|
catatan: "",
|
||||||
|
senderId: "",
|
||||||
|
});
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
@@ -45,10 +50,16 @@ export default function AdminEventRejectInput() {
|
|||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
|
const newData = {
|
||||||
|
catatan: data,
|
||||||
|
senderId: user?.id as string,
|
||||||
|
};
|
||||||
|
|
||||||
const response = await funUpdateStatusEvent({
|
const response = await funUpdateStatusEvent({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
data: data,
|
data: newData,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
|
|||||||
@@ -15,12 +15,11 @@ import { IconDot, IconView } from "@/components/_Icon/IconComponent";
|
|||||||
import { IconTrash } from "@/components/_Icon/IconTrash";
|
import { IconTrash } from "@/components/_Icon/IconTrash";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
||||||
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
|
||||||
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
|
||||||
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
||||||
import { GridSpan_NewComponent } from "@/components/_ShareComponent/GridSpan_NewComponent";
|
import { GridSpan_NewComponent } from "@/components/_ShareComponent/GridSpan_NewComponent";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import {
|
import {
|
||||||
apiAdminForumCommentById,
|
apiAdminForumCommentById,
|
||||||
apiAdminForumDeactivateComment,
|
apiAdminForumDeactivateComment,
|
||||||
@@ -35,6 +34,7 @@ import Toast from "react-native-toast-message";
|
|||||||
|
|
||||||
export default function AdminForumReportComment() {
|
export default function AdminForumReportComment() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
|
const { user } = useAuth();
|
||||||
const [data, setData] = useState<any | null>(null);
|
const [data, setData] = useState<any | null>(null);
|
||||||
const [listReport, setListReport] = useState<any[] | null>(null);
|
const [listReport, setListReport] = useState<any[] | null>(null);
|
||||||
const [loadList, setLoadList] = useState(false);
|
const [loadList, setLoadList] = useState(false);
|
||||||
@@ -111,9 +111,13 @@ export default function AdminForumReportComment() {
|
|||||||
|
|
||||||
<AdminComp_BoxTitle title="Daftar Report Komentar" />
|
<AdminComp_BoxTitle title="Daftar Report Komentar" />
|
||||||
|
|
||||||
<StackCustom gap={"sm"}>
|
<StackCustom gap={"sm"}>
|
||||||
<GridSpan_NewComponent
|
<GridSpan_NewComponent
|
||||||
text1={<TextCustom bold align="center">Aksi</TextCustom>}
|
text1={
|
||||||
|
<TextCustom bold align="center">
|
||||||
|
Aksi
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
text2={<TextCustom bold>Pelapor</TextCustom>}
|
text2={<TextCustom bold>Pelapor</TextCustom>}
|
||||||
text3={<TextCustom bold>Kategori Report</TextCustom>}
|
text3={<TextCustom bold>Kategori Report</TextCustom>}
|
||||||
/>
|
/>
|
||||||
@@ -129,22 +133,24 @@ export default function AdminForumReportComment() {
|
|||||||
<View key={index}>
|
<View key={index}>
|
||||||
<GridSpan_NewComponent
|
<GridSpan_NewComponent
|
||||||
text1={
|
text1={
|
||||||
<CenterCustom>
|
<CenterCustom>
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
icon={<IconView size={ICON_SIZE_BUTTON} color="black" />}
|
icon={
|
||||||
onPress={() => {
|
<IconView size={ICON_SIZE_BUTTON} color="black" />
|
||||||
setOpenDrawerAction(true);
|
}
|
||||||
setSelectedReport({
|
onPress={() => {
|
||||||
id: item.id,
|
setOpenDrawerAction(true);
|
||||||
username: item.User?.username,
|
setSelectedReport({
|
||||||
kategori: item.ForumMaster_KategoriReport?.title,
|
id: item.id,
|
||||||
keterangan:
|
username: item.User?.username,
|
||||||
item.ForumMaster_KategoriReport?.deskripsi,
|
kategori: item.ForumMaster_KategoriReport?.title,
|
||||||
deskripsi: item.deskripsi,
|
keterangan:
|
||||||
});
|
item.ForumMaster_KategoriReport?.deskripsi,
|
||||||
}}
|
deskripsi: item.deskripsi,
|
||||||
/>
|
});
|
||||||
</CenterCustom>
|
}}
|
||||||
|
/>
|
||||||
|
</CenterCustom>
|
||||||
}
|
}
|
||||||
text2={
|
text2={
|
||||||
<TextCustom truncate={1}>
|
<TextCustom truncate={1}>
|
||||||
@@ -188,15 +194,18 @@ export default function AdminForumReportComment() {
|
|||||||
onPressRight: async () => {
|
onPressRight: async () => {
|
||||||
const deleteComment = await apiAdminForumDeactivateComment({
|
const deleteComment = await apiAdminForumDeactivateComment({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
|
data: {
|
||||||
|
senderId: user?.id as string,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!deleteComment.success) {
|
// if (!deleteComment.success) {
|
||||||
Toast.show({
|
// Toast.show({
|
||||||
type: "error",
|
// type: "error",
|
||||||
text1: "Komentar gagal dihapus",
|
// text1: "Komentar gagal dihapus",
|
||||||
});
|
// });
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
setOpenDrawer(false);
|
setOpenDrawer(false);
|
||||||
Toast.show({
|
Toast.show({
|
||||||
|
|||||||
@@ -16,12 +16,11 @@ import { IconDot, IconView } from "@/components/_Icon/IconComponent";
|
|||||||
import { IconTrash } from "@/components/_Icon/IconTrash";
|
import { IconTrash } from "@/components/_Icon/IconTrash";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
||||||
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
|
||||||
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
|
||||||
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
||||||
import { GridSpan_NewComponent } from "@/components/_ShareComponent/GridSpan_NewComponent";
|
import { GridSpan_NewComponent } from "@/components/_ShareComponent/GridSpan_NewComponent";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import {
|
import {
|
||||||
apiAdminForumDeactivatePosting,
|
apiAdminForumDeactivatePosting,
|
||||||
apiAdminForumListReportPostingById,
|
apiAdminForumListReportPostingById,
|
||||||
@@ -35,6 +34,7 @@ import { Divider } from "react-native-paper";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminForumReportPosting() {
|
export default function AdminForumReportPosting() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [openDrawerPage, setOpenDrawerPage] = useState(false);
|
const [openDrawerPage, setOpenDrawerPage] = useState(false);
|
||||||
const [openDrawerAction, setOpenDrawerAction] = useState(false);
|
const [openDrawerAction, setOpenDrawerAction] = useState(false);
|
||||||
@@ -215,6 +215,9 @@ export default function AdminForumReportPosting() {
|
|||||||
onPressRight: async () => {
|
onPressRight: async () => {
|
||||||
const response = await apiAdminForumDeactivatePosting({
|
const response = await apiAdminForumDeactivatePosting({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
|
data: {
|
||||||
|
senderId: user?.id as string,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export default function AdminForumReportPosting() {
|
|||||||
<GridSpan_NewComponent
|
<GridSpan_NewComponent
|
||||||
text1={
|
text1={
|
||||||
<TextCustom bold truncate>
|
<TextCustom bold truncate>
|
||||||
Username
|
Pelapor
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
}
|
}
|
||||||
text2={
|
text2={
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButt
|
|||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
||||||
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
||||||
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
||||||
|
import CustomSkeleton from "@/components/_ShareComponent/SkeletonCustom";
|
||||||
import ReportBox from "@/components/Box/ReportBox";
|
import ReportBox from "@/components/Box/ReportBox";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
@@ -28,6 +29,7 @@ import {
|
|||||||
apiAdminInvestmentDetailById,
|
apiAdminInvestmentDetailById,
|
||||||
} from "@/service/api-admin/api-admin-investment";
|
} from "@/service/api-admin/api-admin-investment";
|
||||||
import { colorBadgeStatus } from "@/utils/colorBadge";
|
import { colorBadgeStatus } from "@/utils/colorBadge";
|
||||||
|
import { countDownAndCondition } from "@/utils/countDownAndCondition";
|
||||||
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@@ -40,91 +42,41 @@ export default function AdminInvestmentDetail() {
|
|||||||
|
|
||||||
const [data, setData] = React.useState<any | null>(null);
|
const [data, setData] = React.useState<any | null>(null);
|
||||||
const [isLoading, setLoading] = React.useState(false);
|
const [isLoading, setLoading] = React.useState(false);
|
||||||
|
const [remind, setRemind] = React.useState({
|
||||||
|
sisa: 0,
|
||||||
|
reminder: false,
|
||||||
|
});
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
}, [id])
|
}, [id]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await apiAdminInvestmentDetailById({ id: id as string });
|
const response = await apiAdminInvestmentDetailById({ id: id as string });
|
||||||
// console.log("[GETONE INVEST]", JSON.stringify(response, null, 2));
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
|
|
||||||
|
const duration = response?.data?.MasterPencarianInvestor?.name;
|
||||||
|
const publishTime = response?.data?.countDown;
|
||||||
|
|
||||||
|
const countDown = countDownAndCondition({
|
||||||
|
duration: duration,
|
||||||
|
publishTime: publishTime
|
||||||
|
});
|
||||||
|
|
||||||
|
setRemind({
|
||||||
|
sisa: countDown.durationDay,
|
||||||
|
reminder: countDown.reminder,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log("Error", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const listData = [
|
|
||||||
{
|
|
||||||
label: "Username",
|
|
||||||
value: (data && data?.author?.username) || "-",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Judul",
|
|
||||||
value: (data && data?.title) || "-",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Status",
|
|
||||||
value:
|
|
||||||
data && data?.MasterStatusInvestasi?.name ? (
|
|
||||||
<BadgeCustom
|
|
||||||
color={colorBadgeStatus({
|
|
||||||
status: data?.MasterStatusInvestasi?.name as string,
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{_.startCase(data?.MasterStatusInvestasi?.name as string)}
|
|
||||||
</BadgeCustom>
|
|
||||||
) : (
|
|
||||||
"-"
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Dana Dibutuhkan",
|
|
||||||
value: `Rp. ${
|
|
||||||
(data && data?.targetDana && formatCurrencyDisplay(data?.targetDana)) ||
|
|
||||||
"-"
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Harga Perlembar",
|
|
||||||
value: `Rp. ${
|
|
||||||
(data &&
|
|
||||||
data?.hargaLembar &&
|
|
||||||
formatCurrencyDisplay(data?.hargaLembar)) ||
|
|
||||||
"-"
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Total Lembar",
|
|
||||||
value:
|
|
||||||
(data &&
|
|
||||||
data?.totalLembar &&
|
|
||||||
formatCurrencyDisplay(data?.totalLembar)) ||
|
|
||||||
"-",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "ROI",
|
|
||||||
value: `${(data && data?.roi && data?.roi) || 0} %`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Pembagian Deviden",
|
|
||||||
value: (data && data?.MasterPembagianDeviden?.name) + " bulan" || "-",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Jadwal Pembagian",
|
|
||||||
value: (data && data?.MasterPeriodeDeviden?.name) || "-",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Pencarian Investor",
|
|
||||||
value: (data && data?.MasterPencarianInvestor?.name) + " hari" || "-",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const handlerSubmitPublish = async () => {
|
const handlerSubmitPublish = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -134,7 +86,6 @@ export default function AdminInvestmentDetail() {
|
|||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("[GET ON INVEST]", JSON.stringify(response, null, 2));
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -164,6 +115,16 @@ export default function AdminInvestmentDetail() {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ViewWrapper>
|
||||||
|
<CustomSkeleton height={200} />
|
||||||
|
</ViewWrapper>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper
|
<ViewWrapper
|
||||||
@@ -177,8 +138,8 @@ export default function AdminInvestmentDetail() {
|
|||||||
{status === "publish" && (
|
{status === "publish" && (
|
||||||
<BaseBox>
|
<BaseBox>
|
||||||
<ProgressCustom
|
<ProgressCustom
|
||||||
label={data && `${data.progress}%` || "0%"}
|
label={(data && `${data.progress}%`) || "0%"}
|
||||||
value={data && data.progress || 0}
|
value={(data && data.progress) || 0}
|
||||||
size="lg"
|
size="lg"
|
||||||
/>
|
/>
|
||||||
<Spacing />
|
<Spacing />
|
||||||
@@ -187,7 +148,8 @@ export default function AdminInvestmentDetail() {
|
|||||||
label={<TextCustom bold>Sisa Saham</TextCustom>}
|
label={<TextCustom bold>Sisa Saham</TextCustom>}
|
||||||
value={
|
value={
|
||||||
<TextCustom>
|
<TextCustom>
|
||||||
{data && formatCurrencyDisplay(data && data?.sisaLembar)} lembar
|
{data && formatCurrencyDisplay(data && data?.sisaLembar)}{" "}
|
||||||
|
lembar
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -206,13 +168,15 @@ export default function AdminInvestmentDetail() {
|
|||||||
<BaseBox>
|
<BaseBox>
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<DummyLandscapeImage imageId={data?.imageId} />
|
<DummyLandscapeImage imageId={data?.imageId} />
|
||||||
{listData.map((item, i) => (
|
{listData({ data: data, reminder: remind.reminder })?.map(
|
||||||
<GridSpan_4_8
|
(item, i) => (
|
||||||
key={i}
|
<GridSpan_4_8
|
||||||
label={<TextCustom bold>{item.label}</TextCustom>}
|
key={i}
|
||||||
value={<TextCustom>{item.value}</TextCustom>}
|
label={<TextCustom bold>{item.label}</TextCustom>}
|
||||||
/>
|
value={<TextCustom>{item.value}</TextCustom>}
|
||||||
))}
|
/>
|
||||||
|
),
|
||||||
|
)}
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
|
|
||||||
@@ -230,7 +194,7 @@ export default function AdminInvestmentDetail() {
|
|||||||
}
|
}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
router.push(
|
router.push(
|
||||||
`/(application)/(file)/${data?.prospektusFileId}`
|
`/(application)/(file)/${data?.prospektusFileId}`,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -259,7 +223,7 @@ export default function AdminInvestmentDetail() {
|
|||||||
}
|
}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
router.push(
|
router.push(
|
||||||
`/(application)/(file)/${item?.fileId}`
|
`/(application)/(file)/${item?.fileId}`,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -299,8 +263,8 @@ export default function AdminInvestmentDetail() {
|
|||||||
onReject={() => {
|
onReject={() => {
|
||||||
router.push(
|
router.push(
|
||||||
`/admin/investment/${id}/reject-input?status=${_.lowerCase(
|
`/admin/investment/${id}/reject-input?status=${_.lowerCase(
|
||||||
data?.MasterStatusInvestasi?.name
|
data?.MasterStatusInvestasi?.name,
|
||||||
)}`
|
)}`,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -343,3 +307,67 @@ export default function AdminInvestmentDetail() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const listData = ({ data, reminder }: { data: any; reminder: boolean }) => [
|
||||||
|
{
|
||||||
|
label: "Username",
|
||||||
|
value: (data && data?.author?.username) || "-",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Judul",
|
||||||
|
value: (data && data?.title) || "-",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Status",
|
||||||
|
value:
|
||||||
|
data && data?.MasterStatusInvestasi?.name ? (
|
||||||
|
<BadgeCustom
|
||||||
|
color={colorBadgeStatus({
|
||||||
|
status: reminder ? "periode berakhir" : "publish",
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{reminder
|
||||||
|
? "Periode Berakhir"
|
||||||
|
: _.startCase(data?.MasterStatusInvestasi?.name as string)}
|
||||||
|
</BadgeCustom>
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Dana Dibutuhkan",
|
||||||
|
value: `Rp. ${
|
||||||
|
(data && data?.targetDana && formatCurrencyDisplay(data?.targetDana)) ||
|
||||||
|
"-"
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Harga Perlembar",
|
||||||
|
value: `Rp. ${
|
||||||
|
(data && data?.hargaLembar && formatCurrencyDisplay(data?.hargaLembar)) ||
|
||||||
|
"-"
|
||||||
|
}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Total Lembar",
|
||||||
|
value:
|
||||||
|
(data && data?.totalLembar && formatCurrencyDisplay(data?.totalLembar)) ||
|
||||||
|
"-",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "ROI",
|
||||||
|
value: `${(data && data?.roi && data?.roi) || 0} %`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Pembagian Deviden",
|
||||||
|
value: (data && data?.MasterPembagianDeviden?.name) + " bulan" || "-",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Jadwal Pembagian",
|
||||||
|
value: (data && data?.MasterPeriodeDeviden?.name) || "-",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Pencarian Investor",
|
||||||
|
value: (data && data?.MasterPencarianInvestor?.name) + " hari" || "-",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButt
|
|||||||
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
||||||
import GridTwoView from "@/components/_ShareComponent/GridTwoView";
|
import GridTwoView from "@/components/_ShareComponent/GridTwoView";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import {
|
import {
|
||||||
apiAdminInvestmentGetOneInvoiceById,
|
apiAdminInvestmentGetOneInvoiceById,
|
||||||
apiAdminInvestmentUpdateInvoice,
|
apiAdminInvestmentUpdateInvoice,
|
||||||
@@ -25,6 +26,7 @@ import { useCallback, useState } from "react";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminInvestmentTransactionDetail() {
|
export default function AdminInvestmentTransactionDetail() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [data, setData] = useState<any | null>(null);
|
const [data, setData] = useState<any | null>(null);
|
||||||
const [isLoading, setLoading] = useState<boolean>(false);
|
const [isLoading, setLoading] = useState<boolean>(false);
|
||||||
@@ -32,7 +34,7 @@ export default function AdminInvestmentTransactionDetail() {
|
|||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
}, [id])
|
}, [id]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
@@ -40,7 +42,6 @@ export default function AdminInvestmentTransactionDetail() {
|
|||||||
const response = await apiAdminInvestmentGetOneInvoiceById({
|
const response = await apiAdminInvestmentGetOneInvoiceById({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
});
|
});
|
||||||
// console.log("[RESPONSE]", JSON.stringify(response, null, 2));
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
}
|
}
|
||||||
@@ -92,7 +93,7 @@ export default function AdminInvestmentTransactionDetail() {
|
|||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
onPress={() =>
|
onPress={() =>
|
||||||
router.push(
|
router.push(
|
||||||
`/(application)/(image)/preview-image/${data?.imageId}`
|
`/(application)/(image)/preview-image/${data?.imageId}`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -109,6 +110,13 @@ export default function AdminInvestmentTransactionDetail() {
|
|||||||
}: {
|
}: {
|
||||||
category: "accept" | "deny";
|
category: "accept" | "deny";
|
||||||
}) => {
|
}) => {
|
||||||
|
if (!user?.id) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Gagal update status transaksi",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await apiAdminInvestmentUpdateInvoice({
|
const response = await apiAdminInvestmentUpdateInvoice({
|
||||||
@@ -117,11 +125,10 @@ export default function AdminInvestmentTransactionDetail() {
|
|||||||
data: {
|
data: {
|
||||||
investasiId: data?.investasiId,
|
investasiId: data?.investasiId,
|
||||||
lembarTerbeli: data?.lembarTerbeli,
|
lembarTerbeli: data?.lembarTerbeli,
|
||||||
|
senderId: user?.id as any,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("[RESPONSE SUBMIT]", JSON.stringify(response, null, 2));
|
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -153,6 +160,7 @@ export default function AdminInvestmentTransactionDetail() {
|
|||||||
styleRight={{ paddingLeft: 10 }}
|
styleRight={{ paddingLeft: 10 }}
|
||||||
leftIcon={
|
leftIcon={
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
|
disabled={isLoading}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
backgroundColor={MainColor.red}
|
backgroundColor={MainColor.red}
|
||||||
textColor="white"
|
textColor="white"
|
||||||
@@ -175,6 +183,7 @@ export default function AdminInvestmentTransactionDetail() {
|
|||||||
}
|
}
|
||||||
rightIcon={
|
rightIcon={
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
|
disabled={isLoading}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
AlertDefaultSystem({
|
AlertDefaultSystem({
|
||||||
@@ -198,8 +207,8 @@ export default function AdminInvestmentTransactionDetail() {
|
|||||||
} else if (data?.StatusInvoice?.name === "Gagal") {
|
} else if (data?.StatusInvoice?.name === "Gagal") {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonCustom textColor="red" onPress={() => router.back()}>
|
<ButtonCustom disabled onPress={() => router.back()}>
|
||||||
Gagal
|
Transaksi telah gagal
|
||||||
</ButtonCustom>
|
</ButtonCustom>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,34 +7,39 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
||||||
import { apiAdminInvestasiUpdateByStatus, apiAdminInvestmentDetailById } from "@/service/api-admin/api-admin-investment";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
|
import {
|
||||||
|
apiAdminInvestasiUpdateByStatus,
|
||||||
|
apiAdminInvestmentDetailById,
|
||||||
|
} from "@/service/api-admin/api-admin-investment";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminInvestmentRejectInput() {
|
export default function AdminInvestmentRejectInput() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
console.log("[STATUS]", status);
|
console.log("[STATUS]", status);
|
||||||
const [value, setValue] = useState<any | null>(null);
|
const [value, setValue] = useState<any | null>(null);
|
||||||
const [isLoading , setLoading] = useState(false)
|
const [isLoading, setLoading] = useState(false);
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
onLoadData();
|
onLoadData();
|
||||||
}, [id])
|
}, [id])
|
||||||
);
|
);
|
||||||
|
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await apiAdminInvestmentDetailById({ id: id as string });
|
const response = await apiAdminInvestmentDetailById({ id: id as string });
|
||||||
console.log("[DATA]", JSON.stringify(response, null, 2));
|
console.log("[DATA]", JSON.stringify(response, null, 2));
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setValue(response.data?.catatan);
|
setValue(response.data?.catatan);
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
};
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handlerSubmit = async () => {
|
const handlerSubmit = async () => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
@@ -45,12 +50,23 @@ export default function AdminInvestmentRejectInput() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!user?.id) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "User tidak ditemukan",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(true);
|
||||||
const response = await apiAdminInvestasiUpdateByStatus({
|
const response = await apiAdminInvestasiUpdateByStatus({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
status: "reject",
|
status: "reject",
|
||||||
data: value,
|
data: {
|
||||||
|
catatan: value,
|
||||||
|
senderId: user?.id as string,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RESPONSE]", JSON.stringify(response, null, 2));
|
console.log("[RESPONSE]", JSON.stringify(response, null, 2));
|
||||||
@@ -76,7 +92,7 @@ export default function AdminInvestmentRejectInput() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(["ERROR"], error);
|
console.error(["ERROR"], error);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import { Divider } from "react-native-paper";
|
|||||||
|
|
||||||
export default function AdminInvestmentStatus() {
|
export default function AdminInvestmentStatus() {
|
||||||
const { status } = useLocalSearchParams();
|
const { status } = useLocalSearchParams();
|
||||||
console.log("[STATUS]", status);
|
|
||||||
|
|
||||||
const [listData, setListData] = React.useState<any[] | null>(null);
|
const [listData, setListData] = React.useState<any[] | null>(null);
|
||||||
const [loadData, setLoadingData] = React.useState(false);
|
const [loadData, setLoadingData] = React.useState(false);
|
||||||
const [search, setSearch] = React.useState("");
|
const [search, setSearch] = React.useState("");
|
||||||
@@ -41,7 +39,7 @@ export default function AdminInvestmentStatus() {
|
|||||||
category: status as "publish" | "review" | "reject",
|
category: status as "publish" | "review" | "reject",
|
||||||
search,
|
search,
|
||||||
});
|
});
|
||||||
console.log("[LIST DATA]", JSON.stringify(response, null, 2));
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setListData(response.data);
|
setListData(response.data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
|||||||
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
||||||
import ReportBox from "@/components/Box/ReportBox";
|
import ReportBox from "@/components/Box/ReportBox";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import funUpdateStatusJob from "@/screens/Admin/Job/funUpdateStatus";
|
import funUpdateStatusJob from "@/screens/Admin/Job/funUpdateStatus";
|
||||||
import { apiAdminJobGetById } from "@/service/api-admin/api-admin-job";
|
import { apiAdminJobGetById } from "@/service/api-admin/api-admin-job";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
@@ -23,8 +24,10 @@ import { useCallback, useState } from "react";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminJobDetailStatus() {
|
export default function AdminJobDetailStatus() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
const [data, setData] = useState<any | null>(null);
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
@@ -92,6 +95,9 @@ export default function AdminJobDetailStatus() {
|
|||||||
const response = await funUpdateStatusJob({
|
const response = await funUpdateStatusJob({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
|
data: {
|
||||||
|
senderId: user?.id as string,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
@@ -142,12 +148,15 @@ export default function AdminJobDetailStatus() {
|
|||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
|
|
||||||
{data && data?.catatan && (status === "reject" || status === "review") && (
|
{data &&
|
||||||
<ReportBox text={data?.catatan}/>
|
data?.catatan &&
|
||||||
)}
|
(status === "reject" || status === "review") && (
|
||||||
|
<ReportBox text={data?.catatan} />
|
||||||
|
)}
|
||||||
|
|
||||||
{status === "review" && (
|
{status === "review" && (
|
||||||
<AdminButtonReview
|
<AdminButtonReview
|
||||||
|
isLoading={isLoading}
|
||||||
onPublish={() => {
|
onPublish={() => {
|
||||||
AlertDefaultSystem({
|
AlertDefaultSystem({
|
||||||
title: "Publish",
|
title: "Publish",
|
||||||
@@ -156,6 +165,7 @@ export default function AdminJobDetailStatus() {
|
|||||||
textRight: "Ya",
|
textRight: "Ya",
|
||||||
onPressRight: () => {
|
onPressRight: () => {
|
||||||
handleUpdate({ changeStatus: "publish" });
|
handleUpdate({ changeStatus: "publish" });
|
||||||
|
setIsLoading(true);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ import Toast from "react-native-toast-message";
|
|||||||
|
|
||||||
export default function AdminJobRejectInput() {
|
export default function AdminJobRejectInput() {
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
const [data, setData] = useState<any | null>(null);
|
const [data, setData] = useState({
|
||||||
|
catatan: "",
|
||||||
|
senderId: ""
|
||||||
|
});
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
@@ -48,7 +51,7 @@ export default function AdminJobRejectInput() {
|
|||||||
const response = await funUpdateStatusJob({
|
const response = await funUpdateStatusJob({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
data: data,
|
data: data ,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
@@ -102,8 +105,8 @@ export default function AdminJobRejectInput() {
|
|||||||
headerComponent={<AdminBackButtonAntTitle title="Penolakan Job" />}
|
headerComponent={<AdminBackButtonAntTitle title="Penolakan Job" />}
|
||||||
>
|
>
|
||||||
<TextAreaCustom
|
<TextAreaCustom
|
||||||
value={data}
|
value={data?.catatan}
|
||||||
onChangeText={setData}
|
onChangeText={(text) => setData({ ...data, catatan: text })}
|
||||||
placeholder="Masukan alasan"
|
placeholder="Masukan alasan"
|
||||||
required
|
required
|
||||||
showCount
|
showCount
|
||||||
|
|||||||
@@ -1,19 +1,28 @@
|
|||||||
import {
|
import {
|
||||||
|
AlertDefaultSystem,
|
||||||
BackButton,
|
BackButton,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
|
DrawerCustom,
|
||||||
|
MenuDrawerDynamicGrid,
|
||||||
NewWrapper,
|
NewWrapper,
|
||||||
ScrollableCustom,
|
ScrollableCustom,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IconPlus } from "@/components/_Icon";
|
import { IconPlus } from "@/components/_Icon";
|
||||||
|
import { IconDot } from "@/components/_Icon/IconComponent";
|
||||||
|
import ListSkeletonComponent from "@/components/_ShareComponent/ListSkeletonComponent";
|
||||||
|
import NoDataText from "@/components/_ShareComponent/NoDataText";
|
||||||
import { AccentColor, MainColor } from "@/constants/color-palet";
|
import { AccentColor, MainColor } from "@/constants/color-palet";
|
||||||
|
import { ICON_SIZE_SMALL } from "@/constants/constans-value";
|
||||||
import { useAuth } from "@/hooks/use-auth";
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import { useNotificationStore } from "@/hooks/use-notification-store";
|
import { useNotificationStore } from "@/hooks/use-notification-store";
|
||||||
import { apiGetNotificationsById } from "@/service/api-notifications";
|
import { apiGetNotificationsById } from "@/service/api-notifications";
|
||||||
import { listOfcategoriesAppNotification } from "@/types/type-notification-category";
|
import { listOfcategoriesAppNotification } from "@/types/type-notification-category";
|
||||||
import { formatChatTime } from "@/utils/formatChatTime";
|
import { formatChatTime } from "@/utils/formatChatTime";
|
||||||
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { router, Stack, useFocusEffect } from "expo-router";
|
import { router, Stack, useFocusEffect } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
import { RefreshControl, View } from "react-native";
|
import { RefreshControl, View } from "react-native";
|
||||||
|
|
||||||
@@ -66,6 +75,10 @@ export default function AdminNotification() {
|
|||||||
const [activeCategory, setActiveCategory] = useState<string | null>("event");
|
const [activeCategory, setActiveCategory] = useState<string | null>("event");
|
||||||
const [listData, setListData] = useState<any[]>([]);
|
const [listData, setListData] = useState<any[]>([]);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
|
|
||||||
|
const { markAsReadAll } = useNotificationStore();
|
||||||
|
|
||||||
const handlePress = (item: any) => {
|
const handlePress = (item: any) => {
|
||||||
setActiveCategory(item.value);
|
setActiveCategory(item.value);
|
||||||
@@ -80,11 +93,12 @@ export default function AdminNotification() {
|
|||||||
|
|
||||||
const fecthData = async () => {
|
const fecthData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true);
|
||||||
const response = await apiGetNotificationsById({
|
const response = await apiGetNotificationsById({
|
||||||
id: user?.id as any,
|
id: user?.id as any,
|
||||||
category: activeCategory as any,
|
category: activeCategory as any,
|
||||||
});
|
});
|
||||||
// console.log("Response Notification", JSON.stringify(response, null, 2));
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setListData(response.data);
|
setListData(response.data);
|
||||||
} else {
|
} else {
|
||||||
@@ -92,6 +106,8 @@ export default function AdminNotification() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error Notification", error);
|
console.log("Error Notification", error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -108,9 +124,9 @@ export default function AdminNotification() {
|
|||||||
title: "Admin Notifikasi",
|
title: "Admin Notifikasi",
|
||||||
headerLeft: () => <BackButton />,
|
headerLeft: () => <BackButton />,
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<IconPlus
|
<IconDot
|
||||||
color={MainColor.yellow}
|
color={MainColor.yellow}
|
||||||
onPress={() => router.push("/test-notifications")}
|
onPress={() => setOpenDrawer(true)}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
@@ -132,12 +148,66 @@ export default function AdminNotification() {
|
|||||||
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
|
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{listData.map((e, i) => (
|
{loading ? (
|
||||||
<View key={i}>
|
<ListSkeletonComponent />
|
||||||
<BoxNotification data={e} activeCategory={activeCategory as any} />
|
) : _.isEmpty(listData) ? (
|
||||||
</View>
|
<NoDataText text="Belum ada notifikasi" />
|
||||||
))}
|
) : (
|
||||||
|
listData.map((e, i) => (
|
||||||
|
<View key={i}>
|
||||||
|
<BoxNotification
|
||||||
|
data={e}
|
||||||
|
activeCategory={activeCategory as any}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
))
|
||||||
|
)}
|
||||||
</NewWrapper>
|
</NewWrapper>
|
||||||
|
|
||||||
|
<DrawerCustom
|
||||||
|
isVisible={openDrawer}
|
||||||
|
closeDrawer={() => setOpenDrawer(false)}
|
||||||
|
height={"auto"}
|
||||||
|
>
|
||||||
|
<MenuDrawerDynamicGrid
|
||||||
|
data={[
|
||||||
|
{
|
||||||
|
label: "Tandai Semua Dibaca",
|
||||||
|
value: "read-all",
|
||||||
|
icon: (
|
||||||
|
<Ionicons
|
||||||
|
name="reader-outline"
|
||||||
|
size={ICON_SIZE_SMALL}
|
||||||
|
color={MainColor.white}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
path: "",
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
onPressItem={(item: any) => {
|
||||||
|
console.log("Item", item.value);
|
||||||
|
if (item.value === "read-all") {
|
||||||
|
AlertDefaultSystem({
|
||||||
|
title: "Tandai Semua Dibaca",
|
||||||
|
message:
|
||||||
|
"Apakah Anda yakin ingin menandai semua notifikasi dibaca?",
|
||||||
|
textLeft: "Batal",
|
||||||
|
textRight: "Ya",
|
||||||
|
onPressRight: () => {
|
||||||
|
markAsReadAll(user?.id as any);
|
||||||
|
const data = _.cloneDeep(listData);
|
||||||
|
data.forEach((e) => {
|
||||||
|
e.isRead = true;
|
||||||
|
});
|
||||||
|
setListData(data);
|
||||||
|
onRefresh();
|
||||||
|
setOpenDrawer(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</DrawerCustom>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export default function SuperAdminDetail() {
|
|||||||
const response = await apiAdminUserAccessUpdateStatus({
|
const response = await apiAdminUserAccessUpdateStatus({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
role: data?.masterUserRoleId === "2" ? "user" : "admin",
|
role: data?.masterUserRoleId === "2" ? "user" : "admin",
|
||||||
|
category: "role"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import GridTwoView from "@/components/_ShareComponent/GridTwoView";
|
import GridTwoView from "@/components/_ShareComponent/GridTwoView";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import {
|
import {
|
||||||
apiAdminUserAccessGetById,
|
apiAdminUserAccessGetById,
|
||||||
apiAdminUserAccessUpdateStatus,
|
apiAdminUserAccessUpdateStatus,
|
||||||
@@ -18,6 +19,7 @@ import { useCallback, useState } from "react";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminUserAccessDetail() {
|
export default function AdminUserAccessDetail() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [data, setData] = useState<any | null>(null);
|
const [data, setData] = useState<any | null>(null);
|
||||||
const [loadData, setLoadData] = useState(false);
|
const [loadData, setLoadData] = useState(false);
|
||||||
@@ -33,6 +35,7 @@ export default function AdminUserAccessDetail() {
|
|||||||
try {
|
try {
|
||||||
setLoadData(true);
|
setLoadData(true);
|
||||||
const response = await apiAdminUserAccessGetById({ id: id as string });
|
const response = await apiAdminUserAccessGetById({ id: id as string });
|
||||||
|
console.log("[DATA]", JSON.stringify(response.data, null, 2));
|
||||||
|
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -48,6 +51,7 @@ export default function AdminUserAccessDetail() {
|
|||||||
const response = await apiAdminUserAccessUpdateStatus({
|
const response = await apiAdminUserAccessUpdateStatus({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
active: !data?.active,
|
active: !data?.active,
|
||||||
|
category: "access",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
@@ -61,6 +65,7 @@ export default function AdminUserAccessDetail() {
|
|||||||
type: "success",
|
type: "success",
|
||||||
text1: "Update aktifasi berhasil ",
|
text1: "Update aktifasi berhasil ",
|
||||||
});
|
});
|
||||||
|
|
||||||
router.back();
|
router.back();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR UPDATE STATUS]", error);
|
console.log("[ERROR UPDATE STATUS]", error);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import AdminButtonReview from "@/components/_ShareComponent/Admin/ButtonReview";
|
|||||||
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
import { GridSpan_4_8 } from "@/components/_ShareComponent/GridSpan_4_8";
|
||||||
import ReportBox from "@/components/Box/ReportBox";
|
import ReportBox from "@/components/Box/ReportBox";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import funUpdateStatusVoting from "@/screens/Admin/Voting/funUpdateStatus";
|
import funUpdateStatusVoting from "@/screens/Admin/Voting/funUpdateStatus";
|
||||||
import { apiAdminVotingById } from "@/service/api-admin/api-admin-voting";
|
import { apiAdminVotingById } from "@/service/api-admin/api-admin-voting";
|
||||||
import { colorBadgeStatus } from "@/utils/colorBadge";
|
import { colorBadgeStatus } from "@/utils/colorBadge";
|
||||||
@@ -29,6 +30,7 @@ import { List } from "react-native-paper";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminVotingDetail() {
|
export default function AdminVotingDetail() {
|
||||||
|
const { user } = useAuth();
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
const [data, setData] = useState<any | null>(null);
|
const [data, setData] = useState<any | null>(null);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -139,6 +141,10 @@ export default function AdminVotingDetail() {
|
|||||||
const response = await funUpdateStatusVoting({
|
const response = await funUpdateStatusVoting({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
|
data: {
|
||||||
|
senderId: user?.id as string,
|
||||||
|
catatan: "",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
import AdminButtonReject from "@/components/_ShareComponent/Admin/ButtonReject";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
import funUpdateStatusVoting from "@/screens/Admin/Voting/funUpdateStatus";
|
import funUpdateStatusVoting from "@/screens/Admin/Voting/funUpdateStatus";
|
||||||
import { apiAdminVotingById } from "@/service/api-admin/api-admin-voting";
|
import { apiAdminVotingById } from "@/service/api-admin/api-admin-voting";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
@@ -14,6 +15,7 @@ import { useCallback, useState } from "react";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminVotingRejectInput() {
|
export default function AdminVotingRejectInput() {
|
||||||
|
const { user } = useAuth()
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
const [data, setData] = useState("");
|
const [data, setData] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
@@ -48,7 +50,10 @@ export default function AdminVotingRejectInput() {
|
|||||||
const response = await funUpdateStatusVoting({
|
const response = await funUpdateStatusVoting({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
changeStatus,
|
changeStatus,
|
||||||
data: data,
|
data: {
|
||||||
|
catatan: data,
|
||||||
|
senderId: user?.id as string,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
|
|||||||
@@ -1,16 +1,26 @@
|
|||||||
import { StackCustom, TextCustom, ViewWrapper } from "@/components";
|
import { BackButton, StackCustom, TextCustom, ViewWrapper } from "@/components";
|
||||||
|
import { Stack } from "expo-router";
|
||||||
|
|
||||||
export default function NotFoundScreen() {
|
export default function NotFoundScreen() {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<Stack.Screen
|
||||||
|
options={{ headerShown: true, title: "", headerLeft: () => <BackButton /> }}
|
||||||
|
/>
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
<StackCustom align="center" gap={0} style={{justifyContent: "center", alignItems: "center", flex: 1}}>
|
<StackCustom
|
||||||
<TextCustom size="large" bold style={{fontSize: 100}}>
|
align="center"
|
||||||
|
gap={0}
|
||||||
|
style={{ justifyContent: "center", alignItems: "center", flex: 1 }}
|
||||||
|
>
|
||||||
|
<TextCustom size="large" bold style={{ fontSize: 100 }}>
|
||||||
404
|
404
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
<TextCustom size="large" bold>
|
<TextCustom size="large" bold>
|
||||||
Sorry, File Not Found
|
Sorry, Page Not Found
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
);
|
</>
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|||||||
9
app/eula.tsx
Normal file
9
app/eula.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import EULAView from "@/screens/Authentication/EULAView";
|
||||||
|
|
||||||
|
export default function EULA() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<EULAView />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -12,10 +12,12 @@ const LeftButtonCustom = ({
|
|||||||
path,
|
path,
|
||||||
icon = "arrow-back",
|
icon = "arrow-back",
|
||||||
iconCustom,
|
iconCustom,
|
||||||
|
onPress,
|
||||||
}: {
|
}: {
|
||||||
path?: Href;
|
path?: Href;
|
||||||
icon?: React.ReactNode | any;
|
icon?: React.ReactNode | any;
|
||||||
iconCustom?: React.ReactNode;
|
iconCustom?: React.ReactNode;
|
||||||
|
onPress?: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -26,7 +28,7 @@ const LeftButtonCustom = ({
|
|||||||
name={icon}
|
name={icon}
|
||||||
size={20}
|
size={20}
|
||||||
color={MainColor.yellow}
|
color={MainColor.yellow}
|
||||||
onPress={() => (path ? router.replace(path) : router.back())}
|
onPress={() => (onPress ? onPress() : path ? router.replace(path) : router.back())}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
29
components/Button/BackButtonFromNotification.tsx
Normal file
29
components/Button/BackButtonFromNotification.tsx
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { useRouter } from "expo-router";
|
||||||
|
import { BackButton } from "..";
|
||||||
|
|
||||||
|
export default function BackButtonFromNotification({
|
||||||
|
from,
|
||||||
|
category,
|
||||||
|
}: {
|
||||||
|
from: string;
|
||||||
|
category?: string;
|
||||||
|
}) {
|
||||||
|
const router = useRouter();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<BackButton
|
||||||
|
onPress={() => {
|
||||||
|
if (from === "notifications") {
|
||||||
|
router.replace(`/notifications?category=${category}`);
|
||||||
|
} else {
|
||||||
|
if (from) {
|
||||||
|
router.replace(`/${from}` as any);
|
||||||
|
} else {
|
||||||
|
router.navigate("/home");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -24,8 +24,6 @@ const DateTimePickerCustom: React.FC<Props> = ({
|
|||||||
disabled = false,
|
disabled = false,
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
console.log("Date Android Comp", value)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{Platform.OS === "ios" ? (
|
{Platform.OS === "ios" ? (
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export default function AvatarComp({
|
|||||||
href = `/(application)/(image)/preview-image/${fileId}`,
|
href = `/(application)/(image)/preview-image/${fileId}`,
|
||||||
}: AvatarCompProps) {
|
}: AvatarCompProps) {
|
||||||
const dimension = sizeMap[size];
|
const dimension = sizeMap[size];
|
||||||
|
|
||||||
const avatarImage = () => {
|
const avatarImage = () => {
|
||||||
return (
|
return (
|
||||||
<Avatar.Image
|
<Avatar.Image
|
||||||
@@ -52,8 +51,9 @@ export default function AvatarComp({
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
activeOpacity={0.9}
|
activeOpacity={0.9}
|
||||||
onPress={
|
onPress={
|
||||||
href && fileId ? () => router.navigate(href as any) : onPress
|
href || fileId ? () => router.navigate(href as any) : onPress
|
||||||
}
|
}
|
||||||
|
disabled={!fileId}
|
||||||
>
|
>
|
||||||
{avatarImage()}
|
{avatarImage()}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
33
components/Modal/ModalReactNative.tsx
Normal file
33
components/Modal/ModalReactNative.tsx
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import { Modal, View } from "react-native";
|
||||||
|
|
||||||
|
export default function ModalReactNative({
|
||||||
|
children,
|
||||||
|
isVisible,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
isVisible: boolean;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
animationType="slide"
|
||||||
|
backdropColor={"rgba(0, 0, 0, 0.5)"}
|
||||||
|
visible={isVisible}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||||
|
// margin: 10,
|
||||||
|
marginBlock: 30,
|
||||||
|
padding: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
paddingTop: 30
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -49,7 +49,8 @@ export default function NotificationInitializer() {
|
|||||||
|
|
||||||
const fcmToken = await getToken(messagingInstance);
|
const fcmToken = await getToken(messagingInstance);
|
||||||
if (!fcmToken) {
|
if (!fcmToken) {
|
||||||
logout();
|
console.warn("Tidak bisa mendapatkan FCM token");
|
||||||
|
// logout();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,12 @@ export {
|
|||||||
PADDING_SMALL,
|
PADDING_SMALL,
|
||||||
PADDING_MEDIUM,
|
PADDING_MEDIUM,
|
||||||
PADDING_LARGE,
|
PADDING_LARGE,
|
||||||
|
PAGINATION_DEFAULT_TAKE
|
||||||
};
|
};
|
||||||
|
|
||||||
// OS Height
|
// OS Height
|
||||||
const OS_ANDROID_HEIGHT = 115
|
const OS_ANDROID_HEIGHT = 115
|
||||||
const OS_IOS_HEIGHT = 70
|
const OS_IOS_HEIGHT = 90
|
||||||
const OS_HEIGHT = Platform.OS === "ios" ? OS_IOS_HEIGHT : OS_ANDROID_HEIGHT
|
const OS_HEIGHT = Platform.OS === "ios" ? OS_IOS_HEIGHT : OS_ANDROID_HEIGHT
|
||||||
|
|
||||||
// Text Size
|
// Text Size
|
||||||
@@ -51,3 +52,5 @@ const PADDING_SMALL = 12
|
|||||||
const PADDING_MEDIUM = 16
|
const PADDING_MEDIUM = 16
|
||||||
const PADDING_LARGE = 20
|
const PADDING_LARGE = 20
|
||||||
|
|
||||||
|
// Pagination
|
||||||
|
const PAGINATION_DEFAULT_TAKE = 10;
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ import {
|
|||||||
apiConfig,
|
apiConfig,
|
||||||
apiLogin,
|
apiLogin,
|
||||||
apiRegister,
|
apiRegister,
|
||||||
|
apiUpdatedTermCondition,
|
||||||
apiValidationCode,
|
apiValidationCode,
|
||||||
} from "@/service/api-config";
|
} from "@/service/api-config";
|
||||||
import { apiDeviceTokenDeleted } from "@/service/api-device-token";
|
import { apiDeviceTokenDeleted } from "@/service/api-device-token";
|
||||||
import { IUser } from "@/types/User";
|
import { IUser } from "@/types/User";
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
|
import * as Device from "expo-device";
|
||||||
import { router } from "expo-router";
|
import { router } from "expo-router";
|
||||||
import { createContext, useEffect, useState } from "react";
|
import { createContext, useEffect, useState } from "react";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
import * as Device from "expo-device";
|
|
||||||
|
|
||||||
// --- Types ---
|
// --- Types ---
|
||||||
type AuthContextType = {
|
type AuthContextType = {
|
||||||
@@ -20,7 +21,7 @@ type AuthContextType = {
|
|||||||
isAuthenticated: boolean;
|
isAuthenticated: boolean;
|
||||||
isAdmin: boolean;
|
isAdmin: boolean;
|
||||||
isUserActive: boolean;
|
isUserActive: boolean;
|
||||||
loginWithNomor: (nomor: string) => Promise<void>;
|
loginWithNomor: (nomor: string) => Promise<boolean>;
|
||||||
validateOtp: (nomor: string) => Promise<any>;
|
validateOtp: (nomor: string) => Promise<any>;
|
||||||
logout: () => Promise<void>;
|
logout: () => Promise<void>;
|
||||||
registerUser: (userData: {
|
registerUser: (userData: {
|
||||||
@@ -29,11 +30,15 @@ type AuthContextType = {
|
|||||||
termsOfServiceAccepted: boolean;
|
termsOfServiceAccepted: boolean;
|
||||||
}) => Promise<void>;
|
}) => Promise<void>;
|
||||||
userData: (token: string) => Promise<any>;
|
userData: (token: string) => Promise<any>;
|
||||||
|
acceptedTerms: (
|
||||||
|
nomor: string,
|
||||||
|
onSetModalVisible: (visible: boolean) => void,
|
||||||
|
) => Promise<any>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// --- Create Context ---
|
// --- Create Context ---
|
||||||
export const AuthContext = createContext<AuthContextType | undefined>(
|
export const AuthContext = createContext<AuthContextType | undefined>(
|
||||||
undefined
|
undefined,
|
||||||
);
|
);
|
||||||
|
|
||||||
export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
||||||
@@ -74,29 +79,15 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
const loginWithNomor = async (nomor: string) => {
|
const loginWithNomor = async (nomor: string) => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
console.log("[Masuk provider]", nomor);
|
|
||||||
const response = await apiLogin({ nomor: nomor });
|
const response = await apiLogin({ nomor: nomor });
|
||||||
console.log("[RESPONSE AUTH]", JSON.stringify(response));
|
console.log("[RESPONSE AUTH]", JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
if (response.success) {
|
|
||||||
console.log("[Keluar provider]", nomor);
|
|
||||||
Toast.show({
|
|
||||||
type: "success",
|
|
||||||
text1: "Sukses",
|
|
||||||
text2: "Kode OTP berhasil dikirim",
|
|
||||||
});
|
|
||||||
|
|
||||||
|
if (response.success && response.isAcceptTerms) {
|
||||||
await AsyncStorage.setItem("kode_otp", response.kodeId);
|
await AsyncStorage.setItem("kode_otp", response.kodeId);
|
||||||
router.push(`/verification?nomor=${nomor}`);
|
router.push(`/verification?nomor=${nomor}`);
|
||||||
return;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
router.push(`/register?nomor=${nomor}`);
|
return false;
|
||||||
Toast.show({
|
|
||||||
type: "info",
|
|
||||||
text1: "Info",
|
|
||||||
text2: "Silahkan mendaftar",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.response?.data?.message || "Gagal kirim OTP");
|
throw new Error(error.response?.data?.message || "Gagal kirim OTP");
|
||||||
@@ -105,18 +96,6 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// const loginWithNomor = async (nomor: string) => {
|
|
||||||
// setIsLoading(true);
|
|
||||||
// try {
|
|
||||||
// const response = await apiLogin({ nomor: nomor });
|
|
||||||
// await AsyncStorage.setItem("kode_otp", response.kodeId);
|
|
||||||
// } catch (error: any) {
|
|
||||||
// throw new Error(error.response?.data?.message || "Gagal kirim OTP");
|
|
||||||
// } finally {
|
|
||||||
// setIsLoading(false);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// --- 2. Validasi OTP & cek user ---
|
// --- 2. Validasi OTP & cek user ---
|
||||||
const validateOtp = async (nomor: string) => {
|
const validateOtp = async (nomor: string) => {
|
||||||
try {
|
try {
|
||||||
@@ -164,7 +143,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log("Error validasi otp >>", (error as Error).message || error);
|
console.log("Error validasi otp >>", (error as Error).message || error);
|
||||||
throw new Error(
|
throw new Error(
|
||||||
error.response?.data?.message || "OTP salah atau user tidak ditemukan"
|
error.response?.data?.message || "OTP salah atau user tidak ditemukan",
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@@ -193,7 +172,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.log(
|
console.log(
|
||||||
"[LOAD USER DATA]",
|
"[LOAD USER DATA]",
|
||||||
error.response?.data?.message + "user" || "Gagal mengambil data user"
|
error.response?.data?.message + "user" || "Gagal mengambil data user",
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
@@ -209,7 +188,6 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await apiRegister({ data: userData });
|
const response = await apiRegister({ data: userData });
|
||||||
console.log("[REGISTER FETCH]", JSON.stringify(response, null, 2));
|
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
@@ -239,42 +217,6 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// const registerUser = async (userData: {
|
|
||||||
// username: string;
|
|
||||||
// nomor: string;
|
|
||||||
// termsOfServiceAccepted: boolean;
|
|
||||||
// }) => {
|
|
||||||
// setIsLoading(true);
|
|
||||||
// try {
|
|
||||||
// const response = await apiRegister({ data: userData });
|
|
||||||
// console.log("response", response);
|
|
||||||
|
|
||||||
// const { token } = response;
|
|
||||||
// if (!response.success) {
|
|
||||||
// Toast.show({
|
|
||||||
// type: "info",
|
|
||||||
// text1: "Info",
|
|
||||||
// text2: response.message,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// setToken(token);
|
|
||||||
// await AsyncStorage.setItem("authToken", token);
|
|
||||||
// Toast.show({
|
|
||||||
// type: "success",
|
|
||||||
// text1: "Sukses",
|
|
||||||
// text2: "Anda berhasil terdaftar",
|
|
||||||
// });
|
|
||||||
// router.replace("/(application)/(user)/waiting-room");
|
|
||||||
// return;
|
|
||||||
// } catch (error: any) {
|
|
||||||
// console.log("Error register", error);
|
|
||||||
// } finally {
|
|
||||||
// setIsLoading(false);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// --- 5. Logout ---
|
// --- 5. Logout ---
|
||||||
|
|
||||||
@@ -284,7 +226,8 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
setToken(null);
|
setToken(null);
|
||||||
setUser(null);
|
setUser(null);
|
||||||
|
|
||||||
const deviceId = Device.osInternalBuildId || Device.modelName || "unknown";
|
const deviceId =
|
||||||
|
Device.osInternalBuildId || Device.modelName || "unknown";
|
||||||
|
|
||||||
await AsyncStorage.removeItem("authToken");
|
await AsyncStorage.removeItem("authToken");
|
||||||
await AsyncStorage.removeItem("userData");
|
await AsyncStorage.removeItem("userData");
|
||||||
@@ -303,6 +246,28 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// --- 6. Accept Terms ---
|
||||||
|
const acceptedTerms = async (
|
||||||
|
nomor: string,
|
||||||
|
onSetModalVisible: (visible: boolean) => void,
|
||||||
|
) => {
|
||||||
|
try {
|
||||||
|
setIsLoading(true);
|
||||||
|
const response = await apiUpdatedTermCondition({ nomor: nomor });
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
return `/verification?nomor=${nomor}`;
|
||||||
|
} else {
|
||||||
|
return `/register?nomor=${nomor}`;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error accept terms", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
onSetModalVisible(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AuthContext.Provider
|
<AuthContext.Provider
|
||||||
@@ -318,6 +283,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
|||||||
logout,
|
logout,
|
||||||
registerUser,
|
registerUser,
|
||||||
userData,
|
userData,
|
||||||
|
acceptedTerms,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -13,3 +13,13 @@ Exp: open ios/HIPMIBADUNG.xcworkspace
|
|||||||
perubahan versi : npm version patch
|
perubahan versi : npm version patch
|
||||||
ios: bunx expo prebuild --platform ios
|
ios: bunx expo prebuild --platform ios
|
||||||
android: bunx expo prebuild --platform android
|
android: bunx expo prebuild --platform android
|
||||||
|
|
||||||
|
### Android
|
||||||
|
adb devices : cek device yang terhubung
|
||||||
|
Note: izinkan perangkat dulu agar statusnya tidak unauthorized
|
||||||
|
|
||||||
|
adb install android/app/build/outputs/apk/debug/app-debug.apk : install apk ke device / emulator
|
||||||
|
Note:
|
||||||
|
Gunakan flag -s (serial) di perintah adb untuk menentukan target
|
||||||
|
adb -s <0G52319V261040B2 ini adalah id nya> install android/app/build/outputs/apk/debug/app-debug.apk
|
||||||
|
|
||||||
22
docs/prompt-for-qwen-code.md
Normal file
22
docs/prompt-for-qwen-code.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<!-- Start Penerapan Pagination -->
|
||||||
|
|
||||||
|
File utama: screens/Job/ScreenArchive2.tsx
|
||||||
|
Fun fecth: apiJobGetByStatus
|
||||||
|
File fetch: service/api-client/api-job.ts
|
||||||
|
File komponen wrapper: components/_ShareComponent/NewWrapper.tsx
|
||||||
|
|
||||||
|
Terapkan pagination pada file "File utama"
|
||||||
|
Analisa juga file "File utama" , jika belum menggunakan NewWrapper pada file "File komponen wrapper" , maka terapkan juga dan ganti wrapper lama yaitu komponen ViewWrapper
|
||||||
|
|
||||||
|
Komponen pagination yang digunaka berada pada file hooks/use-pagination.tsx dan helpers/paginationHelpers.tsx
|
||||||
|
|
||||||
|
Perbaiki fetch "Fun fecth" , pada file "File fetch"
|
||||||
|
Jika tidak ada props page maka tambahkan props page dan default page: "1"
|
||||||
|
|
||||||
|
Gunakan bahasa indonesia pada cli agar saya mudah membacanya.
|
||||||
|
|
||||||
|
<!-- End Penerapan Pagination -->
|
||||||
|
|
||||||
|
<!-- Start Penerapan NewWrapper -->
|
||||||
|
Terapkan NewWrapper pada file: screens/Forum/DetailForum.tsx
|
||||||
|
Component yang digunakan: components/_ShareComponent/NewWrapper.tsx , karena ini adalah halaman detail saya ingin anda fokus pada props pada NewWrapper. Seperti
|
||||||
2
eas.json
2
eas.json
@@ -11,7 +11,7 @@
|
|||||||
"preview": {
|
"preview": {
|
||||||
"distribution": "internal",
|
"distribution": "internal",
|
||||||
"android": {
|
"android": {
|
||||||
"buildType": "app-bundle"
|
"buildType": "apk"
|
||||||
},
|
},
|
||||||
"ios": {
|
"ios": {
|
||||||
"simulator": false
|
"simulator": false
|
||||||
|
|||||||
517
helpers/PaginationGuide.md
Normal file
517
helpers/PaginationGuide.md
Normal file
@@ -0,0 +1,517 @@
|
|||||||
|
# 📱 Reusable Pagination untuk React Native + Expo
|
||||||
|
|
||||||
|
Komponen pagination yang terintegrasi dengan **NewWrapper** untuk infinite scroll, pull-to-refresh, skeleton loading, dan empty state.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 File Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
/hooks/
|
||||||
|
└── usePagination.tsx # Custom hook untuk logika pagination
|
||||||
|
|
||||||
|
/helpers/
|
||||||
|
└── paginationHelpers.tsx # Helper functions untuk komponen UI
|
||||||
|
|
||||||
|
/components/
|
||||||
|
└── NewWrapper.tsx # Komponen wrapper utama (existing)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 Cara Penggunaan
|
||||||
|
|
||||||
|
### **Step 1: Import Hook dan Helpers**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { usePagination } from "@/hooks/usePagination";
|
||||||
|
import { createPaginationComponents } from "@/helpers/paginationHelpers";
|
||||||
|
import NewWrapper from "@/components/_ShareComponent/NewWrapper";
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Step 2: Setup Pagination Hook**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const pagination = usePagination({
|
||||||
|
// ✅ Fungsi untuk fetch data (harus return { data: T[] })
|
||||||
|
fetchFunction: async (page, searchQuery) => {
|
||||||
|
return await apiForumGetAll({
|
||||||
|
category: "beranda",
|
||||||
|
search: searchQuery || "",
|
||||||
|
userLoginId: user.id,
|
||||||
|
page: String(page),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// ✅ Page size (harus sama dengan API)
|
||||||
|
pageSize: 5,
|
||||||
|
|
||||||
|
// ✅ Query pencarian
|
||||||
|
searchQuery: search,
|
||||||
|
|
||||||
|
// ✅ Dependencies (reload saat berubah)
|
||||||
|
dependencies: [user?.id, category],
|
||||||
|
|
||||||
|
// ⚙️ Optional callbacks
|
||||||
|
onDataFetched: (data) => console.log("Loaded:", data.length),
|
||||||
|
onError: (error) => console.error("Error:", error),
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Step 3: Generate Komponen Pagination**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
|
||||||
|
loading: pagination.loading,
|
||||||
|
refreshing: pagination.refreshing,
|
||||||
|
listData: pagination.listData,
|
||||||
|
searchQuery: search,
|
||||||
|
emptyMessage: "Tidak ada data",
|
||||||
|
emptySearchMessage: "Tidak ada hasil pencarian",
|
||||||
|
skeletonCount: 5,
|
||||||
|
skeletonHeight: 200,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Step 4: Gunakan dengan NewWrapper**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
<NewWrapper
|
||||||
|
// Props dari pagination hook
|
||||||
|
listData={pagination.listData}
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
refreshing={pagination.refreshing}
|
||||||
|
onRefresh={pagination.onRefresh}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
onEndReached={pagination.loadMore}
|
||||||
|
|
||||||
|
// Komponen dari helpers
|
||||||
|
ListEmptyComponent={ListEmptyComponent}
|
||||||
|
ListFooterComponent={ListFooterComponent}
|
||||||
|
|
||||||
|
// Render item
|
||||||
|
renderItem={({ item }) => <YourComponent data={item} />}
|
||||||
|
|
||||||
|
// Props lain dari NewWrapper
|
||||||
|
headerComponent={<SearchInput />}
|
||||||
|
floatingButton={<FloatingButton />}
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📖 Contoh Implementasi Lengkap
|
||||||
|
|
||||||
|
### **Contoh 1: Forum Page (Basic)**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { usePagination } from "@/hooks/usePagination";
|
||||||
|
import { createPaginationComponents } from "@/helpers/paginationHelpers";
|
||||||
|
import NewWrapper from "@/components/_ShareComponent/NewWrapper";
|
||||||
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
|
||||||
|
export default function ForumPage() {
|
||||||
|
const { user } = useAuth();
|
||||||
|
const [search, setSearch] = useState("");
|
||||||
|
|
||||||
|
// Setup pagination
|
||||||
|
const pagination = usePagination({
|
||||||
|
fetchFunction: async (page, searchQuery) => {
|
||||||
|
if (!user?.id) return { data: [] };
|
||||||
|
|
||||||
|
return await apiForumGetAll({
|
||||||
|
category: "beranda",
|
||||||
|
search: searchQuery || "",
|
||||||
|
userLoginId: user.id,
|
||||||
|
page: String(page),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
pageSize: 5,
|
||||||
|
searchQuery: search,
|
||||||
|
dependencies: [user?.id],
|
||||||
|
});
|
||||||
|
|
||||||
|
// Generate komponen
|
||||||
|
const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
|
||||||
|
loading: pagination.loading,
|
||||||
|
refreshing: pagination.refreshing,
|
||||||
|
listData: pagination.listData,
|
||||||
|
searchQuery: search,
|
||||||
|
emptyMessage: "Tidak ada diskusi",
|
||||||
|
emptySearchMessage: "Tidak ada hasil pencarian",
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<NewWrapper
|
||||||
|
headerComponent={
|
||||||
|
<SearchInput
|
||||||
|
placeholder="Cari diskusi..."
|
||||||
|
onChangeText={_.debounce(setSearch, 500)}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
listData={pagination.listData}
|
||||||
|
renderItem={({ item }) => <ForumItem data={item} />}
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
tintColor={MainColor.yellow}
|
||||||
|
refreshing={pagination.refreshing}
|
||||||
|
onRefresh={pagination.onRefresh}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
onEndReached={pagination.loadMore}
|
||||||
|
ListEmptyComponent={ListEmptyComponent}
|
||||||
|
ListFooterComponent={ListFooterComponent}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Contoh 2: Product Page (Dengan Filter)**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
export default function ProductPage() {
|
||||||
|
const [search, setSearch] = useState("");
|
||||||
|
const [category, setCategory] = useState("all");
|
||||||
|
|
||||||
|
const pagination = usePagination({
|
||||||
|
fetchFunction: async (page, searchQuery) => {
|
||||||
|
return await apiProductGetAll({
|
||||||
|
page: String(page),
|
||||||
|
search: searchQuery || "",
|
||||||
|
category: category !== "all" ? category : undefined,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
pageSize: 10,
|
||||||
|
searchQuery: search,
|
||||||
|
dependencies: [category], // Reload saat category berubah
|
||||||
|
});
|
||||||
|
|
||||||
|
const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
|
||||||
|
loading: pagination.loading,
|
||||||
|
refreshing: pagination.refreshing,
|
||||||
|
listData: pagination.listData,
|
||||||
|
searchQuery: search,
|
||||||
|
emptyMessage: "Belum ada produk",
|
||||||
|
skeletonCount: 8,
|
||||||
|
skeletonHeight: 100,
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<NewWrapper
|
||||||
|
headerComponent={
|
||||||
|
<View>
|
||||||
|
<SearchInput onChangeText={setSearch} />
|
||||||
|
<CategoryFilter value={category} onChange={setCategory} />
|
||||||
|
</View>
|
||||||
|
}
|
||||||
|
listData={pagination.listData}
|
||||||
|
renderItem={({ item }) => <ProductCard product={item} />}
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
refreshing={pagination.refreshing}
|
||||||
|
onRefresh={pagination.onRefresh}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
onEndReached={pagination.loadMore}
|
||||||
|
ListEmptyComponent={ListEmptyComponent}
|
||||||
|
ListFooterComponent={ListFooterComponent}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚙️ API Reference
|
||||||
|
|
||||||
|
### **usePagination Hook**
|
||||||
|
|
||||||
|
#### Props
|
||||||
|
|
||||||
|
| Prop | Type | Required | Default | Deskripsi |
|
||||||
|
|------|------|----------|---------|-----------|
|
||||||
|
| `fetchFunction` | `(page, search?) => Promise<{data: T[]}>` | ✅ | - | Fungsi fetch data dari API |
|
||||||
|
| `pageSize` | `number` | ❌ | `5` | Jumlah data per halaman |
|
||||||
|
| `searchQuery` | `string` | ❌ | `""` | Query pencarian |
|
||||||
|
| `dependencies` | `any[]` | ❌ | `[]` | Dependencies untuk trigger reload |
|
||||||
|
| `onDataFetched` | `(data: T[]) => void` | ❌ | - | Callback saat data berhasil di-fetch |
|
||||||
|
| `onError` | `(error: any) => void` | ❌ | - | Callback saat terjadi error |
|
||||||
|
|
||||||
|
#### Return Value
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
{
|
||||||
|
listData: T[]; // Array data untuk NewWrapper
|
||||||
|
loading: boolean; // Loading state
|
||||||
|
refreshing: boolean; // Refreshing state
|
||||||
|
hasMore: boolean; // Apakah masih ada data
|
||||||
|
page: number; // Current page
|
||||||
|
onRefresh: () => void; // Function untuk refresh
|
||||||
|
loadMore: () => void; // Function untuk load more
|
||||||
|
reset: () => void; // Function untuk reset state
|
||||||
|
setListData: (data) => void; // Function untuk set data manual
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### **createPaginationComponents Helper**
|
||||||
|
|
||||||
|
#### Props
|
||||||
|
|
||||||
|
| Prop | Type | Required | Default | Deskripsi |
|
||||||
|
|------|------|----------|---------|-----------|
|
||||||
|
| `loading` | `boolean` | ✅ | - | Loading state |
|
||||||
|
| `refreshing` | `boolean` | ✅ | - | Refreshing state |
|
||||||
|
| `listData` | `any[]` | ✅ | - | List data |
|
||||||
|
| `searchQuery` | `string` | ❌ | `""` | Query pencarian |
|
||||||
|
| `emptyMessage` | `string` | ❌ | `"Tidak ada data"` | Pesan empty state |
|
||||||
|
| `emptySearchMessage` | `string` | ❌ | `"Tidak ada hasil pencarian"` | Pesan empty saat search |
|
||||||
|
| `skeletonCount` | `number` | ❌ | `5` | Jumlah skeleton items |
|
||||||
|
| `skeletonHeight` | `number` | ❌ | `200` | Tinggi skeleton items |
|
||||||
|
| `loadingFooterText` | `string` | ❌ | - | Text loading footer |
|
||||||
|
|
||||||
|
#### Return Value
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
{
|
||||||
|
ListEmptyComponent: React.ReactElement; // Component untuk empty state
|
||||||
|
ListFooterComponent: React.ReactElement; // Component untuk loading footer
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### **Helper Functions Lain**
|
||||||
|
|
||||||
|
#### `createSkeletonList(options)`
|
||||||
|
Generate skeleton list untuk loading state.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const SkeletonComponent = createSkeletonList({
|
||||||
|
count: 5,
|
||||||
|
height: 200
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `createEmptyState(options)`
|
||||||
|
Generate empty state component.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const EmptyComponent = createEmptyState({
|
||||||
|
message: "Tidak ada data",
|
||||||
|
searchMessage: "Tidak ada hasil pencarian",
|
||||||
|
searchQuery: search
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `createLoadingFooter(options)`
|
||||||
|
Generate loading footer component.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const FooterComponent = createLoadingFooter({
|
||||||
|
show: loading && listData.length > 0,
|
||||||
|
text: "Memuat data..."
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎨 Custom Components
|
||||||
|
|
||||||
|
### **Custom Empty State**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { createSkeletonList } from "@/helpers/paginationHelpers";
|
||||||
|
|
||||||
|
const CustomEmpty = (
|
||||||
|
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
|
||||||
|
<Text>🔍</Text>
|
||||||
|
<TextCustom>Data tidak ditemukan</TextCustom>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
|
||||||
|
const ListEmptyComponent =
|
||||||
|
pagination.loading && pagination.listData.length === 0
|
||||||
|
? createSkeletonList({ count: 5, height: 200 })
|
||||||
|
: CustomEmpty;
|
||||||
|
|
||||||
|
<NewWrapper
|
||||||
|
ListEmptyComponent={ListEmptyComponent}
|
||||||
|
// ...
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
### **Custom Loading Footer**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { createLoadingFooter } from "@/helpers/paginationHelpers";
|
||||||
|
|
||||||
|
const CustomFooter = createLoadingFooter({
|
||||||
|
show: pagination.loading && !pagination.refreshing && pagination.listData.length > 0,
|
||||||
|
customComponent: (
|
||||||
|
<View style={{ padding: 20, alignItems: "center" }}>
|
||||||
|
<ActivityIndicator size="large" color="#007AFF" />
|
||||||
|
<Text style={{ marginTop: 8 }}>Loading more...</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
<NewWrapper
|
||||||
|
ListFooterComponent={CustomFooter}
|
||||||
|
// ...
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✨ Fitur-Fitur
|
||||||
|
|
||||||
|
✅ **Infinite Scroll** - Auto load saat scroll ke bawah
|
||||||
|
✅ **Pull to Refresh** - Swipe down untuk refresh
|
||||||
|
✅ **Skeleton Loading** - Smooth loading animation
|
||||||
|
✅ **Empty State** - Tampilan saat data kosong
|
||||||
|
✅ **Search Integration** - Support search dengan debounce
|
||||||
|
✅ **Multi Dependencies** - Reload berdasarkan filter apapun
|
||||||
|
✅ **Error Handling** - Built-in error handling
|
||||||
|
✅ **TypeScript** - Full type safety
|
||||||
|
✅ **Fully Customizable** - Custom components untuk semua state
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 Best Practices
|
||||||
|
|
||||||
|
### 1. **Gunakan Debounce untuk Search**
|
||||||
|
```tsx
|
||||||
|
<SearchInput
|
||||||
|
onChangeText={_.debounce((text) => setSearch(text), 500)}
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. **Sesuaikan Page Size dengan API**
|
||||||
|
```tsx
|
||||||
|
const pagination = usePagination({
|
||||||
|
pageSize: 5, // Harus sama dengan takeData di API
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. **Tambahkan Dependencies yang Relevan**
|
||||||
|
```tsx
|
||||||
|
const pagination = usePagination({
|
||||||
|
dependencies: [userId, category, sortBy], // Reload saat berubah
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. **Handle Error dengan Baik**
|
||||||
|
```tsx
|
||||||
|
const pagination = usePagination({
|
||||||
|
onError: (error) => {
|
||||||
|
console.error("Error:", error);
|
||||||
|
Alert.alert("Error", "Gagal memuat data");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. **Pastikan API Return Format yang Benar**
|
||||||
|
```tsx
|
||||||
|
// ❌ SALAH
|
||||||
|
fetchFunction: async () => [data1, data2];
|
||||||
|
|
||||||
|
// ✅ BENAR
|
||||||
|
fetchFunction: async () => ({ data: [data1, data2] });
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔧 Troubleshooting
|
||||||
|
|
||||||
|
### **Data tidak muncul?**
|
||||||
|
- Pastikan `fetchFunction` return `{ data: T[] }`
|
||||||
|
- Cek apakah API return format yang benar
|
||||||
|
- Pastikan `pageSize` sesuai dengan API
|
||||||
|
|
||||||
|
### **Infinite scroll tidak jalan?**
|
||||||
|
- Pastikan API return data sesuai `pageSize`
|
||||||
|
- Cek `hasMore` state
|
||||||
|
- Pastikan `onEndReachedThreshold` tidak terlalu kecil (default 0.5)
|
||||||
|
|
||||||
|
### **Skeleton terus muncul?**
|
||||||
|
- Cek `loading` state
|
||||||
|
- Pastikan `fetchFunction` resolve dengan benar
|
||||||
|
- Cek error di console
|
||||||
|
|
||||||
|
### **Refresh tidak bekerja?**
|
||||||
|
- Pastikan `RefreshControl` menggunakan `pagination.refreshing` dan `pagination.onRefresh`
|
||||||
|
- Cek apakah API dipanggil saat pull-to-refresh
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 Migration Guide
|
||||||
|
|
||||||
|
### **Dari Code Lama ke Code Baru**
|
||||||
|
|
||||||
|
#### **BEFORE:**
|
||||||
|
```tsx
|
||||||
|
const [listData, setListData] = useState([]);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
|
const [hasMore, setHasMore] = useState(true);
|
||||||
|
const [page, setPage] = useState(1);
|
||||||
|
|
||||||
|
const fetchData = async (pageNumber, clear) => {
|
||||||
|
// ... 30+ lines of code
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setPage(1);
|
||||||
|
setListData([]);
|
||||||
|
setHasMore(true);
|
||||||
|
fetchData(1, true);
|
||||||
|
}, [search, user?.id]);
|
||||||
|
|
||||||
|
const onRefresh = useCallback(() => {
|
||||||
|
fetchData(1, true);
|
||||||
|
}, [search, user?.id]);
|
||||||
|
|
||||||
|
const loadMore = useCallback(() => {
|
||||||
|
if (hasMore && !loading && !refreshing) {
|
||||||
|
fetchData(page + 1, false);
|
||||||
|
}
|
||||||
|
}, [hasMore, loading, refreshing, page, search, user?.id]);
|
||||||
|
|
||||||
|
// ... skeleton, empty, footer components
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **AFTER:**
|
||||||
|
```tsx
|
||||||
|
const pagination = usePagination({
|
||||||
|
fetchFunction: async (page, search) => await apiGetData({ page, search }),
|
||||||
|
pageSize: 5,
|
||||||
|
searchQuery: search,
|
||||||
|
dependencies: [user?.id]
|
||||||
|
});
|
||||||
|
|
||||||
|
const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
|
||||||
|
loading: pagination.loading,
|
||||||
|
refreshing: pagination.refreshing,
|
||||||
|
listData: pagination.listData,
|
||||||
|
searchQuery: search,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
**Result:** 50+ lines → 15 lines! 🎉
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👨💻 Author
|
||||||
|
|
||||||
|
Created by Full-Stack Developer
|
||||||
|
React Native + Expo Specialist
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
|
MIT License - Feel free to use in your projects!
|
||||||
280
helpers/paginationHelpers.tsx
Normal file
280
helpers/paginationHelpers.tsx
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
import { View } from "react-native";
|
||||||
|
import { LoaderCustom, TextCustom, StackCustom } from "@/components";
|
||||||
|
import SkeletonCustom from "@/components/_ShareComponent/SkeletonCustom";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pagination Helpers
|
||||||
|
*
|
||||||
|
* Helper functions untuk membuat komponen-komponen pagination
|
||||||
|
* yang sering digunakan (Skeleton, Empty State, Loading Footer)
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface SkeletonListOptions {
|
||||||
|
/**
|
||||||
|
* Jumlah skeleton items
|
||||||
|
* @default 5
|
||||||
|
*/
|
||||||
|
count?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tinggi setiap skeleton item
|
||||||
|
* @default 200
|
||||||
|
*/
|
||||||
|
height?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate Skeleton List Component untuk loading state
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```tsx
|
||||||
|
* <NewWrapper
|
||||||
|
* listData={listData}
|
||||||
|
* ListEmptyComponent={
|
||||||
|
* loading && _.isEmpty(listData)
|
||||||
|
* ? createSkeletonList({ count: 5, height: 200 })
|
||||||
|
* : createEmptyState({ message: "Tidak ada data" })
|
||||||
|
* }
|
||||||
|
* />
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
export const createSkeletonList = (options: SkeletonListOptions = {}) => {
|
||||||
|
const { count = 5, height = 200 } = options;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={{ flex: 1 }}>
|
||||||
|
<StackCustom>
|
||||||
|
{Array.from({ length: count }).map((_, i) => (
|
||||||
|
<SkeletonCustom height={height} key={i} />
|
||||||
|
))}
|
||||||
|
</StackCustom>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
interface EmptyStateOptions {
|
||||||
|
/**
|
||||||
|
* Pesan untuk empty state
|
||||||
|
* @default "Tidak ada data"
|
||||||
|
*/
|
||||||
|
message?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pesan untuk empty state saat search
|
||||||
|
*/
|
||||||
|
searchMessage?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query pencarian (untuk menentukan pesan mana yang ditampilkan)
|
||||||
|
*/
|
||||||
|
searchQuery?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom component untuk empty state
|
||||||
|
*/
|
||||||
|
customComponent?: React.ReactElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate Empty State Component
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```tsx
|
||||||
|
* ListEmptyComponent={
|
||||||
|
* createEmptyState({
|
||||||
|
* message: "Tidak ada diskusi",
|
||||||
|
* searchMessage: "Tidak ada hasil pencarian",
|
||||||
|
* searchQuery: search
|
||||||
|
* })
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
export const createEmptyState = (options: EmptyStateOptions = {}) => {
|
||||||
|
const {
|
||||||
|
message = "Tidak ada data",
|
||||||
|
searchMessage = "Tidak ada hasil pencarian",
|
||||||
|
searchQuery = "",
|
||||||
|
customComponent,
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
if (customComponent) return customComponent;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
padding: 20,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<TextCustom align="center" color="gray">
|
||||||
|
{searchQuery ? searchMessage : message}
|
||||||
|
</TextCustom>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
interface LoadingFooterOptions {
|
||||||
|
/**
|
||||||
|
* Tampilkan loading footer
|
||||||
|
*/
|
||||||
|
show: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom text untuk loading footer
|
||||||
|
*/
|
||||||
|
text?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom component untuk loading footer
|
||||||
|
*/
|
||||||
|
customComponent?: React.ReactElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate Loading Footer Component
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```tsx
|
||||||
|
* ListFooterComponent={
|
||||||
|
* createLoadingFooter({
|
||||||
|
* show: loading && !refreshing && listData.length > 0,
|
||||||
|
* text: "Memuat data..."
|
||||||
|
* })
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
export const createLoadingFooter = (options: LoadingFooterOptions) => {
|
||||||
|
const { show, text, customComponent } = options;
|
||||||
|
|
||||||
|
if (!show) return null;
|
||||||
|
|
||||||
|
if (customComponent) return customComponent;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={{ paddingVertical: 16, alignItems: "center" }}>
|
||||||
|
{text ? (
|
||||||
|
<TextCustom color="gray">
|
||||||
|
{text}
|
||||||
|
</TextCustom>
|
||||||
|
) : (
|
||||||
|
<LoaderCustom />
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
interface PaginationComponentsOptions {
|
||||||
|
/**
|
||||||
|
* Loading state
|
||||||
|
*/
|
||||||
|
loading: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refreshing state
|
||||||
|
*/
|
||||||
|
refreshing: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List data
|
||||||
|
*/
|
||||||
|
listData: any[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query pencarian
|
||||||
|
*/
|
||||||
|
searchQuery?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pesan empty state
|
||||||
|
*/
|
||||||
|
emptyMessage?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pesan empty state saat search
|
||||||
|
*/
|
||||||
|
emptySearchMessage?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jumlah skeleton items
|
||||||
|
*/
|
||||||
|
skeletonCount?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tinggi skeleton items
|
||||||
|
*/
|
||||||
|
skeletonHeight?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text loading footer
|
||||||
|
*/
|
||||||
|
loadingFooterText?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loading pertama
|
||||||
|
*/
|
||||||
|
isInitialLoad?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate semua komponen pagination sekaligus
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```tsx
|
||||||
|
* const { ListEmptyComponent, ListFooterComponent } = createPaginationComponents({
|
||||||
|
* loading,
|
||||||
|
* refreshing,
|
||||||
|
* listData,
|
||||||
|
* searchQuery: search,
|
||||||
|
* emptyMessage: "Tidak ada diskusi",
|
||||||
|
* emptySearchMessage: "Tidak ada hasil pencarian",
|
||||||
|
* skeletonCount: 5,
|
||||||
|
* skeletonHeight: 200
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* <NewWrapper
|
||||||
|
* listData={listData}
|
||||||
|
* ListEmptyComponent={ListEmptyComponent}
|
||||||
|
* ListFooterComponent={ListFooterComponent}
|
||||||
|
* />
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
export const createPaginationComponents = (
|
||||||
|
options: PaginationComponentsOptions
|
||||||
|
) => {
|
||||||
|
const {
|
||||||
|
loading,
|
||||||
|
refreshing,
|
||||||
|
listData,
|
||||||
|
searchQuery = "",
|
||||||
|
emptyMessage = "Tidak ada data",
|
||||||
|
emptySearchMessage = "Tidak ada hasil pencarian",
|
||||||
|
skeletonCount = 5,
|
||||||
|
skeletonHeight = 200,
|
||||||
|
loadingFooterText,
|
||||||
|
isInitialLoad,
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
// Empty Compotnent: Skeleton saat loading pertama, Empty State saat data kosong
|
||||||
|
const ListEmptyComponent =
|
||||||
|
loading && _.isEmpty(listData)
|
||||||
|
? createSkeletonList({ count: skeletonCount, height: skeletonHeight })
|
||||||
|
: createEmptyState({
|
||||||
|
message: emptyMessage,
|
||||||
|
searchMessage: emptySearchMessage,
|
||||||
|
searchQuery,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Footer Component: Loading indicator saat load more
|
||||||
|
const ListFooterComponent = createLoadingFooter({
|
||||||
|
show: loading && !refreshing && listData.length > 0,
|
||||||
|
text: loadingFooterText,
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
ListEmptyComponent,
|
||||||
|
ListFooterComponent,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
onMessage,
|
onMessage,
|
||||||
FirebaseMessagingTypes,
|
FirebaseMessagingTypes,
|
||||||
} from "@react-native-firebase/messaging";
|
} from "@react-native-firebase/messaging";
|
||||||
|
import { useAuth } from "./use-auth";
|
||||||
|
|
||||||
// Gunakan tipe resmi dari library
|
// Gunakan tipe resmi dari library
|
||||||
type RemoteMessage = FirebaseMessagingTypes.RemoteMessage;
|
type RemoteMessage = FirebaseMessagingTypes.RemoteMessage;
|
||||||
@@ -11,17 +12,26 @@ type RemoteMessage = FirebaseMessagingTypes.RemoteMessage;
|
|||||||
export function useForegroundNotifications(
|
export function useForegroundNotifications(
|
||||||
onMessageReceived: (message: RemoteMessage) => void
|
onMessageReceived: (message: RemoteMessage) => void
|
||||||
) {
|
) {
|
||||||
|
const { user } = useAuth();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const messaging = getMessaging();
|
const messaging = getMessaging();
|
||||||
|
|
||||||
const unsubscribe = onMessage(messaging, (remoteMessage) => {
|
const unsubscribe = onMessage(messaging, (remoteMessage) => {
|
||||||
|
const data = remoteMessage.data;
|
||||||
|
// console.log("DATA NOTIFIKASI DARI SERVER", data)
|
||||||
|
if (data?.recipientId && data?.recipientId !== user?.id) {
|
||||||
|
console.log("📵 Notification untuk user lain", data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"🔔 Notifikasi diterima saat app aktif:",
|
"🔔 Notifikasi diterima saat app aktif:",
|
||||||
JSON.stringify(remoteMessage, null, 2)
|
JSON.stringify(data, null, 2)
|
||||||
);
|
);
|
||||||
onMessageReceived(remoteMessage);
|
onMessageReceived(remoteMessage);
|
||||||
});
|
});
|
||||||
|
|
||||||
return unsubscribe;
|
return unsubscribe;
|
||||||
}, [onMessageReceived]);
|
}, [user?.id, onMessageReceived]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ type NotificationContextType = {
|
|||||||
notif: Omit<AppNotification, "id" | "isRead" | "timestamp">
|
notif: Omit<AppNotification, "id" | "isRead" | "timestamp">
|
||||||
) => void;
|
) => void;
|
||||||
markAsRead: (id: string) => void;
|
markAsRead: (id: string) => void;
|
||||||
|
markAsReadAll: (id: string) => void;
|
||||||
syncUnreadCount: () => Promise<void>;
|
syncUnreadCount: () => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,6 +49,7 @@ const NotificationContext = createContext<NotificationContextType>({
|
|||||||
unreadCount: 0,
|
unreadCount: 0,
|
||||||
addNotification: () => {},
|
addNotification: () => {},
|
||||||
markAsRead: () => {},
|
markAsRead: () => {},
|
||||||
|
markAsReadAll: () => {},
|
||||||
syncUnreadCount: async () => {},
|
syncUnreadCount: async () => {},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -98,7 +100,7 @@ export const NotificationProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
|
|
||||||
const markAsRead = async (id: string) => {
|
const markAsRead = async (id: string) => {
|
||||||
try {
|
try {
|
||||||
const response = await apiNotificationMarkAsRead({ id });
|
const response = await apiNotificationMarkAsRead({ id, category: "one" });
|
||||||
console.log("🚀 Response Mark As Read:", response);
|
console.log("🚀 Response Mark As Read:", response);
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -114,6 +116,25 @@ export const NotificationProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const markAsReadAll = async (id: string) => {
|
||||||
|
try {
|
||||||
|
const response = await apiNotificationMarkAsRead({ id, category: "all" });
|
||||||
|
console.log("🚀 Response Mark As Read All:", response);
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
const cloneNotifications = [...notifications];
|
||||||
|
const index = cloneNotifications.findIndex((n) => n?.data?.id === id);
|
||||||
|
if (index !== -1) {
|
||||||
|
cloneNotifications[index].isRead = true;
|
||||||
|
setNotifications(cloneNotifications);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Gagal mark as read:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const syncUnreadCount = async () => {
|
const syncUnreadCount = async () => {
|
||||||
try {
|
try {
|
||||||
const count = await apiNotificationUnreadCount({
|
const count = await apiNotificationUnreadCount({
|
||||||
@@ -133,8 +154,9 @@ export const NotificationProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
value={{
|
value={{
|
||||||
notifications,
|
notifications,
|
||||||
addNotification,
|
addNotification,
|
||||||
markAsRead,
|
|
||||||
unreadCount,
|
unreadCount,
|
||||||
|
markAsRead,
|
||||||
|
markAsReadAll,
|
||||||
syncUnreadCount,
|
syncUnreadCount,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
184
hooks/use-pagination.tsx
Normal file
184
hooks/use-pagination.tsx
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
import { useState, useCallback, useEffect } from "react";
|
||||||
|
|
||||||
|
interface UsePaginationProps<T> {
|
||||||
|
/**
|
||||||
|
* Fungsi API untuk fetch data
|
||||||
|
* @param page - nomor halaman
|
||||||
|
* @param search - query pencarian (opsional)
|
||||||
|
* @returns Promise dengan response API (bukan langsung array)
|
||||||
|
*/
|
||||||
|
fetchFunction: (page: number, search?: string) => Promise<{ data: T[] }>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jumlah data per halaman (harus sama dengan API)
|
||||||
|
* @default 5
|
||||||
|
*/
|
||||||
|
pageSize?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query pencarian
|
||||||
|
*/
|
||||||
|
searchQuery?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dependencies tambahan untuk trigger reload
|
||||||
|
* Contoh: [userId, categoryId]
|
||||||
|
*/
|
||||||
|
dependencies?: any[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback saat data berhasil di-fetch
|
||||||
|
*/
|
||||||
|
onDataFetched?: (data: T[]) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback saat terjadi error
|
||||||
|
*/
|
||||||
|
onError?: (error: any) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UsePaginationReturn<T> {
|
||||||
|
// Data state
|
||||||
|
listData: T[];
|
||||||
|
loading: boolean;
|
||||||
|
refreshing: boolean;
|
||||||
|
hasMore: boolean;
|
||||||
|
page: number;
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
onRefresh: () => void;
|
||||||
|
loadMore: () => void;
|
||||||
|
reset: () => void;
|
||||||
|
setListData: React.Dispatch<React.SetStateAction<T[]>>;
|
||||||
|
isInitialLoad: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom Hook untuk menangani pagination dengan infinite scroll
|
||||||
|
*
|
||||||
|
* Hook ini mengembalikan props yang siap digunakan langsung dengan NewWrapper
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```tsx
|
||||||
|
* const pagination = usePagination({
|
||||||
|
* fetchFunction: async (page, search) => {
|
||||||
|
* return await apiForumGetAll({
|
||||||
|
* category: "beranda",
|
||||||
|
* search: search || "",
|
||||||
|
* userLoginId: user.id,
|
||||||
|
* page: String(page),
|
||||||
|
* });
|
||||||
|
* },
|
||||||
|
* pageSize: 5,
|
||||||
|
* searchQuery: search,
|
||||||
|
* dependencies: [user?.id]
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Lalu gunakan langsung di NewWrapper:
|
||||||
|
* <NewWrapper
|
||||||
|
* listData={pagination.listData}
|
||||||
|
* refreshControl={<RefreshControl refreshing={pagination.refreshing} onRefresh={pagination.onRefresh} />}
|
||||||
|
* onEndReached={pagination.loadMore}
|
||||||
|
* // ... props lainnya
|
||||||
|
* />
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
export function usePagination<T = any>({
|
||||||
|
fetchFunction,
|
||||||
|
pageSize = 5,
|
||||||
|
searchQuery = "",
|
||||||
|
dependencies = [],
|
||||||
|
onDataFetched,
|
||||||
|
onError,
|
||||||
|
}: UsePaginationProps<T>): UsePaginationReturn<T> {
|
||||||
|
const [listData, setListData] = useState<T[]>([]);
|
||||||
|
const [loading, setLoading] = useState(true); // Set true untuk initial load
|
||||||
|
const [isInitialLoad, setIsInitialLoad] = useState(true); // Track initial load
|
||||||
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
|
const [hasMore, setHasMore] = useState(true);
|
||||||
|
const [page, setPage] = useState(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fungsi utama untuk fetch data
|
||||||
|
*/
|
||||||
|
const fetchData = async (pageNumber: number, clear: boolean) => {
|
||||||
|
// Cegah multiple call
|
||||||
|
if (!clear && (loading || refreshing)) return;
|
||||||
|
|
||||||
|
const isRefresh = clear;
|
||||||
|
if (isRefresh) setRefreshing(true);
|
||||||
|
if (!isRefresh) setLoading(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetchFunction(pageNumber, searchQuery);
|
||||||
|
const newData = response.data || [];
|
||||||
|
// console.log("newData", newData);
|
||||||
|
setListData((prev) => {
|
||||||
|
const current = Array.isArray(prev) ? prev : [];
|
||||||
|
return clear ? newData : [...current, ...newData];
|
||||||
|
});
|
||||||
|
// setTimeout(() => {
|
||||||
|
// }, 4000);
|
||||||
|
|
||||||
|
setHasMore(newData.length === pageSize);
|
||||||
|
setPage(pageNumber);
|
||||||
|
|
||||||
|
// Callback jika ada
|
||||||
|
onDataFetched?.(newData);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("[usePagination] Error fetching data:", error);
|
||||||
|
setHasMore(false);
|
||||||
|
onError?.(error);
|
||||||
|
} finally {
|
||||||
|
setRefreshing(false);
|
||||||
|
setLoading(false);
|
||||||
|
setIsInitialLoad(false); // Set false setelah initial load
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset dan reload saat search atau dependencies berubah
|
||||||
|
*/
|
||||||
|
useEffect(() => {
|
||||||
|
reset();
|
||||||
|
fetchData(1, true);
|
||||||
|
}, [searchQuery, ...dependencies]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pull-to-refresh
|
||||||
|
*/
|
||||||
|
const onRefresh = useCallback(() => {
|
||||||
|
fetchData(1, true);
|
||||||
|
}, [searchQuery, ...dependencies]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load more (infinite scroll)
|
||||||
|
*/
|
||||||
|
const loadMore = useCallback(() => {
|
||||||
|
if (hasMore && !loading && !refreshing) {
|
||||||
|
fetchData(page + 1, false);
|
||||||
|
}
|
||||||
|
}, [hasMore, loading, refreshing, page, searchQuery, ...dependencies]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset state pagination
|
||||||
|
*/
|
||||||
|
const reset = useCallback(() => {
|
||||||
|
setPage(1);
|
||||||
|
setListData([]);
|
||||||
|
setHasMore(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return {
|
||||||
|
listData,
|
||||||
|
loading,
|
||||||
|
refreshing,
|
||||||
|
hasMore,
|
||||||
|
page,
|
||||||
|
onRefresh,
|
||||||
|
loadMore,
|
||||||
|
reset,
|
||||||
|
setListData,
|
||||||
|
isInitialLoad
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>17</string>
|
<string>20</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|||||||
9
lib/routeApp.ts
Normal file
9
lib/routeApp.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export { routeAdmin, routeUser };
|
||||||
|
|
||||||
|
const routeAdmin = {
|
||||||
|
userAccess: ({ id }: { id: string }) => `/admin/user-access/${id}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
const routeUser = {
|
||||||
|
home: `/(user)/home`,
|
||||||
|
};
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { apiAdminDonationUpdateStatus } from "@/service/api-admin/api-admin-donation";
|
import { apiAdminDonationUpdateStatus } from "@/service/api-admin/api-admin-donation";
|
||||||
|
import { typeRejectedData } from "@/types/type-collect-other";
|
||||||
|
|
||||||
export const funUpdateStatusDonation = async ({
|
export const funUpdateStatusDonation = async ({
|
||||||
id,
|
id,
|
||||||
@@ -7,7 +8,7 @@ export const funUpdateStatusDonation = async ({
|
|||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
changeStatus: "publish" | "review" | "reject";
|
changeStatus: "publish" | "review" | "reject";
|
||||||
data?: string;
|
data?: typeRejectedData;
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
const response = await apiAdminDonationUpdateStatus({
|
const response = await apiAdminDonationUpdateStatus({
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { apiAdminEventUpdateStatus } from "@/service/api-admin/api-admin-event";
|
import { apiAdminEventUpdateStatus } from "@/service/api-admin/api-admin-event";
|
||||||
|
import { typeRejectedData } from "@/types/type-collect-other";
|
||||||
|
|
||||||
export const funUpdateStatusEvent = async ({
|
export const funUpdateStatusEvent = async ({
|
||||||
id,
|
id,
|
||||||
@@ -7,17 +8,19 @@ export const funUpdateStatusEvent = async ({
|
|||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
changeStatus: "publish" | "review" | "reject";
|
changeStatus: "publish" | "review" | "reject";
|
||||||
data?: string;
|
data?: typeRejectedData;
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
|
console.log("[DATA]", data);
|
||||||
const response = await apiAdminEventUpdateStatus({
|
const response = await apiAdminEventUpdateStatus({
|
||||||
id: id,
|
id: id,
|
||||||
changeStatus: changeStatus as any,
|
changeStatus: changeStatus as any,
|
||||||
data: data,
|
data: data as any,
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,13 +7,17 @@ const funUpdateStatusJob = async ({
|
|||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
changeStatus: "publish" | "review" | "reject";
|
changeStatus: "publish" | "review" | "reject";
|
||||||
data?: string;
|
data: {
|
||||||
|
catatan?: string;
|
||||||
|
senderId: string;
|
||||||
|
};
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
|
const fixData = data;
|
||||||
const response = await apiAdminJobUpdate({
|
const response = await apiAdminJobUpdate({
|
||||||
id: id,
|
id: id,
|
||||||
status: changeStatus as any,
|
status: changeStatus as any,
|
||||||
data: data,
|
data: fixData as any,
|
||||||
});
|
});
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { apiAdminVotingUpdateStatus } from "@/service/api-admin/api-admin-voting";
|
import { apiAdminVotingUpdateStatus } from "@/service/api-admin/api-admin-voting";
|
||||||
|
import { typeRejectedData } from "@/types/type-collect-other";
|
||||||
|
|
||||||
const funUpdateStatusVoting = async ({
|
const funUpdateStatusVoting = async ({
|
||||||
id,
|
id,
|
||||||
@@ -7,7 +8,7 @@ const funUpdateStatusVoting = async ({
|
|||||||
}: {
|
}: {
|
||||||
id: string;
|
id: string;
|
||||||
changeStatus: "publish" | "review" | "reject";
|
changeStatus: "publish" | "review" | "reject";
|
||||||
data?: string;
|
data?: typeRejectedData;
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
const response = await apiAdminVotingUpdateStatus({
|
const response = await apiAdminVotingUpdateStatus({
|
||||||
|
|||||||
286
screens/Authentication/EULASection.tsx
Normal file
286
screens/Authentication/EULASection.tsx
Normal file
@@ -0,0 +1,286 @@
|
|||||||
|
// app/syarat-dan-ketentuan.tsx
|
||||||
|
import {
|
||||||
|
View,
|
||||||
|
Text,
|
||||||
|
ScrollView,
|
||||||
|
TouchableOpacity,
|
||||||
|
StyleSheet,
|
||||||
|
} from "react-native";
|
||||||
|
import { useState, useRef } from "react";
|
||||||
|
import { router, useLocalSearchParams, useRouter } from "expo-router";
|
||||||
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
|
import { AccentColor, MainColor } from "@/constants/color-palet";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
|
export default function EULASection({
|
||||||
|
nomor,
|
||||||
|
onSetModalVisible,
|
||||||
|
setLoadingTerm,
|
||||||
|
}: {
|
||||||
|
nomor: string;
|
||||||
|
onSetModalVisible: (visible: boolean) => void;
|
||||||
|
setLoadingTerm: (loading: boolean) => void;
|
||||||
|
}) {
|
||||||
|
const { acceptedTerms } = useAuth();
|
||||||
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||||
|
const [isAtBottom, setIsAtBottom] = useState(false);
|
||||||
|
const scrollViewRef = useRef<ScrollView>(null);
|
||||||
|
|
||||||
|
const handleScroll = (event: any) => {
|
||||||
|
const { layoutMeasurement, contentOffset, contentSize } = event.nativeEvent;
|
||||||
|
const paddingToBottom = 20;
|
||||||
|
const isCloseToBottom =
|
||||||
|
layoutMeasurement.height + contentOffset.y >=
|
||||||
|
contentSize.height - paddingToBottom;
|
||||||
|
setIsAtBottom(isCloseToBottom);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAccept = async () => {
|
||||||
|
// console.log("Accept terms", nomor);
|
||||||
|
// onSetModalVisible(false);
|
||||||
|
try {
|
||||||
|
if (!isAtBottom) return;
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
const responseAccept = await acceptedTerms(
|
||||||
|
nomor as string,
|
||||||
|
onSetModalVisible,
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("Accept terms", responseAccept);
|
||||||
|
setLoadingTerm(true);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
router.replace(responseAccept);
|
||||||
|
}, 500);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error accept terms", error);
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Error",
|
||||||
|
text2: "Terjadi kesalahan saat menerima syarat dan ketentuan",
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SafeAreaView edges={["bottom"]} style={styles.container}>
|
||||||
|
<Text style={styles.title}>
|
||||||
|
Syarat & Ketentuan Penggunaan HIPMI Badung Connect
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
ref={scrollViewRef}
|
||||||
|
onScroll={handleScroll}
|
||||||
|
scrollEventThrottle={16}
|
||||||
|
style={styles.scrollView}
|
||||||
|
contentContainerStyle={styles.scrollContent}
|
||||||
|
>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Dengan menggunakan aplikasi{" "}
|
||||||
|
<Text style={styles.bold}>HIPMI Badung Connect</Text> (“Aplikasi”),
|
||||||
|
Anda setuju untuk mematuhi dan terikat oleh syarat dan ketentuan
|
||||||
|
berikut. Jika Anda tidak setuju dengan ketentuan ini, harap jangan
|
||||||
|
gunakan Aplikasi.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>1. Definisi</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
<Text style={styles.bold}>HIPMI Badung Connect</Text> adalah platform
|
||||||
|
digital resmi untuk anggota Himpunan Pengusaha Muda Indonesia (HIPMI)
|
||||||
|
Kabupaten Badung, yang bertujuan memfasilitasi jaringan, kolaborasi,
|
||||||
|
dan pertumbuhan bisnis para pengusaha muda.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>2. Larangan Konten Tidak Pantas</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Anda <Text style={styles.bold}>dilarang keras</Text> memposting,
|
||||||
|
mengirim, membagikan, atau mengunggah konten apa pun yang mengandung:
|
||||||
|
</Text>
|
||||||
|
<View style={styles.list}>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Ujaran kebencian, diskriminasi, atau konten SARA (Suku, Agama,
|
||||||
|
Ras, Antar-golongan)
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Pornografi, konten seksual eksplisit, atau gambar tidak senonoh
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Ancaman, pelecehan, bullying, atau perilaku melecehkan
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Informasi palsu, hoaks, spam, atau konten menyesatkan
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Konten ilegal, melanggar hukum, atau melanggar hak kekayaan
|
||||||
|
intelektual pihak lain
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Promosi narkoba, perjudian, atau aktivitas ilegal lainnya
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>3. Tanggung Jawab Pengguna</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Anda bertanggung jawab penuh atas setiap konten yang Anda unggah atau
|
||||||
|
bagikan melalui fitur-fitur berikut:
|
||||||
|
</Text>
|
||||||
|
<View style={styles.list}>
|
||||||
|
<Text style={styles.listItem}>• Profil (bio, foto, portofolio)</Text>
|
||||||
|
<Text style={styles.listItem}>• Forum diskusi</Text>
|
||||||
|
<Text style={styles.listItem}>• Chat pribadi atau grup</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Lowongan kerja, investasi, dan donasi
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Konten yang melanggar ketentuan ini dapat dihapus kapan saja tanpa
|
||||||
|
pemberitahuan.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>4. Tindakan terhadap Pelanggaran</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Jika kami menerima laporan atau menemukan konten yang melanggar
|
||||||
|
ketentuan ini, kami akan:
|
||||||
|
</Text>
|
||||||
|
<View style={styles.list}>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Segera menghapus konten tersebut
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Memberikan peringatan atau memblokir akun pengguna
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Dalam kasus berat, melaporkan ke pihak berwajib sesuai hukum yang
|
||||||
|
berlaku
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Tim kami berkomitmen untuk menanggapi laporan konten tidak pantas{" "}
|
||||||
|
<Text style={styles.bold}>dalam waktu 24 jam</Text>.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>5. Mekanisme Pelaporan</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Anda dapat melaporkan konten atau pengguna yang mencurigakan melalui:
|
||||||
|
</Text>
|
||||||
|
<View style={styles.list}>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Tombol <Text style={styles.bold}>“Laporkan”</Text> di setiap
|
||||||
|
posting forum atau pesan chat
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Tombol <Text style={styles.bold}>“Blokir Pengguna”</Text> di
|
||||||
|
profil pengguna
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Setiap laporan akan ditangani secara rahasia dan segera.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>6. Perubahan Ketentuan</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Kami berhak memperbarui Syarat & Ketentuan ini sewaktu-waktu. Versi
|
||||||
|
terbaru akan dipublikasikan di halaman ini dengan tanggal revisi yang
|
||||||
|
diperbarui.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>7. Kontak</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Jika Anda memiliki pertanyaan tentang ketentuan ini, silakan hubungi
|
||||||
|
kami di:{"\n"}
|
||||||
|
<Text style={[styles.bold, { color: "#1E90FF" }]}>
|
||||||
|
bip.baliinteraktifperkasa@gmail.com
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.footer}>
|
||||||
|
© 2026 Bali Interaktif Perkasa. All rights reserved.
|
||||||
|
</Text>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={handleAccept}
|
||||||
|
disabled={!isAtBottom || isLoading}
|
||||||
|
style={[styles.button, { opacity: !isAtBottom || isLoading ? 0.6 : 1 }]}
|
||||||
|
>
|
||||||
|
<Text style={styles.buttonText}>
|
||||||
|
{isLoading ? "Menyimpan..." : "Saya Setuju"}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: MainColor.darkblue,
|
||||||
|
padding: 16,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: "bold",
|
||||||
|
textAlign: "center",
|
||||||
|
marginBottom: 16,
|
||||||
|
color: MainColor.white,
|
||||||
|
},
|
||||||
|
scrollView: {
|
||||||
|
flex: 1,
|
||||||
|
marginBottom: 20,
|
||||||
|
},
|
||||||
|
scrollContent: {
|
||||||
|
paddingBottom: 30,
|
||||||
|
},
|
||||||
|
heading: {
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: "600",
|
||||||
|
marginTop: 16,
|
||||||
|
marginBottom: 8,
|
||||||
|
color: MainColor.white,
|
||||||
|
},
|
||||||
|
paragraph: {
|
||||||
|
fontSize: 14,
|
||||||
|
lineHeight: 22,
|
||||||
|
color: MainColor.white,
|
||||||
|
marginBottom: 12,
|
||||||
|
},
|
||||||
|
bold: {
|
||||||
|
fontWeight: "600",
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
marginLeft: 8,
|
||||||
|
marginBottom: 12,
|
||||||
|
},
|
||||||
|
listItem: {
|
||||||
|
fontSize: 14,
|
||||||
|
lineHeight: 22,
|
||||||
|
color: MainColor.white,
|
||||||
|
marginBottom: 6,
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
fontSize: 12,
|
||||||
|
color: MainColor.white,
|
||||||
|
textAlign: "center",
|
||||||
|
marginTop: 20,
|
||||||
|
paddingTop: 10,
|
||||||
|
borderTopWidth: 2,
|
||||||
|
borderTopColor: AccentColor.blue,
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
backgroundColor: MainColor.yellow,
|
||||||
|
paddingVertical: 14,
|
||||||
|
borderRadius: 8,
|
||||||
|
alignItems: "center",
|
||||||
|
width: 200,
|
||||||
|
alignSelf: "center",
|
||||||
|
},
|
||||||
|
buttonText: {
|
||||||
|
color: "#fff",
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: "600",
|
||||||
|
},
|
||||||
|
});
|
||||||
259
screens/Authentication/EULAView.tsx
Normal file
259
screens/Authentication/EULAView.tsx
Normal file
@@ -0,0 +1,259 @@
|
|||||||
|
// app/syarat-dan-ketentuan.tsx
|
||||||
|
import {
|
||||||
|
View,
|
||||||
|
Text,
|
||||||
|
ScrollView,
|
||||||
|
TouchableOpacity,
|
||||||
|
StyleSheet,
|
||||||
|
} from "react-native";
|
||||||
|
import { useState, useRef } from "react";
|
||||||
|
import { useLocalSearchParams, useRouter } from "expo-router";
|
||||||
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
|
import { AccentColor, MainColor } from "@/constants/color-palet";
|
||||||
|
import { useAuth } from "@/hooks/use-auth";
|
||||||
|
|
||||||
|
export default function EULAView() {
|
||||||
|
const { acceptedTerms } = useAuth();
|
||||||
|
const { nomor } = useLocalSearchParams();
|
||||||
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||||
|
const [isAtBottom, setIsAtBottom] = useState(false);
|
||||||
|
const scrollViewRef = useRef<ScrollView>(null);
|
||||||
|
|
||||||
|
const handleScroll = (event: any) => {
|
||||||
|
const { layoutMeasurement, contentOffset, contentSize } = event.nativeEvent;
|
||||||
|
const paddingToBottom = 20;
|
||||||
|
const isCloseToBottom =
|
||||||
|
layoutMeasurement.height + contentOffset.y >=
|
||||||
|
contentSize.height - paddingToBottom;
|
||||||
|
setIsAtBottom(isCloseToBottom);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAccept = async () => {
|
||||||
|
try {
|
||||||
|
if (!isAtBottom) return;
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
// await acceptedTerms(nomor as string);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("Error accept terms", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SafeAreaView edges={["bottom"]} style={styles.container}>
|
||||||
|
<Text style={styles.title}>
|
||||||
|
Syarat & Ketentuan Penggunaan HIPMI Badung Connect
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
ref={scrollViewRef}
|
||||||
|
onScroll={handleScroll}
|
||||||
|
scrollEventThrottle={16}
|
||||||
|
style={styles.scrollView}
|
||||||
|
contentContainerStyle={styles.scrollContent}
|
||||||
|
>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Dengan menggunakan aplikasi{" "}
|
||||||
|
<Text style={styles.bold}>HIPMI Badung Connect</Text> (“Aplikasi”),
|
||||||
|
Anda setuju untuk mematuhi dan terikat oleh syarat dan ketentuan
|
||||||
|
berikut. Jika Anda tidak setuju dengan ketentuan ini, harap jangan
|
||||||
|
gunakan Aplikasi.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>1. Definisi</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
<Text style={styles.bold}>HIPMI Badung Connect</Text> adalah platform
|
||||||
|
digital resmi untuk anggota Himpunan Pengusaha Muda Indonesia (HIPMI)
|
||||||
|
Kabupaten Badung, yang bertujuan memfasilitasi jaringan, kolaborasi,
|
||||||
|
dan pertumbuhan bisnis para pengusaha muda.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>2. Larangan Konten Tidak Pantas</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Anda <Text style={styles.bold}>dilarang keras</Text> memposting,
|
||||||
|
mengirim, membagikan, atau mengunggah konten apa pun yang mengandung:
|
||||||
|
</Text>
|
||||||
|
<View style={styles.list}>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Ujaran kebencian, diskriminasi, atau konten SARA (Suku, Agama,
|
||||||
|
Ras, Antar-golongan)
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Pornografi, konten seksual eksplisit, atau gambar tidak senonoh
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Ancaman, pelecehan, bullying, atau perilaku melecehkan
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Informasi palsu, hoaks, spam, atau konten menyesatkan
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Konten ilegal, melanggar hukum, atau melanggar hak kekayaan
|
||||||
|
intelektual pihak lain
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Promosi narkoba, perjudian, atau aktivitas ilegal lainnya
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>3. Tanggung Jawab Pengguna</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Anda bertanggung jawab penuh atas setiap konten yang Anda unggah atau
|
||||||
|
bagikan melalui fitur-fitur berikut:
|
||||||
|
</Text>
|
||||||
|
<View style={styles.list}>
|
||||||
|
<Text style={styles.listItem}>• Profil (bio, foto, portofolio)</Text>
|
||||||
|
<Text style={styles.listItem}>• Forum diskusi</Text>
|
||||||
|
<Text style={styles.listItem}>• Chat pribadi atau grup</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Lowongan kerja, investasi, dan donasi
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Konten yang melanggar ketentuan ini dapat dihapus kapan saja tanpa
|
||||||
|
pemberitahuan.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>4. Tindakan terhadap Pelanggaran</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Jika kami menerima laporan atau menemukan konten yang melanggar
|
||||||
|
ketentuan ini, kami akan:
|
||||||
|
</Text>
|
||||||
|
<View style={styles.list}>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Segera menghapus konten tersebut
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Memberikan peringatan atau memblokir akun pengguna
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Dalam kasus berat, melaporkan ke pihak berwajib sesuai hukum yang
|
||||||
|
berlaku
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Tim kami berkomitmen untuk menanggapi laporan konten tidak pantas{" "}
|
||||||
|
<Text style={styles.bold}>dalam waktu 24 jam</Text>.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>5. Mekanisme Pelaporan</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Anda dapat melaporkan konten atau pengguna yang mencurigakan melalui:
|
||||||
|
</Text>
|
||||||
|
<View style={styles.list}>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Tombol <Text style={styles.bold}>“Laporkan”</Text> di setiap
|
||||||
|
posting forum atau pesan chat
|
||||||
|
</Text>
|
||||||
|
<Text style={styles.listItem}>
|
||||||
|
• Tombol <Text style={styles.bold}>“Blokir Pengguna”</Text> di
|
||||||
|
profil pengguna
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Setiap laporan akan ditangani secara rahasia dan segera.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>6. Perubahan Ketentuan</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Kami berhak memperbarui Syarat & Ketentuan ini sewaktu-waktu. Versi
|
||||||
|
terbaru akan dipublikasikan di halaman ini dengan tanggal revisi yang
|
||||||
|
diperbarui.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.heading}>7. Kontak</Text>
|
||||||
|
<Text style={styles.paragraph}>
|
||||||
|
Jika Anda memiliki pertanyaan tentang ketentuan ini, silakan hubungi
|
||||||
|
kami di:{"\n"}
|
||||||
|
<Text style={[styles.bold, { color: "#1E90FF" }]}>
|
||||||
|
bip.baliinteraktifperkasa@gmail.com
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text style={styles.footer}>
|
||||||
|
© 2026 Bali Interaktif Perkasa. All rights reserved.
|
||||||
|
</Text>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={handleAccept}
|
||||||
|
disabled={!isAtBottom || isLoading}
|
||||||
|
style={[styles.button, { opacity: !isAtBottom || isLoading ? 0.6 : 1 }]}
|
||||||
|
>
|
||||||
|
<Text style={styles.buttonText}>
|
||||||
|
{isLoading ? "Menyimpan..." : "Saya Setuju"}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</SafeAreaView>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: MainColor.darkblue,
|
||||||
|
padding: 16,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: "bold",
|
||||||
|
textAlign: "center",
|
||||||
|
marginBottom: 16,
|
||||||
|
color: MainColor.white,
|
||||||
|
},
|
||||||
|
scrollView: {
|
||||||
|
flex: 1,
|
||||||
|
marginBottom: 20,
|
||||||
|
},
|
||||||
|
scrollContent: {
|
||||||
|
paddingBottom: 30,
|
||||||
|
},
|
||||||
|
heading: {
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: "600",
|
||||||
|
marginTop: 16,
|
||||||
|
marginBottom: 8,
|
||||||
|
color: MainColor.white,
|
||||||
|
},
|
||||||
|
paragraph: {
|
||||||
|
fontSize: 14,
|
||||||
|
lineHeight: 22,
|
||||||
|
color: MainColor.white,
|
||||||
|
marginBottom: 12,
|
||||||
|
},
|
||||||
|
bold: {
|
||||||
|
fontWeight: "600",
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
marginLeft: 8,
|
||||||
|
marginBottom: 12,
|
||||||
|
},
|
||||||
|
listItem: {
|
||||||
|
fontSize: 14,
|
||||||
|
lineHeight: 22,
|
||||||
|
color: MainColor.white,
|
||||||
|
marginBottom: 6,
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
fontSize: 12,
|
||||||
|
color: MainColor.white,
|
||||||
|
textAlign: "center",
|
||||||
|
marginTop: 20,
|
||||||
|
paddingTop: 10,
|
||||||
|
borderTopWidth: 2,
|
||||||
|
borderTopColor: AccentColor.blue,
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
backgroundColor: MainColor.yellow,
|
||||||
|
paddingVertical: 14,
|
||||||
|
borderRadius: 8,
|
||||||
|
alignItems: "center",
|
||||||
|
},
|
||||||
|
buttonText: {
|
||||||
|
color: "#fff",
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: "600",
|
||||||
|
},
|
||||||
|
});
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user