|
@@ -13,6 +13,7 @@ import { connect } from "react-redux";
|
|
|
import Router from "next/router";
|
|
import Router from "next/router";
|
|
|
import Loader from "@/components/Common/Loader";
|
|
import Loader from "@/components/Common/Loader";
|
|
|
import { ToastContainer, toast } from "react-toastify";
|
|
import { ToastContainer, toast } from "react-toastify";
|
|
|
|
|
+import { getCsrf } from "../../../actions/security";
|
|
|
|
|
|
|
|
class Sanksi extends Component {
|
|
class Sanksi extends Component {
|
|
|
state = {
|
|
state = {
|
|
@@ -24,9 +25,11 @@ class Sanksi extends Component {
|
|
|
static getInitialProps = ({ query }) => ({ query });
|
|
static getInitialProps = ({ query }) => ({ query });
|
|
|
|
|
|
|
|
componentDidMount = async () => {
|
|
componentDidMount = async () => {
|
|
|
|
|
+ const getToken = await getCsrf();
|
|
|
|
|
+ const _csrf = getToken.token;
|
|
|
const { token, query } = this.props;
|
|
const { token, query } = this.props;
|
|
|
const sanksi = await getOneSanksi(token, query.id);
|
|
const sanksi = await getOneSanksi(token, query.id);
|
|
|
- updatePT(token, query.id, { is_read: true })
|
|
|
|
|
|
|
+ updatePT(token, query.id, { is_read: true }, _csrf)
|
|
|
this.setState({ sanksi, pt: sanksi.data.laporan.pt });
|
|
this.setState({ sanksi, pt: sanksi.data.laporan.pt });
|
|
|
};
|
|
};
|
|
|
setModal = (modal) => {
|
|
setModal = (modal) => {
|
|
@@ -43,12 +46,14 @@ class Sanksi extends Component {
|
|
|
<ModalBody>Apakah anda akan tidak mengajukan permohonan keberatan atas pengenaan sanksi?</ModalBody>
|
|
<ModalBody>Apakah anda akan tidak mengajukan permohonan keberatan atas pengenaan sanksi?</ModalBody>
|
|
|
<ModalFooter>
|
|
<ModalFooter>
|
|
|
<Button color className="btn-login" onClick={async () => {
|
|
<Button color className="btn-login" onClick={async () => {
|
|
|
|
|
+ const getToken = await getCsrf();
|
|
|
|
|
+ const _csrf = getToken.token;
|
|
|
const toastid = toast.loading("Please wait...");
|
|
const toastid = toast.loading("Please wait...");
|
|
|
try {
|
|
try {
|
|
|
const { token, query } = this.props;
|
|
const { token, query } = this.props;
|
|
|
- await updatePT(token, query.id, { is_pengajuan_keberatan: false })
|
|
|
|
|
|
|
+ await updatePT(token, query.id, { is_pengajuan_keberatan: false }, _csrf)
|
|
|
toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
- Router.push(`/pt/dokumen-perbaikan/detail?id=${sanksi.data._id}`);
|
|
|
|
|
|
|
+ Router.push(`/pt/sanksi/dokumen-perbaikan/detail?id=${sanksi.data._id}`);
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
}
|
|
}
|
|
@@ -96,13 +101,15 @@ class Sanksi extends Component {
|
|
|
Pengajuan dilakukan paling lambat tanggal {moment(sanksi.data.tanggal_akhir_keberatan).locale("id").format("DD MMMM YYYY")}
|
|
Pengajuan dilakukan paling lambat tanggal {moment(sanksi.data.tanggal_akhir_keberatan).locale("id").format("DD MMMM YYYY")}
|
|
|
</p>
|
|
</p>
|
|
|
<p className="lead">
|
|
<p className="lead">
|
|
|
- <Link href={{ pathname: "/pt/keberatan/detail", query: { id: sanksi.data._id } }}>
|
|
|
|
|
|
|
+ <Link href={{ pathname: "/pt/sanksi/keberatan/detail", query: { id: sanksi.data._id } }}>
|
|
|
<span className="btn-radius">
|
|
<span className="btn-radius">
|
|
|
<Button color="" className="btn-labeled-notHover" onClick={async () => {
|
|
<Button color="" className="btn-labeled-notHover" onClick={async () => {
|
|
|
// const toastid = toast.loading("Please wait...");
|
|
// const toastid = toast.loading("Please wait...");
|
|
|
|
|
+ const getToken = await getCsrf();
|
|
|
|
|
+ const _csrf = getToken.token;
|
|
|
try {
|
|
try {
|
|
|
const { token, query } = this.props;
|
|
const { token, query } = this.props;
|
|
|
- await updatePT(token, query.id, { is_pengajuan_keberatan: true })
|
|
|
|
|
|
|
+ await updatePT(token, query.id, { is_pengajuan_keberatan: true }, _csrf)
|
|
|
// toast.update(toastid, { render: "Berhasil", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
// toast.update(toastid, { render: "Berhasil", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
// toast.update(toastid, { render: "Gagal", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
// toast.update(toastid, { render: "Gagal", type: "error", isLoading: false, autoClose: true, closeButton: true });
|