mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Merge branch 'fix/form-error-message' into 'development'
[FIX/FE] Form Error Message See merge request mbugroup/lti-web-client!167
This commit is contained in:
@@ -17,6 +17,7 @@ import DropFileInput from '@/components/input/DropFileInput';
|
|||||||
import ExpenseKandangsTable from '@/components/pages/expense/form/ExpenseKandangsTable';
|
import ExpenseKandangsTable from '@/components/pages/expense/form/ExpenseKandangsTable';
|
||||||
import ExpenseRealizationKandangDetailExpense from '@/components/pages/expense/form/ExpenseRealizationKandangDetailExpense';
|
import ExpenseRealizationKandangDetailExpense from '@/components/pages/expense/form/ExpenseRealizationKandangDetailExpense';
|
||||||
import RequirePermission from '@/components/helper/RequirePermission';
|
import RequirePermission from '@/components/helper/RequirePermission';
|
||||||
|
import AlertErrorList from '@/components/helper/form/FormErrors';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CreateExpenseRealizationPayload,
|
CreateExpenseRealizationPayload,
|
||||||
@@ -35,6 +36,7 @@ import { LocationApi, SupplierApi } from '@/services/api/master-data';
|
|||||||
import { Supplier } from '@/types/api/master-data/supplier';
|
import { Supplier } from '@/types/api/master-data/supplier';
|
||||||
import { ACCEPTED_FILE_TYPE } from '@/config/constant';
|
import { ACCEPTED_FILE_TYPE } from '@/config/constant';
|
||||||
import { cn } from '@/lib/helper';
|
import { cn } from '@/lib/helper';
|
||||||
|
import { useFormikErrorList } from '@/services/hooks/useFormikErrorList';
|
||||||
|
|
||||||
interface ExpenseRealizationFormProps {
|
interface ExpenseRealizationFormProps {
|
||||||
type?: 'add' | 'edit' | 'detail';
|
type?: 'add' | 'edit' | 'detail';
|
||||||
@@ -132,6 +134,7 @@ const ExpenseRealizationForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { setValues: formikSetValues } = formik;
|
const { setValues: formikSetValues } = formik;
|
||||||
|
const { formErrorList, close, handleFormSubmit } = useFormikErrorList(formik);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
setInputValue: setLocationInputValue,
|
setInputValue: setLocationInputValue,
|
||||||
@@ -263,7 +266,7 @@ const ExpenseRealizationForm = ({
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
onSubmit={formik.handleSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
onReset={formik.handleReset}
|
onReset={formik.handleReset}
|
||||||
className='w-full mt-8 flex flex-col gap-6'
|
className='w-full mt-8 flex flex-col gap-6'
|
||||||
>
|
>
|
||||||
@@ -372,6 +375,8 @@ const ExpenseRealizationForm = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<AlertErrorList formErrorList={formErrorList} onClose={close} />
|
||||||
|
|
||||||
{expenseFormErrorMessage && (
|
{expenseFormErrorMessage && (
|
||||||
<div role='alert' className='alert alert-error w-full'>
|
<div role='alert' className='alert alert-error w-full'>
|
||||||
<Icon
|
<Icon
|
||||||
@@ -421,7 +426,7 @@ const ExpenseRealizationForm = ({
|
|||||||
type='submit'
|
type='submit'
|
||||||
color='primary'
|
color='primary'
|
||||||
isLoading={formik.isSubmitting}
|
isLoading={formik.isSubmitting}
|
||||||
disabled={!formik.isValid || formik.isSubmitting}
|
disabled={formik.isSubmitting}
|
||||||
className='px-4'
|
className='px-4'
|
||||||
>
|
>
|
||||||
Submit
|
Submit
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ import { cn } from '@/lib/helper';
|
|||||||
import { TransferToLayingApi } from '@/services/api/production/transfer-to-laying';
|
import { TransferToLayingApi } from '@/services/api/production/transfer-to-laying';
|
||||||
import { ProjectFlock } from '@/types/api/production/project-flock';
|
import { ProjectFlock } from '@/types/api/production/project-flock';
|
||||||
import { TRANSFER_TO_LAYING_APPROVAL_LINE } from '@/config/approval-line';
|
import { TRANSFER_TO_LAYING_APPROVAL_LINE } from '@/config/approval-line';
|
||||||
|
import { useFormikErrorList } from '@/services/hooks/useFormikErrorList';
|
||||||
|
import AlertErrorList from '@/components/helper/form/FormErrors';
|
||||||
|
|
||||||
interface TransferToLayingFormProps {
|
interface TransferToLayingFormProps {
|
||||||
type?: 'add' | 'edit' | 'detail';
|
type?: 'add' | 'edit' | 'detail';
|
||||||
@@ -160,6 +162,7 @@ const TransferToLayingForm = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { setValues: formikSetValues, values: formikValues } = formik;
|
const { setValues: formikSetValues, values: formikValues } = formik;
|
||||||
|
const { formErrorList, close, handleFormSubmit } = useFormikErrorList(formik);
|
||||||
const {
|
const {
|
||||||
flockSourceKandangs: flockSourceKandangsValue,
|
flockSourceKandangs: flockSourceKandangsValue,
|
||||||
flockDestinationKandangs: flockDestinationKandangsValue,
|
flockDestinationKandangs: flockDestinationKandangsValue,
|
||||||
@@ -539,7 +542,7 @@ const TransferToLayingForm = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
onSubmit={formik.handleSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
onReset={formik.handleReset}
|
onReset={formik.handleReset}
|
||||||
className='w-full flex flex-col gap-6'
|
className='w-full flex flex-col gap-6'
|
||||||
>
|
>
|
||||||
@@ -777,6 +780,8 @@ const TransferToLayingForm = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<AlertErrorList formErrorList={formErrorList} onClose={close} />
|
||||||
|
|
||||||
{formErrorMessage && (
|
{formErrorMessage && (
|
||||||
<div role='alert' className='alert alert-error w-full'>
|
<div role='alert' className='alert alert-error w-full'>
|
||||||
<Icon
|
<Icon
|
||||||
@@ -852,7 +857,7 @@ const TransferToLayingForm = ({
|
|||||||
type='submit'
|
type='submit'
|
||||||
color='primary'
|
color='primary'
|
||||||
isLoading={formik.isSubmitting}
|
isLoading={formik.isSubmitting}
|
||||||
disabled={!formik.isValid || formik.isSubmitting}
|
disabled={formik.isSubmitting}
|
||||||
className='px-4'
|
className='px-4'
|
||||||
>
|
>
|
||||||
Submit
|
Submit
|
||||||
|
|||||||
Reference in New Issue
Block a user