wickes-css2 2.94.0-develop.1 → 2.94.0-develop.3

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.
Files changed (68) hide show
  1. package/Readme.md +1 -1
  2. package/build/css/category-main.css +1 -1
  3. package/build/css/homepage-main.css +1 -1
  4. package/build/css/main.css +1 -1
  5. package/build/css/my-account-main-v2.css +1 -1
  6. package/build/css/my-account-main.css +1 -1
  7. package/build/css/pages/my-account.css +1 -1
  8. package/build/css/pages/page_default-store.css +1 -0
  9. package/build/css/pages/page_personal-details.css +1 -1
  10. package/build/css/pages/page_product-details-v2-critical.css +1 -1
  11. package/build/css/pages/page_product-details-v2.css +1 -1
  12. package/build/css/pages/page_shopping-cart-v2.css +1 -1
  13. package/build/css/pdp-main-before-combine.css +1 -1
  14. package/build/css/pdp-main-critical.css +1 -1
  15. package/build/css/pdp-main-non-critical.css +1 -1
  16. package/build/css/pdp-main.css +1 -1
  17. package/build/css/plp-main.css +1 -1
  18. package/build/css/store-locator-main.css +1 -1
  19. package/build/js/account-members.min.js +1 -1
  20. package/build/js/basket.min.js +1 -1
  21. package/build/js/bundle.min.js +1 -1
  22. package/build/js/checkout.min.js +1 -1
  23. package/build/js/default-store.min.js +1 -0
  24. package/build/js/emulation.min.js +99 -3
  25. package/build/js/general.bundle.min.js +1 -1
  26. package/build/js/merged-checkout.min.js +1 -1
  27. package/build/js/page/default-store.js +44 -0
  28. package/build/js/page/personal-details.js +105 -36
  29. package/build/js/page/plp-load-more.js +1 -0
  30. package/build/js/pdp.bundle.min.js +1 -1
  31. package/build/js/personal-details.min.js +1 -1
  32. package/build/js/plp.bundle.min.js +1 -1
  33. package/build/js/project-list.min.js +1 -1
  34. package/package.json +1 -1
  35. package/src/components/account-families/actions-bar.hbs +3 -3
  36. package/src/components/default-store/current-store.hbs +60 -0
  37. package/src/components/default-store/list-of-store.hbs +39 -0
  38. package/src/components/default-store/store-form.hbs +29 -0
  39. package/src/components/default-store/store-unavailable.hbs +4 -0
  40. package/src/components/my-account/personal-details-form.hbs +5 -0
  41. package/src/components/store-details.hbs +22 -20
  42. package/src/components/store-preview.hbs +0 -11
  43. package/src/components/user-information-field.hbs +1 -1
  44. package/src/data/data_big-wins-stores.json +0 -22
  45. package/src/data/my-account/data_personal-details.json +36 -11
  46. package/src/data/my-account/page_default-store.json +158 -0
  47. package/src/elements/input.hbs +2 -2
  48. package/src/js/components/general/switchVat.js +27 -1
  49. package/src/js/components/leave-event.js +41 -2
  50. package/src/js/emulation/big-wins.js +0 -2
  51. package/src/js/emulation/default-store.js +97 -0
  52. package/src/js/emulation/forms.js +1 -1
  53. package/src/js/page/default-store.js +44 -0
  54. package/src/js/page/personal-details.js +105 -36
  55. package/src/js/page/plp-load-more.js +1 -0
  56. package/src/page_default-store-page-empty.html +48 -0
  57. package/src/page_default-store-page.html +55 -0
  58. package/src/page_personal-details-installer.html +17 -7
  59. package/src/page_personal-details.html +15 -7
  60. package/src/page_wismo-order-history-loadmore.html +3 -3
  61. package/src/scss/components/_big-wins-critical.scss +0 -1
  62. package/src/scss/components/_big-wins.scss +1 -8
  63. package/src/scss/components/_order-item-cc.scss +0 -6
  64. package/src/scss/pages/_my-account_new.scss +1 -12
  65. package/src/scss/pages/page_default-store.scss +633 -0
  66. package/src/scss/pages/page_personal-details.scss +37 -5
  67. package/src/scss/partials/_header.scss +5 -0
  68. package/src/sitemap.html +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wickes-css2",
3
- "version": "2.94.0-develop.1",
3
+ "version": "2.94.0-develop.3",
4
4
  "description": "CSS and JS and page templates in use by Wickes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,15 +1,15 @@
1
- <div class="actions-bar {{mod}}">
1
+ <div class="actions-bar {{this.mod}}">
2
2
  {{#each buttons}}
3
3
  {{#if url}}
4
4
  <a
5
- class="btn btn_full {{#if isPrimary}}btn-primary{{/if}} {{#if isSecondary}}btn-secondary{{/if}} {{mod}}"
5
+ class="btn btn_full {{#if isPrimary}}btn-primary{{/if}} {{#if isSecondary}}btn-secondary{{/if}} {{this.mod}}"
6
6
  href="{{url}}"
7
7
  >
8
8
  {{title}}
9
9
  </a>
10
10
  {{else}}
11
11
  <button
12
- class="btn btn_full {{#if isPrimary}}btn-primary{{/if}} {{#if isSecondary}}btn-secondary{{/if}} {{mod}}"
12
+ class="btn btn_full {{#if isPrimary}}btn-primary{{/if}} {{#if isSecondary}}btn-secondary{{/if}} {{this.mod}}"
13
13
  {{#if toggle-modal}}
14
14
  data-toggle="modal"
15
15
  data-target="{{target}}"
@@ -0,0 +1,60 @@
1
+ <div class="current-store">
2
+ <p class="current-store__default">Your default store</p>
3
+ <h3 class="current-store__name">{{name}}</h3>
4
+ <p class="current-store__address">{{address}}</p>
5
+ <p class="current-store__phone">Phone: {{phone}}</p>
6
+ <a class="current-store__link" href="#">View store details</a>
7
+ <div class="current-store__hours">
8
+ <div class="current-store__hours-section">
9
+ <p class="title-section">Opening times</p>
10
+ <ul class="opening-times collapse" id="openingTimes">
11
+ {{#each openingTimes}}
12
+ <li class="opening-times__item">
13
+ <span class="opening-times__day">
14
+ {{day}}
15
+ </span>
16
+ <span class="opening-times__time">
17
+ {{time}}
18
+ </span>
19
+ </li>
20
+ {{/each}}
21
+ </ul>
22
+ </div>
23
+ <div class="current-store__hours-section current-store__hours-section--special">
24
+ <p class="title-section">Special opening times</p>
25
+ <ul class="special-times collapse" id="specialTimes">
26
+ {{#each specialOpeningTimes}}
27
+ <li class="special-times__item">
28
+ <div class="special-times__days">
29
+ <span class="special-times__name">
30
+ {{name}}
31
+ </span>
32
+ <span class="special-times__day">
33
+ {{day}}
34
+ </span>
35
+ </div>
36
+ <span class="special-times__time">
37
+ {{time}}
38
+ </span>
39
+ </li>
40
+ {{/each}}
41
+ </ul>
42
+ </div>
43
+ <div class="current-store__hours-section current-store__hours-section--facilities">
44
+ <p class="title-section">Facilities</p>
45
+ <ul class="facilities collapse" id="facilities">
46
+ {{#each facilities}}
47
+ <li class="facilities__item">
48
+ <span class="facilities__icon-container">
49
+ <i class="{{icon}} facilities__icon"></i>
50
+ </span>
51
+ <span class="facilities__title">{{title}}</span>
52
+ </li>
53
+ {{/each}}
54
+ </ul>
55
+ </div>
56
+ <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#openingTimes, #specialTimes, #facilities" aria-expanded="false" aria-controls="openingTimes specialTimes facilities">
57
+ <i class="far fa-angle-down icon"></i>
58
+ </button>
59
+ </div>
60
+ </div>
@@ -0,0 +1,39 @@
1
+ <form action="#" class="list-of-store" style="{{style}}">
2
+ <div class="bw">
3
+ <div class="bw__stock stock">
4
+ <ul class="stock__list">
5
+ {{#each bigWins.stores}}
6
+ <li class="stock__item">
7
+ <div class="stock__radio">
8
+ {{> radiobutton name="store" id="stock-store" checked=checked}}
9
+ </div>
10
+ {{> store-preview
11
+ class="stock__store"
12
+ id=id
13
+ myAcc=true
14
+ name=name
15
+ distance=distance
16
+ }}
17
+ </li>
18
+ {{/each}}
19
+ {{#each bigWins.stores}}
20
+ {{> store-details
21
+ distance = distance
22
+ distanceUom = distanceUom
23
+ name = name
24
+ phone = phone
25
+ postcode = postcode
26
+ }}
27
+ {{/each}}
28
+ </ul>
29
+ </div>
30
+ </div>
31
+ <div class="bw_act">
32
+ <a href="#" class="btn btn-primary btn_full my-account_add-store">
33
+ Add default store
34
+ </a>
35
+ <a href="#" class="btn btn-outline-primary btn_full my-account_cancel-store">
36
+ Cancel
37
+ </a>
38
+ </div>
39
+ </form>
@@ -0,0 +1,29 @@
1
+ <form action="#" class="search-store" data-clearable>
2
+ <div class="form-row form-row--clear-input" data-row-required>
3
+ <label class="search-store__label" for="{{id}}">{{label}}</label>
4
+ <div class="search-store__wrap">
5
+ <div class="form-row__field search-store__input">
6
+ <input
7
+ class="input"
8
+ id="{{id}}"
9
+ aria-label="{{id}}"
10
+ type="text"
11
+ name="text"
12
+ placeholder="{{placeholder}}"
13
+ autocomplete="off"
14
+ >
15
+ <button class="btn btn-secondary btn--clear" type="button">
16
+ <i class="{{iconCross}} icon"></i>
17
+ </button>
18
+ <button class="btn btn-search" type="submit">
19
+ <i class="{{iconSearch}} icon"></i>
20
+ </button>
21
+ </div>
22
+ <button type="button" class="btn btn-primary btn--location" id="geoLocationIcon">
23
+ <i class="{{iconLocation}} icon"></i>
24
+ <i class="{{iconError}} icon-error" style="display: none;"></i>
25
+ </button>
26
+ </div>
27
+ <div class="form-row__error" style="display: none">{{error}}</div>
28
+ </div>
29
+ </form>
@@ -0,0 +1,4 @@
1
+ <div class="store-unavailable {{mod}}">
2
+ <h3 class="store-unavailable__title">{{title}}</h3>
3
+ <i class="{{icon}} icon"></i>
4
+ </div>
@@ -8,12 +8,17 @@
8
8
  label=this.label
9
9
  value=this.value
10
10
  placeholder=this.placeholder
11
+ input-mod=this.modificator
11
12
  required=this.required
12
13
  row-mod=this.rowMod
13
14
  options=this.options
14
15
  selectedIndex=this.selectedIndex
16
+ data-tag=this.dataTag
15
17
  }}
16
18
  {{/each}}
19
+ {{#if isInstaller}}
20
+ <input id="tradeTypeHidden" type="hidden" name="tradeTypeValue" value="installer" data-tag="trade-type-value">
21
+ {{/if}}
17
22
  <div class="user-form__ctas">
18
23
  {{#each buttons}}
19
24
  <button class="{{this.class}}" type="{{this.type}}" data-action="{{this.dataAction}}">
@@ -66,28 +66,30 @@
66
66
  </table>
67
67
  </div>
68
68
  {{#unless defStore}}
69
+ {{#if specialOpeningTimes}}
69
70
  <div class="s-details__open">
70
- <p class="s-details__open_title">
71
- Special opening times
72
- </p>
73
- <table class="s-details__table s-details__table_special">
74
- {{#each specialOpeningTimes}}
75
- <tr class="s-details__table_row" >
76
- <td class="s-details__table_cell">
77
- {{name}}
78
- </td>
79
- <td class="s-details__table_cell s-details__table_time" rowspan="2">
80
- {{time}}
81
- </td>
82
- </tr>
83
- <tr class="s-details__table_row s-details__table_day">
84
- <td class="s-details__table_cell">
85
- {{day}}
86
- </td>
87
- </tr>
88
- {{/each}}
89
- </table>
71
+ <p class="s-details__open_title">
72
+ Special opening times
73
+ </p>
74
+ <table class="s-details__table s-details__table_special">
75
+ {{#each specialOpeningTimes}}
76
+ <tr class="s-details__table_row" >
77
+ <td class="s-details__table_cell">
78
+ {{name}}
79
+ </td>
80
+ <td class="s-details__table_cell s-details__table_time" rowspan="2">
81
+ {{time}}
82
+ </td>
83
+ </tr>
84
+ <tr class="s-details__table_row s-details__table_day">
85
+ <td class="s-details__table_cell">
86
+ {{day}}
87
+ </td>
88
+ </tr>
89
+ {{/each}}
90
+ </table>
90
91
  </div>
92
+ {{/if}}
91
93
  {{/unless}}
92
94
  </div>
93
95
  </div>
@@ -26,17 +26,6 @@
26
26
  {{ address }}
27
27
  </div>
28
28
  {{/if}}
29
- <div class="store__act">
30
- <span class="icon store__marker">
31
- <i class="far fa-map-marker-alt"></i>
32
- </span>
33
- <span class="icon store__tick">
34
- <i class="far fa-check"></i>
35
- </span>
36
- <a href="#" class="store-state">
37
- Make this your default store
38
- </a>
39
- </div>
40
29
  </div>
41
30
  <div class="store__details">
42
31
  <div class="store__dist">
@@ -1,4 +1,4 @@
1
1
  <li class="user-information__item">
2
2
  <label class="user-information__label">{{label}}</label>
3
- <p class="user-information__value">{{value}}</p>
3
+ <p class="user-information__value">{{textField}}</p>
4
4
  </li>
@@ -40,28 +40,6 @@
40
40
  "day": "Friday",
41
41
  "time": "07:00 - 18:00"
42
42
  }
43
- ],
44
- "specialOpeningTimes": [
45
- {
46
- "name": "Good Friday",
47
- "day": "Fri 10 Apr",
48
- "time": "6.30 - 21.00"
49
- },
50
- {
51
- "name": "Saturday",
52
- "day": "Sat 11 Apr",
53
- "time": "6.30 - 21.00"
54
- },
55
- {
56
- "name": "Easter Sunday",
57
- "day": "Sun 12 Apr",
58
- "time": "CLOSED"
59
- },
60
- {
61
- "name": "Easter Monday",
62
- "day": "Mon 13 Apr",
63
- "time": "06.30 - 21.00"
64
- }
65
43
  ]
66
44
  },
67
45
  {
@@ -23,6 +23,30 @@
23
23
  "buttons": [
24
24
  {
25
25
  "title": "Cancel",
26
+ "data-action": "cancel-reset",
27
+ "isPrimary": true,
28
+ "close-modal": true
29
+ },
30
+ {
31
+ "mod": "btn-continue",
32
+ "data-action": "reset-details",
33
+ "title": "Yes, continue",
34
+ "isSecondary": true,
35
+ "link": "./page_my-account_change-password.html"
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ "reset-popup": {
41
+ "title": "Your personal details won’t be saved",
42
+ "headerIcon": "fas fa-exclamation-circle",
43
+ "description": "Are you sure you want to continue?",
44
+ "actions": {
45
+ "mod": "actions",
46
+ "buttons": [
47
+ {
48
+ "title": "Cancel",
49
+ "data-action": "cancel-reset",
26
50
  "isPrimary": true,
27
51
  "close-modal": true
28
52
  },
@@ -52,7 +76,7 @@
52
76
  ],
53
77
  "currentData": {
54
78
  "Title": "Mr",
55
- "Fist name": "James",
79
+ "First name": "James",
56
80
  "Surname": "Smith",
57
81
  "Email address": "james_smith@gmail.com",
58
82
  "How would you describe yourself or your main trade": "DIY"
@@ -66,9 +90,9 @@
66
90
  "rowMod": "row-title",
67
91
  "required": true,
68
92
  "options": [
69
- { "value": "Mr", "label": "Mr" },
70
- { "value": "Mrs", "label": "Mrs" },
71
- { "value": "Dr", "label": "Dr" }
93
+ { "value": "mr", "label": "Mr" },
94
+ { "value": "mrs", "label": "Mrs" },
95
+ { "value": "dr", "label": "Dr" }
72
96
  ],
73
97
  "selectedIndex": "0"
74
98
  },
@@ -101,8 +125,8 @@
101
125
  "placeholder": "DIY",
102
126
  "required": true,
103
127
  "options": [
104
- { "value": "DIY", "label": "DIY" },
105
- { "value": "TradePro", "label": "Trade Pro" }
128
+ { "value": "diy", "label": "DIY" },
129
+ { "value": "tradepro", "label": "Trade Pro" }
106
130
  ],
107
131
  "selectedIndex": "0"
108
132
  }
@@ -125,7 +149,7 @@
125
149
  ],
126
150
  "currentData": {
127
151
  "Title": "Mr",
128
- "Fist name": "James",
152
+ "First name": "James",
129
153
  "Surname": "Smith",
130
154
  "Email address": "james_smith@gmail.com",
131
155
  "Trade type": "Installer"
@@ -139,9 +163,9 @@
139
163
  "rowMod": "row-title",
140
164
  "required": true,
141
165
  "options": [
142
- { "value": "Mr", "label": "Mr" },
143
- { "value": "Mrs", "label": "Mrs" },
144
- { "value": "Dr", "label": "Dr" }
166
+ { "value": "mr", "label": "Mr" },
167
+ { "value": "mrs", "label": "Mrs" },
168
+ { "value": "dr", "label": "Dr" }
145
169
  ],
146
170
  "selectedIndex": "0"
147
171
  },
@@ -171,7 +195,8 @@
171
195
  "id": "tradeType",
172
196
  "label": "Trade type",
173
197
  "value": "Installer",
174
- "disabled": true
198
+ "dataTag": "trade-type-value",
199
+ "modificator": "disabled"
175
200
  }
176
201
  ]
177
202
  }
@@ -0,0 +1,158 @@
1
+ {
2
+ "default-store": {
3
+ "title": "Default Store",
4
+ "subtitle": "Add default store",
5
+ "subtitleChange": "Change default store",
6
+ "searchField": {
7
+ "id": "postcode",
8
+ "label": "Search by postcode/town name",
9
+ "placeholder": "Postcode / city",
10
+ "iconSearch": "fas fa-search",
11
+ "iconLocation": "fas fa-crosshairs",
12
+ "iconError": "fas fa-exclamation-triangle",
13
+ "iconCross": "far fa-times fa-lg",
14
+ "error": "Check that you’ve entered a valid postcode or place name"
15
+ },
16
+ "unavailable": {
17
+ "title": "You have no default store",
18
+ "icon": "fas fa-warehouse"
19
+ },
20
+ "breadcrumbs": [
21
+ {
22
+ "url": "/",
23
+ "text": "Home"
24
+ },
25
+ {
26
+ "url": "/page_my-account.html",
27
+ "text": "My Account"
28
+ },
29
+ {
30
+ "url": "/page_default-store-page.html",
31
+ "text": "Default Store"
32
+ }
33
+ ],
34
+ "menu": [
35
+ {
36
+ "icon": "fas fa-user",
37
+ "title": "My Account",
38
+ "link": "./page_my-account.html"
39
+ },
40
+ {
41
+ "icon": "fas fa-box-open",
42
+ "link": "./page_my-account_order-history.html",
43
+ "title": "My Orders",
44
+ "description": "View and manage your orders."
45
+ },
46
+ {
47
+ "icon": "fas fa-address-card",
48
+ "link": "./page_my-account_personal-details.html",
49
+ "title": "Personal Details",
50
+ "description": "View and update your Personal Details."
51
+ },
52
+ {
53
+ "icon": "fas fa-book",
54
+ "link": "./page_my-account_address-book.html",
55
+ "title": "Address Book",
56
+ "description": "Manage your delivery addresses."
57
+ },
58
+ {
59
+ "icon": "fas fa-sliders-h",
60
+ "link": "./page_marketing-preferences.html",
61
+ "title": "Marketing Preferences",
62
+ "description": "Manage how you would like to receive the latest offers and deals."
63
+ },
64
+ {
65
+ "icon": "fas fa-list",
66
+ "link": "./page_my-shopping-list.html",
67
+ "title": "Project Lists",
68
+ "description": "Save products to your project lists."
69
+ },
70
+ {
71
+ "icon": "fas fa-warehouse",
72
+ "link": "./page_default-store-page.html",
73
+ "title": "Default Store",
74
+ "description": "Set your default store."
75
+ }
76
+ ],
77
+ "currentStore": {
78
+ "id": 1,
79
+ "name": "Blackheath",
80
+ "phone": "01869 356200",
81
+ "address": "271 Winchester Road, Southampton, Hampshire, SO16 6TP",
82
+ "facilities": [
83
+ {
84
+ "title": "Burger van",
85
+ "icon": "fas fa-burger-soda"
86
+ },
87
+ {
88
+ "title": "Kitchen & bathroom displays",
89
+ "icon": "fas fa-drafting-compass"
90
+ },
91
+ {
92
+ "title": "Installation service",
93
+ "icon": "fas fa-user-hard-hat"
94
+ },
95
+ {
96
+ "title": "Design appointments",
97
+ "icon": "fas fa-user-friends"
98
+ },
99
+ {
100
+ "title": "Paint mixing",
101
+ "icon": "fas fa-paint-roller"
102
+ }
103
+ ],
104
+ "openingTimes": [
105
+ {
106
+ "day": "Monday",
107
+ "time": "07:00 AM - 08:00 PM"
108
+ },
109
+ {
110
+ "day": "Tuesday",
111
+ "time": "07:00 AM - 08:00 PM"
112
+ },
113
+ {
114
+ "day": "Wednesday",
115
+ "time": "07:00 AM - 08:00 PM"
116
+ },
117
+ {
118
+ "day": "Thursday",
119
+ "time": "07:00 AM - 08:00 PM"
120
+ },
121
+ {
122
+ "day": "Friday",
123
+ "time": "07:00 AM - 08:00 PM"
124
+ },
125
+ {
126
+ "day": "Saturday",
127
+ "time": "07:00 AM - 08:00 PM"
128
+ },
129
+ {
130
+ "day": "Sunday",
131
+ "time": "10:00 AM - 04:00 PM"
132
+ }
133
+ ],
134
+ "specialOpeningTimes": [
135
+ {
136
+ "name": "Good Friday",
137
+ "day": "Fri 10 Apr",
138
+ "time": "10:00 AM - 4:00 PM"
139
+ },
140
+ {
141
+ "name": "Saturday",
142
+ "day": "Sat 11 Apr",
143
+ "time": "Closed"
144
+ },
145
+ {
146
+ "name": "Easter Sunday",
147
+ "day": "Sun 12 Apr",
148
+ "time": "Closed"
149
+ },
150
+ {
151
+ "name": "Easter Monday",
152
+ "day": "Mon 13 Apr",
153
+ "time": "10:00 AM - 4:00 PM"
154
+ }
155
+ ]
156
+ }
157
+ }
158
+ }
@@ -1,7 +1,7 @@
1
1
  {{#if textarea}}
2
2
  <textarea class="tbx {{#if textarea}}tbx_textarea{{/if}} {{#if error}}tbx_error{{/if}}" rows="{{textareaRows}}" cols="{{textareaCols}}" value="{{value}}" maxlength="{{maxlength}}" id="{{id}}" name="{{#if name}}{{name}}{{else}}{{id}}{{/if}}" {{#if disabled}}disabled{{/if}}></textarea>
3
3
  {{else if type}}
4
- <input type="{{type}}" class="tbx {{#if error}}tbx_error{{/if}}" value="{{value}}" id="{{id}}" name="{{#if name}}{{name}}{{else}}{{id}}{{/if}}" {{#if (or locked disabled)}}disabled{{/if}} {{#if need-pattern}}pattern=""{{/if}} {{#if readonly}}readonly{{/if}}>
4
+ <input type="{{type}}" class="tbx {{#if error}}tbx_error{{/if}} {{input-mod}}" value="{{value}}" id="{{id}}" name="{{#if name}}{{name}}{{else}}{{id}}{{/if}}" {{#if (or locked disabled)}}disabled{{/if}} {{#if need-pattern}}pattern=""{{/if}} {{#if readonly}}readonly{{/if}} {{#if data-tag}}data-tag="{{data-tag}}"{{/if}}>
5
5
  {{else}}
6
- <input type="text" class="tbx {{#if error}}tbx_error{{/if}}" value="{{value}}" id="{{id}}" name="{{#if name}}{{name}}{{else}}{{id}}{{/if}}" placeholder="{{placeholder}}" {{#if (or locked disabled)}}disabled{{/if}} {{#if need-pattern}}pattern=""{{/if}} {{#if readonly}}readonly{{/if}}>
6
+ <input type="text" class="tbx {{#if error}}tbx_error{{/if}} {{input-mod}}" value="{{value}}" id="{{id}}" name="{{#if name}}{{name}}{{else}}{{id}}{{/if}}" placeholder="{{placeholder}}" {{#if (or locked disabled)}}disabled{{/if}} {{#if need-pattern}}pattern=""{{/if}} {{#if readonly}}readonly{{/if}} {{#if data-tag}}data-tag="{{data-tag}}"{{/if}}>
7
7
  {{/if}}
@@ -36,7 +36,11 @@ Wick.VatToggle = {
36
36
  },
37
37
 
38
38
  getSwitcherState: function() {
39
- return !!$(Wick.VatToggle.el.switchVatInput).attr('checked');
39
+ if ($(Wick.VatToggle.el.switchVatInput).length) {
40
+ return !!$(Wick.VatToggle.el.switchVatInput).attr('checked');
41
+ } else {
42
+ return null;
43
+ }
40
44
  },
41
45
 
42
46
  createToggleEvent: function(isToggled) {
@@ -65,6 +69,28 @@ Wick.VatToggle = {
65
69
  $(includingVatEl).toggleClass(hiddenClassName);
66
70
  $(excludingVat).toggleClass(hiddenClassName);
67
71
  },
72
+ reapplyDisplayClass: function () {
73
+ const includingVatEl = Wick.VatToggle.el.includingVat;
74
+ const excludingVatEl = Wick.VatToggle.el.excludingVat;
75
+ const hiddenClassName = Wick.VatToggle.HIDDEN_CLASS_NAME;
76
+
77
+ let vatState = null;
78
+
79
+ // check switcher state for web or cookie for app
80
+ if (Wick.VatToggle.getSwitcherState() !== null) {
81
+ vatState = Wick.VatToggle.getSwitcherState();
82
+ } else {
83
+ vatState = Wick.VatToggle.isOn();
84
+ }
85
+
86
+ if (vatState) {
87
+ $(includingVatEl).addClass(hiddenClassName);
88
+ $(excludingVatEl).removeClass(hiddenClassName);
89
+ } else {
90
+ $(includingVatEl).removeClass(hiddenClassName);
91
+ $(excludingVatEl).addClass(hiddenClassName);
92
+ }
93
+ },
68
94
 
69
95
  updateGlobalClass: function () {
70
96
  const includingVatGlobal = Wick.VatToggle.el.includingVatGlobalClass;
@@ -26,15 +26,54 @@ Wick.LeaveEvent = {
26
26
  const currentState = Wick.LeaveEvent.getState(form);
27
27
  const isDifferent = !_.isEqual(currentState, Wick.LeaveEvent.initialFormState);
28
28
 
29
- if (isDifferent) {
29
+ const csrfTokenCheck = Wick.LeaveEvent.isCsrfTokenEqual(currentState, Wick.LeaveEvent.initialFormState);
30
+
31
+ if (isDifferent && (csrfTokenCheck || csrfTokenCheck === undefined)) {
30
32
  return Wick.LeaveEvent.LEAVE_MESSAGE;
31
33
  }
32
34
  },
35
+ isCsrfTokenEqual(currentState, initialFormState) {
36
+ const csrfTokenCurrentState = currentState.find(item => item.name === 'CSRFToken')?.value;
37
+ const csrfTokenNewState = initialFormState.find(item => item.name === 'CSRFToken')?.value;
38
+
39
+ return csrfTokenCurrentState === csrfTokenNewState;
40
+ },
33
41
  showCustomModal() {
34
42
  $(Wick.LeaveEvent.el.leavePopup).modal('show')
35
43
  },
36
44
  getState(form) {
37
- return $(form).serializeArray();
45
+ let arrForm = $(form).serializeArray();
46
+ arrForm = Wick.LeaveEvent.processSerializedArr(arrForm, form);
47
+ return arrForm;
48
+ },
49
+ processSerializedArr(arrForm, form) {
50
+ arrForm = arrForm.map((item) => {
51
+ let element = $(form).find(`[name="${item.name}"]`);
52
+
53
+ if (element.attr("data-tag")) {
54
+ let dataTagValue = element.attr("data-tag");
55
+ let similarElements = $(form).find(`[data-tag="${dataTagValue}"]`);
56
+ let hiddenElement = similarElements.filter(`[type="hidden"]`);
57
+
58
+ if (hiddenElement.length) {
59
+ let previousElement = similarElements.not(`[type="hidden"]`);
60
+ let previousValue = previousElement.val();
61
+ item.value = hiddenElement.val();
62
+ item.text = previousValue;
63
+ }
64
+ } else if (element.prop("tagName").toLowerCase() === "select") {
65
+ item.value = element.find("option:selected").val();
66
+ item.text = element.find("option:selected").text();
67
+ }
68
+
69
+ if (item.name === "email" && item.value) {
70
+ item.value = item.value.toLowerCase();
71
+ }
72
+
73
+ return item;
74
+ });
75
+
76
+ return arrForm;
38
77
  },
39
78
  checkLeavePopup() {
40
79
  if (Wick.LeaveEvent.proceedBrowserLeave) {