Fakultas Ilmu Komputer UI

Commit a879f1a2 authored by Shafiya Adzhani's avatar Shafiya Adzhani
Browse files

[CHORES] add default value in form iumk 1

parent 38966860
import React from 'react'
import PropTypes from 'prop-types'
const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
const FormIUMK1 = ({register, errors, handleSubmit, onSubmit, data}) => {
return (
<form
className="px-4"
......@@ -40,6 +40,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({
required: 'Wajib diisi',
})}
defaultValue={data.nama}
/>
{errors.nama && (
<span role="alert" className="text-popred">
......@@ -61,6 +62,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({required: 'Wajib diisi'})}
type="radio"
value="PT"
defaultChecked={data.status == 'PT'}
/>
<label className="heading-3 text-charchoal">PT</label>
</div>
......@@ -72,6 +74,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({required: 'Wajib diisi'})}
type="radio"
value="CV"
defaultChecked={data.status == 'CV'}
/>
<label className="heading-3 text-charchoal">CV</label>
</div>
......@@ -83,6 +86,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({required: 'Wajib diisi'})}
type="radio"
value="Firma"
defaultChecked={data.status == 'Firma'}
/>
<label className="heading-3 text-charchoal">Firma</label>
</div>
......@@ -94,6 +98,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({required: 'Wajib diisi'})}
type="radio"
value="Yayasan"
defaultChecked={data.status == 'Yayasan'}
/>
<label className="heading-3 text-charchoal">Yayasan</label>
</div>
......@@ -105,6 +110,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({required: 'Wajib diisi'})}
type="radio"
value="Koperasi"
defaultChecked={data.status == 'Koperasi'}
/>
<label className="heading-3 text-charchoal">Koperasi</label>
</div>
......@@ -116,6 +122,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({required: 'Wajib diisi'})}
type="radio"
value="Other"
defaultChecked={data.status == 'Other'}
/>
<label className="heading-3 text-charchoal">Other</label>
</div>
......@@ -142,6 +149,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({
required: 'Wajib diisi',
})}
defaultValue={data.alamat}
/>
{errors.alamat && (
<span role="alert" className="text-popred">
......@@ -166,6 +174,7 @@ const FormIUMK1 = ({register, errors, handleSubmit, onSubmit}) => {
ref={register({
required: 'Wajib diisi',
})}
defaultValue={data.barangJasa}
/>
{errors.barangJasa && (
<span role="alert" className="text-popred">
......@@ -190,6 +199,7 @@ FormIUMK1.propTypes = {
errors: PropTypes.object,
handleSubmit: PropTypes.func,
onSubmit: PropTypes.func,
data: PropTypes.object,
}
export default FormIUMK1
......@@ -43,6 +43,9 @@ const FormIUMK = () => {
errors={errors}
handleSubmit={handleSubmit}
onSubmit={onSubmit}
data={data}
currentPage={pageNumber}
setCurrentPage={setPageNumber}
/>
)}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment