fix event draft ajukan kembali

This commit is contained in:
2025-03-03 15:37:23 +08:00
parent 0d2d39ccc4
commit ceab376a62
2 changed files with 25 additions and 23 deletions

View File

@@ -23,33 +23,36 @@ import { Event_funDeleteById } from "../../fun/delete/fun_delete";
import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id"; import { Event_funEditStatusById } from "../../fun/edit/fun_edit_status_by_id";
export default function Event_DetailDraft() { export default function Event_DetailDraft() {
const params = useParams<{ id: string }>(); const params = useParams<{ id: string }>();
const eventId = params.id as string; const eventId = params.id as string;
const [data, setData] = useState<MODEL_EVENT | null>(null); const [data, setData] = useState<MODEL_EVENT | null>(null);
useShallowEffect(() => { useShallowEffect(() => {
onLoadData(); onLoadData();
}, []); }, []);
async function onLoadData() { async function onLoadData() {
try { try {
const respone = await apiGetEventDetailById({ const respone = await apiGetEventDetailById({
id: eventId, id: eventId,
}); });
if (respone) { if (respone) {
setData(respone.data); setData(respone.data);
} }
} catch (error) { } catch (error) {
clientLogger.error("Error get data detail event", error); clientLogger.error("Error get data detail event", error);
} }
} }
return ( return (
<> <>
<Stack spacing={"lg"}> <Stack spacing={"lg"}>
<ComponentEvent_DetailData isReport data={data} /> <ComponentEvent_DetailData isReport data={data} />
<ButtonAction eventId={eventId} endDate={data?.tanggalSelesai} /> <ButtonAction
eventId={eventId}
endDate={data?.tanggalSelesai}
/>
</Stack> </Stack>
</> </>
); );
@@ -62,7 +65,6 @@ function ButtonAction({ eventId, endDate }: { eventId: string; endDate: any }) {
const [openModal1, setOpenModal1] = useState(false); const [openModal1, setOpenModal1] = useState(false);
const [openModal2, setOpenModal2] = useState(false); const [openModal2, setOpenModal2] = useState(false);
async function onDelete() { async function onDelete() {
try { try {
const res = await Event_funDeleteById(eventId); const res = await Event_funDeleteById(eventId);
@@ -86,7 +88,9 @@ function ButtonAction({ eventId, endDate }: { eventId: string; endDate: any }) {
} }
async function onAjukan() { async function onAjukan() {
if (moment(endDate.toISOString().toString()).diff(moment(), "minutes") < 0) // console.log("end Date", endDate)
if (moment(endDate).diff(moment(), "minutes") < 0)
return ComponentGlobal_NotifikasiPeringatan("Waktu acara telah lewat"); return ComponentGlobal_NotifikasiPeringatan("Waktu acara telah lewat");
try { try {

View File

@@ -77,8 +77,6 @@ export default function HomeViewNew() {
} }
} }
console.log("count >", countNtf);
console.log("user >", dataUser);
return ( return (
<> <>