@progressive-development/pd-order 0.1.124 → 0.1.126
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/pd-order-contacts-chunk.js +3060 -0
- package/dist/pd-order-contacts.js +1 -0
- package/dist/pd-order-summary.js +704 -0
- package/package.json +37 -21
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/server.mjs +0 -8
- package/demo/index.html +0 -29
- package/index.js +0 -1
- package/pd-booking.js +0 -3
- package/pd-order-contacts.js +0 -3
- package/pd-order-summary.js +0 -3
- package/src/PdBooking.js +0 -537
- package/src/PdOrderContacts.js +0 -213
- package/src/PdOrderSummary.js +0 -276
- package/stories/booking.stories.js +0 -26
- package/stories/index.stories.js +0 -17
- package/stories/order-contacts.stories.js +0 -78
- package/stories/order-summary.stories.js +0 -103
- package/test/pd-order.test.js +0 -32
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./pd-order-contacts-chunk.js";
|
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
import { html, LitElement, css } from "lit";
|
|
2
|
+
import { format } from "fecha";
|
|
3
|
+
import { o, I as ICON_CLOSE } from "./pd-order-contacts-chunk.js";
|
|
4
|
+
import { PDColorStyles, PDFontStyles } from "@progressive-development/pd-shared-styles";
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
const editIcon = html`<svg
|
|
10
|
+
class="edit"
|
|
11
|
+
id="Layer_1"
|
|
12
|
+
version="1.1"
|
|
13
|
+
viewBox="0 0 19 19"
|
|
14
|
+
xml:space="preserve"
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
17
|
+
>
|
|
18
|
+
<g>
|
|
19
|
+
<path
|
|
20
|
+
d="M8.44,7.25C8.348,7.342,8.277,7.447,8.215,7.557L8.174,7.516L8.149,7.69 C8.049,7.925,8.014,8.183,8.042,8.442l-0.399,2.796l2.797-0.399c0.259,0.028,0.517-0.007,0.752-0.107l0.174-0.024l-0.041-0.041 c0.109-0.062,0.215-0.133,0.307-0.225l5.053-5.053l-3.191-3.191L8.44,7.25z"
|
|
21
|
+
fill="var(--edit-fill-color)"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M18.183,1.568l-0.87-0.87c-0.641-0.641-1.637-0.684-2.225-0.097l-0.797,0.797l3.191,3.191l0.797-0.798 C18.867,3.205,18.824,2.209,18.183,1.568z"
|
|
25
|
+
fill="var(--edit-fill-color)"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
d="M15,9.696V17H2V2h8.953l1.523-1.42c0.162-0.161,0.353-0.221,0.555-0.293 c0.043-0.119,0.104-0.18,0.176-0.287H0v19h17V7.928L15,9.696z"
|
|
29
|
+
fill="var(--edit-fill-color)"
|
|
30
|
+
/>
|
|
31
|
+
</g>
|
|
32
|
+
</svg>`;
|
|
33
|
+
class PdEditContent extends LitElement {
|
|
34
|
+
/**
|
|
35
|
+
* @event edit-content
|
|
36
|
+
*/
|
|
37
|
+
static get styles() {
|
|
38
|
+
return [
|
|
39
|
+
PDColorStyles,
|
|
40
|
+
PDFontStyles,
|
|
41
|
+
css`
|
|
42
|
+
:host {
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
h4 {
|
|
47
|
+
font-family: var(--pd-default-font-title-family);
|
|
48
|
+
font-size: var(--pd-ec-font-title-size, 1.2em);
|
|
49
|
+
margin-top: 0px;
|
|
50
|
+
margin-bottom: 2px;
|
|
51
|
+
line-height: 40px;
|
|
52
|
+
color: var(--pd-ec-font-title-col, var(--pd-default-bg-col));
|
|
53
|
+
padding-left: 5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.header {
|
|
57
|
+
display: flex;
|
|
58
|
+
gap: 5px;
|
|
59
|
+
background-color: var(--pd-ec-bg-col, var(--pd-default-col));
|
|
60
|
+
align-items: center;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.circle {
|
|
64
|
+
margin-left: 5px;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
width: 27px;
|
|
69
|
+
height: 27px;
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
background-color: var(--pd-ec-font-title-col, var(--pd-default-bg-col));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.step-number {
|
|
75
|
+
font-family: var(--pd-default-font-title-family);
|
|
76
|
+
font-size: var(--pd-ec-font-title-size, 1.2em);
|
|
77
|
+
font-weight: var(--pd-ec-nr-font-weight, bold); ;
|
|
78
|
+
color: var(--pd-ec-bg-col, var(--pd-default-col));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Temporär? Hier noch sehr aufwendig mit div/span? */
|
|
82
|
+
|
|
83
|
+
.label {
|
|
84
|
+
display: inline-block;
|
|
85
|
+
font-weight: bold;
|
|
86
|
+
width: 200px;
|
|
87
|
+
padding-top: 10px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Temporär */
|
|
91
|
+
a {
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
font-family: var(--pd-default-font-link-family);
|
|
94
|
+
font-size: var(--pd-default-font-link-size);
|
|
95
|
+
color: var(--pd-default-font-link-col);
|
|
96
|
+
--edit-fill-color: var(--pd-default-font-link-col);
|
|
97
|
+
}
|
|
98
|
+
a:hover {
|
|
99
|
+
color: var(--pd-default-font-link-col-hover);
|
|
100
|
+
--edit-fill-color: var(--pd-default-font-link-col-hover);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.edit {
|
|
104
|
+
width: 1.1em;
|
|
105
|
+
}
|
|
106
|
+
/*
|
|
107
|
+
could used as class for given svg icons, workaround class
|
|
108
|
+
hard coded for specific icon => maybe use custom properties here, but not for that hack...
|
|
109
|
+
*/
|
|
110
|
+
.own-edit-icon {
|
|
111
|
+
width: 2em;
|
|
112
|
+
margin-top: -10px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.link-row {
|
|
116
|
+
padding-top: 5px;
|
|
117
|
+
padding-bottom: 5px;
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-wrap: wrap;
|
|
120
|
+
gap: 15px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.link-item {
|
|
124
|
+
display: flex;
|
|
125
|
+
gap: 2px;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
align-items: center;
|
|
128
|
+
pointer-events: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.param-data {
|
|
132
|
+
padding-bottom: 10px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@media (max-width: 360px) {
|
|
136
|
+
.label {
|
|
137
|
+
width: 130px;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
`
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
static get properties() {
|
|
144
|
+
return {
|
|
145
|
+
stepNumber: { type: Number },
|
|
146
|
+
contentTitle: { type: String },
|
|
147
|
+
data: { type: Array },
|
|
148
|
+
editLinks: { type: Array },
|
|
149
|
+
// TODO: [TIM-37] Put together with edit icon/editDisabled
|
|
150
|
+
editDisabled: { type: Boolean }
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
constructor() {
|
|
154
|
+
super();
|
|
155
|
+
this.stepNumber = void 0;
|
|
156
|
+
this.contentTitle = "";
|
|
157
|
+
this.data = [];
|
|
158
|
+
this.editLinks = [];
|
|
159
|
+
this.editDisabled = false;
|
|
160
|
+
}
|
|
161
|
+
render() {
|
|
162
|
+
return html`
|
|
163
|
+
<div class="header">
|
|
164
|
+
${this.stepNumber ? html`
|
|
165
|
+
<div class="circle">
|
|
166
|
+
<span class="step-number">${this.stepNumber}</span>
|
|
167
|
+
</div>
|
|
168
|
+
` : ""}
|
|
169
|
+
<h4>${this.contentTitle}</h4>
|
|
170
|
+
</div>
|
|
171
|
+
<div>
|
|
172
|
+
${this.data ? html`
|
|
173
|
+
<div class="param-data">
|
|
174
|
+
${this.data.map(
|
|
175
|
+
(dataEntry) => html`
|
|
176
|
+
<div>
|
|
177
|
+
<span class="label">${dataEntry.name}</span>
|
|
178
|
+
<span class="value">${dataEntry.val}</span>
|
|
179
|
+
</div>
|
|
180
|
+
`
|
|
181
|
+
)}
|
|
182
|
+
</div>` : ""}
|
|
183
|
+
<slot></slot>
|
|
184
|
+
<div class="link-row">
|
|
185
|
+
${this.editDisabled ? "" : html`
|
|
186
|
+
<a @click="${this._editContent}">
|
|
187
|
+
<div class="link-item">${editIcon} Bewerk ${this.contentTitle}</div>
|
|
188
|
+
</a>
|
|
189
|
+
`}
|
|
190
|
+
${this.editLinks.map(
|
|
191
|
+
(link) => html`
|
|
192
|
+
<a data-link="${link.key}" @click="${this._editContent}">
|
|
193
|
+
<div class="link-item">${PdEditContent._getLinkLogo(link)} ${link.txt}</div>
|
|
194
|
+
</a>`
|
|
195
|
+
)}
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
`;
|
|
199
|
+
}
|
|
200
|
+
static _getLinkLogo(link) {
|
|
201
|
+
if (link.icon) {
|
|
202
|
+
return link.icon;
|
|
203
|
+
}
|
|
204
|
+
if (link.defaultIcon) {
|
|
205
|
+
return editIcon;
|
|
206
|
+
}
|
|
207
|
+
return "";
|
|
208
|
+
}
|
|
209
|
+
_editContent(e) {
|
|
210
|
+
const { link } = e.target.dataset;
|
|
211
|
+
this.dispatchEvent(
|
|
212
|
+
new CustomEvent("edit-content", {
|
|
213
|
+
detail: {
|
|
214
|
+
step: this.stepNumber,
|
|
215
|
+
link
|
|
216
|
+
},
|
|
217
|
+
bubbles: true,
|
|
218
|
+
composed: true
|
|
219
|
+
})
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
window.customElements.define("pd-edit-content", PdEditContent);
|
|
224
|
+
/**
|
|
225
|
+
* @license
|
|
226
|
+
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
227
|
+
*/
|
|
228
|
+
class PdPricetable extends LitElement {
|
|
229
|
+
static get styles() {
|
|
230
|
+
return css`
|
|
231
|
+
:host {
|
|
232
|
+
display: block;
|
|
233
|
+
max-width: 100%;
|
|
234
|
+
--table-spacing: 1rem;
|
|
235
|
+
--table-radius: 1rem;
|
|
236
|
+
|
|
237
|
+
--table-bg: var(--game-color-dark, #fefefe);
|
|
238
|
+
|
|
239
|
+
--table-header-color: var(--game-color-light, #fefefe);
|
|
240
|
+
--table-header-bg: var(--game-color-dark, #177e89);
|
|
241
|
+
|
|
242
|
+
--table-row-odd-bg: var(--game-color-light, #fefefe);
|
|
243
|
+
|
|
244
|
+
--table-small-cell-bg: var(--game-color-light, lightgrey);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.table {
|
|
248
|
+
position: relative;
|
|
249
|
+
z-index: 1;
|
|
250
|
+
width: 100%;
|
|
251
|
+
background: var(--table-bg);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.table_expanded {
|
|
255
|
+
border-bottom: 2px solid var(--table-small-cell-bg);
|
|
256
|
+
}
|
|
257
|
+
.table_expanded .table__header .table__cell {
|
|
258
|
+
position: relative;
|
|
259
|
+
z-index: 10;
|
|
260
|
+
background-color: var(--table-header-bg);
|
|
261
|
+
box-shadow: 0 2px 0 var(--table-small-cell-bg);
|
|
262
|
+
font-weight: bold;
|
|
263
|
+
color: var(--table-header-color);
|
|
264
|
+
|
|
265
|
+
font-family: Oswald;
|
|
266
|
+
}
|
|
267
|
+
.table_expanded .table__body .table__row:nth-child(odd) {
|
|
268
|
+
background-color: var(--table-row-odd-bg);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.table_expanded .table__cell {
|
|
272
|
+
padding: calc(var(--table-spacing) / 2);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.text-left {
|
|
276
|
+
text-align: left;
|
|
277
|
+
}
|
|
278
|
+
.text-center {
|
|
279
|
+
text-align: center;
|
|
280
|
+
}
|
|
281
|
+
.text-right {
|
|
282
|
+
text-align: right;
|
|
283
|
+
}
|
|
284
|
+
.bold {
|
|
285
|
+
font-size: 1.2em;
|
|
286
|
+
font-family: Oswald;
|
|
287
|
+
color: #084c61;
|
|
288
|
+
}
|
|
289
|
+
.light {
|
|
290
|
+
color: grey;
|
|
291
|
+
}
|
|
292
|
+
.border-row {
|
|
293
|
+
border-bottom: 1px solid black;
|
|
294
|
+
}
|
|
295
|
+
`;
|
|
296
|
+
}
|
|
297
|
+
static get properties() {
|
|
298
|
+
return {
|
|
299
|
+
priceData: { type: Object }
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
constructor() {
|
|
303
|
+
super();
|
|
304
|
+
this.priceData = { articles: [], tax: 0 };
|
|
305
|
+
this.tableCssClasses = { table: true, table_expanded: true };
|
|
306
|
+
this._totalPrice = 0;
|
|
307
|
+
}
|
|
308
|
+
render() {
|
|
309
|
+
return this.loading ? html`Loading...` : html` <table class="${o(this.tableCssClasses)}">
|
|
310
|
+
<thead class="table__header">
|
|
311
|
+
<tr class="table__row">
|
|
312
|
+
<th class="table__cell" scope="col">Artikel</th>
|
|
313
|
+
<th class="table__cell" scope="col">Prijs</th>
|
|
314
|
+
</tr>
|
|
315
|
+
</thead>
|
|
316
|
+
<tbody class="table__body">
|
|
317
|
+
${this._renderBody()}
|
|
318
|
+
</tbody>
|
|
319
|
+
<tfoot>
|
|
320
|
+
<tr>
|
|
321
|
+
<td class="table__cell text-right bold" role="cell">Total:</td>
|
|
322
|
+
<td class="table__cell text-right bold" role="cell">
|
|
323
|
+
${(this._totalPrice + this._totalPrice * this.priceData.tax).toFixed(2)}
|
|
324
|
+
€
|
|
325
|
+
</td>
|
|
326
|
+
</tr>
|
|
327
|
+
</tfoot>
|
|
328
|
+
</table>
|
|
329
|
+
<p>* ${this._getTaxInfo()}</p>`;
|
|
330
|
+
}
|
|
331
|
+
_renderBody() {
|
|
332
|
+
this._totalPrice = 0;
|
|
333
|
+
return html`
|
|
334
|
+
${this.priceData.articles.map((article) => {
|
|
335
|
+
this._totalPrice += article.price ? Number(article.price) : 0;
|
|
336
|
+
return html`
|
|
337
|
+
<tr class="table__row">
|
|
338
|
+
<td class="table__cell text-left" role="cell">${article.name}</td>
|
|
339
|
+
<td class="table__cell text-right" role="cell">
|
|
340
|
+
${article.price ? Number(article.price).toFixed(2) : "--"} €
|
|
341
|
+
</td>
|
|
342
|
+
</tr>
|
|
343
|
+
`;
|
|
344
|
+
})}
|
|
345
|
+
<tr class="table__row">
|
|
346
|
+
<td class="table__cell text-right border-row light" role="cell">
|
|
347
|
+
${this.priceData.tax * 100}% BTW*
|
|
348
|
+
</td>
|
|
349
|
+
<td class="table__cell text-right border-row light" role="cell">
|
|
350
|
+
${(this._totalPrice * this.priceData.tax).toFixed(2)} €
|
|
351
|
+
</td>
|
|
352
|
+
</tr>
|
|
353
|
+
`;
|
|
354
|
+
}
|
|
355
|
+
_getTaxInfo() {
|
|
356
|
+
switch (this.priceData.tax) {
|
|
357
|
+
case 0:
|
|
358
|
+
return "BTW verlegd";
|
|
359
|
+
case 0.06:
|
|
360
|
+
return "6% BTW voor woningen ouder dan 10 jaar.";
|
|
361
|
+
case 0.21:
|
|
362
|
+
return "21% BTW voor woningen jonger dan 10 jaar.";
|
|
363
|
+
default:
|
|
364
|
+
return "--";
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
window.customElements.define("pd-pricetable", PdPricetable);
|
|
369
|
+
/**
|
|
370
|
+
* @license
|
|
371
|
+
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
372
|
+
*/
|
|
373
|
+
class PdPopup extends LitElement {
|
|
374
|
+
static get styles() {
|
|
375
|
+
return [
|
|
376
|
+
PDColorStyles,
|
|
377
|
+
css`
|
|
378
|
+
:host {
|
|
379
|
+
display: block;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* The Modal (background) */
|
|
383
|
+
.modal {
|
|
384
|
+
position: fixed; /* Stay in place */
|
|
385
|
+
z-index: 100; /* Sit on top */
|
|
386
|
+
left: 0;
|
|
387
|
+
top: 0;
|
|
388
|
+
width: 100%; /* Full width */
|
|
389
|
+
height: 100%; /* Full height */
|
|
390
|
+
overflow: auto; /* Enable scroll if needed */
|
|
391
|
+
/* RGBA Wert muss hier verwendet werden #AFC1D2 to rgba for opacity */
|
|
392
|
+
background-color: var(--pd-popup-modal-bg-rgba, rgba(175, 193, 210, 0.8));
|
|
393
|
+
|
|
394
|
+
/* specific for PdPopup, abobe also used for PdPopupDialog */
|
|
395
|
+
display: var(--pd-popup-default-display, none); /* Hidden by default */
|
|
396
|
+
padding-top: 100px; /* Location of the box */
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/* Modal Content */
|
|
400
|
+
.modal-content {
|
|
401
|
+
background-color: var(--pd-default-bg-col);
|
|
402
|
+
opacity: 1;
|
|
403
|
+
margin: auto;
|
|
404
|
+
padding: var(--pd-popup-modal-padding, 20px);
|
|
405
|
+
padding-bottom: 130px;
|
|
406
|
+
border: 2px solid var(--pd-default-col);
|
|
407
|
+
width: 80%;
|
|
408
|
+
max-width: 1200px;
|
|
409
|
+
position: relative;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.modal-content-slot {
|
|
413
|
+
max-width: var(--pd-popup-modal-slot-max-width, 1000px);
|
|
414
|
+
margin: var(--pd-popup-modal-slot-margin, 0 30px);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.close-icon {
|
|
418
|
+
position: absolute;
|
|
419
|
+
cursor: pointer;
|
|
420
|
+
right: 1.2em;
|
|
421
|
+
top: 1.2em;
|
|
422
|
+
}`
|
|
423
|
+
];
|
|
424
|
+
}
|
|
425
|
+
render() {
|
|
426
|
+
return html`
|
|
427
|
+
<!-- Trigger/Open The Modal -->
|
|
428
|
+
<span @click="${this._activatePopup}" @keypress="${this._activatePopup}"
|
|
429
|
+
><slot name="small-view"></slot
|
|
430
|
+
></span>
|
|
431
|
+
|
|
432
|
+
<!-- The Modal -->
|
|
433
|
+
<div id="modalId" class="modal">
|
|
434
|
+
<!-- Modal content -->
|
|
435
|
+
<div class="modal-content">
|
|
436
|
+
<pd-icon icon="${ICON_CLOSE}" class="close-icon"
|
|
437
|
+
@click="${this._closePopup}"></pd-icon>
|
|
438
|
+
<div class="modal-content-slot">
|
|
439
|
+
<slot name="content"></slot>
|
|
440
|
+
</div>
|
|
441
|
+
</div>
|
|
442
|
+
</div>
|
|
443
|
+
`;
|
|
444
|
+
}
|
|
445
|
+
showPopup() {
|
|
446
|
+
this._activatePopup();
|
|
447
|
+
}
|
|
448
|
+
hidePopup() {
|
|
449
|
+
this._closePopup();
|
|
450
|
+
}
|
|
451
|
+
_activatePopup() {
|
|
452
|
+
const modal = this.shadowRoot.getElementById("modalId");
|
|
453
|
+
modal.style.display = "block";
|
|
454
|
+
}
|
|
455
|
+
_closePopup() {
|
|
456
|
+
const modal = this.shadowRoot.getElementById("modalId");
|
|
457
|
+
modal.style.display = "none";
|
|
458
|
+
this.dispatchEvent(
|
|
459
|
+
new CustomEvent("popup-close", {
|
|
460
|
+
bubbles: true,
|
|
461
|
+
composed: true
|
|
462
|
+
})
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
/*
|
|
466
|
+
// When the user clicks anywhere outside of the modal, close it
|
|
467
|
+
window.onclick = function(event) {
|
|
468
|
+
if (event.target == modal) {
|
|
469
|
+
modal.style.display = "none";
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
*/
|
|
473
|
+
}
|
|
474
|
+
window.customElements.define("pd-popup", PdPopup);
|
|
475
|
+
/**
|
|
476
|
+
* @license
|
|
477
|
+
* Copyright (c) 2021 PD Progressive Development UG. All rights reserved.
|
|
478
|
+
*/
|
|
479
|
+
class PdOrderSummary extends LitElement {
|
|
480
|
+
/**
|
|
481
|
+
* @event go-to
|
|
482
|
+
*/
|
|
483
|
+
static get styles() {
|
|
484
|
+
return [
|
|
485
|
+
PDFontStyles,
|
|
486
|
+
PDColorStyles,
|
|
487
|
+
css`
|
|
488
|
+
:host {
|
|
489
|
+
display: block;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
h3 {
|
|
493
|
+
color: var(--pd-default-font-title-col);
|
|
494
|
+
font-family: var(--pd-default-font-title-family);
|
|
495
|
+
font-size: 1.5em;
|
|
496
|
+
/*margin-top: 10px;
|
|
497
|
+
margin-bottom: 20px;*/
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.edit-summary-container {
|
|
501
|
+
display: flex;
|
|
502
|
+
flex-flow: column;
|
|
503
|
+
flex-wrap: wrap;
|
|
504
|
+
gap: 1em;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.payment {
|
|
508
|
+
margin-top: 30px;
|
|
509
|
+
padding: 5px;
|
|
510
|
+
background-color: var(--pd-order-summary-payment-bg-col, var(--pd-default-light-col));
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.pay-logo-box {
|
|
514
|
+
display: flex;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.pay-logo {
|
|
518
|
+
max-width: 6rem;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.pricetable {
|
|
522
|
+
padding-top: 20px;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/* Temporär */
|
|
526
|
+
a {
|
|
527
|
+
cursor: pointer;
|
|
528
|
+
font-family: var(--pd-default-font-link-family);
|
|
529
|
+
font-size: var(--pd-default-font-link-size);
|
|
530
|
+
color: var(--pd-default-font-link-col);
|
|
531
|
+
}
|
|
532
|
+
a:hover {
|
|
533
|
+
color: var(--pd-default-font-link-col-hover);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.agree-box {
|
|
537
|
+
padding-top: 20px;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/* Size Elements for small width */
|
|
541
|
+
@media (max-width: 380px) {
|
|
542
|
+
.pay-logo {
|
|
543
|
+
max-width: 5rem;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
`
|
|
547
|
+
];
|
|
548
|
+
}
|
|
549
|
+
static get properties() {
|
|
550
|
+
return {
|
|
551
|
+
orderSteps: { type: Array },
|
|
552
|
+
withPayment: { type: Boolean },
|
|
553
|
+
withAgreement: { type: Boolean },
|
|
554
|
+
order: { type: Object }
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
constructor() {
|
|
558
|
+
super();
|
|
559
|
+
this.orderSteps = [];
|
|
560
|
+
this.order = {};
|
|
561
|
+
}
|
|
562
|
+
firstUpdated() {
|
|
563
|
+
this.addEventListener("edit-content", (e) => {
|
|
564
|
+
this.dispatchEvent(
|
|
565
|
+
new CustomEvent("go-to", {
|
|
566
|
+
detail: {
|
|
567
|
+
step: e.detail.step
|
|
568
|
+
},
|
|
569
|
+
bubbles: true,
|
|
570
|
+
composed: true
|
|
571
|
+
})
|
|
572
|
+
);
|
|
573
|
+
});
|
|
574
|
+
this.addEventListener("validate-form", this._validateForm);
|
|
575
|
+
}
|
|
576
|
+
render() {
|
|
577
|
+
if (!this.order) {
|
|
578
|
+
return html`<p>No order is set</p>`;
|
|
579
|
+
}
|
|
580
|
+
return html`
|
|
581
|
+
<h3>Overzicht</h3>
|
|
582
|
+
<div class="edit-summary-container">
|
|
583
|
+
${this.orderSteps.map((step, index) => {
|
|
584
|
+
switch (step.key) {
|
|
585
|
+
case "zip":
|
|
586
|
+
case "booking":
|
|
587
|
+
return this._getBookingSummary(index + 1, step);
|
|
588
|
+
case "contacts":
|
|
589
|
+
return this._getContactsSummary(index + 1, step);
|
|
590
|
+
default:
|
|
591
|
+
return html`
|
|
592
|
+
<pd-edit-content
|
|
593
|
+
contentTitle="${step.name}"
|
|
594
|
+
stepNumber="${index + 1}"
|
|
595
|
+
.data="${step.data}"
|
|
596
|
+
>
|
|
597
|
+
<slot name="${step.key}"></slot>
|
|
598
|
+
</pd-edit-content>
|
|
599
|
+
`;
|
|
600
|
+
}
|
|
601
|
+
})}
|
|
602
|
+
</div>
|
|
603
|
+
|
|
604
|
+
${this.order.priceData ? html`
|
|
605
|
+
<div class="payment">
|
|
606
|
+
<h3>Facturatie</h3>
|
|
607
|
+
<!--
|
|
608
|
+
<pd-radio-group id="paymentGroupId" style="--group-direction: column;">
|
|
609
|
+
<pd-checkbox name="direct" value="false">
|
|
610
|
+
Pay direct, you will redirected after submit the order
|
|
611
|
+
<div class="pay-logo-box">
|
|
612
|
+
<img class="pay-logo" src="/images/paypal.svg">
|
|
613
|
+
<img class="pay-logo" src="/images/visa.svg">
|
|
614
|
+
<img class="pay-logo" src="/images/mastercard.svg">
|
|
615
|
+
</div>
|
|
616
|
+
</pd-checkbox>
|
|
617
|
+
<pd-checkbox name="bill" value="false">Pay with bill (5€ additional fee)</pd-checkbox>
|
|
618
|
+
</pd-radio-group>
|
|
619
|
+
-->
|
|
620
|
+
<pd-pricetable
|
|
621
|
+
class="pricetable"
|
|
622
|
+
.priceData="${this.order.priceData}"
|
|
623
|
+
></pd-pricetable>
|
|
624
|
+
</div>
|
|
625
|
+
` : ""}
|
|
626
|
+
|
|
627
|
+
${this.withAgreement ? html`
|
|
628
|
+
<pd-form-container id="submitSummaryFormId">
|
|
629
|
+
<pd-form-row>
|
|
630
|
+
<pd-checkbox
|
|
631
|
+
id="agreeConditionsId"
|
|
632
|
+
valueName="agreeId"
|
|
633
|
+
class="agree-box"
|
|
634
|
+
required
|
|
635
|
+
requiredMsg="Ga akkoord met de algemene voorwaarden om uw order te bevestigen."
|
|
636
|
+
>
|
|
637
|
+
Ga akkoord met onze
|
|
638
|
+
<a
|
|
639
|
+
@click="${this._openTermsAndConditions}"
|
|
640
|
+
@keypress="${this._openTermsAndConditions}"
|
|
641
|
+
>algemene voorwaarden</a
|
|
642
|
+
>
|
|
643
|
+
</pd-checkbox>
|
|
644
|
+
</pd-form-row>
|
|
645
|
+
</pd-form-container>
|
|
646
|
+
|
|
647
|
+
<pd-popup id="agreePopupId">
|
|
648
|
+
<div slot="content"><slot name="legal"></slot></div>
|
|
649
|
+
</pd-popup>
|
|
650
|
+
` : ""}
|
|
651
|
+
`;
|
|
652
|
+
}
|
|
653
|
+
_validateForm(e) {
|
|
654
|
+
if (e.detail && !e.detail.singleElement && this.withAgreement) {
|
|
655
|
+
this.shadowRoot.getElementById("submitSummaryFormId").dispatchEvent(
|
|
656
|
+
new CustomEvent("validate-form", {
|
|
657
|
+
detail: e.detail
|
|
658
|
+
})
|
|
659
|
+
);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
_getBookingSummary(index, step) {
|
|
663
|
+
let date;
|
|
664
|
+
if (this.order.selectedDate) {
|
|
665
|
+
date = format(this.order.selectedDate, "DD/MM/YYYY");
|
|
666
|
+
}
|
|
667
|
+
const bookingData = [{ name: "Postcode:", val: this.order.zip }];
|
|
668
|
+
if (date) {
|
|
669
|
+
bookingData.push({ name: "Datum van herstelling:", val: date });
|
|
670
|
+
}
|
|
671
|
+
return html`
|
|
672
|
+
<pd-edit-content
|
|
673
|
+
contentTitle="${step.name}"
|
|
674
|
+
stepNumber="${index}"
|
|
675
|
+
.data="${bookingData}"
|
|
676
|
+
>
|
|
677
|
+
</pd-edit-content>
|
|
678
|
+
`;
|
|
679
|
+
}
|
|
680
|
+
_getContactsSummary(index, step) {
|
|
681
|
+
return html`
|
|
682
|
+
<pd-edit-content
|
|
683
|
+
contentTitle="${step.name}"
|
|
684
|
+
stepNumber="${index}"
|
|
685
|
+
?editDisabled="${this.order.withLogin}"
|
|
686
|
+
>
|
|
687
|
+
${this.order.contacts ? html`
|
|
688
|
+
<pd-order-contacts
|
|
689
|
+
?withPayment="${this.withPayment}"
|
|
690
|
+
.orderContact="${this.order.contacts.orderContact}"
|
|
691
|
+
.billingContact="${this.order.contacts.billingContact}"
|
|
692
|
+
summary
|
|
693
|
+
>
|
|
694
|
+
</pd-order-contacts>
|
|
695
|
+
` : ""}
|
|
696
|
+
</pd-edit-content>
|
|
697
|
+
`;
|
|
698
|
+
}
|
|
699
|
+
_openTermsAndConditions(e) {
|
|
700
|
+
this.shadowRoot.getElementById("agreePopupId").showPopup();
|
|
701
|
+
e.stopPropagation();
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
window.customElements.define("pd-order-summary", PdOrderSummary);
|