wickes-css2 2.102.0 → 2.103.0-gift-cards.1
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/Readme.md +1 -3
- package/build/css/components/checkout-payment-details-v2.css +1 -1
- package/build/css/pages/page_checkout_delivery-new.css +1 -1
- package/build/img/giftcard.svg +28 -0
- package/build/js/account-members.min.js +1 -1
- package/build/js/basket.min.js +1 -1
- package/build/js/bundle.min.js +1 -1
- package/build/js/checkout.min.js +1 -1
- package/build/js/emulation.min.js +66 -16
- package/build/js/gift-cards.min.js +1 -0
- package/build/js/merged-checkout.min.js +1 -1
- package/build/js/page/components/gift-cards.js +610 -0
- package/build/js/page/components/toggle-password-visibility.js +22 -0
- package/build/js/page/utils/gift-cards-utils.js +43 -0
- package/build/js/page/utils/show-hide-input.js +28 -0
- package/build/js/project-list.min.js +1 -1
- package/build/js/toggle-password-visibility.min.js +1 -0
- package/package.json +2 -2
- package/src/components/checkout-payment-details-v2.hbs +2 -1
- package/src/components/gift-cards-hint.hbs +9 -0
- package/src/components/gift-cards.hbs +89 -0
- package/src/components/giftcard-chip.hbs +23 -0
- package/src/elements/form-row.hbs +1 -1
- package/src/elements/input.hbs +31 -2
- package/src/img/giftcard.svg +28 -0
- package/src/js/emulation/checkout-data.js +35 -0
- package/src/js/emulation/checkout-payment-details.js +23 -14
- package/src/js/emulation/forms.js +7 -2
- package/src/js/page/components/gift-cards.js +610 -0
- package/src/js/page/components/toggle-password-visibility.js +22 -0
- package/src/js/page/utils/gift-cards-utils.js +43 -0
- package/src/js/page/utils/show-hide-input.js +28 -0
- package/src/page_my-account_change-password.html +1 -0
- package/src/page_payment-details-with-gift-card.html +2 -1
- package/src/scss/components/_gift-cards.scss +357 -0
- package/src/scss/components/checkout-payment-details-v2.scss +2 -0
- package/src/scss/pages/page_checkout_delivery-new.scss +19 -0
- package/src/js/components/toggle-password-visibility.js +0 -58
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function i(o,r,s){function u(t,e){if(!r[t]){if(!o[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(a)return a(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}n=r[t]={exports:{}},o[t][0].call(n.exports,function(e){return u(o[t][1][e]||e)},n,n.exports,i,o,r,s)}return r[t].exports}for(var a="function"==typeof require&&require,e=0;e<s.length;e++)u(s[e]);return u}({1:[function(e,t,n){"use strict";var i=e("../utils/show-hide-input"),o=window.Wick||{};o.TogglePasswordVisibility={el:{$containers:$(".form-row[data-show-content] .input-wrap")},init:function(){this.el.$containers.length&&this.el.$containers.each(function(){(0,i.initializeInputToggle)($(this))})}},$(document).ready(function(){o.TogglePasswordVisibility.init()})},{"../utils/show-hide-input":2}],2:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.initializeInputToggle=function(e){var n=e.find("input"),i=e.find(".toggle-show");n.length&&i.length&&(e=function(){i.toggle(0<(n.val()||"").length)},i.off("click.passwordToggle mousedown.passwordToggle").on("mousedown.passwordToggle",function(e){e.preventDefault();var e="password"===String(n.attr("type")),t=(n.attr("type",e?"text":"password"),i.find("svg, i").first());t.length&&t.removeClass("fa-eye fa-eye-slash").addClass(e?"fa-eye":"fa-eye-slash")}),n.off("input.passwordToggle").on("input.passwordToggle",e),e())}},{}]},{},[1]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wickes-css2",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.103.0-gift-cards.1",
|
|
4
4
|
"description": "CSS and JS and page templates in use by Wickes",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"branches": [
|
|
109
109
|
"alt-master",
|
|
110
110
|
{
|
|
111
|
-
"name": "
|
|
111
|
+
"name": "custom-tag/gift-cards",
|
|
112
112
|
"prerelease": "${name.replace(/^custom-tag\\//g, '')}"
|
|
113
113
|
}
|
|
114
114
|
],
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
</div>
|
|
121
121
|
{{/if}}
|
|
122
122
|
<div class="form-row">
|
|
123
|
-
<div class="form-row__field">
|
|
123
|
+
<div class="form-row__field form-row__field-paypal">
|
|
124
124
|
<label class="rbn rbn_align" for="checkout-payment-details-paypal">
|
|
125
125
|
<input type="radio" id="checkout-payment-details-paypal" name="payment-method" value="paypal">
|
|
126
126
|
<ins></ins>
|
|
@@ -128,6 +128,7 @@
|
|
|
128
128
|
</label>
|
|
129
129
|
</div>
|
|
130
130
|
</div>
|
|
131
|
+
{{> gift-cards }}
|
|
131
132
|
</div>
|
|
132
133
|
</div>
|
|
133
134
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<p class="{{hintClass}}">
|
|
2
|
+
{{#if canAdd}}
|
|
3
|
+
<span class="giftcard-summary__add js-giftcard-add">Add another Gift Card</span>
|
|
4
|
+
or pay the remaining balance with a Credit/Debit card.
|
|
5
|
+
{{else}}
|
|
6
|
+
Maximum number of Gift Cards added, please pay remaining balance with a Credit/Debit card.
|
|
7
|
+
{{/if}}
|
|
8
|
+
{{> info-icon title="If you’d like to pay with a different payment method, please remove any / all applied Gift Cards." data-placement="top"}}
|
|
9
|
+
</p>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<div class="form-row giftcard-row">
|
|
2
|
+
<div class="giftcard">
|
|
3
|
+
<div class="giftcard__wrapper">
|
|
4
|
+
<span
|
|
5
|
+
class="giftcard-add"
|
|
6
|
+
id="giftcard-toggle"
|
|
7
|
+
role="button"
|
|
8
|
+
tabindex="0"
|
|
9
|
+
aria-controls="giftcard-inline"
|
|
10
|
+
aria-expanded="false"
|
|
11
|
+
>
|
|
12
|
+
<span class="icon">
|
|
13
|
+
<i class="fas fa-plus giftcard-add__icon" aria-hidden="true"></i>
|
|
14
|
+
</span>
|
|
15
|
+
<span class="giftcard-add__text">Add Wickes Gift Card</span>
|
|
16
|
+
</span>
|
|
17
|
+
<span class="giftcard-hint">Combine with Credit/Debit card</span>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div class="giftcard__container">
|
|
21
|
+
{{> loader hidden=true}}
|
|
22
|
+
<div class="giftcard-inline" id="giftcard-inline" hidden>
|
|
23
|
+
<div class="giftcard-inline__header">
|
|
24
|
+
<span class="giftcard-inline__title">Add Wickes Gift Card</span>
|
|
25
|
+
<a href="https://www.showmybalance.com/" target="_blank" class="giftcard-inline__balance">Check balance</a>
|
|
26
|
+
<span class="giftcard-inline__close">
|
|
27
|
+
<i class="fal fa-times" aria-hidden="true"></i>
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<form class="giftcard-inline__form">
|
|
32
|
+
<div class="giftcard-inline__fields">
|
|
33
|
+
{{> form-row
|
|
34
|
+
id="giftcard-number"
|
|
35
|
+
label="Gift Card number"
|
|
36
|
+
required="true"
|
|
37
|
+
placeholder="0000-0000-0000-0000"
|
|
38
|
+
row-mod="giftcard__field giftcard__field--number"
|
|
39
|
+
name="giftcard-number"
|
|
40
|
+
maxlength="19"
|
|
41
|
+
inputmode="numeric"
|
|
42
|
+
type="tel"
|
|
43
|
+
autocomplete="off"
|
|
44
|
+
input-mod="giftcard__input"
|
|
45
|
+
skipGlobalValidation=true
|
|
46
|
+
}}
|
|
47
|
+
|
|
48
|
+
{{> form-row
|
|
49
|
+
id="giftcard-pin"
|
|
50
|
+
label="Gift Card PIN"
|
|
51
|
+
required="true"
|
|
52
|
+
placeholder="00000000"
|
|
53
|
+
row-mod="giftcard__field giftcard__field--pin"
|
|
54
|
+
name="giftcard-pin"
|
|
55
|
+
maxlength="8"
|
|
56
|
+
type="password"
|
|
57
|
+
inputmode="numeric"
|
|
58
|
+
autocomplete="off"
|
|
59
|
+
input-mod="giftcard__input"
|
|
60
|
+
skipGlobalValidation=true
|
|
61
|
+
showContent=(hash
|
|
62
|
+
idToggleIcon="giftcard-pin-toggle"
|
|
63
|
+
classCustomIcon="fas fa-eye-slash"
|
|
64
|
+
idCustomIcon="giftcard-pin-eye"
|
|
65
|
+
)
|
|
66
|
+
}}
|
|
67
|
+
|
|
68
|
+
<div class="giftcard__actions">
|
|
69
|
+
{{> button text="Add" modification="giftcard__btn" }}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</form>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="giftcard-applied" id="giftcard-applied" hidden>
|
|
80
|
+
<div class="giftcard-applied__inner" role="status" aria-live="polite">
|
|
81
|
+
<span class="giftcard-applied__icon" aria-hidden="true">
|
|
82
|
+
<i class="fas fa-check-circle"></i>
|
|
83
|
+
</span>
|
|
84
|
+
<p class="giftcard-applied__text">
|
|
85
|
+
Gift Card added successfully, basket total updated
|
|
86
|
+
</p>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<div class="giftcard-chip" data-giftcard-id="{{id}}">
|
|
2
|
+
<div class="giftcard-chip__icon" aria-hidden="true">
|
|
3
|
+
<img src="./img/giftcard.svg" alt="" />
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<div class="giftcard-chip__content">
|
|
7
|
+
<div class="giftcard-chip__line">
|
|
8
|
+
<span
|
|
9
|
+
class="giftcard-chip__number"
|
|
10
|
+
aria-label="Gift card ending {{last5}}">
|
|
11
|
+
***********{{last5}}
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="giftcard-chip__line">
|
|
16
|
+
<span class="giftcard-chip__applied">{{currency}}{{amount}} applied</span>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<span class="giftcard-chip__close">
|
|
21
|
+
<i class="fal fa-times" aria-hidden="true"></i>
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="form-row {{#if clearInput}}form-row--clear-input{{/if}} {{#if error}}form-row_validation-error{{/if}} {{#if locked}}form-row--locked{{/if}} {{row-mod}}" {{#if required}}data-row-required{{/if}} {{#if clearInput}}data-clearable{{/if}} {{#if showContent}}data-show-content{{/if}} data-form-field>
|
|
1
|
+
<div class="form-row {{#if clearInput}}form-row--clear-input{{/if}} {{#if error}}form-row_validation-error{{/if}} {{#if locked}}form-row--locked{{/if}} {{row-mod}}" {{#if required}}data-row-required{{/if}} {{#if clearInput}}data-clearable{{/if}} {{#if showContent}}data-show-content{{/if}} {{#if skipGlobalValidation}}data-no-global-validation{{/if}} data-form-field>
|
|
2
2
|
<label class="form-row__label {{#if required}}form-row__label_required{{/if}} {{#if label-hidden}}sr-only{{/if}}" for="{{id}}">
|
|
3
3
|
{{label}}
|
|
4
4
|
{{#if tooltip}}
|
package/src/elements/input.hbs
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
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
|
|
4
|
+
<input
|
|
5
|
+
type="{{type}}"
|
|
6
|
+
class="tbx {{#if error}}tbx_error{{/if}} {{input-mod}}"
|
|
7
|
+
value="{{value}}"
|
|
8
|
+
id="{{id}}"
|
|
9
|
+
name="{{#if name}}{{name}}{{else}}{{id}}{{/if}}"
|
|
10
|
+
placeholder="{{placeholder}}"
|
|
11
|
+
{{#if (or locked disabled)}}disabled{{/if}}
|
|
12
|
+
{{#if need-pattern}}pattern=""{{/if}}
|
|
13
|
+
{{#if readonly}}readonly{{/if}}
|
|
14
|
+
{{#if data-tag}}data-tag="{{data-tag}}"{{/if}}
|
|
15
|
+
{{#if maxlength}}maxlength="{{maxlength}}"{{/if}}
|
|
16
|
+
{{#if inputmode}}inputmode="{{inputmode}}"{{/if}}
|
|
17
|
+
{{#if autocomplete}}autocomplete="{{autocomplete}}"{{/if}}
|
|
18
|
+
>
|
|
5
19
|
{{else}}
|
|
6
|
-
<input
|
|
20
|
+
<input
|
|
21
|
+
type="text"
|
|
22
|
+
class="tbx {{#if error}}tbx_error{{/if}} {{input-mod}}"
|
|
23
|
+
value="{{value}}"
|
|
24
|
+
id="{{id}}"
|
|
25
|
+
name="{{#if name}}{{name}}{{else}}{{id}}{{/if}}"
|
|
26
|
+
placeholder="{{placeholder}}"
|
|
27
|
+
{{#if (or locked disabled)}}disabled{{/if}}
|
|
28
|
+
{{#if need-pattern}}pattern=""{{/if}}
|
|
29
|
+
{{#if readonly}}readonly{{/if}}
|
|
30
|
+
{{#if data-tag}}data-tag="{{data-tag}}"{{/if}}
|
|
31
|
+
{{#if error}}aria-invalid="true"{{/if}}
|
|
32
|
+
{{#if maxlength}}maxlength="{{maxlength}}"{{/if}}
|
|
33
|
+
{{#if inputmode}}inputmode="{{inputmode}}"{{/if}}
|
|
34
|
+
{{#if autocomplete}}autocomplete="{{autocomplete}}"{{/if}}
|
|
35
|
+
>
|
|
7
36
|
{{/if}}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<svg width="48" height="31" viewBox="0 0 48 31" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_9507_79257)">
|
|
3
|
+
<rect y="0.207031" width="48" height="30" rx="3" fill="white"/>
|
|
4
|
+
<path d="M42.5 26.207C39.5 25.707 36.5 21.207 36.5 21.207C36.5 21.207 34 25.207 31 26.207" stroke="#004587" stroke-width="1.8"/>
|
|
5
|
+
<path d="M29.7862 18.5774C30.7643 19.8755 32.9202 20.2323 35.2567 20.6584C35.2241 18.7373 34.7506 16.8572 33.7724 15.5591C32.7942 14.261 31.3287 13.7129 30.0307 14.691C28.7326 15.6692 28.808 17.2793 29.7862 18.5774Z" fill="white" stroke="#004587" stroke-width="1.8"/>
|
|
6
|
+
<path d="M43.164 18.5774C42.1859 19.8755 40.03 20.2323 37.6935 20.6584C37.7261 18.7373 38.1996 16.8572 39.1778 15.5591C40.1559 14.261 41.6215 13.7129 42.9195 14.691C44.2176 15.6692 44.1422 17.2793 43.164 18.5774Z" fill="white" stroke="#004587" stroke-width="1.8"/>
|
|
7
|
+
<g clip-path="url(#clip1_9507_79257)">
|
|
8
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M3 0.207031V12.4151L16.5154 15.1785L30.0427 12.3838V0.207031H3Z" fill="white"/>
|
|
9
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.90234 1.08984V11.6893L16.5155 14.2625L29.1463 11.6881V1.08984H3.90234Z" fill="#004587"/>
|
|
10
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.7783 7.92572C15.7696 7.62779 15.5026 7.41921 15.207 7.41921C14.5493 7.41921 14.4462 7.96811 14.4462 8.45635C14.4462 8.91044 14.6458 9.37843 15.1424 9.37843C15.5498 9.37843 15.7562 9.14851 15.8118 8.77483H16.9531C16.8474 9.71885 16.1003 10.2603 15.1504 10.2603C14.0724 10.2603 13.2715 9.53599 13.2715 8.45635C13.2715 7.33602 13.9969 6.53516 15.1504 6.53516C16.0389 6.53516 16.8342 6.99838 16.9153 7.92572H15.7783Z" fill="white"/>
|
|
11
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.1543 5.31641H18.3288V7.81242L19.4004 6.63986H20.7594L19.4483 7.96917L20.9249 10.16H19.5089L18.6344 8.74224L18.3288 9.03322V10.16H17.1543V5.31641Z" fill="white"/>
|
|
12
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.7333 8.67923C21.7536 9.16013 22.0363 9.47999 22.535 9.47999C22.8166 9.47999 23.0924 9.35193 23.2046 9.09401H24.3016C24.0876 9.90917 23.32 10.2602 22.5192 10.2602C21.3542 10.2602 20.5586 9.56984 20.5586 8.38984C20.5586 7.30951 21.4374 6.53516 22.4916 6.53516C23.7754 6.53516 24.4182 7.48632 24.3632 8.67923H21.7333ZM23.189 8.03592C23.169 7.64149 22.8853 7.31607 22.4916 7.31607C22.0778 7.31607 21.8021 7.60794 21.7333 8.03592H23.189Z" fill="white"/>
|
|
13
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M25.5842 8.99642C25.5842 9.17551 25.6574 9.30418 25.7769 9.39104C25.8863 9.47275 26.0451 9.51434 26.2117 9.51434C26.4397 9.51434 26.7649 9.42043 26.7649 9.13997C26.7649 8.86835 26.3976 8.81603 26.1918 8.76798C25.4513 8.58432 24.5267 8.56159 24.5267 7.61548C24.5267 6.76836 25.4589 6.53516 26.1636 6.53516C26.9515 6.53516 27.7712 6.76041 27.8136 7.67723H26.7287C26.7287 7.52613 26.6751 7.43222 26.5773 7.36908C26.4792 7.30941 26.3507 7.28013 26.2052 7.28013C26.0108 7.28013 25.7017 7.30207 25.7017 7.54688C25.7017 7.87886 26.4881 7.93992 27.0274 8.05399C27.75 8.19744 27.9381 8.71249 27.9381 9.00545C27.9381 9.94987 27.0274 10.2602 26.2187 10.2602C25.3684 10.2602 24.4986 9.98342 24.4639 8.99642H25.5842Z" fill="white"/>
|
|
14
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.3756 10.16H9.08877L8.41406 6.82332H8.3981L7.72329 10.16H6.41975L5.08691 5.31641H6.36913L7.0693 8.85571H7.08112L7.80504 5.31641H9.01268L9.73841 8.85571H9.75195L10.4494 5.31641H11.7329L10.3756 10.16Z" fill="white"/>
|
|
15
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.8215 6.19887H12.9972V5.31641H11.8215V6.19887ZM11.8213 10.1601H12.997V6.63986H11.8213V10.1601Z" fill="white"/>
|
|
16
|
+
</g>
|
|
17
|
+
<path d="M36.5 0.207031V21.707M36.5 30.207V21.707M36.5 21.707H47.5M36.5 21.707H1" stroke="#004587" stroke-width="1.8"/>
|
|
18
|
+
</g>
|
|
19
|
+
<rect x="0.5" y="0.707031" width="47" height="29" rx="2.5" stroke="#CCCCCC"/>
|
|
20
|
+
<defs>
|
|
21
|
+
<clipPath id="clip0_9507_79257">
|
|
22
|
+
<rect y="0.207031" width="48" height="30" rx="3" fill="white"/>
|
|
23
|
+
</clipPath>
|
|
24
|
+
<clipPath id="clip1_9507_79257">
|
|
25
|
+
<rect width="27" height="14.9703" fill="white" transform="translate(3 0.207031)"/>
|
|
26
|
+
</clipPath>
|
|
27
|
+
</defs>
|
|
28
|
+
</svg>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var Wick = Wick || {};
|
|
2
|
+
Wick.CheckoutData = (function () {
|
|
3
|
+
return {
|
|
4
|
+
//TODO: update after BE confirmation
|
|
5
|
+
successGiftCardData: {
|
|
6
|
+
"subTotal": "£85.00",
|
|
7
|
+
"deliveryCost": "£4.00",
|
|
8
|
+
"freeDelivery": false,
|
|
9
|
+
"clickAndCollectCost": "FREE",
|
|
10
|
+
"totalForDelivery": "£69.00",
|
|
11
|
+
"totalForClickAndCollect": "FREE",
|
|
12
|
+
"total": "£67.00",
|
|
13
|
+
"vat": "£11.17",
|
|
14
|
+
"deliveryOrder": true,
|
|
15
|
+
"clickAndCollectOrder": false,
|
|
16
|
+
"discountTotal": "£2.00",
|
|
17
|
+
"giftCardApplied": "-£100.00",
|
|
18
|
+
"discounts": [
|
|
19
|
+
"Spend over £10 and get £2 fixed discount"
|
|
20
|
+
],
|
|
21
|
+
"promotionsInfo": [
|
|
22
|
+
{
|
|
23
|
+
"description": "Spend over £10 and get £2 fixed discount",
|
|
24
|
+
"usedCouponCode": "RT_02"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"subTotalWithDeliveryCost": "£69.00",
|
|
28
|
+
"net": false,
|
|
29
|
+
"subtotalWithDeliveryAndDiscounts": "£67.00",
|
|
30
|
+
"discountAmounts": [],
|
|
31
|
+
"goodsTotalWithoutDiscount": "£65.00",
|
|
32
|
+
"charityPrice": ""
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
@@ -2,24 +2,33 @@ var Wick = Wick || {};
|
|
|
2
2
|
|
|
3
3
|
Wick.PaymentDetails = (function () {
|
|
4
4
|
var $btnEnterDetails = $('.btn-enter-details'),
|
|
5
|
-
$form = $btnEnterDetails.parents('form'),
|
|
6
5
|
isGuestPage = $('.page_checkout-payment-details_guest').length;
|
|
7
6
|
|
|
8
7
|
function bindEvents () {
|
|
9
|
-
$btnEnterDetails.on('click', function(){
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
$btnEnterDetails.on('click', function (e) {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
var $scope = $(this).closest('form');
|
|
11
|
+
if (!$scope.length) $scope = $(this).closest('.billing-address');
|
|
12
|
+
if (!$scope.length) $scope = $('.billing-address');
|
|
13
|
+
var nameVal= ($scope.find('#card-name').val() || '').trim();
|
|
14
|
+
var finderVal= ($scope.find('#first-line-address').val() || '').trim();
|
|
15
|
+
var manualLine1= ($scope.find('#address-line-1').val() || '').trim();
|
|
16
|
+
var manualTown= ($scope.find('#town-city').val() || '').trim();
|
|
17
|
+
var manualPost= ($scope.find('#postcode_additional').val() || '').trim();
|
|
18
|
+
var addressFinderOk = finderVal.length > 0;
|
|
19
|
+
var addressManualOk = manualLine1 && manualTown && manualPost;
|
|
20
|
+
|
|
21
|
+
if (nameVal && (addressFinderOk || addressManualOk)) {
|
|
22
|
+
var $details = $('.checkout-payment-details__card-details');
|
|
23
|
+
$details.removeClass('checkout-payment-details__card-details_hidden');
|
|
24
|
+
$('html, body').animate({ scrollTop: $details.offset().top - 15 }, 700);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var formEl = $scope.closest('form').get(0) || $scope.get(0);
|
|
29
|
+
if (formEl && Wick.Forms && Wick.Forms.showValidationErrors) {
|
|
30
|
+
Wick.Forms.showValidationErrors(formEl);
|
|
20
31
|
}
|
|
21
|
-
Wick.Forms.showValidationErrors($form[0]);
|
|
22
|
-
return false;
|
|
23
32
|
});
|
|
24
33
|
|
|
25
34
|
$('.checkout-payment-details__card-details').on('submit', function(){
|
|
@@ -60,11 +60,16 @@ Wick.Forms = (function(){
|
|
|
60
60
|
|
|
61
61
|
var showValidationErrors = function (form, errorMsg) {
|
|
62
62
|
var $form = $(form);
|
|
63
|
+
var $rows = $form.find(fieldRow).not('[data-no-global-validation]');
|
|
64
|
+
if (!$rows.length) return;
|
|
65
|
+
$rows.find('.form-row__error').remove();
|
|
66
|
+
|
|
63
67
|
if (!$form.hasClass(formInvalid)) {
|
|
64
|
-
$form.
|
|
65
|
-
$form.addClass(formInvalid).find(fieldRow).append(validationError(errorMsg)).addClass(rowValidationError);
|
|
68
|
+
$form.addClass(formInvalid);
|
|
66
69
|
}
|
|
67
70
|
|
|
71
|
+
$rows.append(validationError(errorMsg)).addClass(rowValidationError);
|
|
72
|
+
|
|
68
73
|
var $firstMsg = $form.find(fieldRow).first();
|
|
69
74
|
if($firstMsg.length && !isElementInViewport($firstMsg)){
|
|
70
75
|
var inModal = $firstMsg.closest('.modal').length,
|