mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat: wip UI upload attachments
This commit is contained in:
@@ -78,7 +78,7 @@ export class EditManualJournal {
|
||||
|
||||
return {
|
||||
id: oldManualJournal.id,
|
||||
...omit(manualJournalDTO, ['publish']),
|
||||
...omit(manualJournalDTO, ['publish', 'attachments']),
|
||||
...(manualJournalDTO.publish && !oldManualJournal.publishedAt
|
||||
? { publishedAt: moment().toMySqlDateTime() }
|
||||
: {}),
|
||||
@@ -143,6 +143,7 @@ export class EditManualJournal {
|
||||
tenantId,
|
||||
manualJournal,
|
||||
oldManualJournal,
|
||||
manualJournalDTO,
|
||||
trx,
|
||||
} as IManualJournalEventEditedPayload);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export class GetManualJournal {
|
||||
.withGraphFetched('entries.contact')
|
||||
.withGraphFetched('entries.branch')
|
||||
.withGraphFetched('transactions')
|
||||
.withGraphFetched('media')
|
||||
.withGraphFetched('attachments')
|
||||
.throwIfNotFound();
|
||||
|
||||
return this.transformer.transform(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { IManualJournal } from '@/interfaces';
|
||||
import { Transformer } from '@/lib/Transformer/Transformer';
|
||||
import { formatNumber } from 'utils';
|
||||
import { AttachmentTransformer } from '../Attachments/AttachmentTransformer';
|
||||
|
||||
export class ManualJournalTransfromer extends Transformer {
|
||||
/**
|
||||
@@ -8,7 +9,12 @@ export class ManualJournalTransfromer extends Transformer {
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['formattedAmount', 'formattedDate', 'formattedPublishedAt'];
|
||||
return [
|
||||
'formattedAmount',
|
||||
'formattedDate',
|
||||
'formattedPublishedAt',
|
||||
'attachments',
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -39,4 +45,13 @@ export class ManualJournalTransfromer extends Transformer {
|
||||
protected formattedPublishedAt = (manualJorunal: IManualJournal): string => {
|
||||
return this.formatDate(manualJorunal.publishedAt);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the manual journal attachments.
|
||||
* @param {ISaleInvoice} invoice
|
||||
* @returns
|
||||
*/
|
||||
protected attachments = (manualJorunal: IManualJournal) => {
|
||||
return this.item(manualJorunal.attachments, new AttachmentTransformer());
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user