feat: migrate to new tsclass schema

This commit is contained in:
2025-03-26 14:51:14 +00:00
parent 04e668ff83
commit df4c782fbb
15 changed files with 2531 additions and 2696 deletions

View File

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

View File

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