Fix: Semua tampilan sudah terintegrasi API

### No Issue
This commit is contained in:
2025-09-19 17:51:08 +08:00
parent 391430de46
commit 333b1d2512
15 changed files with 521 additions and 120 deletions

View File

@@ -1,18 +1,19 @@
import {
AlertDefaultSystem,
BadgeCustom,
BoxWithHeaderSection,
ButtonCustom,
CenterCustom,
Spacing,
StackCustom,
TextCustom,
TextCustom
} from "@/components";
import { RadioCustom, RadioGroup } from "@/components/Radio/RadioCustom";
import { apiVotingVote } from "@/service/api-client/api-voting";
import { today } from "@/utils/dateTimeView";
import { router } from "expo-router";
import { useState } from "react";
import { View } from "react-native";
import { Voting_ComponentDetailDataSection } from "./ComponentDetailDataSection";
import { apiVotingVote } from "@/service/api-client/api-voting";
import { useAuth } from "@/hooks/use-auth";
export function Voting_BoxDetailPublishSection({
headerAvatar,
@@ -40,7 +41,10 @@ export function Voting_BoxDetailPublishSection({
id: data?.id,
data: newData,
});
console.log("[RES VOTE]", response);
if (response.success) {
router.push(`/voting/${data?.id}/list-of-contributor`);
}
} catch (error) {
console.log("[ERROR]", error);
}
@@ -79,13 +83,30 @@ export function Voting_BoxDetailPublishSection({
<RadioGroup value={value} onChange={setValue}>
{data?.Voting_DaftarNamaVote?.map((item: any, i: number) => (
<View key={i}>
<RadioCustom label={item?.value} value={item?.id} />
<RadioCustom
disabled={
today.getDate() < new Date(data?.awalVote).getDate()
}
label={item?.value}
value={item?.id}
/>
</View>
))}
</RadioGroup>
</StackCustom>
<ButtonCustom disabled={value === ""} onPress={handlerSubmitVote}>
<ButtonCustom
disabled={value === ""}
onPress={() => {
AlertDefaultSystem({
title: "Anda melaukan voting",
message: "Yakin dengan pilihan anda ini ?",
textLeft: "Batal",
textRight: "Ya",
onPressRight: () => handlerSubmitVote(),
});
}}
>
Vote
</ButtonCustom>
</>