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:
Marshal
2026-08-04 13:06:03 +00:00
parent d0040a6851
commit 8cf49aa1cc
6 changed files with 45 additions and 0 deletions

View File

@@ -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');

View File

@@ -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',

View File

@@ -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),

View File

@@ -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>