|
@@ -44,16 +44,16 @@ const checkIfFilesAreCorrectType = (files) => {
|
|
|
|
|
|
|
|
const laporanSchema = Yup.object().shape({
|
|
const laporanSchema = Yup.object().shape({
|
|
|
no_laporan: Yup.string().required("Harap Diisi"),
|
|
no_laporan: Yup.string().required("Harap Diisi"),
|
|
|
- no_hp: Yup.number().required("Harap Diisi"),
|
|
|
|
|
|
|
+ no_hp: Yup.number().required("Wajib Di Isi"),
|
|
|
nama: Yup.string().notRequired(),
|
|
nama: Yup.string().notRequired(),
|
|
|
setuju: Yup.boolean().isTrue(),
|
|
setuju: Yup.boolean().isTrue(),
|
|
|
alamat: Yup.string().min(3).max(200).notRequired(),
|
|
alamat: Yup.string().min(3).max(200).notRequired(),
|
|
|
- keterangan: Yup.string().min(3).max(200).required("Harap Diisi"),
|
|
|
|
|
|
|
+ keterangan: Yup.string().min(3).max(200).required("Wajib Di Isi"),
|
|
|
email: Yup.string().email().notRequired(),
|
|
email: Yup.string().email().notRequired(),
|
|
|
- pelanggaran_id: Yup.array().min(1).required("Harap Diisi"),
|
|
|
|
|
- pt_id: Yup.string().required("Harap Diisi"),
|
|
|
|
|
|
|
+ pelanggaran_id: Yup.array().min(1).required("Wajib Di Isi"),
|
|
|
|
|
+ pt_id: Yup.string().required("Wajib Di Isi"),
|
|
|
foto: Yup.array().notRequired().test("filesize", "Maksimal ukuran foto 15mb", checkIfFilesAreTooBig).test("type", "harus jpeg/png", checkIfFilesAreCorrectType),
|
|
foto: Yup.array().notRequired().test("filesize", "Maksimal ukuran foto 15mb", checkIfFilesAreTooBig).test("type", "harus jpeg/png", checkIfFilesAreCorrectType),
|
|
|
- dokumen: Yup.array().nullable().notRequired().test("filesize", "Maksimal ukuran dokumen 15mb", checkIfFilesAreTooBig),
|
|
|
|
|
|
|
+ dokumen: Yup.array().min(1).required().test("filesize", "Maksimal ukuran dokumen 15mb", checkIfFilesAreTooBig),
|
|
|
is_private: Yup.boolean().notRequired(),
|
|
is_private: Yup.boolean().notRequired(),
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -275,7 +275,7 @@ class App extends Component {
|
|
|
</div>
|
|
</div>
|
|
|
</FormGroup>
|
|
</FormGroup>
|
|
|
<FormGroup row>
|
|
<FormGroup row>
|
|
|
- <label className="col-md-2 col-form-label">Nomor Aktif</label>
|
|
|
|
|
|
|
+ <label className="col-md-2 col-form-label">Nomor Aktif<span className="star-color">*</span></label>
|
|
|
<div className="col-md-10">
|
|
<div className="col-md-10">
|
|
|
<Field name="no_hp">{({ field, form }) => <Input type="tel" {...field} />}</Field>
|
|
<Field name="no_hp">{({ field, form }) => <Input type="tel" {...field} />}</Field>
|
|
|
<ErrorMessage name="no_hp" component="div" className="form-text text-danger" />
|
|
<ErrorMessage name="no_hp" component="div" className="form-text text-danger" />
|
|
@@ -323,7 +323,7 @@ class App extends Component {
|
|
|
</div>
|
|
</div>
|
|
|
</FormGroup>
|
|
</FormGroup>
|
|
|
<FormGroup row>
|
|
<FormGroup row>
|
|
|
- <label className="col-md-2 col-form-label">Perguruan Tinggi yang Dilaporkan</label>
|
|
|
|
|
|
|
+ <label className="col-md-2 col-form-label">Perguruan Tinggi yang Dilaporkan<span className="star-color">*</span></label>
|
|
|
<div className="col-md-10">
|
|
<div className="col-md-10">
|
|
|
<Field name="pt_id">
|
|
<Field name="pt_id">
|
|
|
{({ field, form }) => (
|
|
{({ field, form }) => (
|
|
@@ -343,7 +343,7 @@ class App extends Component {
|
|
|
</div>
|
|
</div>
|
|
|
</FormGroup>
|
|
</FormGroup>
|
|
|
<FormGroup row>
|
|
<FormGroup row>
|
|
|
- <label className="col-md-2 col-form-label">Jenis Pelanggaran</label>
|
|
|
|
|
|
|
+ <label className="col-md-2 col-form-label">Jenis Pelanggaran<span className="star-color">*</span></label>
|
|
|
<div className="col-md-10">
|
|
<div className="col-md-10">
|
|
|
<Field name="pelanggaran_id">
|
|
<Field name="pelanggaran_id">
|
|
|
{({ field, form }) => (
|
|
{({ field, form }) => (
|
|
@@ -367,14 +367,14 @@ class App extends Component {
|
|
|
</div>
|
|
</div>
|
|
|
</FormGroup>
|
|
</FormGroup>
|
|
|
<FormGroup row>
|
|
<FormGroup row>
|
|
|
- <label className="col-md-2 col-form-label">Keterangan Laporan</label>
|
|
|
|
|
|
|
+ <label className="col-md-2 col-form-label">Keterangan Laporan<span className="star-color">*</span></label>
|
|
|
<div className="col-md-10">
|
|
<div className="col-md-10">
|
|
|
<Field name="keterangan">{({ field }) => <Input type="textarea" {...field} />}</Field>
|
|
<Field name="keterangan">{({ field }) => <Input type="textarea" {...field} />}</Field>
|
|
|
<ErrorMessage name="keterangan" component="div" className="form-text text-danger" />
|
|
<ErrorMessage name="keterangan" component="div" className="form-text text-danger" />
|
|
|
</div>
|
|
</div>
|
|
|
</FormGroup>
|
|
</FormGroup>
|
|
|
<FormGroup row>
|
|
<FormGroup row>
|
|
|
- <label className="col-md-2 col-form-label">File Pendukung</label>
|
|
|
|
|
|
|
+ <label className="col-md-2 col-form-label">File Pendukung<span className="star-color">*</span></label>
|
|
|
<div className="col-md-10">
|
|
<div className="col-md-10">
|
|
|
<Field name="dokumen">{({ field, form }) => <Input type="file" multiple onChange={(e) => form.setFieldValue(field.name, Array.from(e.currentTarget.files))} />}</Field>
|
|
<Field name="dokumen">{({ field, form }) => <Input type="file" multiple onChange={(e) => form.setFieldValue(field.name, Array.from(e.currentTarget.files))} />}</Field>
|
|
|
<ErrorMessage name="dokumen" component="div" className="form-text text-danger" />
|
|
<ErrorMessage name="dokumen" component="div" className="form-text text-danger" />
|