feat: wip UI upload attachments

This commit is contained in:
Ahmed Bouhuolia
2024-05-28 23:34:51 +02:00
parent fcd61c6159
commit cfdbcea9c0
49 changed files with 286 additions and 67 deletions

View File

@@ -29,7 +29,8 @@ export class GetBill {
.withGraphFetched('vendor')
.withGraphFetched('entries.item')
.withGraphFetched('branch')
.withGraphFetched('taxes.taxRate');
.withGraphFetched('taxes.taxRate')
.withGraphFetched('attachments');
// Validates the bill existance.
this.validators.validateBillExistance(bill);

View File

@@ -1,5 +1,6 @@
import { IBill } from '@/interfaces';
import { Transformer } from '@/lib/Transformer/Transformer';
import { AttachmentTransformer } from '@/services/Attachments/AttachmentTransformer';
import { ItemEntryTransformer } from '@/services/Sales/Invoices/ItemEntryTransformer';
import { SaleInvoiceTaxEntryTransformer } from '@/services/Sales/Invoices/SaleInvoiceTaxEntryTransformer';
import { formatNumber } from 'utils';
@@ -26,6 +27,7 @@ export class PurchaseInvoiceTransformer extends Transformer {
'totalLocalFormatted',
'taxes',
'entries',
'attachments',
];
};
@@ -192,4 +194,13 @@ export class PurchaseInvoiceTransformer extends Transformer {
currencyCode: bill.currencyCode,
});
};
/**
* Retrieves the bill attachments.
* @param {ISaleInvoice} invoice
* @returns
*/
protected attachments = (bill) => {
return this.item(bill.attachments, new AttachmentTransformer());
};
}