Fix: Event
Deskripsi: - Perbaikan route status event - Perbaikan route riwayat event ## No Issue
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
"use client";
|
||||
|
||||
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
|
||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||
import UIGlobal_Modal from "@/app_modules/_global/ui/ui_modal";
|
||||
import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin";
|
||||
import mqtt_client from "@/util/mqtt_client";
|
||||
import { Button, Stack } from "@mantine/core";
|
||||
import { useAtom } from "jotai";
|
||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentEvent_DetailData from "../../component/detail/detail_data";
|
||||
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
|
||||
import { gs_event_status } from "../../global_state";
|
||||
import { MODEL_EVENT } from "../../model/interface";
|
||||
|
||||
export default function Event_DetailReview({
|
||||
@@ -32,14 +31,11 @@ export default function Event_DetailReview({
|
||||
|
||||
function ButtonAction({ eventId }: { eventId: string }) {
|
||||
const router = useRouter();
|
||||
const [tabsStatus, setTabsStatus] = useAtom(gs_event_status);
|
||||
const [isLoading, setLoading] = useState(false);
|
||||
const [openModal, setOpenModal] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading ? true : false}
|
||||
radius={"xl"}
|
||||
color={"orange"}
|
||||
onClick={() => setOpenModal(true)}
|
||||
@@ -58,9 +54,11 @@ function ButtonAction({ eventId }: { eventId: string }) {
|
||||
}
|
||||
buttonKanan={
|
||||
<Button
|
||||
loaderPosition="center"
|
||||
loading={isLoading}
|
||||
radius={"xl"}
|
||||
color={"orange"}
|
||||
onClick={() => onClick(router, setTabsStatus, eventId, setLoading)}
|
||||
onClick={() => onClick(router, eventId, setLoading)}
|
||||
>
|
||||
Simpan
|
||||
</Button>
|
||||
@@ -72,7 +70,6 @@ function ButtonAction({ eventId }: { eventId: string }) {
|
||||
|
||||
async function onClick(
|
||||
router: AppRouterInstance,
|
||||
setTabsStatus: any,
|
||||
eventId: string,
|
||||
setLoading: any
|
||||
) {
|
||||
@@ -100,9 +97,8 @@ async function onClick(
|
||||
);
|
||||
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 1500);
|
||||
setTabsStatus("Draft");
|
||||
setLoading(true);
|
||||
router.back();
|
||||
router.replace(RouterEvent.status({ id: "3" }));
|
||||
}
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiGagal(res.message);
|
||||
|
||||
Reference in New Issue
Block a user