|
|
@@ -8,7 +8,7 @@ import Riwayat from "@/components/PT/Keberatan/Riwayat";
|
|
|
import ModalPermohonan from "@/components/PT/Keberatan/ModalPermohonan";
|
|
|
import Link from "next/link";
|
|
|
import moment from "moment";
|
|
|
-import { Row, Col, Card, CardBody, Button } from "reactstrap";
|
|
|
+import { Row, Col, Card, CardBody, Button, Modal, ModalBody, ModalFooter } from "reactstrap";
|
|
|
import { connect } from "react-redux";
|
|
|
import Router from "next/router";
|
|
|
import Loader from "@/components/Common/Loader";
|
|
|
@@ -29,12 +29,39 @@ class Sanksi extends Component {
|
|
|
updatePT(token, query.id, { is_read: true })
|
|
|
this.setState({ sanksi, pt: sanksi.data.laporan.pt });
|
|
|
};
|
|
|
+ setModal = (modal) => {
|
|
|
+ this.setState({
|
|
|
+ modal: !this.state.modal
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
render() {
|
|
|
const { sanksi, pt } = this.state;
|
|
|
console.log(sanksi)
|
|
|
return (
|
|
|
<ContentWrapper unwrap>
|
|
|
+ <Modal isOpen={this.state.modal} toggle={this.props.toggleModal}>
|
|
|
+ <ModalBody>Apakah anda akan tidak mengajukan permohonan keberatan atas pengenaan sanksi?</ModalBody>
|
|
|
+ <ModalFooter>
|
|
|
+ <Button color className="btn-login" onClick={async () => {
|
|
|
+ const toastid = toast.loading("Please wait...");
|
|
|
+ try {
|
|
|
+ const { token, query } = this.props;
|
|
|
+ await updatePT(token, query.id, { is_pengajuan_keberatan: false })
|
|
|
+ toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ Router.push("/pt/dokumen-perbaikan");
|
|
|
+ } catch (error) {
|
|
|
+ toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }>
|
|
|
+ <span className="font-color-white">Ya</span>
|
|
|
+ </Button>
|
|
|
+ <Button color className="btn-v2" onClick={this.setModal}>
|
|
|
+ Tidak
|
|
|
+ </Button>
|
|
|
+ </ModalFooter>
|
|
|
+ </Modal>
|
|
|
{pt && <Header data={pt} />}
|
|
|
<div className="p-3">
|
|
|
<div className="content-heading">
|
|
|
@@ -71,11 +98,11 @@ class Sanksi extends Component {
|
|
|
</p>
|
|
|
<p className="lead">
|
|
|
<span className="btn-radius">
|
|
|
- <Button color="" disabled={sanksi.data.is_pengajuan === true || sanksi.data.is_pengajuan === false} className="btn-labeled" onClick={async () => {
|
|
|
+ <Button color="" disabled={sanksi.data.is_pengajuan_keberatan === true || sanksi.data.is_pengajuan_keberatan === false} className="btn-labeled" onClick={async () => {
|
|
|
const toastid = toast.loading("Please wait...");
|
|
|
try {
|
|
|
const { token, query } = this.props;
|
|
|
- await updatePT(token, query.id, { is_pengajuan: true })
|
|
|
+ await updatePT(token, query.id, { is_pengajuan_keberatan: true })
|
|
|
toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
Router.push("/pt/keberatan");
|
|
|
} catch (error) {
|
|
|
@@ -88,18 +115,7 @@ class Sanksi extends Component {
|
|
|
</Button>
|
|
|
</span>
|
|
|
<span className="btn-radius">
|
|
|
- <Button disabled={sanksi.data.is_pengajuan === true || sanksi.data.is_pengajuan === false} color className="btn-labeled-3" onClick={async () => {
|
|
|
- const toastid = toast.loading("Please wait...");
|
|
|
- try {
|
|
|
- const { token, query } = this.props;
|
|
|
- await updatePT(token, query.id, { is_pengajuan: false })
|
|
|
- toast.update(toastid, { render: "All is good", type: "success", isLoading: false, autoClose: true, closeButton: true });
|
|
|
- Router.push("/pt/dokumen-perbaikan");
|
|
|
- } catch (error) {
|
|
|
- toast.update(toastid, { render: "All is not good", type: "error", isLoading: false, autoClose: true, closeButton: true });
|
|
|
- }
|
|
|
- }
|
|
|
- }>
|
|
|
+ <Button disabled={sanksi.data.is_pengajuan_keberatan === true || sanksi.data.is_pengajuan_keberatan === false} color className="btn-labeled-3" onClick={this.setModal} >
|
|
|
<h4 className=" mt-1 mb-md-2 text-center">Tidak</h4>
|
|
|
</Button>
|
|
|
</span>
|