|
|
@@ -160,76 +160,76 @@ class InputTanggal extends Component {
|
|
|
};
|
|
|
|
|
|
done = async (data) => {
|
|
|
- if (this.props?.user?.role.id === 2071) {
|
|
|
- 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",
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
+ if (this.props?.user?.role.id === 2071) {
|
|
|
+ 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)
|
|
|
+ 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 });
|
|
|
+ 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 });
|
|
|
- }
|
|
|
+ catch (error) {
|
|
|
+ toast.update(toastPddikti, { render: ("Gagal Update PDDIKTI"), type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
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")) {
|
|
|
- const getToken = await getCsrf();
|
|
|
- const _csrf = getToken.token;
|
|
|
- const { token, query } = this.props;
|
|
|
- const { id } = query;
|
|
|
- const formdata = new FormData();
|
|
|
- formdata.append("no_sanksi", data.no_sanksi);
|
|
|
- formdata.append("keterangan", data.keterangan);
|
|
|
- // formdata.append("from_date", data.from_date);
|
|
|
- // formdata.append("to_date", data.to_date);
|
|
|
- // formdata.append("sanksi", JSON.stringify(data.sanksi.map((e) => ({ label: e.value }))));
|
|
|
- formdata.append("sanksi", JSON.stringify(data.sanksi.map((e) => ({ label: e.value.split(";")[0], description: e.value.split(";")[1], level: e.value.split(";")[2] }))));
|
|
|
-
|
|
|
- this.state.files.forEach((e) => {
|
|
|
- formdata.append("dokumen", e);
|
|
|
- });
|
|
|
- const toastid = toast.loading("Please wait...");
|
|
|
- const added = await update(token, id, formdata, _csrf);
|
|
|
- if (!added) {
|
|
|
- toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
- } else {
|
|
|
- toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
- // Router.push("/app/naik-sanksi");
|
|
|
- }
|
|
|
- }else{
|
|
|
- console.log("ubahsanksi")
|
|
|
- const getToken = await getCsrf();
|
|
|
+
|
|
|
+ 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 _csrf = getToken.token;
|
|
|
+ const { token, query } = this.props;
|
|
|
+ const { id } = query;
|
|
|
+ const formdata = new FormData();
|
|
|
+ formdata.append("no_sanksi", data.no_sanksi);
|
|
|
+ formdata.append("keterangan", data.keterangan);
|
|
|
+ // formdata.append("from_date", data.from_date);
|
|
|
+ // formdata.append("to_date", data.to_date);
|
|
|
+ // formdata.append("sanksi", JSON.stringify(data.sanksi.map((e) => ({ label: e.value }))));
|
|
|
+ formdata.append("sanksi", JSON.stringify(data.sanksi.map((e) => ({ label: e.value.split(";")[0], description: e.value.split(";")[1], level: e.value.split(";")[2] }))));
|
|
|
+
|
|
|
+ this.state.files.forEach((e) => {
|
|
|
+ formdata.append("dokumen", e);
|
|
|
+ });
|
|
|
+ const toastid = toast.loading("Please wait...");
|
|
|
+ const added = await update(token, id, formdata, _csrf);
|
|
|
+ if (!added) {
|
|
|
+ toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ } else {
|
|
|
+ toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ // Router.push("/app/naik-sanksi");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("ubahsanksi")
|
|
|
+ const getToken = await getCsrf();
|
|
|
const _csrf = getToken.token;
|
|
|
const { token, query } = this.props;
|
|
|
const { id } = query;
|
|
|
@@ -253,8 +253,8 @@ class InputTanggal extends Component {
|
|
|
// Router.push("/app/naik-sanksi");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
};
|
|
|
render() {
|
|
|
@@ -404,7 +404,7 @@ class InputTanggal extends Component {
|
|
|
)}
|
|
|
{!this.state.tmtCheck && !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") && (
|
|
|
<FormGroup row className="mt-1">
|
|
|
- <label className="col-md-2 col-form-label">TMT</label>
|
|
|
+ <label className="col-md-2 col-form-label">Durasi</label>
|
|
|
<div className="col-md-10 mt-2">
|
|
|
<b>{this.state.to_date ? moment(this.state.to_date).diff(this.state.from_date, 'month') : "-"} bulan</b>
|
|
|
</div>
|
|
|
@@ -450,7 +450,7 @@ class InputTanggal extends Component {
|
|
|
<h5 className="text-center dz-default dz-message">Klik untuk tambah file</h5>
|
|
|
</div> :
|
|
|
<div className="text-center fa-2x icon-cloud-upload mr-2 ">
|
|
|
- <h5 className="text-center dz-default dz-message">Upload dokumen Naik Sanksi</h5>
|
|
|
+ <h5 className="text-center dz-default dz-message">Upload dokumen Perubahan</h5>
|
|
|
</div>
|
|
|
}
|
|
|
</div>
|