@progressive-development/pd-contact 0.9.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -2
- package/README.md +29 -56
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/pd-contact/PdContact.d.ts +39 -24
- package/dist/pd-contact/PdContact.d.ts.map +1 -1
- package/dist/pd-contact/PdContact.js +521 -71
- package/dist/pd-contact/pd-contact-edit.stories.d.ts +51 -16
- package/dist/pd-contact/pd-contact-edit.stories.d.ts.map +1 -1
- package/dist/pd-contact/pd-contact-view.stories.d.ts +53 -11
- package/dist/pd-contact/pd-contact-view.stories.d.ts.map +1 -1
- package/dist/pd-page/dist/pd-socialmedia/PdSocialmedia.js +426 -0
- package/dist/pd-page/dist/pd-socialmedia/pd-socialmedia-model.js +240 -0
- package/dist/pd-page/dist/pd-socialmedia.js +7 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { LitElement, css, html } from 'lit';
|
|
1
|
+
import { LitElement, css, html, nothing } from 'lit';
|
|
2
2
|
import { property, state, query } from 'lit/decorators.js';
|
|
3
3
|
import { msg, str } from '@lit/localize';
|
|
4
4
|
import '@progressive-development/pd-icon/pd-icon';
|
|
5
|
+
import '../pd-page/dist/pd-socialmedia.js';
|
|
5
6
|
import '@progressive-development/pd-forms/pd-checkbox';
|
|
6
7
|
import '@progressive-development/pd-forms/pd-form-container';
|
|
7
8
|
import '@progressive-development/pd-forms/pd-form-row';
|
|
@@ -59,6 +60,8 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
59
60
|
this.addressTitle = msg("Adresse", { id: "pd.contact.address.title" });
|
|
60
61
|
this.phoneMailLink = false;
|
|
61
62
|
this.summary = false;
|
|
63
|
+
this.viewType = "detail";
|
|
64
|
+
this.cardLayout = "auto";
|
|
62
65
|
this.withPropertyDate = false;
|
|
63
66
|
this.requiredFields = [];
|
|
64
67
|
this.inputFields = [];
|
|
@@ -132,6 +135,329 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
132
135
|
.link-item:hover {
|
|
133
136
|
color: var(--pd-default-font-link-col-hover, #451a46);
|
|
134
137
|
}
|
|
138
|
+
|
|
139
|
+
/* ========================================
|
|
140
|
+
DETAIL VIEW STYLES
|
|
141
|
+
======================================== */
|
|
142
|
+
|
|
143
|
+
.detail-view {
|
|
144
|
+
display: flex;
|
|
145
|
+
flex-direction: column;
|
|
146
|
+
gap: var(--pd-spacing-md, 1rem);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.detail-names {
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
gap: var(--pd-spacing-xs, 0.25rem);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.detail-title {
|
|
156
|
+
margin: 0;
|
|
157
|
+
font-family: var(--pd-default-font-title-family, inherit);
|
|
158
|
+
font-size: 1.25rem;
|
|
159
|
+
font-weight: 700;
|
|
160
|
+
color: var(--pd-default-font-title-col, #0a3a48);
|
|
161
|
+
line-height: 1.3;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.detail-company,
|
|
165
|
+
.detail-vat {
|
|
166
|
+
margin: 0;
|
|
167
|
+
color: var(--pd-default-font-content-col, #353738);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.detail-name {
|
|
171
|
+
margin: 0;
|
|
172
|
+
color: var(--pd-default-font-muted-col, #6b7280);
|
|
173
|
+
font-weight: 300;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.detail-address {
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
gap: var(--pd-spacing-xs, 0.25rem);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.detail-address p {
|
|
183
|
+
margin: 0;
|
|
184
|
+
color: var(--pd-default-font-content-col, #353738);
|
|
185
|
+
line-height: 1.5;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.detail-contact-info {
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
gap: var(--pd-spacing-sm, 0.5rem);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.detail-bank {
|
|
195
|
+
display: flex;
|
|
196
|
+
flex-direction: column;
|
|
197
|
+
gap: var(--pd-spacing-xs, 0.25rem);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.detail-bank p {
|
|
201
|
+
margin: 0;
|
|
202
|
+
color: var(--pd-default-font-content-col, #353738);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.detail-label {
|
|
206
|
+
font-weight: 700;
|
|
207
|
+
color: var(--pd-default-font-title-col, #0a3a48) !important;
|
|
208
|
+
padding-top: var(--pd-spacing-sm, 0.5rem);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.detail-divider {
|
|
212
|
+
border: none;
|
|
213
|
+
border-top: 1px solid var(--pd-default-disabled-light-col, #e0e0e0);
|
|
214
|
+
margin: var(--pd-spacing-sm, 0.5rem) 0;
|
|
215
|
+
opacity: 0.5;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* ========================================
|
|
219
|
+
CARD VIEW STYLES
|
|
220
|
+
======================================== */
|
|
221
|
+
|
|
222
|
+
.card-wrapper {
|
|
223
|
+
container-type: inline-size;
|
|
224
|
+
container-name: contact-card;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.card {
|
|
228
|
+
display: grid;
|
|
229
|
+
background: var(
|
|
230
|
+
--pd-contact-card-bg,
|
|
231
|
+
var(--pd-default-bg-col, #fefefe)
|
|
232
|
+
);
|
|
233
|
+
border-radius: var(--pd-contact-card-radius, var(--pd-radius-lg, 8px));
|
|
234
|
+
box-shadow: var(
|
|
235
|
+
--pd-contact-card-shadow,
|
|
236
|
+
var(--pd-shadow-xl, 0 8px 16px rgba(0, 0, 0, 0.15))
|
|
237
|
+
);
|
|
238
|
+
padding: var(--pd-contact-card-padding, 2rem);
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.card-content {
|
|
243
|
+
display: flex;
|
|
244
|
+
flex-direction: column;
|
|
245
|
+
gap: var(--pd-spacing-md, 1rem);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.card-logo {
|
|
249
|
+
display: flex;
|
|
250
|
+
align-items: center;
|
|
251
|
+
justify-content: center;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.card-logo img {
|
|
255
|
+
max-width: 100%;
|
|
256
|
+
max-height: 100%;
|
|
257
|
+
object-fit: contain;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.card-names {
|
|
261
|
+
display: flex;
|
|
262
|
+
flex-direction: column;
|
|
263
|
+
gap: var(--pd-spacing-xs, 0.25rem);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.title-name {
|
|
267
|
+
margin: 0;
|
|
268
|
+
font-family: var(--pd-default-font-title-family, inherit);
|
|
269
|
+
color: var(
|
|
270
|
+
--pd-contact-card-title-col,
|
|
271
|
+
var(--pd-default-font-title-col, #0a3a48)
|
|
272
|
+
);
|
|
273
|
+
font-weight: 700;
|
|
274
|
+
line-height: 1.2;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.real-name {
|
|
278
|
+
margin: 0;
|
|
279
|
+
font-family: var(--pd-default-font-content-family, inherit);
|
|
280
|
+
color: var(
|
|
281
|
+
--pd-contact-card-subtitle-col,
|
|
282
|
+
var(--pd-default-font-muted-col, #6b7280)
|
|
283
|
+
);
|
|
284
|
+
font-weight: 300;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.card-contact-info {
|
|
288
|
+
display: flex;
|
|
289
|
+
flex-direction: column;
|
|
290
|
+
gap: var(--pd-spacing-sm, 0.5rem);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.contact-item {
|
|
294
|
+
display: flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
gap: var(--pd-spacing-sm, 0.5rem);
|
|
297
|
+
text-decoration: none;
|
|
298
|
+
color: var(--pd-default-font-content-col, #353738);
|
|
299
|
+
font-size: var(--pd-default-font-content-size, 1rem);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.contact-item:hover {
|
|
303
|
+
color: var(--pd-default-font-link-col-hover, #ffc857);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.contact-icon {
|
|
307
|
+
--pd-icon-size: 16px;
|
|
308
|
+
--pd-icon-col: var(
|
|
309
|
+
--pd-contact-icon-col,
|
|
310
|
+
var(--pd-default-col, #067394)
|
|
311
|
+
);
|
|
312
|
+
flex-shrink: 0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.card-divider {
|
|
316
|
+
border: none;
|
|
317
|
+
border-top: 1px solid
|
|
318
|
+
var(
|
|
319
|
+
--pd-contact-card-divider-col,
|
|
320
|
+
var(--pd-default-disabled-light-col, #e0e0e0)
|
|
321
|
+
);
|
|
322
|
+
margin: var(--pd-spacing-sm, 0.5rem) 0;
|
|
323
|
+
opacity: 0.5;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/* VERTICAL LAYOUT (default for narrow containers) */
|
|
327
|
+
@container contact-card (max-width: 499px) {
|
|
328
|
+
.card:not(.layout-horizontal) {
|
|
329
|
+
grid-template-rows: auto 1fr;
|
|
330
|
+
grid-template-columns: 1fr;
|
|
331
|
+
text-align: center;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.card:not(.layout-horizontal) .card-logo {
|
|
335
|
+
width: 100%;
|
|
336
|
+
max-height: 150px;
|
|
337
|
+
padding-bottom: var(--pd-spacing-md, 1rem);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.card:not(.layout-horizontal) .card-names {
|
|
341
|
+
align-items: center;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.card:not(.layout-horizontal) .title-name {
|
|
345
|
+
font-size: 1.25rem;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.card:not(.layout-horizontal) .real-name {
|
|
349
|
+
font-size: 0.9rem;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.card:not(.layout-horizontal) .card-contact-info {
|
|
353
|
+
align-items: center;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.card:not(.layout-horizontal) .contact-item {
|
|
357
|
+
justify-content: center;
|
|
358
|
+
font-size: 0.85rem;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.card:not(.layout-horizontal) pd-socialmedia {
|
|
362
|
+
display: flex;
|
|
363
|
+
justify-content: center;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/* HORIZONTAL LAYOUT (for wider containers) */
|
|
368
|
+
@container contact-card (min-width: 500px) {
|
|
369
|
+
.card:not(.layout-vertical) {
|
|
370
|
+
grid-template-columns: 1fr minmax(120px, 200px);
|
|
371
|
+
grid-template-rows: 1fr;
|
|
372
|
+
align-items: start;
|
|
373
|
+
gap: var(--pd-spacing-md, 1rem);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.card:not(.layout-vertical) .card-logo {
|
|
377
|
+
order: 2;
|
|
378
|
+
width: 100%;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.card:not(.layout-vertical) .card-content {
|
|
382
|
+
order: 1;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.card:not(.layout-vertical) .title-name {
|
|
386
|
+
font-size: 1.5rem;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.card:not(.layout-vertical) .real-name {
|
|
390
|
+
font-size: 1rem;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.card:not(.layout-vertical) .contact-item {
|
|
394
|
+
font-size: 0.9rem;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/* FORCED HORIZONTAL LAYOUT */
|
|
399
|
+
.card.layout-horizontal {
|
|
400
|
+
grid-template-columns: 1fr minmax(120px, 200px) !important;
|
|
401
|
+
grid-template-rows: 1fr !important;
|
|
402
|
+
text-align: left !important;
|
|
403
|
+
align-items: start !important;
|
|
404
|
+
gap: var(--pd-spacing-md, 1rem) !important;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.card.layout-horizontal .card-logo {
|
|
408
|
+
order: 2 !important;
|
|
409
|
+
width: 100% !important;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.card.layout-horizontal .card-content {
|
|
413
|
+
order: 1 !important;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.card.layout-horizontal .title-name {
|
|
417
|
+
font-size: 1.5rem;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.card.layout-horizontal .real-name {
|
|
421
|
+
font-size: 1rem;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/* FORCED VERTICAL LAYOUT */
|
|
425
|
+
.card.layout-vertical {
|
|
426
|
+
grid-template-rows: auto 1fr !important;
|
|
427
|
+
grid-template-columns: 1fr !important;
|
|
428
|
+
text-align: center !important;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.card.layout-vertical .card-logo {
|
|
432
|
+
width: 100% !important;
|
|
433
|
+
max-height: 150px !important;
|
|
434
|
+
padding-bottom: var(--pd-spacing-md, 1rem);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.card.layout-vertical .card-names {
|
|
438
|
+
align-items: center !important;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.card.layout-vertical .card-contact-info {
|
|
442
|
+
align-items: center !important;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.card.layout-vertical .contact-item {
|
|
446
|
+
justify-content: center;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.card.layout-vertical pd-socialmedia {
|
|
450
|
+
display: flex;
|
|
451
|
+
justify-content: center;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.card.layout-vertical .title-name {
|
|
455
|
+
font-size: 1.25rem;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.card.layout-vertical .real-name {
|
|
459
|
+
font-size: 0.9rem;
|
|
460
|
+
}
|
|
135
461
|
`
|
|
136
462
|
];
|
|
137
463
|
}
|
|
@@ -143,7 +469,7 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
143
469
|
render() {
|
|
144
470
|
return html`
|
|
145
471
|
<div class="contact">
|
|
146
|
-
${this.summary ? this._renderViewContact() : this._renderEditContact()}
|
|
472
|
+
${this.viewType === "card" && this.summary ? this._renderCardView() : this.summary ? this._renderViewContact() : this._renderEditContact()}
|
|
147
473
|
</div>
|
|
148
474
|
`;
|
|
149
475
|
}
|
|
@@ -154,7 +480,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
154
480
|
<pd-form-row>
|
|
155
481
|
<pd-radio-group
|
|
156
482
|
id="contactTypeRadioId"
|
|
157
|
-
class="quarter3"
|
|
158
483
|
label="${msg("Typ", { id: "pd.contact.label.type" })}"
|
|
159
484
|
required
|
|
160
485
|
initValue="${this._getRadioValue()}"
|
|
@@ -185,7 +510,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
185
510
|
<pd-form-row class="contact-form">
|
|
186
511
|
<pd-input
|
|
187
512
|
id="compNameId"
|
|
188
|
-
class="quarter3"
|
|
189
513
|
label="${msg("Name des Unternehmen", {
|
|
190
514
|
id: "pd.contact.label.company"
|
|
191
515
|
})}"
|
|
@@ -200,7 +524,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
200
524
|
<pd-form-row class="contact-form">
|
|
201
525
|
<pd-input
|
|
202
526
|
id="vatId"
|
|
203
|
-
class="quarter3"
|
|
204
527
|
label="${msg("USt-IdNr.", {
|
|
205
528
|
id: "pd.contact.label.btw"
|
|
206
529
|
})}"
|
|
@@ -217,7 +540,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
217
540
|
<pd-form-row class="contact-form">
|
|
218
541
|
<pd-input
|
|
219
542
|
id="firstNameId"
|
|
220
|
-
class="quarter3"
|
|
221
543
|
label="${msg("Vorname", {
|
|
222
544
|
id: "pd.contact.label.firstName"
|
|
223
545
|
})}"
|
|
@@ -232,7 +554,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
232
554
|
<pd-form-row class="contact-form">
|
|
233
555
|
<pd-input
|
|
234
556
|
id="lastNameId"
|
|
235
|
-
class="quarter3"
|
|
236
557
|
label="${msg("Nachname", {
|
|
237
558
|
id: "pd.contact.label.lastName"
|
|
238
559
|
})}"
|
|
@@ -248,7 +569,7 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
248
569
|
<pd-form-row class="contact-form">
|
|
249
570
|
<pd-input
|
|
250
571
|
id="streetId"
|
|
251
|
-
|
|
572
|
+
span="three-quarters"
|
|
252
573
|
label="${msg("Strasse", { id: "pd.contact.label.street" })}"
|
|
253
574
|
valueName="street"
|
|
254
575
|
initValue="${this.contact?.street || ""}"
|
|
@@ -257,7 +578,7 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
257
578
|
></pd-input>
|
|
258
579
|
<pd-input
|
|
259
580
|
id="streetNrId"
|
|
260
|
-
|
|
581
|
+
span="quarter"
|
|
261
582
|
label="${msg("Nr.", { id: "pd.contact.label.streetNr" })}"
|
|
262
583
|
valueName="streetNr"
|
|
263
584
|
initValue="${this.contact?.streetNr || ""}"
|
|
@@ -271,7 +592,7 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
271
592
|
<pd-input
|
|
272
593
|
readonly
|
|
273
594
|
id="zipId"
|
|
274
|
-
|
|
595
|
+
span="third"
|
|
275
596
|
label="${msg("PLZ", { id: "pd.contact.label.zip" })}"
|
|
276
597
|
valueName="zip"
|
|
277
598
|
initValue="${this.match.zip}"
|
|
@@ -279,7 +600,7 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
279
600
|
` : html`
|
|
280
601
|
<pd-input
|
|
281
602
|
id="zipId"
|
|
282
|
-
|
|
603
|
+
span="third"
|
|
283
604
|
label="${msg("PLZ", { id: "pd.contact.label.zip" })}"
|
|
284
605
|
fieldType="number"
|
|
285
606
|
valueName="zip"
|
|
@@ -290,7 +611,7 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
290
611
|
`}
|
|
291
612
|
<pd-input
|
|
292
613
|
id="cityId"
|
|
293
|
-
|
|
614
|
+
span="two-thirds"
|
|
294
615
|
label="${msg("Ort", { id: "pd.contact.label.city" })}"
|
|
295
616
|
valueName="city"
|
|
296
617
|
initValue="${this.contact?.city || ""}"
|
|
@@ -302,7 +623,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
302
623
|
${this.inputFields.length === 0 || this._showInput(C_ADDITIONAL) ? html`
|
|
303
624
|
<pd-form-row class="contact-form">
|
|
304
625
|
<pd-input
|
|
305
|
-
class="quarter3"
|
|
306
626
|
id="additionalHintId"
|
|
307
627
|
label="${msg("Addresszusatz", {
|
|
308
628
|
id: "pd.contact.label.additional"
|
|
@@ -316,7 +636,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
316
636
|
${this.withPropertyDate ? html`
|
|
317
637
|
<pd-form-row class="contact-form">
|
|
318
638
|
<pd-select
|
|
319
|
-
class="quarter3"
|
|
320
639
|
id="propertyDateId"
|
|
321
640
|
label="${msg("Datum der Immobilie", {
|
|
322
641
|
id: "pd.contact.label.propertyDate"
|
|
@@ -331,7 +650,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
331
650
|
<pd-form-row class="contact-form">
|
|
332
651
|
<pd-input
|
|
333
652
|
id="phoneId"
|
|
334
|
-
class="quarter3"
|
|
335
653
|
label="${msg("Telefon", { id: "pd.contact.label.phone" })}"
|
|
336
654
|
name="phone"
|
|
337
655
|
valueName="phone1"
|
|
@@ -346,7 +664,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
346
664
|
<pd-form-row class="contact-form">
|
|
347
665
|
<pd-input
|
|
348
666
|
id="mailId"
|
|
349
|
-
class="quarter3"
|
|
350
667
|
label="${msg("E-mail", { id: "pd.contact.label.email" })}"
|
|
351
668
|
fieldType="mail"
|
|
352
669
|
valueName="email"
|
|
@@ -369,66 +686,195 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
369
686
|
if (!this.contact) return html`<p>Contact undefined</p>`;
|
|
370
687
|
const trPhoneNr = transformPhone(
|
|
371
688
|
this.contact.phone1 || "",
|
|
372
|
-
this.contact.country || "
|
|
689
|
+
this.contact.country || "de"
|
|
373
690
|
);
|
|
691
|
+
const displayTitle = this.contact.titleName || this.addressTitle;
|
|
374
692
|
return html`
|
|
375
|
-
<
|
|
376
|
-
<
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
${this.
|
|
693
|
+
<div class="detail-view">
|
|
694
|
+
<div class="detail-names">
|
|
695
|
+
${displayTitle ? html`<h3 class="detail-title">${displayTitle}</h3>` : nothing}
|
|
696
|
+
${this.contact.companyName ? html`<p class="detail-company">${this.contact.companyName}</p>` : nothing}
|
|
697
|
+
${this.contact.vatNr ? html`<p class="detail-vat">${this.contact.vatNr}</p>` : nothing}
|
|
698
|
+
${this._getFullName() && this._getFullName() !== displayTitle ? html`<p class="detail-name">${this._getFullName()}</p>` : nothing}
|
|
699
|
+
</div>
|
|
700
|
+
|
|
701
|
+
<div class="detail-address">
|
|
702
|
+
${this._getFullStreet() ? html`<p>${this._getFullStreet()}</p>` : nothing}
|
|
703
|
+
${this._getFullLocation() ? html`<p>${this._getFullLocation()}</p>` : nothing}
|
|
704
|
+
${this.contact.additionalHint ? html`<p>${this.contact.additionalHint}</p>` : nothing}
|
|
705
|
+
${this.contact.country ? html`<p>${this.contact.country}</p>` : nothing}
|
|
706
|
+
${this.contact.propertyDate ? html`<p>
|
|
385
707
|
${msg(str`Baujahr: ${this.contact.propertyDate}`, {
|
|
386
708
|
id: "pd.contact.label.summary.propertyDate"
|
|
387
709
|
})}
|
|
388
|
-
</
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
710
|
+
</p>` : nothing}
|
|
711
|
+
</div>
|
|
712
|
+
|
|
713
|
+
<div class="detail-contact-info">
|
|
714
|
+
${this.contact.phone1 ? html`
|
|
715
|
+
<a
|
|
716
|
+
href="tel:${trPhoneNr || this.contact.phone1}"
|
|
717
|
+
class="contact-item"
|
|
718
|
+
aria-label="Phone: ${this.contact.phone1}"
|
|
719
|
+
>
|
|
720
|
+
<pd-icon icon="phoneIcon" class="contact-icon"></pd-icon>
|
|
721
|
+
<span>${this.contact.phone1}</span>
|
|
722
|
+
</a>
|
|
723
|
+
` : nothing}
|
|
724
|
+
${this.contact.email ? html`
|
|
725
|
+
<a
|
|
726
|
+
href="mailto:${this.contact.email}"
|
|
727
|
+
class="contact-item"
|
|
728
|
+
aria-label="Email: ${this.contact.email}"
|
|
729
|
+
>
|
|
730
|
+
<pd-icon icon="mailIcon" class="contact-icon"></pd-icon>
|
|
731
|
+
<span>${this.contact.email}</span>
|
|
732
|
+
</a>
|
|
733
|
+
` : nothing}
|
|
734
|
+
${this.contact.website ? html`
|
|
735
|
+
<a
|
|
736
|
+
href="${this._ensureHttps(this.contact.website)}"
|
|
737
|
+
target="_blank"
|
|
738
|
+
rel="noopener noreferrer"
|
|
739
|
+
class="contact-item"
|
|
740
|
+
aria-label="Website: ${this.contact.website}"
|
|
741
|
+
>
|
|
742
|
+
<pd-icon icon="circleIcon" class="contact-icon"></pd-icon>
|
|
743
|
+
<span
|
|
744
|
+
>${this._formatWebsiteDisplay(this.contact.website)}</span
|
|
745
|
+
>
|
|
746
|
+
</a>
|
|
747
|
+
` : nothing}
|
|
748
|
+
</div>
|
|
749
|
+
|
|
750
|
+
${this.contact.btw || this.contact.kbc ? html`
|
|
751
|
+
<div class="detail-bank">
|
|
752
|
+
${this.contact.btw ? html`
|
|
753
|
+
<p class="detail-label">BTW</p>
|
|
754
|
+
<p>${this.contact.btw}</p>
|
|
755
|
+
` : nothing}
|
|
756
|
+
${this.contact.kbc ? html`
|
|
757
|
+
<p class="detail-label">Bankgegevens</p>
|
|
758
|
+
<p>${this.contact.kbc}</p>
|
|
759
|
+
${this.contact.bank ? html`<p>${this.contact.bank}</p>` : nothing}
|
|
760
|
+
` : nothing}
|
|
761
|
+
</div>
|
|
762
|
+
` : nothing}
|
|
763
|
+
${this.contact.socialMedia && this.contact.socialMedia.length > 0 ? html`
|
|
764
|
+
<hr class="detail-divider" />
|
|
765
|
+
<pd-socialmedia
|
|
766
|
+
summary
|
|
767
|
+
.initItems="${this.contact.socialMedia}"
|
|
768
|
+
></pd-socialmedia>
|
|
769
|
+
` : nothing}
|
|
770
|
+
</div>
|
|
771
|
+
`;
|
|
772
|
+
}
|
|
773
|
+
// ========================================
|
|
774
|
+
// CARD VIEW RENDER METHODS
|
|
775
|
+
// ========================================
|
|
776
|
+
_renderCardView() {
|
|
777
|
+
if (!this.contact) return html`<p>Contact undefined</p>`;
|
|
778
|
+
const layoutClass = this.cardLayout !== "auto" ? `layout-${this.cardLayout}` : "";
|
|
779
|
+
return html`
|
|
780
|
+
<div class="card-wrapper" part="card-wrapper">
|
|
781
|
+
<div class="card ${layoutClass}">
|
|
782
|
+
${this._renderCardLogo()}
|
|
783
|
+
<div class="card-content">
|
|
784
|
+
${this._renderCardNames()} ${this._renderCardContactInfo()}
|
|
785
|
+
${this._hasCardContactInfo() ? this._renderCardDivider() : nothing}
|
|
786
|
+
${this._renderCardSocialMedia()}
|
|
787
|
+
</div>
|
|
788
|
+
</div>
|
|
789
|
+
</div>
|
|
430
790
|
`;
|
|
431
791
|
}
|
|
792
|
+
_renderCardLogo() {
|
|
793
|
+
if (!this.contact?.logo) return nothing;
|
|
794
|
+
return html`
|
|
795
|
+
<div class="card-logo">
|
|
796
|
+
<img
|
|
797
|
+
src="${this.contact.logo}"
|
|
798
|
+
alt="${this.contact.titleName || "Logo"}"
|
|
799
|
+
/>
|
|
800
|
+
</div>
|
|
801
|
+
`;
|
|
802
|
+
}
|
|
803
|
+
_renderCardNames() {
|
|
804
|
+
const titleName = this.contact?.titleName;
|
|
805
|
+
const fullName = this._getFullName();
|
|
806
|
+
return html`
|
|
807
|
+
<div class="card-names">
|
|
808
|
+
${titleName ? html`<h2 class="title-name">${titleName}</h2>` : nothing}
|
|
809
|
+
${fullName ? html`<p class="real-name">${fullName}</p>` : nothing}
|
|
810
|
+
</div>
|
|
811
|
+
`;
|
|
812
|
+
}
|
|
813
|
+
_renderCardContactInfo() {
|
|
814
|
+
const phone = this.contact?.phone1;
|
|
815
|
+
const email = this.contact?.email;
|
|
816
|
+
const website = this.contact?.website;
|
|
817
|
+
const trPhoneNr = phone ? transformPhone(phone, this.contact?.country || "de") : "";
|
|
818
|
+
return html`
|
|
819
|
+
<div class="card-contact-info">
|
|
820
|
+
${phone ? html`
|
|
821
|
+
<a
|
|
822
|
+
href="tel:${trPhoneNr || phone}"
|
|
823
|
+
class="contact-item"
|
|
824
|
+
aria-label="Phone: ${phone}"
|
|
825
|
+
>
|
|
826
|
+
<pd-icon icon="phoneIcon" class="contact-icon"></pd-icon>
|
|
827
|
+
<span>${phone}</span>
|
|
828
|
+
</a>
|
|
829
|
+
` : nothing}
|
|
830
|
+
${email ? html`
|
|
831
|
+
<a
|
|
832
|
+
href="mailto:${email}"
|
|
833
|
+
class="contact-item"
|
|
834
|
+
aria-label="Email: ${email}"
|
|
835
|
+
>
|
|
836
|
+
<pd-icon icon="mailIcon" class="contact-icon"></pd-icon>
|
|
837
|
+
<span>${email}</span>
|
|
838
|
+
</a>
|
|
839
|
+
` : nothing}
|
|
840
|
+
${website ? html`
|
|
841
|
+
<a
|
|
842
|
+
href="${this._ensureHttps(website)}"
|
|
843
|
+
target="_blank"
|
|
844
|
+
rel="noopener noreferrer"
|
|
845
|
+
class="contact-item"
|
|
846
|
+
aria-label="Website: ${website}"
|
|
847
|
+
>
|
|
848
|
+
<pd-icon icon="circleIcon" class="contact-icon"></pd-icon>
|
|
849
|
+
<span>${this._formatWebsiteDisplay(website)}</span>
|
|
850
|
+
</a>
|
|
851
|
+
` : nothing}
|
|
852
|
+
</div>
|
|
853
|
+
`;
|
|
854
|
+
}
|
|
855
|
+
_renderCardDivider() {
|
|
856
|
+
return html`<hr class="card-divider" />`;
|
|
857
|
+
}
|
|
858
|
+
_renderCardSocialMedia() {
|
|
859
|
+
const socialItems = this.contact?.socialMedia;
|
|
860
|
+
if (!socialItems || socialItems.length === 0) return nothing;
|
|
861
|
+
return html`
|
|
862
|
+
<pd-socialmedia summary .initItems="${socialItems}"></pd-socialmedia>
|
|
863
|
+
`;
|
|
864
|
+
}
|
|
865
|
+
_hasCardContactInfo() {
|
|
866
|
+
return !!(this.contact?.phone1 || this.contact?.email || this.contact?.website);
|
|
867
|
+
}
|
|
868
|
+
_ensureHttps(url) {
|
|
869
|
+
if (!url) return "";
|
|
870
|
+
return /^https?:\/\//i.test(url) ? url : `https://${url}`;
|
|
871
|
+
}
|
|
872
|
+
_formatWebsiteDisplay(url) {
|
|
873
|
+
return url.replace(/^https?:\/\/(www\.)?/i, "").replace(/\/$/, "");
|
|
874
|
+
}
|
|
875
|
+
// ========================================
|
|
876
|
+
// FORM METHODS
|
|
877
|
+
// ========================================
|
|
432
878
|
get valid() {
|
|
433
879
|
return this._contactForm?.valid === true;
|
|
434
880
|
}
|
|
@@ -437,7 +883,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
437
883
|
}
|
|
438
884
|
getValues() {
|
|
439
885
|
const contactFormValues = this._contactForm?.getValues().origin;
|
|
440
|
-
console.log("VAlues:", contactFormValues);
|
|
441
886
|
const commonValues = {
|
|
442
887
|
business: this._business,
|
|
443
888
|
street: contactFormValues.street,
|
|
@@ -465,7 +910,6 @@ const _PdContact = class _PdContact extends LitElement {
|
|
|
465
910
|
};
|
|
466
911
|
}
|
|
467
912
|
_switchAddressType(e) {
|
|
468
|
-
console.log("Do switch", e);
|
|
469
913
|
if (e.detail.name === "contactTypeRadioId") {
|
|
470
914
|
this._business = e.detail.value === "business";
|
|
471
915
|
}
|
|
@@ -520,6 +964,12 @@ __decorateClass([
|
|
|
520
964
|
__decorateClass([
|
|
521
965
|
property({ type: Boolean })
|
|
522
966
|
], _PdContact.prototype, "summary");
|
|
967
|
+
__decorateClass([
|
|
968
|
+
property({ type: String, reflect: true, attribute: "view-type" })
|
|
969
|
+
], _PdContact.prototype, "viewType");
|
|
970
|
+
__decorateClass([
|
|
971
|
+
property({ type: String, reflect: true, attribute: "card-layout" })
|
|
972
|
+
], _PdContact.prototype, "cardLayout");
|
|
523
973
|
__decorateClass([
|
|
524
974
|
property({ type: Boolean })
|
|
525
975
|
], _PdContact.prototype, "withPropertyDate");
|