import {
DeesElement,
property,
html,
customElement,
type TemplateResult,
css,
cssManager,
unsafeCSS,
domtools,
} from '@design.estate/dees-element';
import * as plugins from '../plugins.js';
import { dedocumentSharedStyle } from '../style.js';
declare global {
interface HTMLElementTagNameMap {
'dedocument-letterheader': DeLetterHeader;
}
}
@customElement('dedocument-letterheader')
export class DeLetterHeader extends DeesElement {
public static demo = () => html`
`;
@property({
type: Object,
reflect: true
})
public letterData: plugins.tsclass.business.ILetter;
@property({
type: Number,
reflect: true,
})
public pageNumber: number = 1;
@property({
type: Number,
reflect: true,
})
public pageTotalNumber: number = 1;
constructor() {
super();
domtools.DomTools.setupDomTools();
}
public static styles = [
domtools.elementBasic.staticStyles,
dedocumentSharedStyle,
css`
:host {
color: #333;
}
.recepientInfo {
position: absolute;
display: block;
overflow: hidden;
top: 200px;
right: ${unsafeCSS(plugins.shared.rightMargin + 'px')};
width: 200px;
text-align: right;
}
.recepientInfo .label {
margin-top: 10px;
margin-bottom: 3px;
font-size: 10px;
font-weight: bold;
}
.date {
position: absolute;
top: 180px;
right: ${unsafeCSS(plugins.shared.rightMargin + 'px')};
text-align: right;
}
.address {
position: absolute;
top: 180px;
left: ${unsafeCSS(plugins.shared.leftMargin + 'px')};
}
.address .from {
font-size: 10px;
}
.address .to {
margin-top: 10px;
}
`,
];
public render(): TemplateResult {
return html`
${new Date(this.letterData.date).getDate()}. ${new Date(this.letterData.date).toLocaleString('default', { month: 'long' })}
${new Date(this.letterData.date).getFullYear()}
${this.letterData.from.name}, ${this.letterData.from.address.streetName}
${this.letterData.from.address.houseNumber}, ${this.letterData.from.address.postalCode}
${this.letterData.from.address.city}, ${this.letterData.from.address.country}
${this.letterData.to.name}
${this.letterData.to.address.streetName} ${this.letterData.to.address.houseNumber}
${this.letterData.to.address.postalCode} ${this.letterData.to.address.city}
${this.letterData.from.address.country}
your customer id:
${this.letterData.to.customerNumber || 'not registered'}
your vat id on file:
${this.letterData.to.vatId || 'not provided'}
`;
}
}