@progressive-development/pd-order 0.7.11 → 0.9.2
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/dist/generated/locales/be.d.ts +2 -1
- package/dist/generated/locales/be.d.ts.map +1 -1
- package/dist/generated/locales/de.d.ts +2 -1
- package/dist/generated/locales/de.d.ts.map +1 -1
- package/dist/generated/locales/en.d.ts +2 -1
- package/dist/generated/locales/en.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -12
- package/dist/locales/be.js +4 -6
- package/dist/locales/de.js +4 -7
- package/dist/locales/en.js +4 -6
- package/dist/pd-order-contacts/PdOrderContacts.d.ts +46 -0
- package/dist/pd-order-contacts/PdOrderContacts.d.ts.map +1 -0
- package/dist/pd-order-contacts/PdOrderContacts.js +383 -0
- package/dist/pd-order-contacts/pd-order-contacts.d.ts +3 -0
- package/dist/pd-order-contacts/pd-order-contacts.d.ts.map +1 -0
- package/dist/{stories → pd-order-contacts}/pd-order-contacts.stories.d.ts +1 -1
- package/dist/pd-order-contacts/pd-order-contacts.stories.d.ts.map +1 -0
- package/dist/pd-order-contacts.d.ts +2 -45
- package/dist/pd-order-contacts.js +6 -387
- package/dist/pd-order-summary/PdOrderSummary.d.ts +39 -0
- package/dist/pd-order-summary/PdOrderSummary.d.ts.map +1 -0
- package/dist/pd-order-summary/PdOrderSummary.js +242 -0
- package/dist/pd-order-summary/pd-order-summary.d.ts +3 -0
- package/dist/pd-order-summary/pd-order-summary.d.ts.map +1 -0
- package/dist/{stories → pd-order-summary}/pd-order-summary.stories.d.ts +1 -1
- package/dist/pd-order-summary/pd-order-summary.stories.d.ts.map +1 -0
- package/dist/pd-order-summary.d.ts +2 -38
- package/dist/pd-order-summary.js +6 -248
- package/dist/stories/test-impl/test-summary.d.ts +1 -1
- package/dist/stories/test-impl/test-summary.d.ts.map +1 -1
- package/package.json +30 -51
- package/dist/pd-order-contacts.d.ts.map +0 -1
- package/dist/pd-order-summary.d.ts.map +0 -1
- package/dist/stories/pd-order-contacts.stories.d.ts.map +0 -1
- package/dist/stories/pd-order-summary.stories.d.ts.map +0 -1
|
@@ -1,389 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { property, state, customElement } from "lit/decorators.js";
|
|
3
|
-
import { localized, msg } from "@lit/localize";
|
|
4
|
-
import "@progressive-development/pd-content/pd-collapse-group";
|
|
5
|
-
import "@progressive-development/pd-content/pd-collapse";
|
|
6
|
-
import "@progressive-development/pd-contact/pd-contact";
|
|
7
|
-
import "@progressive-development/pd-forms/pd-checkbox";
|
|
8
|
-
import { PdFontStyles } from "@progressive-development/pd-shared-styles";
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
12
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
13
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14
|
-
if (decorator = decorators[i])
|
|
15
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
16
|
-
if (kind && result) __defProp(target, key, result);
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
19
|
-
let PdOrderContacts = class extends LitElement {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.summary = false;
|
|
23
|
-
this.contactTitle = {};
|
|
24
|
-
this.requiredFields = [];
|
|
25
|
-
this.withPayment = false;
|
|
26
|
-
this.withPropertyOwner = false;
|
|
27
|
-
this.withPropertyDate = false;
|
|
28
|
-
this._ownBillingContact = false;
|
|
29
|
-
this._ownAdminContact = false;
|
|
30
|
-
this._isPropertyOwner = false;
|
|
31
|
-
}
|
|
32
|
-
update(changedProps) {
|
|
33
|
-
if (changedProps.has("billingContact")) {
|
|
34
|
-
this._ownBillingContact = !!this.billingContact;
|
|
35
|
-
}
|
|
36
|
-
if (changedProps.has("adminContact")) {
|
|
37
|
-
this._ownAdminContact = !!this.adminContact;
|
|
38
|
-
}
|
|
39
|
-
if (changedProps.has("propertyContact")) {
|
|
40
|
-
this._isPropertyOwner = !!this.propertyContact;
|
|
41
|
-
}
|
|
42
|
-
super.update(changedProps);
|
|
43
|
-
}
|
|
44
|
-
render() {
|
|
45
|
-
return this.summary ? this._renderSummary() : this._renderEditContacts();
|
|
46
|
-
}
|
|
47
|
-
_renderEditContacts() {
|
|
48
|
-
return html`
|
|
49
|
-
<pd-collapse-group>
|
|
50
|
-
<pd-collapse id="orderContactCollapseId">
|
|
51
|
-
<div slot="header">
|
|
52
|
-
${this.contactTitle.orderInputContact ?? msg("Adresse", {
|
|
53
|
-
id: "pd.order.contacts.orderContact.inputHeader"
|
|
54
|
-
})}
|
|
55
|
-
</div>
|
|
56
|
-
<pd-contact
|
|
57
|
-
id="orderContactId"
|
|
58
|
-
class="collapse-contact"
|
|
59
|
-
slot="content"
|
|
60
|
-
.requiredFields="${this.requiredFields}"
|
|
61
|
-
.contact="${this.orderContact}"
|
|
62
|
-
.match="${this.match}"
|
|
63
|
-
?withPropertyDate="${!this._isPropertyOwner && this.withPropertyDate}"
|
|
64
|
-
></pd-contact>
|
|
65
|
-
</pd-collapse>
|
|
1
|
+
import { PdOrderContacts } from './pd-order-contacts/PdOrderContacts.js';
|
|
66
2
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
id: "pd.order.contacts.billingContact.inputHeader"
|
|
72
|
-
})}
|
|
73
|
-
</div>
|
|
74
|
-
<div slot="content">
|
|
75
|
-
${this._ownBillingContact ? html`
|
|
76
|
-
<p>
|
|
77
|
-
<a @click="${() => this._ownBillingContact = false}"
|
|
78
|
-
>${msg(
|
|
79
|
-
"Kundenadresse als Rechnungsadresse verwenden"
|
|
80
|
-
)}</a
|
|
81
|
-
>
|
|
82
|
-
</p>
|
|
83
|
-
<pd-contact
|
|
84
|
-
id="billingContactId"
|
|
85
|
-
class="collapse-contact"
|
|
86
|
-
.requiredFields="${this.requiredFields}"
|
|
87
|
-
.contact="${this.billingContact}"
|
|
88
|
-
></pd-contact>
|
|
89
|
-
` : html`
|
|
90
|
-
<p>
|
|
91
|
-
${msg(
|
|
92
|
-
"Rechnungsadresse entspricht der Kundenadresse."
|
|
93
|
-
)}
|
|
94
|
-
</p>
|
|
95
|
-
<p>
|
|
96
|
-
<a @click=${() => this._ownBillingContact = true}
|
|
97
|
-
>${msg("Neue Rechnungsadresse hinzufügen")}</a
|
|
98
|
-
>
|
|
99
|
-
</p>
|
|
100
|
-
`}
|
|
101
|
-
</div>
|
|
102
|
-
</pd-collapse>
|
|
103
|
-
` : nothing}
|
|
104
|
-
${this.withPropertyOwner ? html`
|
|
105
|
-
<div class="property-owner-box">
|
|
106
|
-
<pd-checkbox
|
|
107
|
-
id="isPropertyOwnerId"
|
|
108
|
-
initValue="${this._isPropertyOwner}"
|
|
109
|
-
@pd-form-element-change="${(e) => {
|
|
110
|
-
this._isPropertyOwner = e.detail.value === "true";
|
|
111
|
-
}}"
|
|
112
|
-
>
|
|
113
|
-
${msg("Ist der Kunde Vermieter?", {
|
|
114
|
-
id: "pd.order.contacts.propertyContact.checkBox"
|
|
115
|
-
})}
|
|
116
|
-
</pd-checkbox>
|
|
3
|
+
const tag = "pd-order-contacts";
|
|
4
|
+
if (!customElements.get(tag)) {
|
|
5
|
+
customElements.define(tag, PdOrderContacts);
|
|
6
|
+
}
|
|
117
7
|
|
|
118
|
-
|
|
119
|
-
<pd-collapse
|
|
120
|
-
id="propertyContactCollapseId"
|
|
121
|
-
style="padding-top: 20px;"
|
|
122
|
-
>
|
|
123
|
-
<div slot="header">
|
|
124
|
-
${this.contactTitle.propertyInputContact ?? msg("Adresse der Immobilie")}
|
|
125
|
-
</div>
|
|
126
|
-
<div slot="content">
|
|
127
|
-
<pd-contact
|
|
128
|
-
id="propertyContactId"
|
|
129
|
-
class="collapse-contact"
|
|
130
|
-
.requiredFields="${[
|
|
131
|
-
"street",
|
|
132
|
-
"streetNr",
|
|
133
|
-
"zip",
|
|
134
|
-
"city"
|
|
135
|
-
]}"
|
|
136
|
-
.inputFields="${[
|
|
137
|
-
"street",
|
|
138
|
-
"city",
|
|
139
|
-
"additionalHint"
|
|
140
|
-
]}"
|
|
141
|
-
.contact="${this.propertyContact}"
|
|
142
|
-
?withPropertyDate="${this.withPropertyDate}"
|
|
143
|
-
></pd-contact>
|
|
144
|
-
</div>
|
|
145
|
-
</pd-collapse>
|
|
146
|
-
|
|
147
|
-
<pd-collapse id="adminContactCollapseId">
|
|
148
|
-
<div slot="header">
|
|
149
|
-
${this.contactTitle.adminInputContact ?? msg("Adresse der Verwaltung (optional)")}
|
|
150
|
-
</div>
|
|
151
|
-
<div slot="content">
|
|
152
|
-
${this._ownAdminContact ? html`
|
|
153
|
-
<p>
|
|
154
|
-
<a
|
|
155
|
-
@click="${() => this._ownAdminContact = false}"
|
|
156
|
-
>${msg(
|
|
157
|
-
"Kundenadresse als Verwaltungsadresse verwenden"
|
|
158
|
-
)}</a
|
|
159
|
-
>
|
|
160
|
-
</p>
|
|
161
|
-
<pd-contact
|
|
162
|
-
id="adminContactId"
|
|
163
|
-
class="collapse-contact"
|
|
164
|
-
.requiredFields="${this.requiredFields}"
|
|
165
|
-
.contact="${this.adminContact}"
|
|
166
|
-
></pd-contact>
|
|
167
|
-
` : html`
|
|
168
|
-
<p>
|
|
169
|
-
${msg(
|
|
170
|
-
"Verwaltungsadresse entspricht der Kundenadresse."
|
|
171
|
-
)}
|
|
172
|
-
</p>
|
|
173
|
-
<p>
|
|
174
|
-
<a
|
|
175
|
-
@click="${() => this._ownAdminContact = true}"
|
|
176
|
-
>${msg(
|
|
177
|
-
"Neue Verwaltungsadresse hinzufügen"
|
|
178
|
-
)}</a
|
|
179
|
-
>
|
|
180
|
-
</p>
|
|
181
|
-
`}
|
|
182
|
-
</div>
|
|
183
|
-
</pd-collapse>
|
|
184
|
-
` : nothing}
|
|
185
|
-
</div>
|
|
186
|
-
` : nothing}
|
|
187
|
-
</pd-collapse-group>
|
|
188
|
-
`;
|
|
189
|
-
}
|
|
190
|
-
_renderSummary() {
|
|
191
|
-
return html`
|
|
192
|
-
<div class="summary-box">
|
|
193
|
-
${this.orderContact ? html`
|
|
194
|
-
<pd-contact
|
|
195
|
-
addressTitle="${this.contactTitle.orderSummaryContact ?? msg("Adresse")}"
|
|
196
|
-
.contact="${this.orderContact}"
|
|
197
|
-
summary
|
|
198
|
-
></pd-contact>
|
|
199
|
-
` : nothing}
|
|
200
|
-
${this.billingContact ? html`
|
|
201
|
-
<pd-contact
|
|
202
|
-
addressTitle="${this.contactTitle.billingSummaryContact ?? msg("Rechnungsadresse")}"
|
|
203
|
-
.contact="${this.billingContact}"
|
|
204
|
-
summary
|
|
205
|
-
></pd-contact>
|
|
206
|
-
` : nothing}
|
|
207
|
-
${this.propertyContact ? html`
|
|
208
|
-
<pd-contact
|
|
209
|
-
addressTitle="${this.contactTitle.propertySummaryContact ?? msg("Immobilie")}"
|
|
210
|
-
.contact="${this.propertyContact}"
|
|
211
|
-
summary
|
|
212
|
-
></pd-contact>
|
|
213
|
-
` : nothing}
|
|
214
|
-
${this.adminContact ? html`
|
|
215
|
-
<pd-contact
|
|
216
|
-
addressTitle="${this.contactTitle.adminSummaryContact ?? msg("Verwaltung")}"
|
|
217
|
-
.contact="${this.adminContact}"
|
|
218
|
-
summary
|
|
219
|
-
></pd-contact>
|
|
220
|
-
` : nothing}
|
|
221
|
-
</div>
|
|
222
|
-
`;
|
|
223
|
-
}
|
|
224
|
-
get valid() {
|
|
225
|
-
var _a;
|
|
226
|
-
for (const { id, collapse, condition = true } of this._getCollapseMap()) {
|
|
227
|
-
if (!condition) continue;
|
|
228
|
-
const element = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(id);
|
|
229
|
-
if (!(element == null ? void 0 : element.valid)) {
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return true;
|
|
234
|
-
}
|
|
235
|
-
async triggerValidate() {
|
|
236
|
-
var _a, _b;
|
|
237
|
-
let firstInvalidCollapseId = null;
|
|
238
|
-
const collapseMap = this._getCollapseMap();
|
|
239
|
-
console.log("Map: ", collapseMap);
|
|
240
|
-
for (const { id, collapse, condition = true } of collapseMap) {
|
|
241
|
-
if (!condition) continue;
|
|
242
|
-
const element = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(id);
|
|
243
|
-
if (!element) continue;
|
|
244
|
-
const result = await element.triggerValidate();
|
|
245
|
-
console.log("PdContact triggerValidate: ", result);
|
|
246
|
-
if (!result && !firstInvalidCollapseId) {
|
|
247
|
-
firstInvalidCollapseId = collapse;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (firstInvalidCollapseId) {
|
|
251
|
-
console.log("PdContact open failed: ", firstInvalidCollapseId);
|
|
252
|
-
const collapseEl = (_b = this.shadowRoot) == null ? void 0 : _b.getElementById(
|
|
253
|
-
firstInvalidCollapseId
|
|
254
|
-
);
|
|
255
|
-
if (collapseEl) {
|
|
256
|
-
collapseEl.active = true;
|
|
257
|
-
}
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
return true;
|
|
261
|
-
}
|
|
262
|
-
getValues() {
|
|
263
|
-
var _a, _b;
|
|
264
|
-
const contactValues = {};
|
|
265
|
-
for (const { id, collapse, condition = true } of this._getCollapseMap()) {
|
|
266
|
-
if (!condition) continue;
|
|
267
|
-
contactValues[id] = (_b = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(id)) == null ? void 0 : _b.getValues();
|
|
268
|
-
}
|
|
269
|
-
return contactValues;
|
|
270
|
-
}
|
|
271
|
-
_getCollapseMap() {
|
|
272
|
-
return [
|
|
273
|
-
{ id: "orderContactId", collapse: "orderContactCollapseId" },
|
|
274
|
-
{
|
|
275
|
-
id: "billingContactId",
|
|
276
|
-
collapse: "billingContactCollapseId",
|
|
277
|
-
condition: this._ownBillingContact
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
id: "propertyContactId",
|
|
281
|
-
collapse: "propertyContactCollapseId",
|
|
282
|
-
condition: this._isPropertyOwner
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
id: "adminContactId",
|
|
286
|
-
collapse: "adminContactCollapseId",
|
|
287
|
-
condition: this._isPropertyOwner && this._ownAdminContact
|
|
288
|
-
}
|
|
289
|
-
];
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
PdOrderContacts.styles = [
|
|
293
|
-
PdFontStyles,
|
|
294
|
-
css`
|
|
295
|
-
:host {
|
|
296
|
-
display: block;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
p {
|
|
300
|
-
color: var(--pd-default-font-content-col);
|
|
301
|
-
font-size: var(--pd-default-font-content-size);
|
|
302
|
-
font-family: var(--pd-default-font-content-family);
|
|
303
|
-
max-width: 1000px;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
a {
|
|
307
|
-
cursor: pointer;
|
|
308
|
-
font-family: var(--pd-default-font-link-family);
|
|
309
|
-
font-size: var(--pd-default-font-link-size);
|
|
310
|
-
color: var(--pd-default-font-link-col);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
a:hover {
|
|
314
|
-
color: var(--pd-default-font-link-col-hover);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.collapse-contact {
|
|
318
|
-
padding: 10px;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.summary-box {
|
|
322
|
-
display: flex;
|
|
323
|
-
flex-wrap: wrap;
|
|
324
|
-
gap: 10px;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.summary-box pd-contact {
|
|
328
|
-
min-width: 150px;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
.property-owner-box {
|
|
332
|
-
border: 2px solid #007b8f;
|
|
333
|
-
border-radius: 8px;
|
|
334
|
-
padding: 16px;
|
|
335
|
-
margin: 16px 0;
|
|
336
|
-
background-color: #f8fafb;
|
|
337
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
338
|
-
}
|
|
339
|
-
`
|
|
340
|
-
];
|
|
341
|
-
__decorateClass([
|
|
342
|
-
property({ type: Boolean })
|
|
343
|
-
], PdOrderContacts.prototype, "summary", 2);
|
|
344
|
-
__decorateClass([
|
|
345
|
-
property({ type: Object })
|
|
346
|
-
], PdOrderContacts.prototype, "contactTitle", 2);
|
|
347
|
-
__decorateClass([
|
|
348
|
-
property({ type: Array })
|
|
349
|
-
], PdOrderContacts.prototype, "requiredFields", 2);
|
|
350
|
-
__decorateClass([
|
|
351
|
-
property({ type: Object })
|
|
352
|
-
], PdOrderContacts.prototype, "orderContact", 2);
|
|
353
|
-
__decorateClass([
|
|
354
|
-
property({ type: Object })
|
|
355
|
-
], PdOrderContacts.prototype, "billingContact", 2);
|
|
356
|
-
__decorateClass([
|
|
357
|
-
property({ type: Object })
|
|
358
|
-
], PdOrderContacts.prototype, "adminContact", 2);
|
|
359
|
-
__decorateClass([
|
|
360
|
-
property({ type: Object })
|
|
361
|
-
], PdOrderContacts.prototype, "propertyContact", 2);
|
|
362
|
-
__decorateClass([
|
|
363
|
-
property({ type: Boolean })
|
|
364
|
-
], PdOrderContacts.prototype, "withPayment", 2);
|
|
365
|
-
__decorateClass([
|
|
366
|
-
property({ type: Boolean })
|
|
367
|
-
], PdOrderContacts.prototype, "withPropertyOwner", 2);
|
|
368
|
-
__decorateClass([
|
|
369
|
-
property({ type: Boolean })
|
|
370
|
-
], PdOrderContacts.prototype, "withPropertyDate", 2);
|
|
371
|
-
__decorateClass([
|
|
372
|
-
property({ type: Object })
|
|
373
|
-
], PdOrderContacts.prototype, "match", 2);
|
|
374
|
-
__decorateClass([
|
|
375
|
-
state()
|
|
376
|
-
], PdOrderContacts.prototype, "_ownBillingContact", 2);
|
|
377
|
-
__decorateClass([
|
|
378
|
-
state()
|
|
379
|
-
], PdOrderContacts.prototype, "_ownAdminContact", 2);
|
|
380
|
-
__decorateClass([
|
|
381
|
-
state()
|
|
382
|
-
], PdOrderContacts.prototype, "_isPropertyOwner", 2);
|
|
383
|
-
PdOrderContacts = __decorateClass([
|
|
384
|
-
customElement("pd-order-contacts"),
|
|
385
|
-
localized()
|
|
386
|
-
], PdOrderContacts);
|
|
387
|
-
export {
|
|
388
|
-
PdOrderContacts
|
|
389
|
-
};
|
|
8
|
+
export { PdOrderContacts };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LitElement, CSSResultGroup, TemplateResult } from 'lit';
|
|
2
|
+
import { PdOrderStep } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Komponente zur Darstellung der Bestellübersicht
|
|
5
|
+
*
|
|
6
|
+
* @fires go-to - Wird ausgelöst, wenn der Benutzer "edit-content" aktiviert
|
|
7
|
+
* @slot legal - Slot für die AGB-Inhalte
|
|
8
|
+
* @tagname pd-order-summary
|
|
9
|
+
*/
|
|
10
|
+
export declare class PdOrderSummary extends LitElement {
|
|
11
|
+
/**
|
|
12
|
+
* Die Liste der Bestellschritte (z.B. Buchung, Kontaktdaten, etc.),
|
|
13
|
+
* wie sie in der Zusammenfassung gerendert werden.
|
|
14
|
+
*/
|
|
15
|
+
orderSteps: PdOrderStep[];
|
|
16
|
+
/**
|
|
17
|
+
* Gibt an, ob ein Zahlungsabschnitt mit Preisdetails angezeigt werden soll.
|
|
18
|
+
*/
|
|
19
|
+
withPayment: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Gibt an, ob eine Checkbox zur Zustimmung zu den AGB angezeigt und validiert werden soll.
|
|
22
|
+
*/
|
|
23
|
+
withAgreement: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Die vollständigen Bestelldaten inklusive Postleitzahl, Kontakten und Preisinformationen.
|
|
26
|
+
*/
|
|
27
|
+
order?: any;
|
|
28
|
+
private _agreeForm;
|
|
29
|
+
static styles: CSSResultGroup;
|
|
30
|
+
firstUpdated(): void;
|
|
31
|
+
render(): TemplateResult<1>;
|
|
32
|
+
get valid(): boolean;
|
|
33
|
+
triggerValidate(): Promise<boolean>;
|
|
34
|
+
protected _mapOrderStepSummary(step: PdOrderStep, index: number): TemplateResult;
|
|
35
|
+
protected _renderCustomOrderStepSummary(step: PdOrderStep, index: number): TemplateResult | null;
|
|
36
|
+
protected _getContactsSummary(index: number, step: PdOrderStep): TemplateResult<1>;
|
|
37
|
+
private _openTermsAndConditions;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=PdOrderSummary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdOrderSummary.d.ts","sourceRoot":"","sources":["../../src/pd-order-summary/PdOrderSummary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5E,OAAO,qDAAqD,CAAC;AAC7D,OAAO,+CAA+C,CAAC;AACvD,OAAO,+CAA+C,CAAC;AAEvD,OAAO,iDAAiD,CAAC;AACzD,OAAO,6CAA6C,CAAC;AACrD,OAAO,qDAAqD,CAAC;AAE7D,OAAO,EAAsB,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,2CAA2C,CAAC;AAGnD;;;;;;GAMG;AACH,qBACa,cAAe,SAAQ,UAAU;IAC5C;;;OAGG;IAEH,UAAU,EAAE,WAAW,EAAE,CAAM;IAE/B;;OAEG;IAEH,WAAW,UAAS;IAEpB;;OAEG;IAEH,aAAa,UAAS;IAEtB;;OAEG;IAEH,KAAK,CAAC,EAAE,GAAG,CAAC;IAGZ,OAAO,CAAC,UAAU,CAAmB;IAErC,OAAgB,MAAM,EAAE,cAAc,CAmDpC;IAEO,YAAY,IAAI,IAAI;IAYpB,MAAM;IA0Df,IAAI,KAAK,YAER;IAEY,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IA6BhD,SAAS,CAAC,oBAAoB,CAC5B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,cAAc;IAkBjB,SAAS,CAAC,6BAA6B,CACrC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,IAAI;IAUxB,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;IAoB9D,OAAO,CAAC,uBAAuB;CAOhC"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { css, LitElement, html } from 'lit';
|
|
2
|
+
import { property, query } from 'lit/decorators.js';
|
|
3
|
+
import { localized, msg } from '@lit/localize';
|
|
4
|
+
import '@progressive-development/pd-forms/pd-form-container';
|
|
5
|
+
import '@progressive-development/pd-forms/pd-form-row';
|
|
6
|
+
import '@progressive-development/pd-forms/pd-checkbox';
|
|
7
|
+
import '@progressive-development/pd-price/pd-pricetable';
|
|
8
|
+
import '@progressive-development/pd-dialog/pd-popup';
|
|
9
|
+
import '@progressive-development/pd-content/pd-edit-content';
|
|
10
|
+
import '../pd-order-contacts.js';
|
|
11
|
+
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
16
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
if (decorator = decorators[i])
|
|
18
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19
|
+
if (kind && result) __defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
let PdOrderSummary = class extends LitElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.orderSteps = [];
|
|
26
|
+
this.withPayment = false;
|
|
27
|
+
this.withAgreement = false;
|
|
28
|
+
}
|
|
29
|
+
firstUpdated() {
|
|
30
|
+
this.addEventListener("edit-content", (e) => {
|
|
31
|
+
this.dispatchEvent(
|
|
32
|
+
new CustomEvent("go-to", {
|
|
33
|
+
detail: { step: e.detail.step },
|
|
34
|
+
bubbles: true,
|
|
35
|
+
composed: true
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
if (!this.order) return html`<p>No order is set</p>`;
|
|
42
|
+
return html`
|
|
43
|
+
<h3>${msg("Übersicht", { id: "pd.order.summary.title" })}</h3>
|
|
44
|
+
<div class="edit-summary-container">
|
|
45
|
+
${this.orderSteps.map(
|
|
46
|
+
(step, index) => this._mapOrderStepSummary(step, index)
|
|
47
|
+
)}
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
${this.order.priceData ? html`
|
|
51
|
+
<div class="payment">
|
|
52
|
+
<h3>${msg("Rechnung", { id: "pd.order.summary.billing" })}</h3>
|
|
53
|
+
<pd-pricetable
|
|
54
|
+
class="pricetable"
|
|
55
|
+
.priceData="${this.order.priceData}"
|
|
56
|
+
></pd-pricetable>
|
|
57
|
+
</div>
|
|
58
|
+
` : ""}
|
|
59
|
+
${this.withAgreement ? html`
|
|
60
|
+
<pd-form-container id="submitSummaryFormId">
|
|
61
|
+
<pd-form-row>
|
|
62
|
+
<pd-checkbox
|
|
63
|
+
id="agreeConditionsId"
|
|
64
|
+
valueName="agreeId"
|
|
65
|
+
class="agree-box"
|
|
66
|
+
required
|
|
67
|
+
requiredMsg="${msg(
|
|
68
|
+
"Bitte stimmen Sie den Allgemeinen Geschäftsbedingungen zu, um fortzufahren.",
|
|
69
|
+
{ id: "pd.order.summary.agree.required" }
|
|
70
|
+
)}"
|
|
71
|
+
>
|
|
72
|
+
${msg("Ich akzeptiere die", {
|
|
73
|
+
id: "pd.order.summary.agree.link1"
|
|
74
|
+
})}
|
|
75
|
+
<a
|
|
76
|
+
@click="${this._openTermsAndConditions}"
|
|
77
|
+
@keypress="${this._openTermsAndConditions}"
|
|
78
|
+
>${msg("Allgemeinen Geschäftsbedingungen", {
|
|
79
|
+
id: "pd.order.summary.agree.link2"
|
|
80
|
+
})}</a
|
|
81
|
+
>
|
|
82
|
+
</pd-checkbox>
|
|
83
|
+
</pd-form-row>
|
|
84
|
+
</pd-form-container>
|
|
85
|
+
|
|
86
|
+
<pd-popup id="agreePopupId">
|
|
87
|
+
<div slot="content"><slot name="legal"></slot></div>
|
|
88
|
+
</pd-popup>
|
|
89
|
+
` : ""}
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
get valid() {
|
|
93
|
+
return !this.withAgreement || this._agreeForm?.valid === true;
|
|
94
|
+
}
|
|
95
|
+
async triggerValidate() {
|
|
96
|
+
return this._agreeForm?.triggerValidate();
|
|
97
|
+
}
|
|
98
|
+
/*
|
|
99
|
+
For Booking:
|
|
100
|
+
case "zip":
|
|
101
|
+
case "booking":
|
|
102
|
+
return this._getBookingSummary(index + 1, step);
|
|
103
|
+
|
|
104
|
+
private _getBookingSummary(index: number, step: PdOrderStep) {
|
|
105
|
+
const date = this.order?.selectedDate
|
|
106
|
+
? format(this.order.selectedDate, "DD/MM/YYYY")
|
|
107
|
+
: undefined;
|
|
108
|
+
const bookingData = [{ name: "Postcode:", val: this.order?.zip }];
|
|
109
|
+
if (date) {
|
|
110
|
+
bookingData.push({ name: "Datum van herstelling:", val: date });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return html`
|
|
114
|
+
<pd-edit-content
|
|
115
|
+
contentTitle="${step.name}"
|
|
116
|
+
stepNumber="${index}"
|
|
117
|
+
.data="${bookingData}"
|
|
118
|
+
></pd-edit-content>
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
*/
|
|
122
|
+
_mapOrderStepSummary(step, index) {
|
|
123
|
+
const custom = this._renderCustomOrderStepSummary(step, index);
|
|
124
|
+
if (custom) {
|
|
125
|
+
return custom;
|
|
126
|
+
}
|
|
127
|
+
return html`
|
|
128
|
+
<pd-edit-content
|
|
129
|
+
contentTitle="${step.name}"
|
|
130
|
+
stepNumber="${index + 1}"
|
|
131
|
+
.data="${step.data}"
|
|
132
|
+
>
|
|
133
|
+
<slot name="${step.key}"></slot>
|
|
134
|
+
</pd-edit-content>
|
|
135
|
+
`;
|
|
136
|
+
}
|
|
137
|
+
_renderCustomOrderStepSummary(step, index) {
|
|
138
|
+
switch (step.key) {
|
|
139
|
+
case "contacts":
|
|
140
|
+
return this._getContactsSummary(index + 1, step);
|
|
141
|
+
default:
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// ?editDisabled="${this.order?.withLogin}" => Alter code, von ticomi-web
|
|
146
|
+
_getContactsSummary(index, step) {
|
|
147
|
+
const contactData = this.order?.contacts;
|
|
148
|
+
return html`
|
|
149
|
+
<pd-edit-content contentTitle="${step.name}" stepNumber="${index}">
|
|
150
|
+
${contactData ? html`
|
|
151
|
+
<pd-order-contacts
|
|
152
|
+
?withPayment="${this.withPayment}"
|
|
153
|
+
.orderContact="${contactData.orderContact}"
|
|
154
|
+
.billingContact="${contactData.billingContact}"
|
|
155
|
+
.adminContact="${contactData.adminContact}"
|
|
156
|
+
.propertyContact="${contactData.propertyContact}"
|
|
157
|
+
summary
|
|
158
|
+
></pd-order-contacts>
|
|
159
|
+
` : ""}
|
|
160
|
+
</pd-edit-content>
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
_openTermsAndConditions(e) {
|
|
164
|
+
e.stopPropagation();
|
|
165
|
+
const popup = this.shadowRoot?.getElementById(
|
|
166
|
+
"agreePopupId"
|
|
167
|
+
);
|
|
168
|
+
popup?.showPopup();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
PdOrderSummary.styles = [
|
|
172
|
+
css`
|
|
173
|
+
:host {
|
|
174
|
+
display: block;
|
|
175
|
+
}
|
|
176
|
+
h3 {
|
|
177
|
+
color: var(--pd-default-font-title-col);
|
|
178
|
+
font-family: var(--pd-default-font-title-family);
|
|
179
|
+
font-size: 1.5em;
|
|
180
|
+
}
|
|
181
|
+
.edit-summary-container {
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-flow: column;
|
|
184
|
+
flex-wrap: wrap;
|
|
185
|
+
gap: 1em;
|
|
186
|
+
}
|
|
187
|
+
.payment {
|
|
188
|
+
margin-top: 30px;
|
|
189
|
+
padding: 5px;
|
|
190
|
+
background-color: var(
|
|
191
|
+
--pd-order-summary-payment-bg-col,
|
|
192
|
+
var(--pd-default-light-col)
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
.pay-logo-box {
|
|
196
|
+
display: flex;
|
|
197
|
+
}
|
|
198
|
+
.pay-logo {
|
|
199
|
+
max-width: 6rem;
|
|
200
|
+
}
|
|
201
|
+
.pricetable {
|
|
202
|
+
padding-top: 20px;
|
|
203
|
+
}
|
|
204
|
+
a {
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
font-family: var(--pd-default-font-link-family);
|
|
207
|
+
font-size: var(--pd-default-font-link-size);
|
|
208
|
+
color: var(--pd-default-font-link-col);
|
|
209
|
+
}
|
|
210
|
+
a:hover {
|
|
211
|
+
color: var(--pd-default-font-link-col-hover);
|
|
212
|
+
}
|
|
213
|
+
.agree-box {
|
|
214
|
+
padding-top: 20px;
|
|
215
|
+
}
|
|
216
|
+
@media (max-width: 380px) {
|
|
217
|
+
.pay-logo {
|
|
218
|
+
max-width: 5rem;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
`
|
|
222
|
+
];
|
|
223
|
+
__decorateClass([
|
|
224
|
+
property({ type: Array })
|
|
225
|
+
], PdOrderSummary.prototype, "orderSteps", 2);
|
|
226
|
+
__decorateClass([
|
|
227
|
+
property({ type: Boolean })
|
|
228
|
+
], PdOrderSummary.prototype, "withPayment", 2);
|
|
229
|
+
__decorateClass([
|
|
230
|
+
property({ type: Boolean })
|
|
231
|
+
], PdOrderSummary.prototype, "withAgreement", 2);
|
|
232
|
+
__decorateClass([
|
|
233
|
+
property({ type: Object })
|
|
234
|
+
], PdOrderSummary.prototype, "order", 2);
|
|
235
|
+
__decorateClass([
|
|
236
|
+
query("#submitSummaryFormId")
|
|
237
|
+
], PdOrderSummary.prototype, "_agreeForm", 2);
|
|
238
|
+
PdOrderSummary = __decorateClass([
|
|
239
|
+
localized()
|
|
240
|
+
], PdOrderSummary);
|
|
241
|
+
|
|
242
|
+
export { PdOrderSummary };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-order-summary.d.ts","sourceRoot":"","sources":["../../src/pd-order-summary/pd-order-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryFn } from '@storybook/web-components';
|
|
2
|
-
import { TestSummary } from '
|
|
2
|
+
import { TestSummary } from '../stories/test-impl/test-summary.js';
|
|
3
3
|
declare const _default: Meta<TestSummary>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const OrderSummary: StoryFn<TestSummary & {
|