Compare commits
5 Commits
api-admin/
...
api-admin/
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d4328a139 | |||
| 125bf16605 | |||
| 73a803f2e8 | |||
| 1bcd1a044f | |||
| 1e0b72de22 |
@@ -16,20 +16,19 @@ import Donation_ComponentInfoFundrising from "@/screens/Donation/ComponentInfoFu
|
|||||||
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 {
|
import {
|
||||||
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";
|
||||||
|
|
||||||
export default function DonasiDetailBeranda() {
|
export default function DonasiDetailBeranda() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
console.log("ID ", id);
|
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
|
|
||||||
const [data, setData] = useState<any>();
|
const [data, setData] = useState<any>();
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
@@ -45,21 +44,41 @@ export default function DonasiDetailBeranda() {
|
|||||||
category: "permanent",
|
category: "permanent",
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RES GET ONE]", JSON.stringify(response.data, null, 2));
|
|
||||||
|
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const buttonSection = (
|
const buttonSection = (
|
||||||
<>
|
<>
|
||||||
<BoxButtonOnFooter>
|
<BoxButtonOnFooter>
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
|
disabled={value?.reminder}
|
||||||
onPress={() => router.navigate(`/donation/${id}/(transaction-flow)`)}
|
onPress={() => router.navigate(`/donation/${id}/(transaction-flow)`)}
|
||||||
>
|
>
|
||||||
Donasi
|
{value?.reminder ? "Waktu berakhir" : "Donasi"}
|
||||||
</ButtonCustom>
|
</ButtonCustom>
|
||||||
</BoxButtonOnFooter>
|
</BoxButtonOnFooter>
|
||||||
</>
|
</>
|
||||||
@@ -80,6 +99,8 @@ export default function DonasiDetailBeranda() {
|
|||||||
<ViewWrapper footerComponent={buttonSection}>
|
<ViewWrapper footerComponent={buttonSection}>
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<Donation_ComponentBoxDetailData
|
<Donation_ComponentBoxDetailData
|
||||||
|
sisaHari={value.sisa}
|
||||||
|
reminder={value.reminder}
|
||||||
data={data}
|
data={data}
|
||||||
bottomSection={<Donation_ProgressSection id={id as string} />}
|
bottomSection={<Donation_ProgressSection id={id as string} />}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ export default function UserEventConfirmation() {
|
|||||||
userId: user?.id as string,
|
userId: user?.id as string,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RES CONFIRMATION]", JSON.stringify(response, null, 2));
|
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data?.dataEvent);
|
setData(response.data?.dataEvent);
|
||||||
setPeserta(response.data?.peserta);
|
setPeserta(response.data?.peserta);
|
||||||
@@ -142,11 +140,11 @@ export default function UserEventConfirmation() {
|
|||||||
return (
|
return (
|
||||||
<TamplateBox data={data}>
|
<TamplateBox data={data}>
|
||||||
<TamplateText
|
<TamplateText
|
||||||
text={`Event telah selesai, anda terdaftar sebagai peserta dan${
|
text={`Event telah selesai, anda terdaftar sebagai peserta dan ${
|
||||||
konfirmasi
|
konfirmasi
|
||||||
? "Anda telah mengonfirmasi kehadiran."
|
? "Anda telah mengonfirmasi kehadiran."
|
||||||
: "Anda tidak mengonfirmasi kehadiran."
|
: "Anda tidak mengonfirmasi kehadiran."
|
||||||
}. Terima kasih atas perhatian dan minat Anda. Kami berharap dapat bertemu di acara kami berikutnya.`}
|
} Terima kasih atas perhatian dan minat Anda. Kami berharap dapat bertemu di acara kami berikutnya.`}
|
||||||
/>
|
/>
|
||||||
<BackToOtherPath
|
<BackToOtherPath
|
||||||
path="event"
|
path="event"
|
||||||
@@ -173,14 +171,16 @@ export default function UserEventConfirmation() {
|
|||||||
if (isWithinConfirmationWindow && peserta === true) {
|
if (isWithinConfirmationWindow && peserta === true) {
|
||||||
if (konfirmasi === false) {
|
if (konfirmasi === false) {
|
||||||
return (
|
return (
|
||||||
<TamplateBox data={data}>
|
<UserParticipan_And_DuringEvent
|
||||||
<TamplateText text="Konfirmasi Kehadiran" />
|
id={data.id}
|
||||||
</TamplateBox>
|
userId={user?.id as string}
|
||||||
|
data={data}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<TamplateBox data={data}>
|
<TamplateBox data={data}>
|
||||||
<TamplateText text="Anda telah mengonfirmasi kehadiran." />
|
<TamplateText text="Terimakasih telah mengonfirmasi kehadiran. Silahkan lihat peserta lain pada halaman event atau kembali ke halaman home. Selamat menikmati acara dan selamat berpartisipasi." />
|
||||||
<BackToOtherPath
|
<BackToOtherPath
|
||||||
path="event"
|
path="event"
|
||||||
id={data.id}
|
id={data.id}
|
||||||
@@ -192,7 +192,7 @@ export default function UserEventConfirmation() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TamplateBox data={data}>
|
<TamplateBox data={data}>
|
||||||
<TamplateText text="Anda terdaftar sebagai peserta. Konfirmasi kehadiran dibuka 1 jam sebelum acara dimulai." />
|
<TamplateText text="Anda telah terdaftar sebagai peserta pada Event ini. Konfirmasi kehadiran dibuka 1 jam sebelum acara dimulai." />
|
||||||
<BackToOtherPath
|
<BackToOtherPath
|
||||||
path="event"
|
path="event"
|
||||||
id={data.id}
|
id={data.id}
|
||||||
@@ -326,7 +326,7 @@ const TamplateBox = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const TamplateText = ({ text }: { text: string }) => {
|
const TamplateText = ({ text }: { text: React.ReactNode }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TextCustom align="center">{text}</TextCustom>
|
<TextCustom align="center">{text}</TextCustom>
|
||||||
@@ -442,7 +442,7 @@ const NotStarted_And_UserNotParticipan = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 🟡 ZONA ACARA BERLANGSUNG
|
// 🟡 ZONA ACARA BERLANGSUNG
|
||||||
// Acara sedang berlangsung & belum terdaftar
|
// Acara sedang berlangsung & belum terdaftar & user harus join dan konfirmasi
|
||||||
const UserNotParticipan_And_DuringEvent = ({
|
const UserNotParticipan_And_DuringEvent = ({
|
||||||
id,
|
id,
|
||||||
userId,
|
userId,
|
||||||
@@ -464,8 +464,6 @@ const UserNotParticipan_And_DuringEvent = ({
|
|||||||
category: "join_and_confirm",
|
category: "join_and_confirm",
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("[RES JOIN & CONFIRMATION EVENT]", response);
|
|
||||||
|
|
||||||
if (!response.success) {
|
if (!response.success) {
|
||||||
Toast.show({
|
Toast.show({
|
||||||
type: "error",
|
type: "error",
|
||||||
@@ -498,3 +496,59 @@ const UserNotParticipan_And_DuringEvent = ({
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 🟡 ZONA ACARA BERLANGSUN
|
||||||
|
// User sudah terdaftar & Event sedang berlangsung & user harus konfirmasi
|
||||||
|
const UserParticipan_And_DuringEvent = ({
|
||||||
|
id,
|
||||||
|
userId,
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
userId: string;
|
||||||
|
data: DataEvent;
|
||||||
|
}) => {
|
||||||
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const handlerSubmit = async () => {
|
||||||
|
try {
|
||||||
|
setIsLoading(true);
|
||||||
|
|
||||||
|
const response = await apiEventConfirmationAction({
|
||||||
|
id: id as string,
|
||||||
|
userId: userId as string,
|
||||||
|
category: "confirmation",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Anda gagal konfirmasi",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Anda berhasil konfirmasi",
|
||||||
|
});
|
||||||
|
router.navigate(`/(application)/(user)/event/${id}/publish`);
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR JOIN & CONFIRMATION EVENT]", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TamplateBox data={data}>
|
||||||
|
<TamplateText text="Anda sudah terdaftar sebagai peserta & Event sedang berlangsung. Silahkan konfirmasi kehadiran" />
|
||||||
|
|
||||||
|
<ButtonCustom onPress={() => handlerSubmit()} isLoading={isLoading}>
|
||||||
|
Konfirmasi
|
||||||
|
</ButtonCustom>
|
||||||
|
</TamplateBox>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -11,29 +11,30 @@ import {
|
|||||||
apiEventGetOne,
|
apiEventGetOne,
|
||||||
apiEventListOfParticipants,
|
apiEventListOfParticipants,
|
||||||
} from "@/service/api-client/api-event";
|
} from "@/service/api-client/api-event";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import dayjs, { Dayjs } from "dayjs";
|
||||||
import { useEffect, useState } from "react";
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
|
||||||
export default function EventListOfParticipants() {
|
export default function EventListOfParticipants() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const [startDate, setStartDate] = useState();
|
const [startDate, setStartDate] = useState<Dayjs | undefined>();
|
||||||
const [listData, setListData] = useState([]);
|
const [listData, setListData] = useState<any[] | null>(null);
|
||||||
const [isLoadData, setIsLoadData] = useState(false);
|
const [loadtData, setLoadData] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useFocusEffect(
|
||||||
handlerLoadData();
|
useCallback(() => {
|
||||||
}, [id]);
|
handlerLoadData();
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
const handlerLoadData = () => {
|
const handlerLoadData = () => {
|
||||||
try {
|
try {
|
||||||
setIsLoadData(true);
|
|
||||||
onLoadData();
|
onLoadData();
|
||||||
onLoadList();
|
onLoadList();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
} finally {
|
|
||||||
setIsLoadData(false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -41,7 +42,8 @@ export default function EventListOfParticipants() {
|
|||||||
try {
|
try {
|
||||||
const response = await apiEventGetOne({ id: id as string });
|
const response = await apiEventGetOne({ id: id as string });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setStartDate(response.data.tanggal);
|
const date = dayjs(response.data.tanggal);
|
||||||
|
setStartDate(date);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
@@ -50,30 +52,36 @@ export default function EventListOfParticipants() {
|
|||||||
|
|
||||||
const onLoadList = async () => {
|
const onLoadList = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoadData(true);
|
||||||
const response = await apiEventListOfParticipants({ id: id as string });
|
const response = await apiEventListOfParticipants({ id: id as string });
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setListData(response.data);
|
setListData(response.data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoadData(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
{isLoadData ? (
|
{loadtData && !listData ? (
|
||||||
<LoaderCustom />
|
<LoaderCustom />
|
||||||
) : listData.length === 0 ? (
|
) : _.isEmpty(listData) ? (
|
||||||
<TextCustom align="center">Belum ada peserta</TextCustom>
|
<TextCustom align="center" color="gray">
|
||||||
|
Belum ada peserta
|
||||||
|
</TextCustom>
|
||||||
) : (
|
) : (
|
||||||
listData.map((item: any, index: number) => (
|
listData?.map((item: any, index: number) => (
|
||||||
<BaseBox key={index}>
|
<BaseBox key={index}>
|
||||||
<AvatarUsernameAndOtherComponent
|
<AvatarUsernameAndOtherComponent
|
||||||
avatar={item?.User?.Profile?.imageId}
|
avatar={item?.User?.Profile?.imageId}
|
||||||
name={item?.User?.username}
|
name={item?.User?.username}
|
||||||
avatarHref={`/profile/${item?.User?.Profile?.id}`}
|
avatarHref={`/profile/${item?.User?.Profile?.id}`}
|
||||||
rightComponent={
|
rightComponent={
|
||||||
new Date().getTime() > new Date(startDate as any).getTime() ? (
|
startDate && startDate.subtract(1, "hour").diff(dayjs()) < 0 ? (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
justifyContent: "flex-end",
|
justifyContent: "flex-end",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
@@ -18,97 +19,147 @@ 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 { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import ReportBox from "@/components/Box/ReportBox";
|
||||||
import { ICON_SIZE_BUTTON, TEXT_SIZE_LARGE } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON, TEXT_SIZE_LARGE } from "@/constants/constans-value";
|
||||||
import AdminDonation_BoxOfDonationStory from "@/screens/Admin/Donation/BoxOfDonationStory";
|
import AdminDonation_BoxOfDonationStory from "@/screens/Admin/Donation/BoxOfDonationStory";
|
||||||
|
import { funUpdateStatusDonation } from "@/screens/Admin/Donation/funDonationUpdateStatus";
|
||||||
|
import { apiAdminDonationDetailById } from "@/service/api-admin/api-admin-donation";
|
||||||
|
import { colorBadgeStatus } from "@/utils/colorBadge";
|
||||||
|
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminDonationDetail() {
|
export default function AdminDonationDetail() {
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
const [openDrawer, setOpenDrawer] = React.useState(false);
|
const [openDrawer, setOpenDrawer] = React.useState(false);
|
||||||
|
|
||||||
const colorBadge = () => {
|
const [data, setData] = React.useState<any | null>(null);
|
||||||
if (status === "publish") {
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
return MainColor.green;
|
|
||||||
} else if (status === "review") {
|
useFocusEffect(
|
||||||
return MainColor.orange;
|
React.useCallback(() => {
|
||||||
} else if (status === "reject") {
|
onLoadData();
|
||||||
return MainColor.red;
|
}, [id])
|
||||||
} else {
|
);
|
||||||
return MainColor.placeholder;
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminDonationDetailById({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("[RES GET BY ID]", JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
setData(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const listData = [
|
const listData = [
|
||||||
{
|
{
|
||||||
label: "Penggalang Dana",
|
label: "Penggalang Dana",
|
||||||
value: `Bagas Banuna ${id}`,
|
value: (data && data?.Author?.username) || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Judul",
|
label: "Judul",
|
||||||
value: `Donasi Lorem ipsum dolor sit amet, consectetur adipisicing elit.`,
|
value: (data && data?.title) || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Status",
|
label: "Status",
|
||||||
value: (
|
value:
|
||||||
<BadgeCustom color={colorBadge()}>
|
data && data?.DonasiMaster_Status?.name ? (
|
||||||
{_.startCase(status as string)}
|
<BadgeCustom
|
||||||
</BadgeCustom>
|
color={colorBadgeStatus({ status: data?.DonasiMaster_Status?.name })}
|
||||||
),
|
>
|
||||||
|
{_.startCase(data?.DonasiMaster_Status?.name)}
|
||||||
|
</BadgeCustom>
|
||||||
|
) : (
|
||||||
|
"-"
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Durasi",
|
label: "Durasi",
|
||||||
value: "30 Hari",
|
value: (data && data?.DonasiMaster_Durasi?.name) + " hari" || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Target Dana",
|
label: "Target Dana",
|
||||||
value: "Rp 10.000.000",
|
value:
|
||||||
|
data && data?.target
|
||||||
|
? `Rp. ${formatCurrencyDisplay(data?.target)}`
|
||||||
|
: "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Kategori",
|
label: "Kategori",
|
||||||
value: "Kategori Donasi",
|
value: (data && data?.DonasiMaster_Ketegori?.name) || "-",
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// label: "Total Donatur",
|
|
||||||
// value: "-",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: "Progress",
|
|
||||||
// value: "0 %",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: "Dana Terkumpul",
|
|
||||||
// value: "Rp 0",
|
|
||||||
// },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const listPencarianDana = [
|
const listPencarianDana = [
|
||||||
{
|
{
|
||||||
label: "Total Dana Dicairkan",
|
label: "Total Dana Dicairkan",
|
||||||
value: "Rp 0",
|
value: `Rp ${(data && data?.totalPencairan) || 0}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Sisa Dana",
|
label: "Sisa Dana",
|
||||||
value: "Rp 0",
|
value: `Rp ${(data && data?.terkumpul - data?.totalPencairan) || 0}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Akumulasi Pencairan",
|
label: "Akumulasi Pencairan",
|
||||||
value: "0 kali",
|
value: `${(data && data?.totalPencairan) || 0} kali`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Bank Tujuan",
|
label: "Bank Tujuan",
|
||||||
value: "BNI",
|
value: (data && data?.namaBank) || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Nomor Rekening",
|
label: "Nomor Rekening",
|
||||||
value: "123456789",
|
value: (data && data?.rekening) || "-",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const handleReport = async ({
|
||||||
|
changeStatus,
|
||||||
|
}: {
|
||||||
|
changeStatus: "publish" | "review" | "reject";
|
||||||
|
}) => {
|
||||||
|
try {
|
||||||
|
setIsLoading(true);
|
||||||
|
const response = await funUpdateStatusDonation({
|
||||||
|
id: id as string,
|
||||||
|
changeStatus,
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Update status gagal",
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Update status berhasil",
|
||||||
|
});
|
||||||
|
|
||||||
|
router.back();
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const rightComponent = (
|
const rightComponent = (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
icon={<IconDot size={ICON_SIZE_BUTTON} />}
|
icon={<IconDot size={ICON_SIZE_BUTTON} />}
|
||||||
@@ -118,8 +169,6 @@ export default function AdminDonationDetail() {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper
|
<ViewWrapper
|
||||||
@@ -147,6 +196,7 @@ export default function AdminDonationDetail() {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
|
|
||||||
<ButtonCustom
|
<ButtonCustom
|
||||||
iconLeft={
|
iconLeft={
|
||||||
<Ionicons name="cash-outline" size={ICON_SIZE_BUTTON} />
|
<Ionicons name="cash-outline" size={ICON_SIZE_BUTTON} />
|
||||||
@@ -179,7 +229,7 @@ export default function AdminDonationDetail() {
|
|||||||
|
|
||||||
<BaseBox>
|
<BaseBox>
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<DummyLandscapeImage />
|
<DummyLandscapeImage imageId={data?.imageId || ""} />
|
||||||
{listData.map((item, i) => (
|
{listData.map((item, i) => (
|
||||||
<GridDetail_4_8
|
<GridDetail_4_8
|
||||||
key={i}
|
key={i}
|
||||||
@@ -190,27 +240,33 @@ export default function AdminDonationDetail() {
|
|||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
|
|
||||||
|
<AdminDonation_BoxOfDonationStory data={data?.CeritaDonasi as any} />
|
||||||
|
|
||||||
|
{data &&
|
||||||
|
data?.catatan &&
|
||||||
|
(status === "review" || status === "reject") && (
|
||||||
|
<ReportBox text={data?.catatan} />
|
||||||
|
)}
|
||||||
|
|
||||||
{status === "review" && (
|
{status === "review" && (
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<AdminDonation_BoxOfDonationStory />
|
|
||||||
|
|
||||||
<AdminButtonReview
|
<AdminButtonReview
|
||||||
|
isLoading={isLoading}
|
||||||
onPublish={() => {
|
onPublish={() => {
|
||||||
AlertDefaultSystem({
|
AlertDefaultSystem({
|
||||||
title: "Publish",
|
title: "Publish",
|
||||||
message: "Apakah anda yakin ingin mempublikasikan data ini?",
|
message: "Apakah anda yakin ingin mempublikasikan data ini?",
|
||||||
textLeft: "Batal",
|
textLeft: "Batal",
|
||||||
textRight: "Ya",
|
textRight: "Ya",
|
||||||
onPressLeft: () => {
|
|
||||||
router.back();
|
|
||||||
},
|
|
||||||
onPressRight: () => {
|
onPressRight: () => {
|
||||||
router.back();
|
handleReport({ changeStatus: "publish" });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
onReject={() => {
|
onReject={() => {
|
||||||
router.push(`/admin/donation/${id}/reject-input`);
|
router.push(
|
||||||
|
`/admin/donation/${id}/reject-input?status=${status}`
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
@@ -218,12 +274,12 @@ export default function AdminDonationDetail() {
|
|||||||
|
|
||||||
{status === "reject" && (
|
{status === "reject" && (
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<AdminDonation_BoxOfDonationStory />
|
|
||||||
|
|
||||||
<AdminButtonReject
|
<AdminButtonReject
|
||||||
title="Tambah Catatan"
|
title="Tambah Catatan"
|
||||||
onReject={() => {
|
onReject={() => {
|
||||||
router.push(`/admin/donation/${id}/reject-input`);
|
router.push(
|
||||||
|
`/admin/donation/${id}/reject-input?status=${status}`
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
BadgeCustom,
|
BadgeCustom,
|
||||||
@@ -10,22 +11,86 @@ import {
|
|||||||
import { IconView } from "@/components/_Icon/IconComponent";
|
import { IconView } from "@/components/_Icon/IconComponent";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import { GridViewCustomSpan } from "@/components/_ShareComponent/GridViewCustomSpan";
|
import { GridViewCustomSpan } from "@/components/_ShareComponent/GridViewCustomSpan";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
import { dummyMasterStatusTransaction } from "@/lib/dummy-data/_master/status-transaction";
|
import { apiAdminDonationListOfDonatur } from "@/service/api-admin/api-admin-donation";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { apiMasterTransaction } from "@/service/api-client/api-master";
|
||||||
import React from "react";
|
import { colorBadgeTransaction } from "@/utils/colorBadge";
|
||||||
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import { Divider } from "react-native-paper";
|
import { Divider } from "react-native-paper";
|
||||||
|
|
||||||
export default function AdminDonasiListOfDonatur() {
|
export default function AdminDonasiListOfDonatur() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
|
console.log("[ID >>]", id);
|
||||||
|
const [listData, setListData] = React.useState<any[] | null>(null);
|
||||||
|
const [master, setMaster] = React.useState<any[]>([]);
|
||||||
|
|
||||||
|
const [selectStatus, setSelectStatus] = React.useState<
|
||||||
|
"berhasil" | "gagal" | "proses" | "menunggu" | ""
|
||||||
|
>("");
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
React.useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [id, selectStatus])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminDonationListOfDonatur({
|
||||||
|
id: id as string,
|
||||||
|
status: "" as any,
|
||||||
|
});
|
||||||
|
console.log(
|
||||||
|
"[LIST OF DONATUR]",
|
||||||
|
JSON.stringify(response, null, 2)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setListData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
setListData([]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
onLoadMaster();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const onLoadMaster = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiMasterTransaction();
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setMaster(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
setMaster([]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const searchComponent = (
|
const searchComponent = (
|
||||||
<View style={{ flexDirection: "row", gap: 5 }}>
|
<View style={{ flexDirection: "row", gap: 5 }}>
|
||||||
<SelectCustom
|
<SelectCustom
|
||||||
placeholder="Pilih status transaksi"
|
placeholder="Pilih status transaksi"
|
||||||
data={dummyMasterStatusTransaction}
|
data={
|
||||||
onChange={(value) => console.log(value)}
|
_.isEmpty(master)
|
||||||
|
? []
|
||||||
|
: master?.map((item: any) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.name
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
onChange={(value: any) => {
|
||||||
|
console.log("[SELECT STATUS]", value);
|
||||||
|
const statusChooses = _.lowerCase(value);
|
||||||
|
setSelectStatus(statusChooses as any);
|
||||||
|
}}
|
||||||
styleContainer={{ width: "100%", marginBottom: 0 }}
|
styleContainer={{ width: "100%", marginBottom: 0 }}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@@ -59,7 +124,7 @@ export default function AdminDonasiListOfDonatur() {
|
|||||||
/>
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
{Array.from({ length: 10 }).map((_, index) => (
|
{listData?.map((item: any, index: number) => (
|
||||||
<View key={index}>
|
<View key={index}>
|
||||||
<GridViewCustomSpan
|
<GridViewCustomSpan
|
||||||
span1={3}
|
span1={3}
|
||||||
@@ -79,15 +144,15 @@ export default function AdminDonasiListOfDonatur() {
|
|||||||
}
|
}
|
||||||
component2={
|
component2={
|
||||||
<TextCustom bold align="center" truncate>
|
<TextCustom bold align="center" truncate>
|
||||||
Bagas Banuna
|
{item?.Author?.username || "-"}
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
}
|
}
|
||||||
component3={
|
component3={
|
||||||
<BadgeCustom
|
<BadgeCustom
|
||||||
style={{ alignSelf: "center" }}
|
style={{ alignSelf: "center" }}
|
||||||
color={MainColor.green}
|
color={colorBadgeTransaction({status: item?.DonasiMaster_StatusInvoice?.name})}
|
||||||
>
|
>
|
||||||
Berhasil
|
{item?.DonasiMaster_StatusInvoice?.name}
|
||||||
</BadgeCustom>
|
</BadgeCustom>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
BoxButtonOnFooter,
|
BoxButtonOnFooter,
|
||||||
@@ -6,15 +7,84 @@ 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 { router, useLocalSearchParams } from "expo-router";
|
import { funUpdateStatusDonation } from "@/screens/Admin/Donation/funDonationUpdateStatus";
|
||||||
import { useState } from "react";
|
import {
|
||||||
|
apiAdminDonationDetailById
|
||||||
|
} from "@/service/api-admin/api-admin-donation";
|
||||||
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import React from "react";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminDonationRejectInput() {
|
export default function AdminDonationRejectInput() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
const [value, setValue] = useState(id as string);
|
|
||||||
|
const [data, setData] = React.useState<any | null>(null);
|
||||||
|
const [isLoading, setIsLoading] = React.useState(false);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
React.useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminDonationDetailById({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data.catatan);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
setData(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleReport = async ({
|
||||||
|
changeStatus,
|
||||||
|
}: {
|
||||||
|
changeStatus: "publish" | "review" | "reject";
|
||||||
|
}) => {
|
||||||
|
try {
|
||||||
|
setIsLoading(true);
|
||||||
|
const response = await funUpdateStatusDonation({
|
||||||
|
id: id as string,
|
||||||
|
changeStatus,
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Report gagal",
|
||||||
|
});
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Report berhasil",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (status === "review") {
|
||||||
|
router.replace(`/admin/donation/reject/status`);
|
||||||
|
} else if (status === "reject") {
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const buttonSubmit = (
|
const buttonSubmit = (
|
||||||
<BoxButtonOnFooter>
|
<BoxButtonOnFooter>
|
||||||
<AdminButtonReject
|
<AdminButtonReject
|
||||||
|
isLoading={isLoading}
|
||||||
title="Reject"
|
title="Reject"
|
||||||
onReject={() =>
|
onReject={() =>
|
||||||
AlertDefaultSystem({
|
AlertDefaultSystem({
|
||||||
@@ -22,12 +92,9 @@ export default function AdminDonationRejectInput() {
|
|||||||
message: "Apakah anda yakin ingin menolak data ini?",
|
message: "Apakah anda yakin ingin menolak data ini?",
|
||||||
textLeft: "Batal",
|
textLeft: "Batal",
|
||||||
textRight: "Ya",
|
textRight: "Ya",
|
||||||
onPressLeft: () => {
|
|
||||||
router.back();
|
|
||||||
},
|
|
||||||
onPressRight: () => {
|
onPressRight: () => {
|
||||||
console.log("value:", value);
|
handleReport({ changeStatus: "reject" });
|
||||||
router.replace(`/admin/donation/reject/status`);
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -42,8 +109,8 @@ export default function AdminDonationRejectInput() {
|
|||||||
headerComponent={<AdminBackButtonAntTitle title="Penolakan Donasi" />}
|
headerComponent={<AdminBackButtonAntTitle title="Penolakan Donasi" />}
|
||||||
>
|
>
|
||||||
<TextAreaCustom
|
<TextAreaCustom
|
||||||
value={value}
|
value={data}
|
||||||
onChangeText={setValue}
|
onChangeText={setData}
|
||||||
placeholder="Masukan alasan"
|
placeholder="Masukan alasan"
|
||||||
required
|
required
|
||||||
showCount
|
showCount
|
||||||
|
|||||||
@@ -1,69 +1,116 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
SearchInput,
|
LoaderCustom,
|
||||||
Spacing,
|
SearchInput,
|
||||||
TextCustom,
|
StackCustom,
|
||||||
ViewWrapper
|
TextCustom,
|
||||||
|
ViewWrapper
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
||||||
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
import AdminTitleTable from "@/components/_ShareComponent/Admin/TableTitle";
|
||||||
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
import AdminTableValue from "@/components/_ShareComponent/Admin/TableValue";
|
||||||
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
|
import { apiAdminDonation } from "@/service/api-admin/api-admin-donation";
|
||||||
import { Octicons } from "@expo/vector-icons";
|
import { Octicons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
import { Divider } from "react-native-paper";
|
import { Divider } from "react-native-paper";
|
||||||
|
|
||||||
export default function AdminDonationStatus() {
|
export default function AdminDonationStatus() {
|
||||||
const { status } = useLocalSearchParams();
|
const { status } = useLocalSearchParams();
|
||||||
|
console.log("[STATUS]", status);
|
||||||
|
|
||||||
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
const [search, setSearch] = useState<string>("");
|
||||||
|
const [loadData, setLoadData] = useState<boolean>(false);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [status, search])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setLoadData(true);
|
||||||
|
const response = await apiAdminDonation({
|
||||||
|
category: status as "publish" | "review" | "reject",
|
||||||
|
search,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("[RES]", JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
setData([]);
|
||||||
|
} finally {
|
||||||
|
setLoadData(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const rightComponent = (
|
const rightComponent = (
|
||||||
<SearchInput
|
<SearchInput
|
||||||
containerStyle={{ width: "100%", marginBottom: 0 }}
|
containerStyle={{ width: "100%", marginBottom: 0 }}
|
||||||
placeholder="Cari"
|
placeholder="Cari"
|
||||||
|
value={search}
|
||||||
|
onChangeText={(value) => setSearch(value)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper
|
<ViewWrapper headerComponent={<AdminTitlePage title="Donasi" />}>
|
||||||
headerComponent={
|
<StackCustom gap={"sm"}>
|
||||||
<AdminComp_BoxTitle
|
<AdminComp_BoxTitle
|
||||||
title={`Donasi ${_.startCase(status as string)}`}
|
title={`${_.startCase(status as string)}`}
|
||||||
rightComponent={rightComponent}
|
rightComponent={rightComponent}
|
||||||
/>
|
/>
|
||||||
}
|
<AdminTitleTable
|
||||||
>
|
title1="Aksi"
|
||||||
<AdminTitleTable
|
title2="Username"
|
||||||
title1="Aksi"
|
title3="Judul Donasi"
|
||||||
title2="Username"
|
|
||||||
title3="Judul Donasi"
|
|
||||||
/>
|
|
||||||
<Spacing />
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
{Array.from({ length: 10 }).map((_, index) => (
|
|
||||||
<AdminTableValue
|
|
||||||
key={index}
|
|
||||||
value1={
|
|
||||||
<ActionIcon
|
|
||||||
icon={
|
|
||||||
<Octicons name="eye" size={ICON_SIZE_BUTTON} color="black" />
|
|
||||||
}
|
|
||||||
onPress={() => {
|
|
||||||
router.push(`/admin/donation/${index}/${status}`);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
value2={<TextCustom truncate={1}>Username username</TextCustom>}
|
|
||||||
value3={
|
|
||||||
<TextCustom truncate={2}>
|
|
||||||
Lorem ipsum dolor sit amet consectetur adipisicing elit.
|
|
||||||
Blanditiis asperiores quidem deleniti architecto eaque et
|
|
||||||
nostrum, ad consequuntur eveniet quisquam quae voluptatum
|
|
||||||
ducimus! Dolorem nobis modi officia debitis, beatae mollitia.
|
|
||||||
</TextCustom>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
<Divider />
|
||||||
|
|
||||||
|
{loadData ? (
|
||||||
|
<LoaderCustom />
|
||||||
|
) : _.isEmpty(data) ? (
|
||||||
|
<TextCustom align="center" size="small" color="gray">
|
||||||
|
Belum ada data
|
||||||
|
</TextCustom>
|
||||||
|
) : (
|
||||||
|
data?.map((item: any, index: number) => (
|
||||||
|
<AdminTableValue
|
||||||
|
key={index}
|
||||||
|
value1={
|
||||||
|
<ActionIcon
|
||||||
|
icon={
|
||||||
|
<Octicons
|
||||||
|
name="eye"
|
||||||
|
size={ICON_SIZE_BUTTON}
|
||||||
|
color="black"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
onPress={() => {
|
||||||
|
router.push(`/admin/donation/${item.id}/${status}`);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
value2={<TextCustom truncate={1}>{item?.Author?.username || "-"}</TextCustom>}
|
||||||
|
value3={
|
||||||
|
<TextCustom truncate={2}>
|
||||||
|
{item?.title || "-"}
|
||||||
|
</TextCustom>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</StackCustom>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,15 +1,67 @@
|
|||||||
import { Spacing, StackCustom, ViewWrapper } from "@/components";
|
import { Spacing, StackCustom, ViewWrapper } from "@/components";
|
||||||
import {
|
import {
|
||||||
IconList,
|
IconList,
|
||||||
IconPublish,
|
IconPublish,
|
||||||
IconReject,
|
IconReject,
|
||||||
IconReview,
|
IconReview,
|
||||||
} from "@/components/_Icon/IconComponent";
|
} from "@/components/_Icon/IconComponent";
|
||||||
import AdminComp_BoxDashboard from "@/components/_ShareComponent/Admin/BoxDashboard";
|
import AdminComp_BoxDashboard from "@/components/_ShareComponent/Admin/BoxDashboard";
|
||||||
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import { apiAdminDonation } from "@/service/api-admin/api-admin-donation";
|
||||||
|
import { useFocusEffect } from "expo-router";
|
||||||
|
import { useState, useCallback } from "react";
|
||||||
|
|
||||||
export default function AdminDonation() {
|
export default function AdminDonation() {
|
||||||
|
const [data, setData] = useState<any | null>(null);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
|
||||||
|
const response = await apiAdminDonation({
|
||||||
|
category: "dashboard",
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("[RES]", JSON.stringify(response, null, 2));
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
setData([]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const listData = [
|
||||||
|
{
|
||||||
|
label: "Publish",
|
||||||
|
value: (data && data.publish) || 0,
|
||||||
|
icon: <IconPublish size={25} color={MainColor.green} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Review",
|
||||||
|
value: (data && data.review) || 0,
|
||||||
|
icon: <IconReview size={25} color={MainColor.orange} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Reject",
|
||||||
|
value: (data && data.reject) || 0,
|
||||||
|
icon: <IconReject size={25} color={MainColor.red} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Kategori",
|
||||||
|
value: (data && data.categoryDonation) || 0,
|
||||||
|
icon: <IconList size={25} color={MainColor.white_gray} />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper>
|
<ViewWrapper>
|
||||||
@@ -24,26 +76,3 @@ export default function AdminDonation() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const listData = [
|
|
||||||
{
|
|
||||||
label: "Publish",
|
|
||||||
value: 4,
|
|
||||||
icon: <IconPublish size={25} color={MainColor.green} />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Review",
|
|
||||||
value: 7,
|
|
||||||
icon: <IconReview size={25} color={MainColor.orange} />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Reject",
|
|
||||||
value: 5,
|
|
||||||
icon: <IconReject size={25} color={MainColor.red} />,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Kategori",
|
|
||||||
value: 4,
|
|
||||||
icon: <IconList size={25} color={MainColor.white_gray} />,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
BadgeCustom,
|
BadgeCustom,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
DrawerCustom,
|
DrawerCustom,
|
||||||
MenuDrawerDynamicGrid,
|
LoaderCustom,
|
||||||
Spacing,
|
MenuDrawerDynamicGrid,
|
||||||
StackCustom,
|
Spacing,
|
||||||
TextCustom,
|
StackCustom,
|
||||||
ViewWrapper,
|
TextCustom,
|
||||||
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IconDot, IconList } from "@/components/_Icon/IconComponent";
|
import { IconDot, IconList } from "@/components/_Icon/IconComponent";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
@@ -22,24 +23,21 @@ 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 { DEEP_LINK_URL } from "@/service/api-config";
|
import { DEEP_LINK_URL } from "@/service/api-config";
|
||||||
import { colorBadge } from "@/utils/colorBadge";
|
import { colorBadgeStatus } from "@/utils/colorBadge";
|
||||||
import { dateTimeView } from "@/utils/dateTimeView";
|
import { dateTimeView } from "@/utils/dateTimeView";
|
||||||
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
import { router, useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React, { useCallback } from "react";
|
import React, { useCallback } from "react";
|
||||||
import QRCode from "react-native-qrcode-svg";
|
import QRCode from "react-native-qrcode-svg";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminEventDetail() {
|
export default function AdminEventDetail() {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const { id, status } = useLocalSearchParams();
|
const { id, status } = useLocalSearchParams();
|
||||||
|
|
||||||
console.log("[ID QRCODE]", id);
|
|
||||||
console.log("[STATUS Detail]", status);
|
|
||||||
const [openDrawer, setOpenDrawer] = React.useState(false);
|
const [openDrawer, setOpenDrawer] = React.useState(false);
|
||||||
const newURL = DEEP_LINK_URL
|
|
||||||
console.log("[DEEP LINK URL]", newURL);
|
|
||||||
|
|
||||||
const [data, setData] = React.useState<any | null>(null);
|
const [data, setData] = React.useState<any | null>(null);
|
||||||
|
const [loadData, setLoadData] = React.useState(false);
|
||||||
const deepLinkURL = `${DEEP_LINK_URL}/--/event/${id}/confirmation?userId=${user?.id}`;
|
const deepLinkURL = `${DEEP_LINK_URL}/--/event/${id}/confirmation?userId=${user?.id}`;
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
@@ -48,17 +46,18 @@ export default function AdminEventDetail() {
|
|||||||
);
|
);
|
||||||
const onLoadData = async () => {
|
const onLoadData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoadData(true);
|
||||||
const response = await apiAdminEventById({
|
const response = await apiAdminEventById({
|
||||||
id: id as string,
|
id: id as string,
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(`[RES DATA BY ID: ${id}]`, JSON.stringify(response, null, 2));
|
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data);
|
setData(response.data);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoadData(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,7 +74,7 @@ export default function AdminEventDetail() {
|
|||||||
label: "Status",
|
label: "Status",
|
||||||
value:
|
value:
|
||||||
(data && (
|
(data && (
|
||||||
<BadgeCustom color={colorBadge({ status: status as string })}>
|
<BadgeCustom color={colorBadgeStatus({ status: status as string })}>
|
||||||
{_.startCase(status as string)}
|
{_.startCase(status as string)}
|
||||||
</BadgeCustom>
|
</BadgeCustom>
|
||||||
)) ||
|
)) ||
|
||||||
@@ -124,11 +123,19 @@ export default function AdminEventDetail() {
|
|||||||
changeStatus: "publish",
|
changeStatus: "publish",
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("[RES PUBLISH]", JSON.stringify(response, null, 2));
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
if (response.success) {
|
type: "error",
|
||||||
router.back();
|
text1: "Gagal mempublikasikan event",
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Event berhasil dipublikasikan",
|
||||||
|
});
|
||||||
|
router.back();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("[ERROR]", error);
|
console.log("[ERROR]", error);
|
||||||
}
|
}
|
||||||
@@ -170,15 +177,19 @@ export default function AdminEventDetail() {
|
|||||||
<BaseBox>
|
<BaseBox>
|
||||||
<StackCustom style={{ alignItems: "center" }}>
|
<StackCustom style={{ alignItems: "center" }}>
|
||||||
<TextCustom bold>QR Code Event</TextCustom>
|
<TextCustom bold>QR Code Event</TextCustom>
|
||||||
<QRCode
|
{loadData ? (
|
||||||
value={deepLinkURL}
|
<LoaderCustom />
|
||||||
size={200}
|
) : (
|
||||||
// logo={require("@/assets/images/logo-hipmi.png")}
|
<QRCode
|
||||||
// logoSize={70}
|
value={deepLinkURL}
|
||||||
// logoBackgroundColor="transparent"
|
size={200}
|
||||||
// logoBorderRadius={50}
|
// logo={require("@/assets/images/logo-hipmi.png")}
|
||||||
// color="black"
|
// logoSize={70}
|
||||||
/>
|
// logoBackgroundColor="transparent"
|
||||||
|
// logoBorderRadius={50}
|
||||||
|
// color="black"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,41 +1,81 @@
|
|||||||
import { BadgeCustom, BaseBox, Grid, TextCustom, ViewWrapper } from "@/components";
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
|
import {
|
||||||
|
BadgeCustom,
|
||||||
|
BaseBox,
|
||||||
|
Grid,
|
||||||
|
LoaderCustom,
|
||||||
|
StackCustom,
|
||||||
|
TextCustom,
|
||||||
|
ViewWrapper,
|
||||||
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import { MainColor } from "@/constants/color-palet";
|
import { apiAdminEventListOfParticipants } from "@/service/api-admin/api-admin-event";
|
||||||
|
import { useFocusEffect, useLocalSearchParams } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
|
||||||
export default function AdminEventListOfParticipants() {
|
export default function AdminEventListOfParticipants() {
|
||||||
|
const { id } = useLocalSearchParams();
|
||||||
|
const [listData, setListData] = useState<any[] | null>(null);
|
||||||
|
const [loadData, setLoadData] = useState(false);
|
||||||
|
|
||||||
const isPresent = ({id}: {id: number}) => {
|
useFocusEffect(
|
||||||
const check = id % 3 * 3;
|
useCallback(() => {
|
||||||
if (check === 0) {
|
onLoadData();
|
||||||
return true;
|
}, [id])
|
||||||
} else {
|
);
|
||||||
return false;
|
|
||||||
}
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setLoadData(true);
|
||||||
|
const response = await apiAdminEventListOfParticipants({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setListData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
} finally {
|
||||||
|
setLoadData(false);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper
|
<ViewWrapper
|
||||||
headerComponent={<AdminBackButtonAntTitle title="Daftar Peserta" />}
|
headerComponent={<AdminBackButtonAntTitle title="Daftar Peserta" />}
|
||||||
>
|
>
|
||||||
{Array.from({ length: 10 }).map((item, index) => (
|
{loadData ? (
|
||||||
<BaseBox key={index}>
|
<LoaderCustom />
|
||||||
<Grid>
|
) : _.isEmpty(listData) ? (
|
||||||
<Grid.Col span={6}>
|
<TextCustom align="center" color="gray">
|
||||||
<TextCustom bold>Username {index + 1}</TextCustom>
|
Belum ada peserta
|
||||||
<TextCustom>+6282123456789</TextCustom>
|
</TextCustom>
|
||||||
</Grid.Col>
|
) : (
|
||||||
<Grid.Col span={6} style={{ justifyContent: "center" }}>
|
listData?.map((item: any, index: number) => (
|
||||||
<BadgeCustom
|
<BaseBox key={index}>
|
||||||
style={{ alignSelf: "flex-end" }}
|
<Grid>
|
||||||
color={isPresent({id: index}) ? MainColor.green : MainColor.red}
|
<Grid.Col span={6}>
|
||||||
>
|
<StackCustom gap={"sm"}>
|
||||||
{isPresent({id: index}) ? "Hadir" : "Tidak Hadir"}
|
<TextCustom bold truncate>{item?.User?.username}</TextCustom>
|
||||||
</BadgeCustom>
|
<TextCustom>+{item?.User?.nomor}</TextCustom>
|
||||||
</Grid.Col>
|
</StackCustom>
|
||||||
</Grid>
|
</Grid.Col>
|
||||||
</BaseBox>
|
<Grid.Col span={6} style={{ justifyContent: "center" }}>
|
||||||
))}
|
<BadgeCustom
|
||||||
|
style={{ alignSelf: "flex-end" }}
|
||||||
|
color={item?.isPresent ? "green" : "red"}
|
||||||
|
>
|
||||||
|
{item?.isPresent ? "Hadir" : "Tidak Hadir"}
|
||||||
|
</BadgeCustom>
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</BaseBox>
|
||||||
|
))
|
||||||
|
)}
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,13 +5,48 @@ import {
|
|||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
|
import { apiEventCreateTypeOfEvent } from "@/service/api-admin/api-master-admin";
|
||||||
import { useRouter } from "expo-router";
|
import { useRouter } from "expo-router";
|
||||||
|
import { useState } from "react";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminEventTypeOfEventCreate() {
|
export default function AdminEventTypeOfEventCreate() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [value, setValue] = useState("");
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const handlerSubmit = async () => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await apiEventCreateTypeOfEvent({
|
||||||
|
data: value,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Gagal menambahkan tipe acara",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Berhasil menambahkan tipe acara",
|
||||||
|
});
|
||||||
|
router.back();
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR CREATE TYPE EVENT]", error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const buttonSubmit = (
|
const buttonSubmit = (
|
||||||
<BoxButtonOnFooter>
|
<BoxButtonOnFooter>
|
||||||
<ButtonCustom onPress={() => router.back()}>Simpan</ButtonCustom>
|
<ButtonCustom isLoading={isLoading} onPress={() => handlerSubmit()}>
|
||||||
|
Simpan
|
||||||
|
</ButtonCustom>
|
||||||
</BoxButtonOnFooter>
|
</BoxButtonOnFooter>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
@@ -20,7 +55,11 @@ export default function AdminEventTypeOfEventCreate() {
|
|||||||
headerComponent={<AdminBackButtonAntTitle title="Tambah Tipe Acara" />}
|
headerComponent={<AdminBackButtonAntTitle title="Tambah Tipe Acara" />}
|
||||||
footerComponent={buttonSubmit}
|
footerComponent={buttonSubmit}
|
||||||
>
|
>
|
||||||
<TextInputCustom placeholder="Masukkan Tipe Acara" />
|
<TextInputCustom
|
||||||
|
placeholder="Masukkan Tipe Acara"
|
||||||
|
value={value}
|
||||||
|
onChangeText={setValue}
|
||||||
|
/>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,23 +1,53 @@
|
|||||||
import {
|
import {
|
||||||
ActionIcon,
|
ActionIcon,
|
||||||
BaseBox,
|
BadgeCustom,
|
||||||
CenterCustom,
|
CenterCustom,
|
||||||
|
LoaderCustom,
|
||||||
Spacing,
|
Spacing,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { IconEdit } from "@/components/_Icon";
|
import { IconEdit } from "@/components/_Icon";
|
||||||
import AdminActionIconPlus from "@/components/_ShareComponent/Admin/ActionIconPlus";
|
import AdminActionIconPlus from "@/components/_ShareComponent/Admin/ActionIconPlus";
|
||||||
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
import AdminComp_BoxTitle from "@/components/_ShareComponent/Admin/BoxTitlePage";
|
||||||
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
import AdminTitlePage from "@/components/_ShareComponent/Admin/TitlePage";
|
||||||
import { GridDetail_4_8 } from "@/components/_ShareComponent/GridDetail_4_8";
|
import { GridViewCustomSpan } from "@/components/_ShareComponent/GridViewCustomSpan";
|
||||||
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
|
||||||
import { router } from "expo-router";
|
import { apiAdminMasterTypeOfEvent } from "@/service/api-admin/api-master-admin";
|
||||||
|
import { colorActivationForBadge } from "@/utils/colorActivationForBadge";
|
||||||
|
import { router, useFocusEffect } from "expo-router";
|
||||||
|
import _ from "lodash";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import { Divider } from "react-native-paper";
|
import { Divider } from "react-native-paper";
|
||||||
|
|
||||||
export default function AdminEventTypeOfEvent() {
|
export default function AdminEventTypeOfEvent() {
|
||||||
|
const [listData, setListData] = useState<any[] | null>(null);
|
||||||
|
const [loadData, setLoadData] = useState<boolean>(false);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
setLoadData(true);
|
||||||
|
const response = await apiAdminMasterTypeOfEvent();
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setListData(response.data);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]",error);
|
||||||
|
setListData([]);
|
||||||
|
} finally {
|
||||||
|
setLoadData(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ViewWrapper headerComponent={<AdminTitlePage title="Event" />}>
|
<ViewWrapper headerComponent={<AdminTitlePage title="Event" />}>
|
||||||
@@ -32,73 +62,68 @@ export default function AdminEventTypeOfEvent() {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<BaseBox>
|
<>
|
||||||
<GridDetail_4_8
|
<GridViewCustomSpan
|
||||||
label={
|
span1={2}
|
||||||
|
span2={5}
|
||||||
|
span3={5}
|
||||||
|
component1={
|
||||||
<TextCustom bold align="center">
|
<TextCustom bold align="center">
|
||||||
Aksi
|
Aksi
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
}
|
}
|
||||||
value={<TextCustom bold>Tipe Acara</TextCustom>}
|
component2={<TextCustom bold align="center">Status</TextCustom>}
|
||||||
|
component3={<TextCustom bold>Tipe Acara</TextCustom>}
|
||||||
/>
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Spacing />
|
<Spacing />
|
||||||
|
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
{listData.map((item, index) => (
|
{loadData ? (
|
||||||
<View key={index}>
|
<LoaderCustom />
|
||||||
<GridDetail_4_8
|
) : _.isEmpty(listData) ? (
|
||||||
label={
|
<TextCustom align="center" color="gray">
|
||||||
<CenterCustom>
|
Belum ada data
|
||||||
<ActionIcon
|
</TextCustom>
|
||||||
icon={
|
) : (
|
||||||
<IconEdit size={ICON_SIZE_BUTTON} color="black" />
|
listData?.map((item, index) => (
|
||||||
}
|
<View key={index}>
|
||||||
onPress={() => {
|
<GridViewCustomSpan
|
||||||
router.push(`/admin/event/type-update?id=${index}`);
|
span1={2}
|
||||||
}}
|
span2={5}
|
||||||
/>
|
span3={5}
|
||||||
</CenterCustom>
|
component1={
|
||||||
}
|
<CenterCustom>
|
||||||
value={<TextCustom bold>{item.label}</TextCustom>}
|
<ActionIcon
|
||||||
/>
|
icon={
|
||||||
<Divider />
|
<IconEdit size={ICON_SIZE_BUTTON} color="black" />
|
||||||
</View>
|
}
|
||||||
))}
|
onPress={() => {
|
||||||
|
router.push(`/admin/event/type-update?id=${item.id}`);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</CenterCustom>
|
||||||
|
}
|
||||||
|
style2={{ alignItems: "center" }}
|
||||||
|
component2={
|
||||||
|
<CenterCustom>
|
||||||
|
<BadgeCustom
|
||||||
|
color={colorActivationForBadge({
|
||||||
|
status: item?.active,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{item?.active ? "Aktif" : "Tidak Aktif"}
|
||||||
|
</BadgeCustom>
|
||||||
|
</CenterCustom>
|
||||||
|
}
|
||||||
|
component3={<TextCustom >{item.name}</TextCustom>}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
))
|
||||||
|
)}
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const listData = [
|
|
||||||
{
|
|
||||||
label: "Seminar",
|
|
||||||
value: "seminar",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Workshop",
|
|
||||||
value: "workshop",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Konferensi",
|
|
||||||
value: "konferensi",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Lomba",
|
|
||||||
value: "lomba",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Pameran",
|
|
||||||
value: "pameran",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Pesta",
|
|
||||||
value: "pesta",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Pertandingan",
|
|
||||||
value: "pertandingan",
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|||||||
@@ -1,20 +1,91 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
BoxButtonOnFooter,
|
BoxButtonOnFooter,
|
||||||
ButtonCustom,
|
ButtonCustom,
|
||||||
|
Spacing,
|
||||||
|
TextCustom,
|
||||||
TextInputCustom,
|
TextInputCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
import AdminBackButtonAntTitle from "@/components/_ShareComponent/Admin/BackButtonAntTitle";
|
||||||
import { useLocalSearchParams, useRouter } from "expo-router";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
|
import {
|
||||||
|
apiAdminMasterTypeOfEventGetOne,
|
||||||
|
apiAdminMasterTypeOfEventUpdate,
|
||||||
|
} from "@/service/api-admin/api-master-admin";
|
||||||
|
|
||||||
|
import { useFocusEffect, useLocalSearchParams, useRouter } from "expo-router";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
import { Switch } from "react-native-paper";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function AdminEventTypeOfEventUpdate() {
|
export default function AdminEventTypeOfEventUpdate() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
console.log("id >", id);
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const [data, setData] = useState<{ name: string; active: boolean }>({
|
||||||
|
name: "",
|
||||||
|
active: false,
|
||||||
|
});
|
||||||
|
const [isLoading, setLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
|
useFocusEffect(
|
||||||
|
useCallback(() => {
|
||||||
|
onLoadData();
|
||||||
|
}, [id])
|
||||||
|
);
|
||||||
|
|
||||||
|
const onLoadData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminMasterTypeOfEventGetOne({
|
||||||
|
id: id as string,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.success) {
|
||||||
|
setData({
|
||||||
|
name: response.data.name,
|
||||||
|
active: response.data.active,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR UPDATE]", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlerSubmit = async () => {
|
||||||
|
try {
|
||||||
|
setLoading(true);
|
||||||
|
|
||||||
|
const response = await apiAdminMasterTypeOfEventUpdate({
|
||||||
|
id: id as string,
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
Toast.show({
|
||||||
|
type: "error",
|
||||||
|
text1: "Gagal mengupdate tipe acara",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Toast.show({
|
||||||
|
type: "success",
|
||||||
|
text1: "Berhasil mengupdate tipe acara",
|
||||||
|
});
|
||||||
|
router.back();
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR UPDATE]", error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const buttonSubmit = (
|
const buttonSubmit = (
|
||||||
<BoxButtonOnFooter>
|
<BoxButtonOnFooter>
|
||||||
<ButtonCustom onPress={() => router.back()}>Update</ButtonCustom>
|
<ButtonCustom isLoading={isLoading} onPress={() => handlerSubmit()}>
|
||||||
|
Update
|
||||||
|
</ButtonCustom>
|
||||||
</BoxButtonOnFooter>
|
</BoxButtonOnFooter>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
@@ -23,7 +94,19 @@ export default function AdminEventTypeOfEventUpdate() {
|
|||||||
headerComponent={<AdminBackButtonAntTitle title="Ubah Tipe Acara" />}
|
headerComponent={<AdminBackButtonAntTitle title="Ubah Tipe Acara" />}
|
||||||
footerComponent={buttonSubmit}
|
footerComponent={buttonSubmit}
|
||||||
>
|
>
|
||||||
<TextInputCustom placeholder="Masukkan Tipe Acara" value="" />
|
<TextInputCustom
|
||||||
|
placeholder="Masukkan Tipe Acara"
|
||||||
|
value={data.name}
|
||||||
|
onChangeText={(text) => setData({ ...data, name: text })}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextCustom>Aktivasi</TextCustom>
|
||||||
|
<Spacing height={10} />
|
||||||
|
<Switch
|
||||||
|
color={MainColor.yellow}
|
||||||
|
value={data.active}
|
||||||
|
onValueChange={(value) => setData({ ...data, active: value })}
|
||||||
|
/>
|
||||||
</ViewWrapper>
|
</ViewWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
AlertDefaultSystem,
|
AlertDefaultSystem,
|
||||||
BadgeCustom,
|
BadgeCustom,
|
||||||
BaseBox,
|
BaseBox,
|
||||||
CircleContainer,
|
CircleContainer,
|
||||||
Grid,
|
Grid,
|
||||||
Spacing,
|
Spacing,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ViewWrapper,
|
ViewWrapper,
|
||||||
} 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";
|
||||||
@@ -18,7 +18,7 @@ import ReportBox from "@/components/Box/ReportBox";
|
|||||||
import { MainColor } from "@/constants/color-palet";
|
import { MainColor } from "@/constants/color-palet";
|
||||||
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 { colorBadge } from "@/utils/colorBadge";
|
import { colorBadgeStatus } from "@/utils/colorBadge";
|
||||||
import { dateTimeView } from "@/utils/dateTimeView";
|
import { dateTimeView } from "@/utils/dateTimeView";
|
||||||
import { Entypo } from "@expo/vector-icons";
|
import { Entypo } from "@expo/vector-icons";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
@@ -68,7 +68,7 @@ export default function AdminVotingDetail() {
|
|||||||
label: "Status",
|
label: "Status",
|
||||||
value:
|
value:
|
||||||
data && data?.Voting_Status?.name ? (
|
data && data?.Voting_Status?.name ? (
|
||||||
<BadgeCustom color={colorBadge({ status: status as string })}>
|
<BadgeCustom color={colorBadgeStatus({ status: status as string })}>
|
||||||
{status === "history" ? "Riwayat" : _.startCase(status as string)}
|
{status === "history" ? "Riwayat" : _.startCase(status as string)}
|
||||||
</BadgeCustom>
|
</BadgeCustom>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ const DateTimeInput_Android: React.FC<DateTimeInputProps> = ({
|
|||||||
onChange={handleConfirmTime}
|
onChange={handleConfirmTime}
|
||||||
minimumDate={minimumDate}
|
minimumDate={minimumDate}
|
||||||
maximumDate={maximumDate}
|
maximumDate={maximumDate}
|
||||||
|
themeVariant="light"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ const DateTimeInput_IOS: React.FC<DateTimeInputProps> = ({
|
|||||||
onChange={handleConfirm}
|
onChange={handleConfirm}
|
||||||
minimumDate={minimumDate}
|
minimumDate={minimumDate}
|
||||||
maximumDate={maximumDate}
|
maximumDate={maximumDate}
|
||||||
|
themeVariant="light"
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ import {
|
|||||||
DummyLandscapeImage,
|
DummyLandscapeImage,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
|
|
||||||
export default function AdminDonation_BoxOfDonationStory() {
|
export default function AdminDonation_BoxOfDonationStory({
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
data: any;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BaseBox>
|
<BaseBox>
|
||||||
@@ -14,19 +18,9 @@ export default function AdminDonation_BoxOfDonationStory() {
|
|||||||
<Spacing />
|
<Spacing />
|
||||||
|
|
||||||
<StackCustom>
|
<StackCustom>
|
||||||
<TextCustom>
|
<TextCustom>{(data && data?.pembukaan) || "-"}</TextCustom>
|
||||||
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Rem magni
|
<DummyLandscapeImage imageId={data?.imageId || "-"} />
|
||||||
perspiciatis eius ipsam provident, impedit, fugiat aliquid nobis
|
<TextCustom>{(data && data?.cerita) || "-"}</TextCustom>
|
||||||
pariatur asperiores fuga quidem temporibus labore, molestias
|
|
||||||
perferendis optio ipsum. Praesentium, tempore?
|
|
||||||
</TextCustom>
|
|
||||||
<DummyLandscapeImage />
|
|
||||||
<TextCustom>
|
|
||||||
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Rem magni
|
|
||||||
perspiciatis eius ipsam provident, impedit, fugiat aliquid nobis
|
|
||||||
pariatur asperiores fuga quidem temporibus labore, molestias
|
|
||||||
perferendis optio ipsum. Praesentium, tempore?
|
|
||||||
</TextCustom>
|
|
||||||
</StackCustom>
|
</StackCustom>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
</>
|
</>
|
||||||
|
|||||||
23
screens/Admin/Donation/funDonationUpdateStatus.ts
Normal file
23
screens/Admin/Donation/funDonationUpdateStatus.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { apiAdminDonationUpdateStatus } from "@/service/api-admin/api-admin-donation";
|
||||||
|
|
||||||
|
export const funUpdateStatusDonation = async ({
|
||||||
|
id,
|
||||||
|
changeStatus,
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
changeStatus: "publish" | "review" | "reject";
|
||||||
|
data?: string;
|
||||||
|
}) => {
|
||||||
|
try {
|
||||||
|
const response = await apiAdminDonationUpdateStatus({
|
||||||
|
id: id,
|
||||||
|
changeStatus: changeStatus as any,
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
return response;
|
||||||
|
} catch (error) {
|
||||||
|
console.log("[ERROR]", error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import {
|
import {
|
||||||
BaseBox,
|
BaseBox,
|
||||||
Grid,
|
|
||||||
DummyLandscapeImage,
|
DummyLandscapeImage,
|
||||||
|
Grid,
|
||||||
|
ProgressCustom,
|
||||||
StackCustom,
|
StackCustom,
|
||||||
TextCustom,
|
TextCustom,
|
||||||
ProgressCustom,
|
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
|
import { countDownAndCondition } from "@/utils/countDownAndCondition";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
|
||||||
export default function Donation_BoxPublish({
|
export default function Donation_BoxPublish({
|
||||||
@@ -15,6 +18,27 @@ export default function Donation_BoxPublish({
|
|||||||
id: string;
|
id: string;
|
||||||
data: any;
|
data: any;
|
||||||
}) {
|
}) {
|
||||||
|
const [value, setValue] = useState({
|
||||||
|
sisa: 0,
|
||||||
|
reminder: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
updateCountDown();
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
const updateCountDown = () => {
|
||||||
|
const countDown = countDownAndCondition({
|
||||||
|
duration: data?.durasiDonasi,
|
||||||
|
publishTime: data?.publishTime,
|
||||||
|
});
|
||||||
|
|
||||||
|
setValue({
|
||||||
|
sisa: countDown.durationDay,
|
||||||
|
reminder: countDown.reminder,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BaseBox paddingTop={7} paddingBottom={7} href={`/donation/${id}`}>
|
<BaseBox paddingTop={7} paddingBottom={7} href={`/donation/${id}`}>
|
||||||
@@ -36,7 +60,13 @@ export default function Donation_BoxPublish({
|
|||||||
{data?.title || "-"}
|
{data?.title || "-"}
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
<TextCustom size="small">
|
<TextCustom size="small">
|
||||||
Sisa hari: {data?.durasiDonasi || 0}
|
{value.reminder ? (
|
||||||
|
<TextCustom bold color="red">
|
||||||
|
Waktu berakhir
|
||||||
|
</TextCustom>
|
||||||
|
) : (
|
||||||
|
<TextCustom>Sisa hari: {value.sisa}</TextCustom>
|
||||||
|
)}
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
</View>
|
</View>
|
||||||
<ProgressCustom
|
<ProgressCustom
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import {
|
import {
|
||||||
BaseBox,
|
BaseBox,
|
||||||
StackCustom,
|
|
||||||
DummyLandscapeImage,
|
DummyLandscapeImage,
|
||||||
TextCustom,
|
|
||||||
Grid,
|
Grid,
|
||||||
|
StackCustom,
|
||||||
|
TextCustom,
|
||||||
} from "@/components";
|
} from "@/components";
|
||||||
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
import { formatCurrencyDisplay } from "@/utils/formatCurrencyDisplay";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@@ -12,10 +12,15 @@ import { View } from "react-native";
|
|||||||
export default function Donation_ComponentBoxDetailData({
|
export default function Donation_ComponentBoxDetailData({
|
||||||
bottomSection,
|
bottomSection,
|
||||||
data,
|
data,
|
||||||
|
sisaHari,
|
||||||
|
reminder,
|
||||||
}: {
|
}: {
|
||||||
bottomSection?: React.ReactNode;
|
bottomSection?: React.ReactNode;
|
||||||
data: any;
|
data: any;
|
||||||
|
sisaHari: number;
|
||||||
|
reminder: boolean;
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BaseBox>
|
<BaseBox>
|
||||||
@@ -25,9 +30,13 @@ export default function Donation_ComponentBoxDetailData({
|
|||||||
<TextCustom bold size="large">
|
<TextCustom bold size="large">
|
||||||
{data?.title || "-"}
|
{data?.title || "-"}
|
||||||
</TextCustom>
|
</TextCustom>
|
||||||
<TextCustom size="small">
|
{reminder ? (
|
||||||
Durasi: {data?.DonasiMaster_Durasi?.name || "-"}
|
<TextCustom bold color="red">
|
||||||
</TextCustom>
|
Waktu berakhir
|
||||||
|
</TextCustom>
|
||||||
|
) : (
|
||||||
|
<TextCustom>Sisa hari: {sisaHari}</TextCustom>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|||||||
66
service/api-admin/api-admin-donation.ts
Normal file
66
service/api-admin/api-admin-donation.ts
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import { apiConfig } from "../api-config";
|
||||||
|
|
||||||
|
export async function apiAdminDonation({
|
||||||
|
category,
|
||||||
|
search,
|
||||||
|
}: {
|
||||||
|
category: "dashboard" | "publish" | "review" | "reject";
|
||||||
|
search?: string;
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(
|
||||||
|
`/mobile/admin/donation?category=${category}&search=${search}`
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminDonationDetailById({ id }: { id: string }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/mobile/admin/donation/${id}`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminDonationUpdateStatus({
|
||||||
|
id,
|
||||||
|
changeStatus,
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
changeStatus: "publish" | "review" | "reject";
|
||||||
|
data?: string;
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.put(
|
||||||
|
`/mobile/admin/donation/${id}?status=${changeStatus}`,
|
||||||
|
{
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminDonationListOfDonatur({
|
||||||
|
id,
|
||||||
|
status,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
status: "berhasil" | "gagal" | "proses" | "menunggu" | "";
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(
|
||||||
|
`/mobile/admin/donation/${id}/donatur?status=${status}`
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,3 +48,15 @@ export async function apiAdminEventUpdateStatus({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function apiAdminEventListOfParticipants({ id }: { id: string }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(
|
||||||
|
`/mobile/admin/event/${id}/participants`
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,9 @@ export async function apiAdminMasterBusinessField() {
|
|||||||
|
|
||||||
export async function apiAdminMasterBusinessFieldById({ id }: { id: string }) {
|
export async function apiAdminMasterBusinessFieldById({ id }: { id: string }) {
|
||||||
try {
|
try {
|
||||||
const response = await apiConfig.get(`/mobile/admin/master/business-field/${id}`);
|
const response = await apiConfig.get(
|
||||||
|
`/mobile/admin/master/business-field/${id}`
|
||||||
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
@@ -77,26 +79,91 @@ export async function apiAdminMasterBusinessFieldUpdate({
|
|||||||
data: any;
|
data: any;
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
const response = await apiConfig.put(`/mobile/admin/master/business-field/${id}`, {
|
const response = await apiConfig.put(
|
||||||
data: data,
|
`/mobile/admin/master/business-field/${id}`,
|
||||||
});
|
{
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function apiAdminMasterBusinessFieldCreate({ data }: { data: any }) {
|
export async function apiAdminMasterBusinessFieldCreate({
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
data: any;
|
||||||
|
}) {
|
||||||
try {
|
try {
|
||||||
const response = await apiConfig.post(`/mobile/admin/master/business-field`, {
|
const response = await apiConfig.post(
|
||||||
data: data,
|
`/mobile/admin/master/business-field`,
|
||||||
});
|
{
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ================== END BUSINNES FIELD ================== //
|
// ================== END BUSINNES FIELD ================== //
|
||||||
|
|
||||||
|
// ================== START EVENT ================== //
|
||||||
|
export async function apiAdminMasterTypeOfEvent() {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/mobile/admin/master/type-of-event`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiEventCreateTypeOfEvent({ data }: { data: string }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.post(
|
||||||
|
`/mobile/admin/master/type-of-event`,
|
||||||
|
{
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminMasterTypeOfEventGetOne({ id }: { id: string }) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(
|
||||||
|
`/mobile/admin/master/type-of-event/${id}`
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function apiAdminMasterTypeOfEventUpdate({
|
||||||
|
id,
|
||||||
|
data,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
data: any;
|
||||||
|
}) {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.put(
|
||||||
|
`/mobile/admin/master/type-of-event/${id}`,
|
||||||
|
{
|
||||||
|
data: data,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ================== END EVENT ================== //
|
||||||
|
|||||||
@@ -177,3 +177,5 @@ export async function apiEventConfirmationAction({
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -157,3 +157,14 @@ export async function apiMasterDonation({
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ================== END MASTER DONATION ================== //
|
||||||
|
|
||||||
|
export async function apiMasterTransaction() {
|
||||||
|
try {
|
||||||
|
const response = await apiConfig.get(`/mobile/master/transaction-status`);
|
||||||
|
return response.data;
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
9
utils/colorActivationForBadge.ts
Normal file
9
utils/colorActivationForBadge.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { AccentColor } from "@/constants/color-palet";
|
||||||
|
|
||||||
|
export const colorActivationForBadge = ({ status }: { status: boolean }) => {
|
||||||
|
if (status) {
|
||||||
|
return AccentColor.blue;
|
||||||
|
} else {
|
||||||
|
return AccentColor.blackgray;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { MainColor } from "@/constants/color-palet";
|
import { AccentColor, MainColor } from "@/constants/color-palet";
|
||||||
|
|
||||||
export const colorBadge = ({ status }: { status: string }) => {
|
export const colorBadgeStatus = ({ status }: { status: string }) => {
|
||||||
const statusLowerCase = status.toLowerCase();
|
const statusLowerCase = status.toLowerCase();
|
||||||
if (statusLowerCase === "publish") {
|
if (statusLowerCase === "publish") {
|
||||||
return MainColor.green;
|
return MainColor.green;
|
||||||
@@ -12,3 +12,16 @@ export const colorBadge = ({ status }: { status: string }) => {
|
|||||||
return MainColor.placeholder;
|
return MainColor.placeholder;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const colorBadgeTransaction = ({ status }: { status: string }) => {
|
||||||
|
const statusLowerCase = status.toLowerCase();
|
||||||
|
if (statusLowerCase === "berhasil") {
|
||||||
|
return MainColor.green;
|
||||||
|
} else if (statusLowerCase === "menunggu") {
|
||||||
|
return MainColor.orange;
|
||||||
|
} else if (statusLowerCase === "gagal") {
|
||||||
|
return MainColor.red;
|
||||||
|
} else {
|
||||||
|
return AccentColor.blue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
21
utils/countDownAndCondition.ts
Normal file
21
utils/countDownAndCondition.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
|
export function countDownAndCondition({
|
||||||
|
publishTime,
|
||||||
|
duration,
|
||||||
|
}: {
|
||||||
|
publishTime: Date;
|
||||||
|
duration: number | string;
|
||||||
|
}) {
|
||||||
|
const now = dayjs();
|
||||||
|
const publish = dayjs(publishTime);
|
||||||
|
const diffTime = publish.diff(now, "day");
|
||||||
|
|
||||||
|
const durasi = Number(duration);
|
||||||
|
const sisaHari = durasi + diffTime;
|
||||||
|
|
||||||
|
return {
|
||||||
|
durationDay: sisaHari,
|
||||||
|
reminder: sisaHari <= 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user