|
|
@@ -17,6 +17,7 @@ import moment from "moment";
|
|
|
import { connect } from "react-redux";
|
|
|
import Loader from "@/components/Common/Loader";
|
|
|
import Router from "next/router";
|
|
|
+import { ToastContainer, toast } from "react-toastify";
|
|
|
|
|
|
const status = [
|
|
|
{ value: "Ditindaklanjuti DIKTI", label: "Ditindaklanjuti DIKTI", className: "State-ACT" },
|
|
|
@@ -123,7 +124,7 @@ class Calendar extends Component {
|
|
|
this.handleEventCalendar(info);
|
|
|
};
|
|
|
|
|
|
- handleEventCalendar = async ({ event }) => {
|
|
|
+ handleEventCalendar = ({ event }) => {
|
|
|
const number = this.props.query.number;
|
|
|
const ptId = this.props.query.ptId;
|
|
|
const data = {
|
|
|
@@ -132,8 +133,11 @@ class Calendar extends Component {
|
|
|
to_date: event.end || event.start,
|
|
|
background_color: event.backgroundColor,
|
|
|
};
|
|
|
-
|
|
|
- const update = await updateJadwal({ number, ptId }, data);
|
|
|
+ toast.promise(updateJadwal({ number, ptId }, data), {
|
|
|
+ pending: "Loading",
|
|
|
+ success: "Success",
|
|
|
+ error: "Error",
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
defaultStatus = async (data) => {
|
|
|
@@ -152,11 +156,13 @@ class Calendar extends Component {
|
|
|
const { selectedOption } = this.state;
|
|
|
const { ptId, number } = this.props.query;
|
|
|
this.setState({ selectedOption });
|
|
|
+ const id = toast.loading("Please wait...");
|
|
|
if (selectedOption.value === this.getStatus()[1].value) {
|
|
|
const roleId = this.props.user.peran[0].peran.id;
|
|
|
await changeRoleData({ number, ptId }, { role_data: roleId === 2021 ? "dikti" : "lldikti" });
|
|
|
const statusData = roleId === 2021 ? status : statusLLDIKTI;
|
|
|
await addStatus({ number, ptId }, { status: statusData[0].value });
|
|
|
+ toast.update(id, { render: "All is good", type: "success", isLoading: false });
|
|
|
Router.push("/app/penjadwalan");
|
|
|
return;
|
|
|
}
|
|
|
@@ -166,6 +172,7 @@ class Calendar extends Component {
|
|
|
await activeLaporan({ number, ptId });
|
|
|
}
|
|
|
await addStatus({ number, ptId }, { status: selectedOption.value });
|
|
|
+ toast.update(id, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
};
|
|
|
|
|
|
render() {
|