Voting
Fix: Semua tampilan sudah terintegrasi API ### No Issue
This commit is contained in:
@@ -9,23 +9,32 @@ import { GStyles } from "@/styles/global-styles";
|
||||
import { Voting_ComponentDetailDataSection } from "./ComponentDetailDataSection";
|
||||
|
||||
export function Voting_BoxDetailContributionSection({
|
||||
data,
|
||||
headerAvatar,
|
||||
nameChoice,
|
||||
}: {
|
||||
data: any;
|
||||
headerAvatar?: React.ReactNode;
|
||||
nameChoice?: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<BoxWithHeaderSection>
|
||||
{headerAvatar ? headerAvatar : <Spacing />}
|
||||
{headerAvatar && (
|
||||
<>
|
||||
{headerAvatar}
|
||||
<Spacing />
|
||||
</>
|
||||
)}
|
||||
<StackCustom gap={"lg"}>
|
||||
<Voting_ComponentDetailDataSection />
|
||||
<Voting_ComponentDetailDataSection data={data} />
|
||||
|
||||
<StackCustom gap={"xs"}>
|
||||
<StackCustom gap={"sm"}>
|
||||
<TextCustom bold size="small" align="center">
|
||||
Pilihan Anda
|
||||
</TextCustom>
|
||||
<BadgeCustom style={[GStyles.alignSelfCenter]}>
|
||||
Pilihan 1
|
||||
<BadgeCustom variant="light" size="lg" style={[GStyles.alignSelfCenter]}>
|
||||
{nameChoice || "-"}
|
||||
</BadgeCustom>
|
||||
</StackCustom>
|
||||
</StackCustom>
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
export default function Voting_BoxDetailHasilVotingSection({
|
||||
listData,
|
||||
}: {
|
||||
listData?: any[];
|
||||
listData: any[];
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,21 +1,36 @@
|
||||
import {
|
||||
BadgeCustom,
|
||||
BoxWithHeaderSection,
|
||||
Spacing,
|
||||
StackCustom
|
||||
StackCustom,
|
||||
TextCustom
|
||||
} from "@/components";
|
||||
import { Voting_ComponentDetailDataSection } from "./ComponentDetailDataSection";
|
||||
import { GStyles } from "@/styles/global-styles";
|
||||
|
||||
export function Voting_BoxDetailHistorySection({
|
||||
headerAvatar,
|
||||
data,
|
||||
nameChoice,
|
||||
}: {
|
||||
headerAvatar?: React.ReactNode;
|
||||
data: any;
|
||||
nameChoice: string;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<BoxWithHeaderSection>
|
||||
{headerAvatar ? headerAvatar : <Spacing />}
|
||||
<StackCustom>
|
||||
<Voting_ComponentDetailDataSection />
|
||||
<Voting_ComponentDetailDataSection data={data} />
|
||||
<StackCustom gap={"sm"}>
|
||||
<TextCustom bold size="small" align="center">
|
||||
Pilihan Anda
|
||||
</TextCustom>
|
||||
<BadgeCustom variant="light" size="lg" style={[GStyles.alignSelfCenter]}>
|
||||
{nameChoice || "-"}
|
||||
</BadgeCustom>
|
||||
</StackCustom>
|
||||
</StackCustom>
|
||||
</BoxWithHeaderSection>
|
||||
</>
|
||||
|
||||
@@ -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