|
|
@@ -4,6 +4,7 @@ import BasePage from "@/components/Layout/BasePage";
|
|
|
import { getPT } from "@/actions/PT";
|
|
|
import { getPelanggaran } from "@/actions/pelanggaran";
|
|
|
import { createPelaporan } from "@/actions/pelaporan";
|
|
|
+import { notifLaporanBaru } from "@/actions/notifikasi";
|
|
|
import Select from "react-select";
|
|
|
import AsyncSelect from "react-select/async";
|
|
|
import { Row, Col, FormGroup, Input, Card, CardBody, Button, CustomInput, Navbar, NavItem, NavLink, NavbarBrand, NavbarToggler, Nav, Collapse } from "reactstrap";
|
|
|
@@ -101,11 +102,19 @@ class App extends Component {
|
|
|
const { nama } = this.state;
|
|
|
const user_id = await this.createUser();
|
|
|
await this.createLaporan(user_id, nama);
|
|
|
+ await this.sendNotif();
|
|
|
Router.push("/laporan/new");
|
|
|
// validasi
|
|
|
// if (nama === '') msgError.push({nama: 'Wajib diisi'})
|
|
|
};
|
|
|
|
|
|
+ sendNotif = async () => {
|
|
|
+ const { nama, no_hp, selectedPerguruanTinggi, keteranganLaporan, pelaporanNumber, selectedJenis } = this.state;
|
|
|
+ const description = `${selectedJenis.map((e) => e.label).join(", ")} dengan keterangan ${keteranganLaporan}`;
|
|
|
+ // const description = keteranganLaporan;
|
|
|
+ return await notifLaporanBaru({ nama, pt_name: selectedPerguruanTinggi.label, description, no_laporan: pelaporanNumber.toString() });
|
|
|
+ };
|
|
|
+
|
|
|
createUser = async () => {
|
|
|
const { nama, alamat, no_hp, email, fileIdentitas, isPrivate } = this.state;
|
|
|
const dataUser = new FormData();
|
|
|
@@ -126,6 +135,7 @@ class App extends Component {
|
|
|
formdata.append("number", pelaporanNumber);
|
|
|
formdata.append("user_id", user_id);
|
|
|
formdata.append("pt_id", selectedPerguruanTinggi.value);
|
|
|
+ formdata.append("pt_name", selectedPerguruanTinggi.label);
|
|
|
formdata.append("description", keteranganLaporan);
|
|
|
formdata.append("is_public", true);
|
|
|
formdata.append("nama", nama);
|