|
|
@@ -10,7 +10,7 @@ import Riwayat from "@/components/Keberatan/Riwayat";
|
|
|
import { getSanksi } from "@/actions/sanksi";
|
|
|
import { addJawabanKeberatan } from "@/actions/keberatan";
|
|
|
import ContentWrapper from "@/components/Layout/ContentWrapper";
|
|
|
-import { Row, Col, Card, CardBody, FormGroup, Input, Button } from "reactstrap";
|
|
|
+import { Row, Col, Card, CardBody, FormGroup, Input, Button, Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap";
|
|
|
import { getPT } from "@/actions/PT";
|
|
|
|
|
|
let Dropzone = null;
|
|
|
@@ -33,6 +33,7 @@ class DetailKeberatan extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
+ modal: false,
|
|
|
selectedOption: null,
|
|
|
files: [],
|
|
|
keterangan: "",
|
|
|
@@ -52,6 +53,12 @@ class DetailKeberatan extends Component {
|
|
|
this.setState({ pt, sanksi });
|
|
|
};
|
|
|
|
|
|
+ toggleModal = () => {
|
|
|
+ this.setState({
|
|
|
+ modal: !this.state.modal,
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
handleChangeSelect = (selectedOption) => {
|
|
|
this.setState({ selectedOption });
|
|
|
};
|
|
|
@@ -97,14 +104,15 @@ class DetailKeberatan extends Component {
|
|
|
this.state.files.forEach((e) => {
|
|
|
formdata.append("files", e);
|
|
|
});
|
|
|
+ const added = await addJawabanKeberatan({ noSanksi, ptId }, formdata);
|
|
|
+ if (added) {
|
|
|
+ Router.push({
|
|
|
+ pathname: "/app/keberatan",
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- const added = await addJawabanKeberatan({ noSanksi, ptId }, formdata);
|
|
|
- if (added) {
|
|
|
- Router.push({
|
|
|
- pathname: "/app/keberatan",
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
};
|
|
|
|
|
|
render() {
|
|
|
@@ -192,7 +200,7 @@ class DetailKeberatan extends Component {
|
|
|
</FormGroup>
|
|
|
{/* <FormGroup>
|
|
|
<div className="row-xl-10"> */}
|
|
|
- <Button color="primary" onClick={this.handelSimpan} type="submit">
|
|
|
+ <Button color="primary" onClick={sanksi.data && sanksi.data.length && sanksi.data[0].sanksi.keberatan.jawaban ? this.toggleModal : this.handelSimpan}>
|
|
|
Simpan
|
|
|
</Button>
|
|
|
{/* </div>
|
|
|
@@ -209,6 +217,17 @@ class DetailKeberatan extends Component {
|
|
|
<Col>{sanksi.data && sanksi.data.length && <Riwayat data={sanksi.data[0].sanksi.keberatan.jawaban} />}</Col>
|
|
|
</Row>
|
|
|
</div>
|
|
|
+ <Modal isOpen={this.state.modal} toggle={this.toggleModal}>
|
|
|
+ <ModalBody>Apakah anda yakin ingin mengubah jawaban sebelumnya?</ModalBody>
|
|
|
+ <ModalFooter>
|
|
|
+ <Button color="primary" onClick={this.handelSimpan}>
|
|
|
+ Ya
|
|
|
+ </Button>{" "}
|
|
|
+ <Button color="secondary" onClick={this.toggleModal}>
|
|
|
+ Tidak
|
|
|
+ </Button>
|
|
|
+ </ModalFooter>
|
|
|
+ </Modal>
|
|
|
</ContentWrapper>
|
|
|
);
|
|
|
}
|