Fakultas Ilmu Komputer UI

Commit aaa0d6ca authored by FadhilP's avatar FadhilP
Browse files

[REFACTOR] Fix bug

parent 930e8d38
Pipeline #82071 failed with stages
in 1 minute and 53 seconds
......@@ -120,8 +120,7 @@ const FormProduk = ({ onSubmit, initialData = null, error }) => {
if (formKey.includes(key)) {
if (data.image.length !== 0)
formData.append("image", data["image"][0]);
} else if (formCurrency.includes(key))
formData.append(key, formatValue(data[key]));
}
else formData.append(key, data[key]);
isPreorder === "true"
? formData.set("stock", "")
......@@ -129,6 +128,9 @@ const FormProduk = ({ onSubmit, initialData = null, error }) => {
isHampers === "false"
? formData.set("hampers_price", "")
: formData.set("hampers_price", data["hampers_price"]);
formData.set("modal", formatValue(valueModal))
formData.set("price", formatValue(valueHarga))
}
onSubmit(formData);
},
......@@ -182,30 +184,28 @@ const FormProduk = ({ onSubmit, initialData = null, error }) => {
{/* NAME SECTION END */}
{/* MODAL SECTION START */}
{/* SATUAN SECTION START */}
<RowInput>
<LabelInput htmlFor="modal">Modal/Satuan </LabelInput>
<MaskedInput
data-testid="modal-produk-input"
type="text"
name="modal"
<RowInput>
<LabelInput htmlFor="unit">
Satuan
<span
css={css`
color: red;
`}
>
*
</span>
</LabelInput>
<InputForm
data-testid="unit-produk-input"
name="unit"
ref={register({ required: true })}
onChange={onChangeModal}
mask={currencyMask}
css={css`
flex-grow: 4;
border: 1px solid #e0e1e2;
box-sizing: border-box;
border-radius: 4px;
font-size: 1rem;
padding-left: 1rem;
`}
/>
{errorModal === 1 && <ErrorDiv>Modal tidak boleh kosong</ErrorDiv>}
{errors.unit && <ErrorDiv>Satuan Produk tidak boleh kosong</ErrorDiv>}
</RowInput>
{/* MODAL SECTION END */}
{/* SATUAN SECTION END */}
{/* CATEGORY SECTION START */}
......@@ -303,6 +303,31 @@ const FormProduk = ({ onSubmit, initialData = null, error }) => {
{/* DESCRIPTION SECTION END */}
{/* MODAL SECTION START */}
<RowInput>
<LabelInput htmlFor="modal">Modal/Satuan </LabelInput>
<MaskedInput
data-testid="modal-produk-input"
type="text"
name="modal"
ref={register({ required: true })}
onChange={onChangeModal}
mask={currencyMask}
css={css`
flex-grow: 4;
border: 1px solid #e0e1e2;
box-sizing: border-box;
border-radius: 4px;
font-size: 1rem;
padding-left: 1rem;
`}
/>
{errorModal === 1 && <ErrorDiv>Modal tidak boleh kosong</ErrorDiv>}
</RowInput>
{/* MODAL SECTION END */}
{/* HARGA SECTION START */}
<RowInput>
......@@ -505,29 +530,6 @@ const FormProduk = ({ onSubmit, initialData = null, error }) => {
{/* PREORDER SECTION END */}
{/* SATUAN SECTION START */}
<RowInput>
<LabelInput htmlFor="unit">
Satuan
<span
css={css`
color: red;
`}
>
*
</span>
</LabelInput>
<InputForm
data-testid="unit-produk-input"
name="unit"
ref={register({ required: true })}
/>
{errors.unit && <ErrorDiv>Satuan Produk tidak boleh kosong</ErrorDiv>}
</RowInput>
{/* SATUAN SECTION END */}
{/* IMAGE SECTION START */}
<RowInput>
......
Markdown is supported
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