Merge pull request #908 from bigcapitalhq/feature/20260121133953

fix: bill response with entries
This commit is contained in:
Ahmed Bouhuolia
2026-01-21 13:40:53 +02:00
committed by GitHub
5 changed files with 40 additions and 55 deletions

View File

@@ -51,6 +51,7 @@ export class Bill extends TenantBaseModel {
public updatedAt: Date | null; public updatedAt: Date | null;
public entries?: ItemEntry[]; public entries?: ItemEntry[];
public attachments!: Document[];
public locatedLandedCosts?: BillLandedCost[]; public locatedLandedCosts?: BillLandedCost[];
/** /**
* Timestamps columns. * Timestamps columns.
@@ -633,7 +634,7 @@ export class Bill extends TenantBaseModel {
return this.query(trx) return this.query(trx)
.where('id', billId) .where('id', billId)
[changeMethod]('payment_amount', Math.abs(amount)); [changeMethod]('payment_amount', Math.abs(amount));
} }
/** /**

View File

@@ -1,5 +1,7 @@
import { Transformer } from '@/modules/Transformer/Transformer'; import { Transformer } from '@/modules/Transformer/Transformer';
import { Bill } from '../models/Bill'; import { Bill } from '../models/Bill';
import { ItemEntryTransformer } from '@/modules/TransactionItemEntry/ItemEntry.transformer';
import { AttachmentTransformer } from '@/modules/Attachments/Attachment.transformer';
export class BillTransformer extends Transformer { export class BillTransformer extends Transformer {
/** /**
@@ -231,20 +233,18 @@ export class BillTransformer extends Transformer {
/** /**
* Retrieves the entries of the bill. * Retrieves the entries of the bill.
* @param {Bill} credit * @param {Bill} credit
* @returns {}
*/ */
// protected entries = (bill: Bill) => { protected entries = (bill: Bill) => {
// return this.item(bill.entries, new ItemEntryTransformer(), { return this.item(bill.entries, new ItemEntryTransformer(), {
// currencyCode: bill.currencyCode, currencyCode: bill.currencyCode,
// }); });
// }; };
/** /**
* Retrieves the bill attachments. * Retrieves the bill attachments.
* @param {ISaleInvoice} invoice * @param {Bill} bill
* @returns
*/ */
// protected attachments = (bill: Bill) => { protected attachments = (bill: Bill) => {
// return this.item(bill.attachments, new AttachmentTransformer()); return this.item(bill.attachments, new AttachmentTransformer());
// }; };
} }

View File

@@ -13,9 +13,8 @@ export class UpdateOrganizationService {
private readonly tenancyContext: TenancyContext, private readonly tenancyContext: TenancyContext,
private readonly eventEmitter: EventEmitter2, private readonly eventEmitter: EventEmitter2,
private readonly commandOrganizationValidators: CommandOrganizationValidators, private readonly commandOrganizationValidators: CommandOrganizationValidators,
private readonly tenantRepository: TenantRepository, private readonly tenantRepository: TenantRepository,
) {} ) { }
/** /**
* Updates organization information. * Updates organization information.

View File

@@ -1,18 +0,0 @@
.root{
padding: 20px;
}
.footer{
margin-top: 2rem;
}
.resourceFormGroup{
max-width: 280px;
}
.paragraph{
color: #5F6B7C;
margin-bottom: 1.2rem;
}

View File

@@ -2,8 +2,8 @@
import { FFormGroup, FRadioGroup, FSelect, Group } from '@/components'; import { FFormGroup, FRadioGroup, FSelect, Group } from '@/components';
import { Button, Intent, Radio } from '@blueprintjs/core'; import { Button, Intent, Radio } from '@blueprintjs/core';
import { Form, useFormikContext } from 'formik'; import { Form, useFormikContext } from 'formik';
import { x } from '@xstyled/emotion';
import { ExportResources } from './constants'; import { ExportResources } from './constants';
import styles from './ExportDialogContent.module.scss';
import { compose } from '@/utils'; import { compose } from '@/utils';
import { withDialogActions } from '@/containers/Dialog/withDialogActions'; import { withDialogActions } from '@/containers/Dialog/withDialogActions';
import { DialogsName } from '@/constants/dialogs'; import { DialogsName } from '@/constants/dialogs';
@@ -19,21 +19,22 @@ function ExportDialogFormContentRoot({
return ( return (
<Form> <Form>
<div className={styles.root}> <x.div p="20px">
<p className={styles.paragraph}> <x.p className="bp4-text-muted" mb="1.2rem">
You can export data from Bigcapital in CSV or XLSX format You can export data from Bigcapital in CSV or XLSX format
</p> </x.p>
<FFormGroup <FFormGroup
name={'resource'} name={'resource'}
label={'Select Resource'} label={'Select Resource'}
className={styles.resourceFormGroup}
> >
<FSelect <x.div maxWidth="280px">
name={'resource'} <FSelect
items={ExportResources} name={'resource'}
popoverProps={{ minimal: true }} items={ExportResources}
/> popoverProps={{ minimal: true }}
/>
</x.div>
</FFormGroup> </FFormGroup>
<FRadioGroup label={'Export As'} name={'format'}> <FRadioGroup label={'Export As'} name={'format'}>
@@ -41,19 +42,21 @@ function ExportDialogFormContentRoot({
<Radio value={'csv'}>CSV (Comma Seperated Value)</Radio> <Radio value={'csv'}>CSV (Comma Seperated Value)</Radio>
</FRadioGroup> </FRadioGroup>
<Group position={'right'} spacing={10} className={styles.footer}> <x.div mt="1.6rem">
<Button intent={Intent.NONE} onClick={handleCancelBtnClick}> <Group position={'right'} spacing={10}>
Cancel <Button intent={Intent.NONE} onClick={handleCancelBtnClick}>
</Button> Cancel
<Button </Button>
type={'submit'} <Button
intent={Intent.PRIMARY} type={'submit'}
loading={isSubmitting} intent={Intent.PRIMARY}
> loading={isSubmitting}
Export >
</Button> Export
</Group> </Button>
</div> </Group>
</x.div>
</x.div>
</Form> </Form>
); );
} }