QC Voting
- # fix - Beranda dan mandatori input ## No issuee
This commit is contained in:
@@ -12,6 +12,7 @@ import { Vote_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { Vote_funDeleteById } from "../../fun/delete/fun_delete_by_id";
|
||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
|
||||
import moment from "moment";
|
||||
|
||||
export default function Vote_DetailDraft({
|
||||
dataVote,
|
||||
@@ -41,7 +42,10 @@ function ButtonAction({
|
||||
|
||||
async function onUpdate() {
|
||||
const hariIni = new Date();
|
||||
if (awalVote < hariIni) return ComponentGlobal_NotifikasiPeringatan("Tanggal Voting Lewat");
|
||||
const cekHari = moment(awalVote).diff(hariIni, "days");
|
||||
|
||||
if (cekHari < 0)
|
||||
return ComponentGlobal_NotifikasiPeringatan("Tanggal Voting Lewat");
|
||||
|
||||
await Vote_funEditStatusByStatusId(voteId, "2").then((res) => {
|
||||
if (res.status === 200) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import { MODEL_VOTING } from "../../model/interface";
|
||||
import { Vote_funDeleteById } from "../../fun/delete/fun_delete_by_id";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { Vote_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_id";
|
||||
import ComponentVote_NotedBox from "../../component/noted_box";
|
||||
|
||||
export default function Vote_DetailReject({
|
||||
dataVote,
|
||||
@@ -28,6 +29,7 @@ export default function Vote_DetailReject({
|
||||
return (
|
||||
<>
|
||||
<Stack spacing={"xl"}>
|
||||
<ComponentVote_NotedBox informasi={dataVote?.catatan} />
|
||||
<ComponentVote_DetailDataSebelumPublish data={dataVote as any} />
|
||||
<ButtonAction voteId={dataVote.id} />
|
||||
</Stack>
|
||||
|
||||
@@ -22,6 +22,7 @@ import ComponentVote_DetailDataSebelumPublish from "../../component/detail/detai
|
||||
import { Vote_funEditStatusByStatusId } from "../../fun/edit/fun_edit_status_by_id";
|
||||
import { MODEL_VOTING } from "../../model/interface";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function Vote_DetailReview({
|
||||
dataVote,
|
||||
@@ -40,6 +41,7 @@ export default function Vote_DetailReview({
|
||||
|
||||
function ButtonAction({ voteId }: { voteId: string }) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [tabsStatus, setTabsStatus] = useAtom(gs_vote_status);
|
||||
|
||||
async function onUpdate() {
|
||||
@@ -48,6 +50,7 @@ function ButtonAction({ voteId }: { voteId: string }) {
|
||||
setTabsStatus("Draft");
|
||||
ComponentGlobal_NotifikasiBerhasil("Berhasil Batalkan Review", 2000);
|
||||
router.back();
|
||||
setIsLoading(true);
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
}
|
||||
@@ -56,9 +59,11 @@ function ButtonAction({ voteId }: { voteId: string }) {
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
radius={"xl"}
|
||||
color="red"
|
||||
onClick={() => {
|
||||
color="orange"
|
||||
onClick={() => {8
|
||||
onUpdate();
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user