|
@@ -158,17 +158,51 @@ class InputTanggal extends Component {
|
|
|
handleChangeListSanksi = (listSanksi) => {
|
|
handleChangeListSanksi = (listSanksi) => {
|
|
|
this.setState({ listSanksi });
|
|
this.setState({ listSanksi });
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ done = async (data) => {
|
|
|
|
|
+ if (this.props?.user?.role.id === 2024) {
|
|
|
|
|
+ Swal.fire({
|
|
|
|
|
+ icon: 'error',
|
|
|
|
|
+ title: 'Oops...',
|
|
|
|
|
+ html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
|
|
|
|
|
+ confirmButtonColor: "#3e3a8e",
|
|
|
|
|
+ confirmButtonText: 'Oke'
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ loading: true
|
|
|
|
|
+ })
|
|
|
|
|
+ const sanksi = await this.ubahSanksi(data)
|
|
|
|
|
+ if (sanksi && ENV === "production") {
|
|
|
|
|
+ await this.updatePddikti(sanksi.data._id) //kirim sanksiID ke function updatePDDIKTI
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ await Router.push({
|
|
|
|
|
+ pathname: "/app/naik-sanksi",
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ updatePddikti = async (sanksiId) => {
|
|
|
|
|
+ const getToken = await getCsrf();
|
|
|
|
|
+ const _csrf2 = getToken.token;
|
|
|
|
|
+ const toastPddikti = toast.loading("Updating pddikti...");
|
|
|
|
|
+ try {
|
|
|
|
|
+ const { query, token } = this.props;
|
|
|
|
|
+ const { id } = query;
|
|
|
|
|
+ await updatePddikti(token, sanksiId, _csrf2)
|
|
|
|
|
+
|
|
|
|
|
+ toast.update(toastPddikti, { render: "Berhasil Update PDDIKTI", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ catch (error) {
|
|
|
|
|
+ toast.update(toastPddikti, { render: ("Gagal Update PDDIKTI"), type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- handelSimpan = async (data) => {
|
|
|
|
|
- if (this.props?.user?.role.id === 2024) {
|
|
|
|
|
- Swal.fire({
|
|
|
|
|
- icon: 'error',
|
|
|
|
|
- title: 'Oops...',
|
|
|
|
|
- html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
|
|
|
|
|
- confirmButtonColor: "#3e3a8e",
|
|
|
|
|
- confirmButtonText: 'Oke'
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ ubahSanksi = async (data) => {
|
|
|
|
|
+
|
|
|
if (this.state.tmtCheck === true ||this.state.listSanksi?.find(z => z.label === "Sanksi Administratif Berat - Pencabutan izin Program Studi" || z.label === "Sanksi Administratif Berat - Pembubaran PTN atau pencabutan izin PTS")) {
|
|
if (this.state.tmtCheck === true ||this.state.listSanksi?.find(z => z.label === "Sanksi Administratif Berat - Pencabutan izin Program Studi" || z.label === "Sanksi Administratif Berat - Pembubaran PTN atau pencabutan izin PTS")) {
|
|
|
const getToken = await getCsrf();
|
|
const getToken = await getCsrf();
|
|
|
const _csrf = getToken.token;
|
|
const _csrf = getToken.token;
|
|
@@ -191,9 +225,10 @@ class InputTanggal extends Component {
|
|
|
toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
} else {
|
|
} else {
|
|
|
toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
- Router.push("/app/naik-sanksi");
|
|
|
|
|
|
|
+ // Router.push("/app/naik-sanksi");
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
|
|
+ console.log("ubahsanksi")
|
|
|
const getToken = await getCsrf();
|
|
const getToken = await getCsrf();
|
|
|
const _csrf = getToken.token;
|
|
const _csrf = getToken.token;
|
|
|
const { token, query } = this.props;
|
|
const { token, query } = this.props;
|
|
@@ -215,10 +250,10 @@ class InputTanggal extends Component {
|
|
|
toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
} else {
|
|
} else {
|
|
|
toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
- Router.push("/app/naik-sanksi");
|
|
|
|
|
|
|
+ // Router.push("/app/naik-sanksi");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
};
|
|
@@ -251,7 +286,7 @@ class InputTanggal extends Component {
|
|
|
dokumen: [],
|
|
dokumen: [],
|
|
|
}}
|
|
}}
|
|
|
validationSchema={rekomendasiSchema}
|
|
validationSchema={rekomendasiSchema}
|
|
|
- onSubmit={this.handelSimpan}
|
|
|
|
|
|
|
+ onSubmit={this.done}
|
|
|
>
|
|
>
|
|
|
{({ isSubmitting }) => (
|
|
{({ isSubmitting }) => (
|
|
|
<Form className="form-horizontal">
|
|
<Form className="form-horizontal">
|