feat: migrate to new tsclass schema
This commit is contained in:
		
							
								
								
									
										24
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								package.json
									
									
									
									
									
								
							| @@ -22,28 +22,28 @@ | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "@design.estate/dees-catalog": "^1.4.1", | ||||
|     "@design.estate/dees-domtools": "^2.0.65", | ||||
|     "@design.estate/dees-domtools": "^2.3.2", | ||||
|     "@design.estate/dees-element": "^2.0.39", | ||||
|     "@design.estate/dees-wcctools": "^1.0.90", | ||||
|     "@git.zone/tsrun": "^1.3.3", | ||||
|     "@push.rocks/smartfile": "^11.0.21", | ||||
|     "@push.rocks/smartfile": "^11.2.0", | ||||
|     "@push.rocks/smartjson": "^5.0.20", | ||||
|     "@push.rocks/smartpath": "^5.0.18", | ||||
|     "@push.rocks/smartpdf": "^3.1.8", | ||||
|     "@push.rocks/smarttime": "^4.0.8", | ||||
|     "@tsclass/tsclass": "^4.4.3", | ||||
|     "@types/node": "^22.10.1", | ||||
|     "@push.rocks/smartpdf": "^3.2.2", | ||||
|     "@push.rocks/smarttime": "^4.1.1", | ||||
|     "@tsclass/tsclass": "^8.0.3", | ||||
|     "@types/node": "^22.13.13", | ||||
|     "@types/qrcode": "^1.5.5", | ||||
|     "puppeteer": "^24.3.0", | ||||
|     "puppeteer": "^24.4.0", | ||||
|     "qrcode": "^1.5.4" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@git.zone/tsbuild": "^2.2.0", | ||||
|     "@git.zone/tsbundle": "^2.1.0", | ||||
|     "@git.zone/tstest": "^1.0.90", | ||||
|     "@git.zone/tswatch": "^2.0.34", | ||||
|     "@git.zone/tsbuild": "^2.3.2", | ||||
|     "@git.zone/tsbundle": "^2.2.5", | ||||
|     "@git.zone/tstest": "^1.0.96", | ||||
|     "@git.zone/tswatch": "^2.1.0", | ||||
|     "@push.rocks/projectinfo": "^5.0.2", | ||||
|     "@push.rocks/tapbundle": "^5.5.3" | ||||
|     "@push.rocks/tapbundle": "^5.6.0" | ||||
|   }, | ||||
|   "files": [ | ||||
|     "ts/**/*", | ||||
|   | ||||
							
								
								
									
										4355
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4355
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										206
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										206
									
								
								test/test.ts
									
									
									
									
									
								
							| @@ -1,119 +1,107 @@ | ||||
| import * as plugins from './plugins.js'; | ||||
| import * as paths from './paths.js'; | ||||
| import * as interfaces from '../ts_shared/interfaces/index.js'; | ||||
| import { expect, tap } from '@push.rocks/tapbundle'; | ||||
| import * as deesDocumentServer from '../ts/index.js'; | ||||
| import * as plugins from "./plugins.js"; | ||||
| import * as paths from "./paths.js"; | ||||
| import * as interfaces from "../ts_shared/interfaces/index.js"; | ||||
| import { expect, tap } from "@push.rocks/tapbundle"; | ||||
| import * as deesDocumentServer from "../ts/index.js"; | ||||
|  | ||||
| let testPdfServiceInstance: deesDocumentServer.PdfService; | ||||
| const testLetterData: plugins.tsclass.business.ILetter = { | ||||
|   accentColor: null, | ||||
|   type: 'invoice', | ||||
| const testLetterData: plugins.tsclass.finance.TInvoice = { | ||||
|   type: "invoice", | ||||
|   invoiceType: "debitnote", | ||||
|   date: null, | ||||
|   needsCoverSheet: true, | ||||
|   objectActions: [], | ||||
|   pdf: null, | ||||
|   content: { | ||||
|     invoiceData: { | ||||
|       id: 'XX-CLIENT-48765', | ||||
|       reverseCharge: true, | ||||
|       dueInDays: 30, | ||||
|       currency: 'EUR', | ||||
|       notes: [], | ||||
|       type: 'debitnote', | ||||
|       billedBy: { | ||||
|         address: null, | ||||
|         description: null, | ||||
|         name: 'Some Service GmbH', | ||||
|         type: null, | ||||
|         customerNumber: null, | ||||
|         email: null, | ||||
|         facebookUrl: null, | ||||
|         fax: null, | ||||
|         legalEntity: null, | ||||
|         sepaConnection: { | ||||
|           bic: 'BPOTBEB1', | ||||
|           iban: 'BE72000000001616', | ||||
|         }, | ||||
|       }, | ||||
|       billedTo: null, | ||||
|       status: null, | ||||
|       deliveryDate: new Date().getTime(), | ||||
|       periodOfPerformance: null, | ||||
|       printResult: null, | ||||
|       items: [ | ||||
|         { | ||||
|           name: 'Website Creation', | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 1200, | ||||
|           unitType: 'item', | ||||
|           vatPercentage: 0, | ||||
|           position: 1, | ||||
|         }, | ||||
|       ], | ||||
|   id: "XX-CLIENT-48765", | ||||
|   invoiceId: "XX-CLIENT-48765", | ||||
|   reverseCharge: true, | ||||
|   dueInDays: 30, | ||||
|   currency: "EUR", | ||||
|   notes: [], | ||||
|   status: null, | ||||
|   deliveryDate: new Date().getTime(), | ||||
|   periodOfPerformance: null, | ||||
|   printResult: null, | ||||
|   items: [ | ||||
|     { | ||||
|       name: "Website Creation", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: "item", | ||||
|       vatPercentage: 0, | ||||
|       position: 1, | ||||
|     }, | ||||
|     contractData: { | ||||
|       contractDate: Date.now(), | ||||
|       id: 'LL-CONTRACT-48765', | ||||
|     }, | ||||
|     textData: [], | ||||
|     timesheetData: '', | ||||
|   }, | ||||
|   ], | ||||
|   from: { | ||||
|     name: 'PdfService Test Company', | ||||
|     type: 'company', | ||||
|     description: 'doing pdf stuff', | ||||
|     name: "PdfService Test Company", | ||||
|     type: "company", | ||||
|     status: "active", | ||||
|     foundedDate: { day: 1, month: 1, year: 2025 }, | ||||
|     description: "doing pdf stuff", | ||||
|     address: { | ||||
|       streetName: 'Awesome Street', | ||||
|       houseNumber: '5', | ||||
|       city: 'Bremen', | ||||
|       country: 'Germany', | ||||
|       postalCode: '28359', | ||||
|       streetName: "Awesome Street", | ||||
|       houseNumber: "5", | ||||
|       city: "Bremen", | ||||
|       country: "Germany", | ||||
|       postalCode: "28359", | ||||
|     }, | ||||
|     sepaConnection: { | ||||
|       bic: 'BPOTBEB1', | ||||
|       iban: 'BE72000000001616', | ||||
|       bic: "BPOTBEB1", | ||||
|       iban: "BE72000000001616", | ||||
|     }, | ||||
|     registrationDetails: { | ||||
|       vatId: "", | ||||
|       registrationName: "", | ||||
|       registrationId: "", | ||||
|     }, | ||||
|   }, | ||||
|   to: { | ||||
|     name: 'Awesome To Company', | ||||
|     type: 'company', | ||||
|     description: 'a company that does stuff', | ||||
|     name: "Awesome To Company", | ||||
|     type: "company", | ||||
|     status: "active", | ||||
|     foundedDate: { day: 1, month: 1, year: 2025 }, | ||||
|     description: "a company that does stuff", | ||||
|     address: { | ||||
|       streetName: 'Awesome Street', | ||||
|       houseNumber: '5', | ||||
|       city: 'Bremen', | ||||
|       country: 'Germany', | ||||
|       postalCode: '28359', | ||||
|       streetName: "Awesome Street", | ||||
|       houseNumber: "5", | ||||
|       city: "Bremen", | ||||
|       country: "Germany", | ||||
|       postalCode: "28359", | ||||
|     }, | ||||
|     registrationDetails: { | ||||
|       vatId: "", | ||||
|       registrationName: "", | ||||
|       registrationId: "", | ||||
|     }, | ||||
|   }, | ||||
|   incidenceId: null, | ||||
|   language: null, | ||||
|   legalContact: null, | ||||
|   logoUrl: null, | ||||
|   pdfAttachments: null, | ||||
|   subject: 'Invoice XX-CLIENT-48765', | ||||
|   subject: "Invoice XX-CLIENT-48765", | ||||
|   versionInfo: { | ||||
|     type: 'final', | ||||
|     version: '1.0.0', | ||||
|     type: "final", | ||||
|     version: "1.0.0", | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| tap.test('should create a document from an invoice', async () => { | ||||
| tap.test("should create a document from an invoice", async () => { | ||||
|   testPdfServiceInstance = new deesDocumentServer.PdfService({}); | ||||
|   await testPdfServiceInstance.start(); | ||||
|   expect(testPdfServiceInstance).toBeInstanceOf(deesDocumentServer.PdfService); | ||||
| }); | ||||
|  | ||||
| tap.test('should create an invoice', async () => { | ||||
| tap.test("should create an invoice", async () => { | ||||
|   let counter = 0; | ||||
|   const saveResult = async (optionsArg: { | ||||
|     letterData: plugins.tsclass.business.ILetter; | ||||
|     letterData: plugins.tsclass.finance.TInvoice; | ||||
|     documentSettings: interfaces.IDocumentSettings; | ||||
|   }) => { | ||||
|     const pdfResult = await testPdfServiceInstance.createPdfFromLetterObject(optionsArg); | ||||
|     const pdfResult = await testPdfServiceInstance.createPdfFromLetterObject( | ||||
|       optionsArg | ||||
|     ); | ||||
|     await plugins.smartfile.memory.toFs( | ||||
|       Buffer.from(pdfResult.buffer), | ||||
|       plugins.path.join(paths.nogitDir, `test-${counter++}.pdf`), | ||||
|       plugins.path.join(paths.nogitDir, `test-${counter++}.pdf`) | ||||
|     ); | ||||
|   }; | ||||
|   await saveResult({ | ||||
| @@ -124,106 +112,106 @@ tap.test('should create an invoice', async () => { | ||||
|     letterData: { | ||||
|       ...testLetterData, | ||||
|       versionInfo: { | ||||
|         type: 'draft', | ||||
|         version: '1.0.0', | ||||
|         type: "draft", | ||||
|         version: "1.0.0", | ||||
|       }, | ||||
|     }, | ||||
|     documentSettings: {}, | ||||
|   }); | ||||
|   (testLetterData.content.invoiceData.items = [ | ||||
|   (testLetterData.items = [ | ||||
|     { | ||||
|       name: 'Website Creation', | ||||
|       name: "Website Creation", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 0, | ||||
|       position: 1, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Hosting', | ||||
|       name: "Hosting", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 19, | ||||
|       position: 2, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Overnight Shipping', | ||||
|       name: "Overnight Shipping", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 24, | ||||
|       position: 3, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Website Creation', | ||||
|       name: "Website Creation", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 0, | ||||
|       position: 4, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Hosting', | ||||
|       name: "Hosting", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 19, | ||||
|       position: 5, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Overnight Shipping', | ||||
|       name: "Overnight Shipping", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 24, | ||||
|       position: 6, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Website Creation', | ||||
|       name: "Website Creation", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 0, | ||||
|       position: 7, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Hosting', | ||||
|       name: "Hosting", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 19, | ||||
|       position: 8, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Overnight Shipping', | ||||
|       name: "Overnight Shipping", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 24, | ||||
|       position: 9, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Website Creation', | ||||
|       name: "Website Creation", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 0, | ||||
|       position: 10, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Hosting', | ||||
|       name: "Hosting", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 19, | ||||
|       position: 11, | ||||
|     }, | ||||
|     { | ||||
|       name: 'Overnight Shipping', | ||||
|       name: "Overnight Shipping", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 1200, | ||||
|       unitType: 'item', | ||||
|       unitType: "item", | ||||
|       vatPercentage: 24, | ||||
|       position: 12, | ||||
|     }, | ||||
| @@ -234,7 +222,7 @@ tap.test('should create an invoice', async () => { | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| tap.test('should stop the service', async () => { | ||||
| tap.test("should stop the service", async () => { | ||||
|   await testPdfServiceInstance.stop(); | ||||
| }); | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import * as plugins from './plugins.js'; | ||||
| import * as helpers from './helpers.js'; | ||||
| import * as plugins from "./plugins.js"; | ||||
| import * as helpers from "./helpers.js"; | ||||
|  | ||||
| export interface IPdfServiceConstructorOptions {} | ||||
|  | ||||
| @@ -8,7 +8,9 @@ export interface IPdfServiceConstructorOptions {} | ||||
|  */ | ||||
| export class PdfService { | ||||
|   // STATIC | ||||
|   public static async createAndStart(optionsArg: IPdfServiceConstructorOptions) { | ||||
|   public static async createAndStart( | ||||
|     optionsArg: IPdfServiceConstructorOptions | ||||
|   ) { | ||||
|     const pdfService = new PdfService(optionsArg); | ||||
|     await pdfService.start(); | ||||
|     return pdfService; | ||||
| @@ -42,17 +44,23 @@ export class PdfService { | ||||
|    * creates an letter | ||||
|    */ | ||||
|   public async createPdfFromLetterObject(optionsArg: { | ||||
|     letterData: plugins.tsclass.business.ILetter; | ||||
|     letterData: plugins.tsclass.business.TLetter; | ||||
|     documentSettings: plugins.shared.interfaces.IDocumentSettings; | ||||
|   }) { | ||||
|   }): Promise<plugins.smartpdf.IPdf> { | ||||
|     const html = ` | ||||
|       <script type="module"> | ||||
|         ${await helpers.getBundleAsString()} | ||||
|       </script> | ||||
|       <dedocument-dedocument printMode documentSettings="${plugins.smartjson.stringifyBase64(optionsArg.documentSettings)}" letterData="${plugins.smartjson.stringifyBase64(optionsArg.letterData)}"></dedocument-dedocument> | ||||
|       <dedocument-dedocument printMode documentSettings="${plugins.smartjson.stringifyBase64( | ||||
|         optionsArg.documentSettings | ||||
|       )}" letterData="${plugins.smartjson.stringifyBase64( | ||||
|       optionsArg.letterData | ||||
|     )}"></dedocument-dedocument> | ||||
|     `; | ||||
|     // console.log(html); | ||||
|     const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString(html); | ||||
|     const pdfResult = await this.smartpdfInstance.getA4PdfResultForHtmlString( | ||||
|       html | ||||
|     ); | ||||
|     return pdfResult; | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -1,9 +1,11 @@ | ||||
| import * as plugins from "./plugins.js"; | ||||
| import * as interfaces from "./interfaces/index.js"; | ||||
|  | ||||
| const fromContact: plugins.tsclass.business.IContact = { | ||||
| const fromContact: plugins.tsclass.business.TContact = { | ||||
|   name: "Awesome From Company", | ||||
|   type: "company", | ||||
|   status: "active", | ||||
|   foundedDate: { day: 1, month: 1, year: 2025 }, | ||||
|   description: "a company that does stuff", | ||||
|   address: { | ||||
|     streetName: "Awesome Street", | ||||
| @@ -12,7 +14,6 @@ const fromContact: plugins.tsclass.business.IContact = { | ||||
|     country: "Germany", | ||||
|     postalCode: "28359", | ||||
|   }, | ||||
|   vatId: "DE12345678", | ||||
|   sepaConnection: { | ||||
|     bic: "BPOTBEB1", | ||||
|     iban: "BE01234567891616", | ||||
| @@ -20,11 +21,18 @@ const fromContact: plugins.tsclass.business.IContact = { | ||||
|   email: "hello@awesome.company", | ||||
|   phone: "+49 421 1234567", | ||||
|   fax: "+49 421 1234568", | ||||
|   registrationDetails: { | ||||
|     registrationId: "HRB 35230 HB", | ||||
|     registrationName: "Amtsgericht Bremen", | ||||
|     vatId: "DE12345678", | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| const toContact: plugins.tsclass.business.IContact = { | ||||
| const toContact: plugins.tsclass.business.TContact = { | ||||
|   name: "Awesome To GmbH", | ||||
|   type: "company", | ||||
|   status: "active", | ||||
|   foundedDate: { day: 1, month: 1, year: 2025 }, | ||||
|   customerNumber: "LL-CLIENT-123", | ||||
|   description: "a company that does stuff", | ||||
|   address: { | ||||
| @@ -34,217 +42,201 @@ const toContact: plugins.tsclass.business.IContact = { | ||||
|     country: "Germany", | ||||
|     postalCode: "28359", | ||||
|   }, | ||||
|   vatId: "BE12345678", | ||||
|   registrationDetails: { | ||||
|     registrationId: "HRB 35230 HB", | ||||
|     registrationName: "Amtsgericht Bremen", | ||||
|     vatId: "DE12345678", | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| export const demoLetter: plugins.tsclass.business.ILetter = { | ||||
|   versionInfo: { | ||||
|     type: "draft", | ||||
|     version: "1.0.0", | ||||
|   }, | ||||
|   accentColor: null, | ||||
|   content: { | ||||
|     textData: null, | ||||
|     timesheetData: null, | ||||
|     contractData: { | ||||
|       contractDate: Date.now(), | ||||
|       id: "someid", | ||||
|     }, | ||||
|     letterData: {} as plugins.tsclass.business.ILetter, | ||||
|     invoiceData: { | ||||
|       id: "LL-INV-48765", | ||||
|       reverseCharge: true, | ||||
|       dueInDays: 30, | ||||
|       billedBy: fromContact, | ||||
|       billedTo: toContact, | ||||
|       status: null, | ||||
|       deliveryDate: new Date().getTime(), | ||||
|       periodOfPerformance: { | ||||
|         from: +new Date().setDate(new Date().getDate() - 7), | ||||
|         to: +new Date(), | ||||
|       }, | ||||
|       printResult: null, | ||||
|       currency: "EUR", | ||||
|       notes: [], | ||||
|       type: "debitnote", | ||||
|       items: [ | ||||
|         { | ||||
|           name: "Item with 19% VAT", | ||||
|           unitQuantity: 2, | ||||
|           unitNetPrice: 100, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 19, | ||||
|           position: 0, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 7% VAT", | ||||
|           unitQuantity: 4, | ||||
|           unitNetPrice: 100, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 7, | ||||
|           position: 1, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 7% VAT", | ||||
|           unitQuantity: 3, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 7, | ||||
|           position: 2, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 21% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 21, | ||||
|           position: 3, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 6, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 4, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 19% VAT", | ||||
|           unitQuantity: 8, | ||||
|           unitNetPrice: 100, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 19, | ||||
|           position: 5, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 7% VAT", | ||||
|           unitQuantity: 9, | ||||
|           unitNetPrice: 100, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 7, | ||||
|           position: 6, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 7% VAT", | ||||
|           unitQuantity: 4, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 7, | ||||
|           position: 8, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 21% VAT", | ||||
|           unitQuantity: 3, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 21, | ||||
|           position: 9, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 10, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 11, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 12, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 13, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 14, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 15, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 16, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 17, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 18, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 19, | ||||
|         }, | ||||
|         { | ||||
|           name: "Item with 0% VAT", | ||||
|           unitQuantity: 1, | ||||
|           unitNetPrice: 230, | ||||
|           unitType: "hours", | ||||
|           vatPercentage: 0, | ||||
|           position: 20, | ||||
|         }, | ||||
|       ], | ||||
|     }, | ||||
|   }, | ||||
|  | ||||
|   date: Date.now(), | ||||
| export const demoLetter: plugins.tsclass.finance.TInvoice = { | ||||
|   type: "invoice", | ||||
|   needsCoverSheet: false, | ||||
|   objectActions: [], | ||||
|   pdf: null, | ||||
|   id: "LL-INV-48765", | ||||
|   versionInfo: { | ||||
|     version: "1.0.0", | ||||
|     type: "draft", | ||||
|   }, | ||||
|   language: "de", | ||||
|   date: Date.now(), | ||||
|   incidenceId: "LL-INV-48765", | ||||
|   invoiceId: "LL-INV-48765", | ||||
|   subject: "LL-INV-48765", | ||||
|   reverseCharge: true, | ||||
|   dueInDays: 30, | ||||
|   from: fromContact, | ||||
|   to: toContact, | ||||
|   incidenceId: null, | ||||
|   language: null, | ||||
|   legalContact: null, | ||||
|   logoUrl: null, | ||||
|   pdfAttachments: null, | ||||
|   subject: "Invoice: LL-INV-48765", | ||||
|   status: null, | ||||
|   deliveryDate: new Date().getTime(), | ||||
|   periodOfPerformance: { | ||||
|     from: +new Date().setDate(new Date().getDate() - 7), | ||||
|     to: +new Date(), | ||||
|   }, | ||||
|   printResult: null, | ||||
|   currency: "EUR", | ||||
|   notes: [], | ||||
|   invoiceType: "debitnote", | ||||
|   items: [ | ||||
|     { | ||||
|       name: "Item with 19% VAT", | ||||
|       unitQuantity: 2, | ||||
|       unitNetPrice: 100, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 19, | ||||
|       position: 0, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 7% VAT", | ||||
|       unitQuantity: 4, | ||||
|       unitNetPrice: 100, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 7, | ||||
|       position: 1, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 7% VAT", | ||||
|       unitQuantity: 3, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 7, | ||||
|       position: 2, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 21% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 21, | ||||
|       position: 3, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 6, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 4, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 19% VAT", | ||||
|       unitQuantity: 8, | ||||
|       unitNetPrice: 100, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 19, | ||||
|       position: 5, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 7% VAT", | ||||
|       unitQuantity: 9, | ||||
|       unitNetPrice: 100, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 7, | ||||
|       position: 6, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 7% VAT", | ||||
|       unitQuantity: 4, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 7, | ||||
|       position: 8, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 21% VAT", | ||||
|       unitQuantity: 3, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 21, | ||||
|       position: 9, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 10, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 11, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 12, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 13, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 14, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 15, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 16, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 17, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 18, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 19, | ||||
|     }, | ||||
|     { | ||||
|       name: "Item with 0% VAT", | ||||
|       unitQuantity: 1, | ||||
|       unitNetPrice: 230, | ||||
|       unitType: "hours", | ||||
|       vatPercentage: 0, | ||||
|       position: 20, | ||||
|     }, | ||||
|   ], | ||||
| }; | ||||
|  | ||||
| export const demoDocumentSettings: interfaces.IDocumentSettings = { | ||||
|   | ||||
| @@ -148,82 +148,10 @@ export const DE_translations: Dictionary = { | ||||
|   vat: "Umsatzsteuer", | ||||
| }; | ||||
|  | ||||
| // Define Spanish translations | ||||
| // export const ES_translations: TTranslationImplementation = { | ||||
| //   address: "Dirección", | ||||
| //   bankConnection: "Conexión bancaria", | ||||
| //   contactInfo: "Información de contacto", | ||||
| //   description: "Descripción", | ||||
| //   invoice: "Factura", | ||||
| //   itemPos: "Pos.", | ||||
| //   quantity: "Cantidad", | ||||
| //   registrationInfo: "Información de registro", | ||||
| //   reverseVatNote: | ||||
| //     "El IVA se aplica por inversión del sujeto pasivo y debe ser pagado por el cliente.", | ||||
| //   totalNetPrice: "Precio total neto", | ||||
| //   unitNetPrice: "Precio unitario neto", | ||||
| //   unitType: "Tipo de unidad", | ||||
| //   yourCustomerId: "Su número de cliente:", | ||||
| //   yourVatId: "Su ID de IVA:", | ||||
| //   continuesOnPage: "Continúa en la página", | ||||
| //   finalPageStatement: "Esta es la última página de este documento.", | ||||
| //   page: "Página", | ||||
| //   vatShort: "IVA", | ||||
| // }; | ||||
|  | ||||
| // Define French translations | ||||
| // export const FR_translations: TTranslationImplementation = { | ||||
| //   address: "Adresse", | ||||
| //   bankConnection: "Coordonnées bancaires", | ||||
| //   contactInfo: "Informations de contact", | ||||
| //   description: "Description", | ||||
| //   invoice: "Facture", | ||||
| //   itemPos: "Position", | ||||
| //   quantity: "Quantité", | ||||
| //   registrationInfo: "Informations d'enregistrement", | ||||
| //   reverseVatNote: | ||||
| //     "La TVA s'applique selon le mécanisme d'autoliquidation et est à payer par le client.", | ||||
| //   totalNetPrice: "Prix net total", | ||||
| //   unitNetPrice: "Prix unitaire net", | ||||
| //   unitType: "Type d'unité", | ||||
| //   yourCustomerId: "Votre numéro de client :", | ||||
| //   yourVatId: "Votre numéro de TVA :", | ||||
| //   continuesOnPage: "Continue sur la page", | ||||
| //   finalPageStatement: "Ceci est la dernière page de ce document.", | ||||
| //   page: "Page", | ||||
| //   vatShort: "TVA", | ||||
| // }; | ||||
|  | ||||
| // Define Italian translations | ||||
| // export const IT_translations: TTranslationImplementation = { | ||||
| //   address: "Indirizzo", | ||||
| //   bankConnection: "Coordinate bancarie", | ||||
| //   contactInfo: "Informazioni di contatto", | ||||
| //   description: "Descrizione", | ||||
| //   invoice: "Fattura", | ||||
| //   itemPos: "Pos.", | ||||
| //   quantity: "Quantità", | ||||
| //   registrationInfo: "Informazioni di registrazione", | ||||
| //   reverseVatNote: | ||||
| //     "L'IVA è applicata con inversione contabile ed è a carico del cliente.", | ||||
| //   totalNetPrice: "Prezzo netto totale", | ||||
| //   unitNetPrice: "Prezzo netto unitario", | ||||
| //   unitType: "Tipo di unità", | ||||
| //   yourCustomerId: "Il tuo numero cliente:", | ||||
| //   yourVatId: "Il tuo numero di partita IVA:", | ||||
| //   continuesOnPage: "Continua alla pagina", | ||||
| //   finalPageStatement: "Questa è l'ultima pagina di questo documento.", | ||||
| //   page: "Pagina", | ||||
| //   vatShort: "IVA", | ||||
| // }; | ||||
|  | ||||
| // Language Code Map | ||||
| export const languageCodeMap: Record<string, Dictionary> = { | ||||
|   EN: EN_translations, | ||||
|   DE: DE_translations, | ||||
|   // ES: ES_translations, | ||||
|   // FR: FR_translations, | ||||
|   // IT: IT_translations, | ||||
| }; | ||||
|  | ||||
| // Language Code Type | ||||
|   | ||||
| @@ -41,7 +41,7 @@ export class DeContentInvoice extends DeesElement { | ||||
|     type: Object, | ||||
|     reflect: true, | ||||
|   }) | ||||
|   public letterData: plugins.tsclass.business.ILetter; | ||||
|   public letterData: plugins.tsclass.finance.TInvoice; | ||||
|  | ||||
|   @property({ | ||||
|     type: Object, | ||||
| @@ -178,7 +178,7 @@ export class DeContentInvoice extends DeesElement { | ||||
|       return totalNet; | ||||
|     } | ||||
|  | ||||
|     for (const item of this.letterData.content.invoiceData.items) { | ||||
|     for (const item of this.letterData.items) { | ||||
|       totalNet += item.unitNetPrice * item.unitQuantity; | ||||
|     } | ||||
|     return totalNet; | ||||
| @@ -200,7 +200,7 @@ export class DeContentInvoice extends DeesElement { | ||||
|   public getVatGroups = () => { | ||||
|     const vatGroups: { | ||||
|       vatPercentage: number; | ||||
|       items: plugins.tsclass.finance.IInvoice["items"]; | ||||
|       items: plugins.tsclass.finance.TInvoice["items"]; | ||||
|       vatAmountSum: number; | ||||
|     }[] = []; | ||||
|  | ||||
| @@ -209,14 +209,14 @@ export class DeContentInvoice extends DeesElement { | ||||
|     } | ||||
|  | ||||
|     const taxAmounts: number[] = []; | ||||
|     for (const item of this.letterData.content.invoiceData.items) { | ||||
|     for (const item of this.letterData.items) { | ||||
|       taxAmounts.includes(item.vatPercentage) | ||||
|         ? null | ||||
|         : taxAmounts.push(item.vatPercentage); | ||||
|     } | ||||
|  | ||||
|     for (const taxAmount of taxAmounts) { | ||||
|       const matchingItems = this.letterData.content.invoiceData.items.filter( | ||||
|       const matchingItems = this.letterData.items.filter( | ||||
|         (itemArg) => itemArg.vatPercentage === taxAmount | ||||
|       ); | ||||
|       let sum = 0; | ||||
| @@ -324,7 +324,7 @@ export class DeContentInvoice extends DeesElement { | ||||
|             }).format( | ||||
|               new Date(this.letterData.date).setDate( | ||||
|                 new Date(this.letterData.date).getDate() + | ||||
|                   this.letterData?.content.invoiceData.dueInDays | ||||
|                   this.letterData?.dueInDays | ||||
|               ) | ||||
|             )} | ||||
|           </span> | ||||
| @@ -334,14 +334,12 @@ export class DeContentInvoice extends DeesElement { | ||||
|   } | ||||
|  | ||||
|   private renderPaymentInfo(): TemplateResult { | ||||
|     const bic = | ||||
|       this.letterData?.content.invoiceData.billedBy.sepaConnection.bic; | ||||
|     const name = this.letterData?.content.invoiceData.billedBy.name; | ||||
|     const iban = | ||||
|       this.letterData?.content.invoiceData.billedBy.sepaConnection.iban; | ||||
|     const currency = this.letterData?.content.invoiceData.currency; | ||||
|     const bic = this.letterData?.from.sepaConnection.bic; | ||||
|     const name = this.letterData?.from.name; | ||||
|     const iban = this.letterData?.from.sepaConnection.iban; | ||||
|     const currency = this.letterData?.currency; | ||||
|     const totalGross = this.getTotalGross(); | ||||
|     const reference = this.letterData?.content.invoiceData.id; | ||||
|     const reference = this.letterData?.id; | ||||
|  | ||||
|     return html`<div class="infoBox"> | ||||
|       <div> | ||||
| @@ -362,22 +360,23 @@ export class DeContentInvoice extends DeesElement { | ||||
|   } | ||||
|  | ||||
|   private renderReferencedContract(): TemplateResult { | ||||
|     return this.documentSettings.enableInvoiceContractRefSection && | ||||
|       this.letterData?.content?.contractData?.contractDate | ||||
|       ? html` | ||||
|           <div class="infoBox"> | ||||
|             <div class="label"> | ||||
|               ${this.translateKey("invoice@@referencedContract")} | ||||
|             </div> | ||||
|             ${this.translateKey("invoice@@referencedContract.text")} | ||||
|             ${new Intl.DateTimeFormat(this.documentSettings.languageCode, { | ||||
|               dateStyle: this.documentSettings.dateStyle, | ||||
|             }).format( | ||||
|               new Date(this.letterData?.content.contractData.contractDate) | ||||
|             )}. | ||||
|           </div> | ||||
|         ` | ||||
|       : null; | ||||
|     return null; | ||||
|     // return this.documentSettings.enableInvoiceContractRefSection && | ||||
|     //   this.invoiceData?.content?.contractData?.contractDate | ||||
|     //   ? html` | ||||
|     //       <div class="infoBox"> | ||||
|     //         <div class="label"> | ||||
|     //           ${this.translateKey("invoice@@referencedContract")} | ||||
|     //         </div> | ||||
|     //         ${this.translateKey("invoice@@referencedContract.text")} | ||||
|     //         ${new Intl.DateTimeFormat(this.documentSettings.languageCode, { | ||||
|     //           dateStyle: this.documentSettings.dateStyle, | ||||
|     //         }).format( | ||||
|     //           new Date(this.invoiceData?.content.contractData.contractDate) | ||||
|     //         )}. | ||||
|     //       </div> | ||||
|     //     ` | ||||
|     //   : null; | ||||
|   } | ||||
|  | ||||
|   public async attachInvoiceDom() { | ||||
| @@ -406,7 +405,7 @@ export class DeContentInvoice extends DeesElement { | ||||
|             ${this.translateKey("invoice@@price.total.net")} | ||||
|           </div> | ||||
|         </div> | ||||
|         ${this.letterData?.content.invoiceData?.items?.map( | ||||
|         ${this.letterData?.items?.map( | ||||
|           (invoiceItem, index) => html` | ||||
|             <div class="grid needsDataHeader"> | ||||
|               <div class="lineItem rightAlign">${index + 1}</div> | ||||
| @@ -438,10 +437,7 @@ export class DeContentInvoice extends DeesElement { | ||||
|           </div> | ||||
|           ${this.getVatGroups().map((vatGroupArg) => { | ||||
|             let itemNumbers = vatGroupArg.items | ||||
|               .map( | ||||
|                 (item) => | ||||
|                   this.letterData.content.invoiceData.items.indexOf(item) + 1 | ||||
|               ) | ||||
|               .map((item) => this.letterData.items.indexOf(item) + 1) | ||||
|               .join(", "); | ||||
|             return html` | ||||
|               <div class="sumline"> | ||||
| @@ -472,7 +468,7 @@ export class DeContentInvoice extends DeesElement { | ||||
|         </div> | ||||
|         <div class="divider"></div> | ||||
|  | ||||
|         ${this.letterData?.content.invoiceData.reverseCharge | ||||
|         ${this.letterData?.reverseCharge | ||||
|           ? html`<div class="taxNote"> | ||||
|               ${this.translateKey("invoice@@vat.reverseCharge.note")} | ||||
|             </div>` | ||||
|   | ||||
| @@ -26,6 +26,7 @@ import { DeContentInvoice } from "./contentinvoice.js"; | ||||
|  | ||||
| import { demoFunc } from "./document.demo.js"; | ||||
| import { dedocumentSharedStyle } from "../style.js"; | ||||
| import type { TInvoice } from "@tsclass/tsclass/dist_ts/finance/invoice.js"; | ||||
|  | ||||
| declare global { | ||||
|   interface HTMLElementTagNameMap { | ||||
| @@ -72,7 +73,7 @@ export class DeDocument extends DeesElement { | ||||
|       } | ||||
|     }, | ||||
|   }) | ||||
|   public letterData: plugins.tsclass.business.ILetter; | ||||
|   public letterData: plugins.tsclass.business.TLetter; | ||||
|  | ||||
|   @property({ | ||||
|     type: Object, | ||||
| @@ -136,7 +137,7 @@ export class DeDocument extends DeesElement { | ||||
|  | ||||
|   public latestDocumentSettings: plugins.shared.interfaces.IDocumentSettings = | ||||
|     null; | ||||
|   public latestRenderedLetterData: plugins.tsclass.business.ILetter = null; | ||||
|   public latestRenderedLetterData: plugins.tsclass.business.TLetter = null; | ||||
|   public cleanupStore: any[] = []; | ||||
|  | ||||
|   public async renderDocument() { | ||||
| @@ -158,7 +159,7 @@ export class DeDocument extends DeesElement { | ||||
|     // lets append the content | ||||
|     const content: DeContentInvoice = new DeContentInvoice(); | ||||
|     cleanUpStoreCurrentRender.push(content); | ||||
|     content.letterData = this.letterData; | ||||
|     content.letterData = this.letterData as unknown as TInvoice; | ||||
|     content.documentSettings = this.documentSettings; | ||||
|     document.body.appendChild(content); | ||||
|  | ||||
|   | ||||
| @@ -31,7 +31,7 @@ export class DeLetterHeader extends DeesElement { | ||||
|     type: Object, | ||||
|     reflect: true, | ||||
|   }) | ||||
|   public letterData: plugins.tsclass.business.ILetter; | ||||
|   public letterData: plugins.tsclass.finance.TInvoice; | ||||
|  | ||||
|   @property({ | ||||
|     type: Number, | ||||
| @@ -171,7 +171,7 @@ export class DeLetterHeader extends DeesElement { | ||||
|             "letterhead@@vat.yourId" | ||||
|           )} | ||||
|         </div> | ||||
|         ${this.letterData.to.vatId || "not provided"} | ||||
|         ${this.letterData.to.registrationDetails.vatId || "not provided"} | ||||
|  | ||||
|         <!-- TODO: Make use of components --> | ||||
|         ${this.letterData.type === "invoice" | ||||
| @@ -181,15 +181,11 @@ export class DeLetterHeader extends DeesElement { | ||||
|                   "letterhead@@invoice.number" | ||||
|                 )} | ||||
|               </div> | ||||
|               ${this.letterData.content.invoiceData.id || "not registered"}` | ||||
|               ${this.letterData.id || "not registered"}` | ||||
|           : null} | ||||
|         ${this.renderDeliveryDate( | ||||
|           new Date( | ||||
|             this.letterData.content?.invoiceData?.periodOfPerformance?.from | ||||
|           ), | ||||
|           new Date( | ||||
|             this.letterData.content?.invoiceData?.periodOfPerformance?.to | ||||
|           ) | ||||
|           new Date(this.letterData.periodOfPerformance?.from), | ||||
|           new Date(this.letterData.periodOfPerformance?.to) | ||||
|         )} | ||||
|       </div> | ||||
|     `; | ||||
|   | ||||
| @@ -53,7 +53,7 @@ export class DePage extends DeesElement { | ||||
|   @property({ | ||||
|     type: Object, | ||||
|   }) | ||||
|   public letterData: tsclass.business.ILetter = null; | ||||
|   public letterData: tsclass.business.TLetter = null; | ||||
|  | ||||
|   @property({ | ||||
|     type: Boolean, | ||||
|   | ||||
| @@ -28,7 +28,7 @@ export class DePageContent extends DeesElement { | ||||
|   @property({ | ||||
|     type: Number, | ||||
|   }) | ||||
|   public letterData: plugins.tsclass.business.ILetter; | ||||
|   public letterData: plugins.tsclass.business.TLetter; | ||||
|  | ||||
|   @property({ | ||||
|     type: Number, | ||||
|   | ||||
| @@ -27,7 +27,7 @@ export class DePageFooter extends DeesElement { | ||||
|   @property({ | ||||
|     type: Object, | ||||
|   }) | ||||
|   letterData: plugins.tsclass.business.ILetter; | ||||
|   letterData: plugins.tsclass.business.TLetter; | ||||
|  | ||||
|   @property({ | ||||
|     type: Object, | ||||
| @@ -119,17 +119,20 @@ export class DePageFooter extends DeesElement { | ||||
|           ${this.letterData.from.address.city}<br /> | ||||
|           ${this.letterData.from.address.country} | ||||
|         </div> | ||||
|         <div> | ||||
|           <strong | ||||
|             >${plugins.shared.translation.translate( | ||||
|               this.documentSettings.languageCode, | ||||
|               "footer@@registration.label" | ||||
|             )}:</strong | ||||
|           ><br /> | ||||
|           Amtsgericht Bremen<br /> | ||||
|           <i>reg-#:</i> HRB 35230 HB<br /> | ||||
|           <i>vat-id:</i> ${this.letterData.from.vatId} | ||||
|         </div> | ||||
|         ${this.letterData.from.registrationDetails | ||||
|           ? html` <div> | ||||
|               <strong | ||||
|                 >${plugins.shared.translation.translate( | ||||
|                   this.documentSettings.languageCode, | ||||
|                   "footer@@registration.label" | ||||
|                 )}:</strong | ||||
|               ><br /> | ||||
|               ${this.letterData.from.registrationDetails.registrationName}<br /> | ||||
|               <i>reg-#:</i> ${this.letterData.from.registrationDetails | ||||
|                 .registrationId}<br /> | ||||
|               <i>vat-id:</i> ${this.letterData.from.registrationDetails.vatId} | ||||
|             </div>` | ||||
|           : null} | ||||
|         <div> | ||||
|           <strong | ||||
|             >${plugins.shared.translation.translate( | ||||
|   | ||||
| @@ -28,7 +28,7 @@ export class DePageHeader extends DeesElement { | ||||
|   @property({ | ||||
|     type: Object, | ||||
|   }) | ||||
|   public letterData: plugins.tsclass.business.ILetter = null; | ||||
|   public letterData: plugins.tsclass.business.TLetter = null; | ||||
|  | ||||
|   @property({ | ||||
|     type: Object, | ||||
|   | ||||
| @@ -26,7 +26,7 @@ export class DeDocumentViewer extends DeesElement { | ||||
|     type: Object, | ||||
|     reflect: true, | ||||
|   }) | ||||
|   public letterData: plugins.tsclass.business.ILetter = null; | ||||
|   public letterData: plugins.tsclass.business.TLetter = null; | ||||
|  | ||||
|   @property({ | ||||
|     type: Object, | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import * as plugins from '../plugins.js'; | ||||
| import { html } from '@design.estate/dees-element'; | ||||
| import * as plugins from "../plugins.js"; | ||||
| import { html } from "@design.estate/dees-element"; | ||||
|  | ||||
| export const page1 = () => html` | ||||
|   <style> | ||||
| @@ -7,11 +7,15 @@ export const page1 = () => html` | ||||
|       margin: 16px; | ||||
|     } | ||||
|   </style> | ||||
|   <dedocument-dedocument .printMode=${false} letterData=${plugins.smartjson.stringifyBase64({ | ||||
|   <dedocument-dedocument | ||||
|     .printMode=${false} | ||||
|     letterData=${plugins.smartjson.stringifyBase64({ | ||||
|       ...plugins.shared.demoLetter, | ||||
|       from: { | ||||
|         ...plugins.shared.demoLetter.from, | ||||
|         description: 'a string set via stringified JSON' | ||||
|       } | ||||
|     } as plugins.tsclass.business.ILetter)}> </dedocument-dedocument> | ||||
|         description: "a string set via stringified JSON", | ||||
|       }, | ||||
|     } as plugins.tsclass.finance.TInvoice)} | ||||
|   > | ||||
|   </dedocument-dedocument> | ||||
| `; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user