Voting
Fix: Semua tampilan sudah terintegrasi API ### No Issue
This commit is contained in:
@@ -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>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user