mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 18:48:11 +00:00
enhance contract document rendering with detailed cargo information
- Updated ContractDocumentViewModelBuilder to include cargoTypeName, containerType, and cargoSummary in the schedule. - Modified contract dynamic template tests to validate the new cargo fields. - Enhanced contract renderer service tests to reflect changes in cargo data structure. - Updated contract view model interface to include new cargo-related fields. - Improved dynamic template rendering to display cargo type and container type. - Refactored exchange settings controller and service to streamline error handling and feed status management. - Introduced article HTML conversion functions to support Quill editor integration for structured article editing. - Added tests for article HTML conversion to ensure correct round-trip processing of clauses and bullets.
This commit is contained in:
@@ -90,6 +90,8 @@ describe('dynamic template rendering (edr-dynamic.hbs)', () => {
|
||||
template: { ...meta, title: 'Bulk Import Contract', templateFile: 'edr-dynamic.hbs' },
|
||||
contractDate: '1 January 2026',
|
||||
contractYear: 2026,
|
||||
contractStartDate: '1 January 2026',
|
||||
contractEndDate: '31 December 2026',
|
||||
client: {
|
||||
companyName: 'Abyssinia Trading PLC',
|
||||
companyAddress: 'Bole Sub-city, Addis Ababa',
|
||||
@@ -195,6 +197,24 @@ describe('dynamic template rendering (edr-dynamic.hbs)', () => {
|
||||
expect(html).toContain('#1b9e7a');
|
||||
});
|
||||
|
||||
it('shows the contract validity window in the commercial schedule annex', () => {
|
||||
const html = renderer.render(dynamicView());
|
||||
expect(html).toContain('Valid from');
|
||||
expect(html).toContain('Valid until');
|
||||
expect(html).toContain('1 January 2026');
|
||||
expect(html).toContain('31 December 2026');
|
||||
});
|
||||
|
||||
it('interpolates the start/end date placeholders inside article text', () => {
|
||||
const view = dynamicView();
|
||||
expect(
|
||||
interpolateTemplateText(
|
||||
'In force {{contractStartDate}} to {{contractEndDate}}.',
|
||||
view,
|
||||
),
|
||||
).toBe('In force 1 January 2026 to 31 December 2026.');
|
||||
});
|
||||
|
||||
it('shows cargo type and container type in the commercial schedule annex', () => {
|
||||
const html = renderer.render(dynamicView());
|
||||
expect(html).toContain('Cargo type');
|
||||
|
||||
@@ -16,6 +16,8 @@ describe('ContractRendererService', () => {
|
||||
template,
|
||||
contractDate: '1 January 2026',
|
||||
contractYear: 2026,
|
||||
contractStartDate: '1 January 2026',
|
||||
contractEndDate: '31 December 2026',
|
||||
client: {
|
||||
companyName: 'Test Co',
|
||||
companyAddress: 'Addis Ababa',
|
||||
|
||||
@@ -150,6 +150,8 @@ export class ContractViewModelBuilder {
|
||||
year: 'numeric',
|
||||
}),
|
||||
contractYear: new Date().getFullYear(),
|
||||
contractStartDate: this.formatDate(booking.contractValidFrom),
|
||||
contractEndDate: this.formatDate(booking.contractValidUntil),
|
||||
client: {
|
||||
companyName: booking.company?.name ?? 'Client',
|
||||
companyAddress: this.valueOrDash(booking.company?.address),
|
||||
|
||||
@@ -143,6 +143,12 @@
|
||||
<th>Payment currency</th>
|
||||
<td>{{paymentArticle}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Valid from</th>
|
||||
<td>{{contractStartDate}}</td>
|
||||
<th>Valid until</th>
|
||||
<td>{{contractEndDate}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user