fix: refund credit notes

This commit is contained in:
Ahmed Bouhuolia
2026-01-01 17:03:27 +02:00
parent a91a7c612f
commit ead4fc9b97
6 changed files with 102 additions and 56 deletions

View File

@@ -31,6 +31,9 @@ import {
FeatureCan,
FInputGroup,
FMoneyInputGroup,
FDateInput,
FFormGroup,
FTextArea,
} from '@/components';
import {
inputIntent,
@@ -66,16 +69,13 @@ function RefundCreditNoteFormFields({
<FeatureCan feature={Features.Branches}>
<Row>
<Col xs={5}>
<FormGroup
label={<T id={'branch'} />}
className={classNames('form-group--select-list', Classes.FILL)}
>
<FFormGroup name={'branch_id'} label={<T id={'branch'} />}>
<BranchSelect
name={'branch_id'}
branches={branches}
popoverProps={{ minimal: true }}
/>
</FormGroup>
</FFormGroup>
</Col>
</Row>
<BranchRowDivider />
@@ -84,29 +84,23 @@ function RefundCreditNoteFormFields({
<Row>
<Col xs={5}>
{/* ------------- Refund date ------------- */}
<FastField name={'date'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FFormGroup
name={'date'}
label={<T id={'refund_credit_note.dialog.refund_date'} />}
labelInfo={<FieldRequiredHint />}
fill
>
<DateInput
{...momentFormatter('YYYY/MM/DD')}
value={tansformDateValue(value)}
onChange={handleDateChange((formattedDate) => {
form.setFieldValue('date', formattedDate);
})}
popoverProps={{ position: Position.BOTTOM, minimal: true }}
inputProps={{
leftIcon: <Icon icon={'date-range'} />,
}}
/>
</FFormGroup>
)}
</FastField>
<FFormGroup
name={'date'}
label={<T id={'refund_credit_note.dialog.refund_date'} />}
labelInfo={<FieldRequiredHint />}
fill
>
<FDateInput
name={'date'}
{...momentFormatter('YYYY/MM/DD')}
popoverProps={{ position: Position.BOTTOM, minimal: true }}
inputProps={{
leftIcon: <Icon icon={'date-range'} />,
}}
/>
</FFormGroup>
</Col>
<Col xs={5}>
{/* ------------ Form account ------------ */}
<FFormGroup
@@ -114,6 +108,7 @@ function RefundCreditNoteFormFields({
label={<T id={'refund_credit_note.dialog.from_account'} />}
labelInfo={<FieldRequiredHint />}
fill
fastField
>
<FAccountsSuggestField
name={'from_account_id'}
@@ -126,6 +121,7 @@ function RefundCreditNoteFormFields({
ACCOUNT_TYPE.CASH,
ACCOUNT_TYPE.FIXED_ASSET,
]}
fastField
/>
</FFormGroup>
</Col>
@@ -137,6 +133,7 @@ function RefundCreditNoteFormFields({
label={<T id={'refund_credit_note.dialog.amount'} />}
labelInfo={<FieldRequiredHint />}
fill
fastField
>
<ControlGroup>
<InputPrependText text={values.currency_code} />
@@ -144,6 +141,7 @@ function RefundCreditNoteFormFields({
name={'amount'}
minimal={true}
inputRef={(ref) => (amountFieldRef.current = ref)}
/>
</ControlGroup>
</FFormGroup>
@@ -161,21 +159,19 @@ function RefundCreditNoteFormFields({
</If>
{/* ------------ Reference No. ------------ */}
<FFormGroup name={'reference_no'} label={<T id={'reference_no'} />} fill>
<FFormGroup name={'reference_no'} label={<T id={'reference_no'} />} fill fastField>
<FInputGroup name={'reference_no'} minimal fill />
</FFormGroup>
{/* --------- Statement --------- */}
<FastField name={'description'}>
{({ form, field, meta: { error, touched } }) => (
<FormGroup
label={<T id={'refund_credit_note.dialog.description'} />}
className={'form-group--description'}
>
<TextArea growVertically={true} {...field} />
</FormGroup>
)}
</FastField>
<FFormGroup
name={'description'}
label={<T id={'refund_credit_note.dialog.description'} />}
fill
fastField
>
<FTextArea name={'description'} growVertically fill fastField />
</FFormGroup>
</div>
);
}
@@ -183,7 +179,12 @@ function RefundCreditNoteFormFields({
export default compose(withCurrentOrganization())(RefundCreditNoteFormFields);
export const BranchRowDivider = styled.div`
--x-divider-color: #ebf1f6;
.bp4-dark & {
--x-divider-color: rgba(255, 255, 255, 0.1);
}
height: 1px;
background: #ebf1f6;
background: var(--x-divider-color);
margin-bottom: 13px;
`;

View File

@@ -19,7 +19,6 @@ import {
FormattedMessage as T,
ExchangeRateMutedField,
BranchSelect,
BranchSelectButton,
FeatureCan,
FFormGroup,
FDateInput,
@@ -57,7 +56,6 @@ function RefundVendorCreditFormFields({
<BranchSelect
name={'branch_id'}
branches={branches}
input={BranchSelectButton}
popoverProps={{ minimal: true }}
/>
</FFormGroup>
@@ -154,8 +152,8 @@ function RefundVendorCreditFormFields({
</FFormGroup>
{/* --------- Statement --------- */}
<FFormGroup name={'description'} fill fastField>
<FTextArea name={'description'} growVertically={true} fastField />
<FFormGroup name={'description'} label={<T id={'refund_vendor_credit.dialog.description'} />} fill fastField>
<FTextArea name={'description'} growVertically fill fastField />
</FFormGroup>
</div>
);
@@ -164,7 +162,12 @@ function RefundVendorCreditFormFields({
export default compose(withCurrentOrganization())(RefundVendorCreditFormFields);
export const BranchRowDivider = styled.div`
--x-divider-color: #ebf1f6;
.bp4-dark & {
--x-divider-color: rgba(255, 255, 255, 0.1);
}
height: 1px;
background: #ebf1f6;
background: var(--x-divider-color);
margin-bottom: 13px;
`;