Skip to content

Commit 757c086

Browse files
committed
Billing account: add default form value
1 parent f08061f commit 757c086

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/apps/admin/src/billing-account/BillingAccountNewPage/BillingAccountNewPage.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,18 @@ export const BillingAccountNewPage: FC<Props> = (props: Props) => {
6767
formState: { errors, isDirty },
6868
}: UseFormReturn<FormEditBillingAccount> = useForm({
6969
defaultValues: {
70+
budgetAmount: '' as any,
71+
client: undefined,
72+
companyId: '' as any,
73+
description: '',
74+
endDate: undefined,
75+
name: '',
76+
paymentTerms: '' as any,
77+
poNumber: '',
7078
salesTax: 0,
79+
startDate: undefined,
7180
status: 'Active',
81+
subscriptionNumber: '' as any,
7282
},
7383
mode: 'all',
7484
resolver: yupResolver(formEditBillingAccountSchema),

src/apps/admin/src/billing-account/BillingAccountResourceNewPage/BillingAccountResourceNewPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const BillingAccountResourceNewPage: FC<Props> = (props: Props) => {
5353
control,
5454
handleSubmit,
5555
register,
56-
formState: { errors },
56+
formState: { errors, isDirty },
5757
setValue,
5858
}: UseFormReturn<FormNewBillingAccountResource> = useForm({
5959
defaultValues: {
@@ -158,7 +158,7 @@ export const BillingAccountResourceNewPage: FC<Props> = (props: Props) => {
158158
primary
159159
size='lg'
160160
type='submit'
161-
disabled={isAdding || isLoading}
161+
disabled={isAdding || isLoading || !isDirty}
162162
>
163163
Save Changes
164164
</Button>

src/apps/admin/src/billing-account/ClientEditPage/ClientEditPage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ export const ClientEditPage: FC<Props> = (props: Props) => {
6565
reset,
6666
}: UseFormReturn<FormEditClient> = useForm({
6767
defaultValues: {
68+
codeName: '',
69+
endDate: undefined,
70+
name: '',
71+
startDate: undefined,
6872
status: 'Active',
6973
},
7074
mode: 'all',
@@ -163,7 +167,7 @@ export const ClientEditPage: FC<Props> = (props: Props) => {
163167
onChange={_.noop}
164168
classNameWrapper={styles.field}
165169
inputControl={register('codeName')}
166-
error={_.get(errors, 'name.message')}
170+
error={_.get(errors, 'codeName.message')}
167171
dirty
168172
disabled={isAdding || isUpdating}
169173
/>

0 commit comments

Comments
 (0)