# Voting prototype
- feat - Tampilan beranda - Tampilan status - Tampilan kontribusi - Tampilan riwayat ## No Issue
This commit is contained in:
119
src/app_modules/vote/edit/index.tsx
Normal file
119
src/app_modules/vote/edit/index.tsx
Normal file
@@ -0,0 +1,119 @@
|
||||
"use client";
|
||||
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil";
|
||||
import {
|
||||
Button,
|
||||
Center,
|
||||
Grid,
|
||||
Group,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { DatePickerInput } from "@mantine/dates";
|
||||
import { useCounter } from "@mantine/hooks";
|
||||
import { IconHome } from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import moment from "moment";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { gs_vote_hotMenu, gs_vote_status } from "../global_state";
|
||||
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
|
||||
|
||||
export default function Vote_Edit() {
|
||||
const router = useRouter();
|
||||
const [hotMenu, setHotMenu] = useAtom(gs_vote_hotMenu);
|
||||
const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack px={"sm"}>
|
||||
<TextInput
|
||||
label="Judul"
|
||||
withAsterisk
|
||||
placeholder="Masukan judul"
|
||||
onChange={() => {}}
|
||||
/>
|
||||
<TextInput
|
||||
label="Deskripsi"
|
||||
withAsterisk
|
||||
placeholder="Masukan deskripsi"
|
||||
onChange={() => {}}
|
||||
/>
|
||||
|
||||
<DatePickerInput
|
||||
label="Jangka Waktu"
|
||||
placeholder="Masukan jangka waktu voting"
|
||||
withAsterisk
|
||||
dropdownType="modal"
|
||||
type="range"
|
||||
excludeDate={(date) => {
|
||||
return moment(date).diff(Date.now(), "days") < 0;
|
||||
}}
|
||||
onChange={(val) => console.log(val)}
|
||||
/>
|
||||
|
||||
<Stack>
|
||||
<Text fw={"bold"} fz={"sm"}>
|
||||
Daftar Voting
|
||||
</Text>
|
||||
|
||||
<Stack>
|
||||
<Grid>
|
||||
<Grid.Col span={"content"}>
|
||||
<Stack h={"100%"} justify="center">
|
||||
<Title order={3}>-</Title>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<TextInput
|
||||
label="Pilihan 1"
|
||||
placeholder="Masukan pilihan 1"
|
||||
withAsterisk
|
||||
onChange={() => {}}
|
||||
/>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.Col span={"content"}>
|
||||
<Stack h={"100%"} justify="center">
|
||||
<Title order={3}>-</Title>
|
||||
</Stack>
|
||||
</Grid.Col>
|
||||
<Grid.Col span={"auto"}>
|
||||
<TextInput
|
||||
label="Pilihan 2"
|
||||
placeholder="Masukan pilihan 2"
|
||||
withAsterisk
|
||||
onChange={() => {}}
|
||||
/>
|
||||
</Grid.Col>
|
||||
</Grid>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
<Button
|
||||
mt={"lg"}
|
||||
radius={"xl"}
|
||||
color="green"
|
||||
onClick={() => onSave(router, setHotMenu, setTabsStatus)}
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
</Stack>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
async function onSave(
|
||||
router: AppRouterInstance,
|
||||
setHotMenu: any,
|
||||
setTabsStatus: any
|
||||
) {
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Update");
|
||||
setHotMenu(1);
|
||||
setTabsStatus("Draft");
|
||||
router.back();
|
||||
}
|
||||
19
src/app_modules/vote/edit/layout.tsx
Normal file
19
src/app_modules/vote/edit/layout.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
"use client";
|
||||
|
||||
import { AppShell } from "@mantine/core";
|
||||
import React from "react";
|
||||
import ComponentVote_HeaderTamplate from "../component/header_tamplate";
|
||||
|
||||
export default function LayoutVote_Edit({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<AppShell header={<ComponentVote_HeaderTamplate title="Edit Vote" />}>
|
||||
{children}
|
||||
</AppShell>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user