wickes-css2 2.104.0-develop.1 → 2.104.0-develop.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/build/css/components/checkout-chip.css +1 -0
- package/build/css/components/checkout-payment-repayment-terms.css +1 -0
- package/build/css/main.css +1 -1
- package/build/js/emulation.min.js +210 -98
- package/build/js/page/billie-business-type.js +11 -6
- package/build/js/page/checkout-payment-details.js +175 -51
- package/package.json +1 -1
- package/src/components/address-billie.hbs +38 -36
- package/src/components/billie-modal.hbs +2 -2
- package/src/components/checkout-chip.hbs +15 -0
- package/src/components/checkout-edit-billing-address.hbs +1 -3
- package/src/components/checkout-payment-details-v2.hbs +35 -23
- package/src/components/checkout-payment-repayment-terms.hbs +12 -0
- package/src/components/my-account/active-orders/list-orders.hbs +1 -1
- package/src/data/data_billie-terms.json +7 -0
- package/src/data/my-account/data_my-account.json +153 -3
- package/src/js/emulation/billie-modal.js +45 -0
- package/src/js/emulation/checkout-payment-details.js +8 -8
- package/src/js/emulation/forms.js +118 -89
- package/src/js/emulation/paymentLoader.js +4 -3
- package/src/js/emulation/repayment-toggle.js +35 -0
- package/src/js/page/billie-business-type.js +11 -6
- package/src/js/page/checkout-payment-details.js +175 -51
- package/src/page_my-account.html +0 -1
- package/src/scss/components/checkout-chip.scss +65 -0
- package/src/scss/components/checkout-payment-repayment-terms.scss +39 -0
- package/src/scss/main.scss +2 -0
|
@@ -55,7 +55,107 @@
|
|
|
55
55
|
},
|
|
56
56
|
"paymentStatus": {
|
|
57
57
|
"status": "default",
|
|
58
|
-
"paymentText": "Payment due 30 days from
|
|
58
|
+
"paymentText": "Payment due 30 days from Dispatch or Collection Date"
|
|
59
|
+
},
|
|
60
|
+
"totalPrice": "72,986.40",
|
|
61
|
+
"totalItemCount": 14,
|
|
62
|
+
"orderDate": "22nd January 2025 10:35 am",
|
|
63
|
+
"totalConsignments": 5,
|
|
64
|
+
"shipmentDetails": [
|
|
65
|
+
{
|
|
66
|
+
"shipmentIcon": "fas fa-hand-holding-box",
|
|
67
|
+
"shipmentTitle": "Click & Collect at Southport Kitchens & Bathrooms Showroom",
|
|
68
|
+
"shipmentInfo": "Ready for Collection",
|
|
69
|
+
"itemsCount": 2
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"shipmentIcon": "fas fa-times",
|
|
73
|
+
"shipmentTitle": "Click & Collect at Wickes Long Eaton",
|
|
74
|
+
"shipmentInfo": "Cancelled",
|
|
75
|
+
"itemsCount": 4
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"shipmentIcon": "fas fa-shipping-fast",
|
|
79
|
+
"shipmentTitle": "Wickes Delivery from Ashford Store",
|
|
80
|
+
"shipmentInfo": "Dispatched. Delivery - 8th Jan 2025",
|
|
81
|
+
"itemsCount": 4,
|
|
82
|
+
"trackingLink": "/"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"shipmentIcon": "fas fa-shipping-fast",
|
|
86
|
+
"shipmentTitle": "Rapid Delivery from Southampton Store",
|
|
87
|
+
"shipmentInfo": "Dispatched. Delivery — within 3 hours",
|
|
88
|
+
"itemsCount": 4,
|
|
89
|
+
"trackingLink": "/"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"shipmentIcon": "fas fa-shipping-fast",
|
|
93
|
+
"shipmentTitle": "Supplier Delivery",
|
|
94
|
+
"shipmentInfo": "Dispatched. The supplier will be in contact with you after receiving order confirmation.",
|
|
95
|
+
"itemsCount": 4
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"orderId": "940524222",
|
|
101
|
+
"orderTooltipText": "We are mindful of the environment, and we try to plan our routes with sustainability in mind. We are trying to get your order to you as quickly as we can, therefore you're order may come on multiple vans",
|
|
102
|
+
"orderStatus": {
|
|
103
|
+
"statusTitle": "Processing",
|
|
104
|
+
"statusIcon": "fas fa-sync"
|
|
105
|
+
},
|
|
106
|
+
"paymentStatus": {
|
|
107
|
+
"status": "default",
|
|
108
|
+
"paymentText": "Payment due 60 days from Dispatch or Collection Date"
|
|
109
|
+
},
|
|
110
|
+
"totalPrice": "72,986.40",
|
|
111
|
+
"totalItemCount": 14,
|
|
112
|
+
"orderDate": "22nd January 2025 10:35 am",
|
|
113
|
+
"totalConsignments": 5,
|
|
114
|
+
"shipmentDetails": [
|
|
115
|
+
{
|
|
116
|
+
"shipmentIcon": "fas fa-hand-holding-box",
|
|
117
|
+
"shipmentTitle": "Click & Collect at Southport Kitchens & Bathrooms Showroom",
|
|
118
|
+
"shipmentInfo": "Ready for Collection",
|
|
119
|
+
"itemsCount": 2
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"shipmentIcon": "fas fa-times",
|
|
123
|
+
"shipmentTitle": "Click & Collect at Wickes Long Eaton",
|
|
124
|
+
"shipmentInfo": "Cancelled",
|
|
125
|
+
"itemsCount": 4
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"shipmentIcon": "fas fa-shipping-fast",
|
|
129
|
+
"shipmentTitle": "Wickes Delivery from Ashford Store",
|
|
130
|
+
"shipmentInfo": "Dispatched. Delivery - 8th Jan 2025",
|
|
131
|
+
"itemsCount": 4,
|
|
132
|
+
"trackingLink": "/"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"shipmentIcon": "fas fa-shipping-fast",
|
|
136
|
+
"shipmentTitle": "Rapid Delivery from Southampton Store",
|
|
137
|
+
"shipmentInfo": "Dispatched. Delivery — within 3 hours",
|
|
138
|
+
"itemsCount": 4,
|
|
139
|
+
"trackingLink": "/"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"shipmentIcon": "fas fa-shipping-fast",
|
|
143
|
+
"shipmentTitle": "Supplier Delivery",
|
|
144
|
+
"shipmentInfo": "Dispatched. The supplier will be in contact with you after receiving order confirmation.",
|
|
145
|
+
"itemsCount": 4
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"orderId": "940524222",
|
|
151
|
+
"orderTooltipText": "We are mindful of the environment, and we try to plan our routes with sustainability in mind. We are trying to get your order to you as quickly as we can, therefore you're order may come on multiple vans",
|
|
152
|
+
"orderStatus": {
|
|
153
|
+
"statusTitle": "Processing",
|
|
154
|
+
"statusIcon": "fas fa-sync"
|
|
155
|
+
},
|
|
156
|
+
"paymentStatus": {
|
|
157
|
+
"status": "default",
|
|
158
|
+
"paymentText": "Payment due 90 days from Dispatch or Collection Date"
|
|
59
159
|
},
|
|
60
160
|
"totalPrice": "72,986.40",
|
|
61
161
|
"totalItemCount": 14,
|
|
@@ -129,8 +229,58 @@
|
|
|
129
229
|
},
|
|
130
230
|
"paymentStatus": {
|
|
131
231
|
"status": "partial",
|
|
132
|
-
"paymentTitle": "
|
|
133
|
-
"paymentText": "
|
|
232
|
+
"paymentTitle": "Invoice partially paid to Billie",
|
|
233
|
+
"paymentText": "Payment due 30 days from Dispatch or Collection Date"
|
|
234
|
+
},
|
|
235
|
+
"totalPrice": "316.73",
|
|
236
|
+
"totalItemCount": 8,
|
|
237
|
+
"orderDate": "22nd January 2025 10:35 am",
|
|
238
|
+
"totalConsignments": 1,
|
|
239
|
+
"shipmentDetails": [
|
|
240
|
+
{
|
|
241
|
+
"shipmentIcon": "fas fa-shipping-fast",
|
|
242
|
+
"shipmentTitle": "Supplier Delivery",
|
|
243
|
+
"shipmentInfo": "Dispatched. The supplier will be in contact with you after receiving order confirmation.",
|
|
244
|
+
"itemsCount": 4
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"orderId": "940524222",
|
|
250
|
+
"orderTooltipText": "We are mindful of the environment, and we try to plan our routes with sustainability in mind. We are trying to get your order to you as quickly as we can, therefore you're order may come on multiple vans",
|
|
251
|
+
"orderStatus": {
|
|
252
|
+
"statusTitle": "Processing",
|
|
253
|
+
"statusIcon": "fas fa-sync"
|
|
254
|
+
},
|
|
255
|
+
"paymentStatus": {
|
|
256
|
+
"status": "partial",
|
|
257
|
+
"paymentTitle": "Invoice partially paid to Billie",
|
|
258
|
+
"paymentText": "Payment due 60 days from Dispatch or Collection Date"
|
|
259
|
+
},
|
|
260
|
+
"totalPrice": "316.73",
|
|
261
|
+
"totalItemCount": 8,
|
|
262
|
+
"orderDate": "22nd January 2025 10:35 am",
|
|
263
|
+
"totalConsignments": 1,
|
|
264
|
+
"shipmentDetails": [
|
|
265
|
+
{
|
|
266
|
+
"shipmentIcon": "fas fa-shipping-fast",
|
|
267
|
+
"shipmentTitle": "Supplier Delivery",
|
|
268
|
+
"shipmentInfo": "Dispatched. The supplier will be in contact with you after receiving order confirmation.",
|
|
269
|
+
"itemsCount": 4
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"orderId": "940524222",
|
|
275
|
+
"orderTooltipText": "We are mindful of the environment, and we try to plan our routes with sustainability in mind. We are trying to get your order to you as quickly as we can, therefore you're order may come on multiple vans",
|
|
276
|
+
"orderStatus": {
|
|
277
|
+
"statusTitle": "Processing",
|
|
278
|
+
"statusIcon": "fas fa-sync"
|
|
279
|
+
},
|
|
280
|
+
"paymentStatus": {
|
|
281
|
+
"status": "partial",
|
|
282
|
+
"paymentTitle": "Invoice partially paid to Billie",
|
|
283
|
+
"paymentText": "Payment due 90 days from Dispatch or Collection Date"
|
|
134
284
|
},
|
|
135
285
|
"totalPrice": "316.73",
|
|
136
286
|
"totalItemCount": 8,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
const ORDER = ["30", "30_60", "30_90", "30_60_90"];
|
|
3
|
+
|
|
4
|
+
const COPY = {
|
|
5
|
+
"30": {
|
|
6
|
+
heading: "Buy now, pay within 30 days",
|
|
7
|
+
repayment: "From the point of collection / delivery of goods you’ll have 30 days to pay",
|
|
8
|
+
},
|
|
9
|
+
"30_60": {
|
|
10
|
+
heading: "Buy now and choose to pay within 30 or 60 days",
|
|
11
|
+
repayment: "From the point of collection / delivery of goods, you'll have until the end of your chosen repayment term to pay",
|
|
12
|
+
},
|
|
13
|
+
"30_90": {
|
|
14
|
+
heading: "Buy now and choose to pay within 30 or 90 days",
|
|
15
|
+
repayment: "From the point of collection / delivery of goods, you'll have until the end of your chosen repayment term to pay",
|
|
16
|
+
},
|
|
17
|
+
"30_60_90": {
|
|
18
|
+
heading: "Buy now and choose to pay within 30, 60 or 90 days",
|
|
19
|
+
repayment: "From the point of collection / delivery of goods, you'll have until the end of your chosen repayment term to pay",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let index = -1;
|
|
24
|
+
|
|
25
|
+
function nextTerms() {
|
|
26
|
+
index = (index + 1) % ORDER.length;
|
|
27
|
+
return ORDER[index];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function applyBillieTerms(terms) {
|
|
31
|
+
const copy = COPY[terms] || COPY["30"];
|
|
32
|
+
const $modal = $("#billieLearnMoreModal");
|
|
33
|
+
|
|
34
|
+
$modal.find(".js-billie-terms-heading").text(copy.heading);
|
|
35
|
+
$modal.find(".js-billie-repayment-line").text(copy.repayment);
|
|
36
|
+
$modal.attr("data-billie-terms", terms);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
$(document).on("click", ".billie__link", function (e) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
|
|
42
|
+
const terms = nextTerms();
|
|
43
|
+
applyBillieTerms(terms);
|
|
44
|
+
});
|
|
45
|
+
})();
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var Wick = Wick || {};
|
|
2
2
|
|
|
3
|
-
Wick.PaymentDetails = (function
|
|
3
|
+
Wick.PaymentDetails = (function() {
|
|
4
4
|
var $btnEnterDetails = $('.btn-enter-details'),
|
|
5
5
|
$form = $btnEnterDetails.parents('form'),
|
|
6
6
|
isGuestPage = $('.page_checkout-payment-details_guest').length;
|
|
7
7
|
|
|
8
|
-
function bindEvents
|
|
9
|
-
$btnEnterDetails.on('click', function(){
|
|
10
|
-
if ($form.find('#card-name').val()
|
|
8
|
+
function bindEvents() {
|
|
9
|
+
$btnEnterDetails.on('click', function() {
|
|
10
|
+
if ($form.find('#card-name').val()?.length &&
|
|
11
11
|
$form.find('#first-line-address').val().length &&
|
|
12
12
|
$form.find('#address-line-1').val().length &&
|
|
13
13
|
$form.find('#town-city').val().length &&
|
|
14
|
-
$form.find('#postcode_additional').val().length){
|
|
14
|
+
$form.find('#postcode_additional').val().length) {
|
|
15
15
|
$('.checkout-payment-details__card-details').removeClass('checkout-payment-details__card-details_hidden');
|
|
16
16
|
$('html, body').animate({
|
|
17
|
-
scrollTop: $('.checkout-payment-details__card-details').offset().top - 15
|
|
17
|
+
scrollTop: $('.checkout-payment-details__card-details').offset().top - 15,
|
|
18
18
|
}, 700);
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
@@ -22,14 +22,14 @@ Wick.PaymentDetails = (function () {
|
|
|
22
22
|
return false;
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
$('.checkout-payment-details__card-details').on('submit', function(){
|
|
25
|
+
$('.checkout-payment-details__card-details').on('submit', function() {
|
|
26
26
|
var $form = $(this);
|
|
27
27
|
if ($form.find('#card-type').val() &&
|
|
28
28
|
$form.find('#card-name1').val().length &&
|
|
29
29
|
$form.find('#card-number').val().length &&
|
|
30
30
|
$form.find('#month').val() &&
|
|
31
31
|
$form.find('#year').val() &&
|
|
32
|
-
$form.find('#security-code').val()){
|
|
32
|
+
$form.find('#security-code').val()) {
|
|
33
33
|
window.location.href = isGuestPage
|
|
34
34
|
? './page_checkout_confirmation_guest.html'
|
|
35
35
|
: './page_checkout_confirmation.html';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var Wick = Wick || {};
|
|
2
|
-
Wick.Forms = (function(){
|
|
2
|
+
Wick.Forms = (function() {
|
|
3
3
|
var fieldRow = '.form-row[data-row-required]',
|
|
4
4
|
field = '.form-row__field',
|
|
5
5
|
fieldError = '.form-row__error',
|
|
@@ -9,43 +9,44 @@ Wick.Forms = (function(){
|
|
|
9
9
|
// validationError = '<div class="form-row__error">Error message here</div>',
|
|
10
10
|
$forgotPassword = $('.link-forgot-password'),
|
|
11
11
|
scenarios = [{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
12
|
+
condition: function() {
|
|
13
|
+
// fill in the valid returning customer's details
|
|
14
|
+
// Email: responsive@test.com; Password: 123456
|
|
15
|
+
return $('#login-email').val() === 'responsive@test.com' && $('#password').val() === '123456';
|
|
16
|
+
},
|
|
17
|
+
action: function() {
|
|
18
|
+
// redirected to the homepage
|
|
19
|
+
Wick.User.login();
|
|
20
|
+
window.location.href = './';
|
|
22
21
|
},
|
|
22
|
+
},
|
|
23
23
|
{
|
|
24
|
-
condition: function(){
|
|
24
|
+
condition: function() {
|
|
25
25
|
// continue as a new user with "test+random@user.com"
|
|
26
26
|
return $('#registration-email').val().length;
|
|
27
27
|
// return $('#registration-email').val() === 'test+random@user.com';
|
|
28
28
|
},
|
|
29
|
-
action: function(){
|
|
29
|
+
action: function() {
|
|
30
30
|
// redirected to the register form
|
|
31
31
|
window.location.href = './page_registration.html';
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
condition: function(){
|
|
35
|
+
condition: function() {
|
|
36
36
|
// When I click forgotten password link
|
|
37
37
|
},
|
|
38
|
-
action: function(){
|
|
38
|
+
action: function() {
|
|
39
39
|
// redirected on the "Forgotten Password" page
|
|
40
40
|
window.location.href = './page_forgotten-password.html';
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
]
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
validationError = function(errorMsg) {
|
|
46
|
+
return `<div class="form-row__error"> ${errorMsg || 'Error message here'}</div>`;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function isElementInViewport(el) {
|
|
49
50
|
if (typeof jQuery === 'function' && el instanceof jQuery) {
|
|
50
51
|
el = el[0];
|
|
51
52
|
}
|
|
@@ -58,15 +59,21 @@ Wick.Forms = (function(){
|
|
|
58
59
|
);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
var showValidationErrors = function
|
|
62
|
+
var showValidationErrors = function(form, errorMsg) {
|
|
62
63
|
var $form = $(form);
|
|
63
64
|
if (!$form.hasClass(formInvalid)) {
|
|
64
65
|
$form.find('.form-row__error').remove();
|
|
65
|
-
$form.
|
|
66
|
+
var $rows = $form.find(fieldRow).filter(function() {
|
|
67
|
+
return $(this).is(':visible');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
$rows.append(validationError(errorMsg)).addClass(rowValidationError);
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
var $firstMsg = $form.find(fieldRow).
|
|
69
|
-
|
|
73
|
+
var $firstMsg = $form.find(fieldRow).filter(function() {
|
|
74
|
+
return $(this).is(':visible');
|
|
75
|
+
}).first();
|
|
76
|
+
if ($firstMsg.length && !isElementInViewport($firstMsg)) {
|
|
70
77
|
var inModal = $firstMsg.closest('.modal').length,
|
|
71
78
|
$scrollableEl = inModal ? $firstMsg.closest('.modal') : $('html, body'),
|
|
72
79
|
y = inModal ? 0 : $firstMsg.offset().top - 30;
|
|
@@ -75,22 +82,26 @@ Wick.Forms = (function(){
|
|
|
75
82
|
}
|
|
76
83
|
};
|
|
77
84
|
|
|
78
|
-
var clearValidationErrors = function
|
|
85
|
+
var clearValidationErrors = function(form) {
|
|
79
86
|
var $form = $(form);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
|
|
88
|
+
$form.removeClass(formInvalid);
|
|
89
|
+
|
|
90
|
+
$form.find(fieldRow)
|
|
91
|
+
.removeClass(rowValidationError)
|
|
92
|
+
.find(fieldError).remove();
|
|
93
|
+
|
|
94
|
+
$form.find(fieldError).remove();
|
|
85
95
|
};
|
|
86
96
|
|
|
87
|
-
|
|
97
|
+
|
|
98
|
+
var handleSmoothScroll = function() {
|
|
88
99
|
$('html, body').animate({
|
|
89
|
-
scrollTop: $('.cards-store-list').offset().top - 60
|
|
100
|
+
scrollTop: $('.cards-store-list').offset().top - 60,
|
|
90
101
|
}, 300);
|
|
91
102
|
};
|
|
92
103
|
|
|
93
|
-
var handleFormSubmit = function
|
|
104
|
+
var handleFormSubmit = function() {
|
|
94
105
|
var form = this;
|
|
95
106
|
|
|
96
107
|
if ($(form).is('#form-login') || $(form).is('#form-register')) {
|
|
@@ -104,21 +115,21 @@ Wick.Forms = (function(){
|
|
|
104
115
|
}
|
|
105
116
|
|
|
106
117
|
if ($(form).is('#form-forgotten-password')) {
|
|
107
|
-
if ($(form).find('#email').val().length){
|
|
118
|
+
if ($(form).find('#email').val().length) {
|
|
108
119
|
window.location.href = './page_upd-pass.html';
|
|
109
120
|
return false;
|
|
110
121
|
}
|
|
111
122
|
}
|
|
112
123
|
|
|
113
124
|
if ($(form).is('#form-forgotten-password-popup')) {
|
|
114
|
-
if ($(form).find('#email').val().length){
|
|
125
|
+
if ($(form).find('#email').val().length) {
|
|
115
126
|
window.location.href = './page_checkout_sign-in.html';
|
|
116
127
|
return false;
|
|
117
128
|
}
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
if ($(form).is('#checkout-form-forgotten-password-popup')) {
|
|
121
|
-
if ($(form).find('#email').val().length){
|
|
132
|
+
if ($(form).find('#email').val().length) {
|
|
122
133
|
$('.modal-reset-wrap').addClass('d-block');
|
|
123
134
|
$('.request-pass').addClass('d-none');
|
|
124
135
|
$('.modal-title').text('Password Reset');
|
|
@@ -127,7 +138,7 @@ Wick.Forms = (function(){
|
|
|
127
138
|
}
|
|
128
139
|
|
|
129
140
|
if ($(form).is('.update-pass')) {
|
|
130
|
-
if ($(form).find('#new-password').val().length && $(form).find('#confirmed-password').val().length){
|
|
141
|
+
if ($(form).find('#new-password').val().length && $(form).find('#confirmed-password').val().length) {
|
|
131
142
|
window.location.href = './page_login.html';
|
|
132
143
|
return false;
|
|
133
144
|
}
|
|
@@ -136,7 +147,7 @@ Wick.Forms = (function(){
|
|
|
136
147
|
if ($(form).is('.change-email')) {
|
|
137
148
|
if ($(form).find('#new-email').val().length &&
|
|
138
149
|
$(form).find('#confirm-new-email').val().length &&
|
|
139
|
-
$(form).find('#password').val().length){
|
|
150
|
+
$(form).find('#password').val().length) {
|
|
140
151
|
window.location.href = './page_my-account.html';
|
|
141
152
|
return false;
|
|
142
153
|
}
|
|
@@ -145,7 +156,7 @@ Wick.Forms = (function(){
|
|
|
145
156
|
if ($(form).is('.form-change-password')) {
|
|
146
157
|
if ($(form).find('#current-password').val().length &&
|
|
147
158
|
$(form).find('#new-password').val().length &&
|
|
148
|
-
$(form).find('#confirm-password').val().length){
|
|
159
|
+
$(form).find('#confirm-password').val().length) {
|
|
149
160
|
window.location.href = './page_my-account.html';
|
|
150
161
|
return false;
|
|
151
162
|
}
|
|
@@ -157,14 +168,14 @@ Wick.Forms = (function(){
|
|
|
157
168
|
$(form).find('#postcode').val().length &&
|
|
158
169
|
$(form).find('#email').val().length &&
|
|
159
170
|
$(form).find('#password').val().length &&
|
|
160
|
-
$(form).find('#confirm-password').val().length){
|
|
171
|
+
$(form).find('#confirm-password').val().length) {
|
|
161
172
|
window.location.href = './page_my-account.html';
|
|
162
173
|
return false;
|
|
163
174
|
}
|
|
164
175
|
}
|
|
165
176
|
|
|
166
177
|
if ($(form).is('.form-personal-details')) {
|
|
167
|
-
if ($(form).find('#first-name').val().length && $(form).find('#surname').val().length){
|
|
178
|
+
if ($(form).find('#first-name').val().length && $(form).find('#surname').val().length) {
|
|
168
179
|
window.location.href = './page_my-account.html';
|
|
169
180
|
return false;
|
|
170
181
|
}
|
|
@@ -172,26 +183,26 @@ Wick.Forms = (function(){
|
|
|
172
183
|
|
|
173
184
|
if ($(form).is('.form-address-details')) {
|
|
174
185
|
if ($(form).find('#first-name').val().length &&
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
186
|
+
$(form).find('#second-name').val().length &&
|
|
187
|
+
$(form).find('#address1').val().length &&
|
|
188
|
+
$(form).find('#town-city').val().length &&
|
|
189
|
+
$(form).find('#mobile-telephone').val().length) {
|
|
179
190
|
window.location.href = './page_my-account_address-book.html';
|
|
180
191
|
return false;
|
|
181
192
|
}
|
|
182
193
|
}
|
|
183
194
|
|
|
184
195
|
if ($(form).is('.form-locator')) {
|
|
185
|
-
if ($(form).find('#store-id').val()){
|
|
196
|
+
if ($(form).find('#store-id').val()) {
|
|
186
197
|
window.location.href = './page_store-locator-details.html';
|
|
187
198
|
return false;
|
|
188
199
|
}
|
|
189
200
|
}
|
|
190
201
|
|
|
191
202
|
if ($(form).is('.form-locator-list')) {
|
|
192
|
-
if ($(form).find('#postcode-town').val().length){
|
|
203
|
+
if ($(form).find('#postcode-town').val().length) {
|
|
193
204
|
var actionAfterSubmit = $(form).attr('data-action');
|
|
194
|
-
if (actionAfterSubmit === 'scroll-to-list'){
|
|
205
|
+
if (actionAfterSubmit === 'scroll-to-list') {
|
|
195
206
|
clearValidationErrors(this);
|
|
196
207
|
handleSmoothScroll();
|
|
197
208
|
} else {
|
|
@@ -202,7 +213,7 @@ Wick.Forms = (function(){
|
|
|
202
213
|
}
|
|
203
214
|
|
|
204
215
|
if ($(form).is('#form-mini-basket')) {
|
|
205
|
-
if (Wick.User.isLoggedIn()){
|
|
216
|
+
if (Wick.User.isLoggedIn()) {
|
|
206
217
|
window.location.href = './page_checkout_delivery-address.html';
|
|
207
218
|
} else {
|
|
208
219
|
window.location.href = './page_checkout_sign-in.html';
|
|
@@ -210,13 +221,31 @@ Wick.Forms = (function(){
|
|
|
210
221
|
return false;
|
|
211
222
|
}
|
|
212
223
|
|
|
213
|
-
function isNotEmpty(field){
|
|
214
|
-
|
|
224
|
+
function isNotEmpty(field) {
|
|
225
|
+
var $field = $(field);
|
|
226
|
+
var type = ($field.attr('type') || '').toLowerCase();
|
|
227
|
+
|
|
228
|
+
if (type === 'checkbox') {
|
|
229
|
+
return $field.is(':checked');
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (type === 'radio') {
|
|
233
|
+
var name = $field.attr('name');
|
|
234
|
+
if (!name) return false;
|
|
235
|
+
|
|
236
|
+
var $scope = $field.closest('[data-row-required]');
|
|
237
|
+
if (!$scope.length) $scope = $field.closest('form');
|
|
238
|
+
|
|
239
|
+
return $scope.find('input[type="radio"][name="' + name.replace(/"/g, '\\"') + '"]').is(':checked');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return !!$field.val();
|
|
215
243
|
}
|
|
216
244
|
|
|
245
|
+
|
|
217
246
|
if ($(form).is('#form-checkout-your-details')) {
|
|
218
247
|
var requiredFields = $(form).find('[data-row-required]:visible :input');
|
|
219
|
-
if (_.every(requiredFields, isNotEmpty)){
|
|
248
|
+
if (_.every(requiredFields, isNotEmpty)) {
|
|
220
249
|
window.location.href = $(form).attr('data-action');
|
|
221
250
|
return false;
|
|
222
251
|
}
|
|
@@ -224,7 +253,7 @@ Wick.Forms = (function(){
|
|
|
224
253
|
|
|
225
254
|
if ($(form).is('#checkout-your-details-modal')) {
|
|
226
255
|
var requiredFields = $(form).find('[data-row-required]:visible :input');
|
|
227
|
-
if (_.every(requiredFields, isNotEmpty)){
|
|
256
|
+
if (_.every(requiredFields, isNotEmpty)) {
|
|
228
257
|
$('#modalDeliveryEdit').modal('hide');
|
|
229
258
|
return false;
|
|
230
259
|
}
|
|
@@ -238,15 +267,15 @@ Wick.Forms = (function(){
|
|
|
238
267
|
}
|
|
239
268
|
}
|
|
240
269
|
|
|
241
|
-
if ($(form).is('.checkout-register')){
|
|
270
|
+
if ($(form).is('.checkout-register')) {
|
|
242
271
|
if ($(form).find('#password').val().length &&
|
|
243
|
-
|
|
272
|
+
$(form).find('#confirm-password').val().length) {
|
|
244
273
|
window.location.href = './page_my-account.html';
|
|
245
274
|
return false;
|
|
246
275
|
}
|
|
247
276
|
}
|
|
248
277
|
|
|
249
|
-
if ($(form).is('#form-checkout-voucher')){
|
|
278
|
+
if ($(form).is('#form-checkout-voucher')) {
|
|
250
279
|
if ($(form).find('#voucher-code').val().length) {
|
|
251
280
|
return false;
|
|
252
281
|
}
|
|
@@ -258,11 +287,11 @@ Wick.Forms = (function(){
|
|
|
258
287
|
}
|
|
259
288
|
}
|
|
260
289
|
|
|
261
|
-
if ($(form).is('.header-search')){
|
|
290
|
+
if ($(form).is('.header-search')) {
|
|
262
291
|
window.location.href = './page_search-results.html';
|
|
263
292
|
}
|
|
264
293
|
|
|
265
|
-
if ($(form).is('.click-and-collect__locator-form')){
|
|
294
|
+
if ($(form).is('.click-and-collect__locator-form')) {
|
|
266
295
|
var $form = $(form);
|
|
267
296
|
if ($form.find('#click-and-collect-town').val().length) {
|
|
268
297
|
clearValidationErrors(this);
|
|
@@ -275,24 +304,24 @@ Wick.Forms = (function(){
|
|
|
275
304
|
return false;
|
|
276
305
|
}
|
|
277
306
|
|
|
278
|
-
if($(form).is('.form-track-order')) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if ($form.find('#order').val().length &&
|
|
282
|
-
$form.find('#tel').val().length &&
|
|
283
|
-
$form.find('#email').val().length &&
|
|
284
|
-
$form.find('#postcode').val().length) {
|
|
285
|
-
clearValidationErrors(this);
|
|
286
|
-
} else if (!$form.hasClass(formInvalid)) {
|
|
287
|
-
$form.addClass(formInvalid);
|
|
288
|
-
|
|
289
|
-
$(fieldRow).each(function() {
|
|
290
|
-
$(this).addClass(rowValidationError)
|
|
291
|
-
.append('<div class="form-row__error">' + $(this).data('message') + '</div>');
|
|
292
|
-
});
|
|
293
|
-
}
|
|
307
|
+
if ($(form).is('.form-track-order')) {
|
|
308
|
+
var $form = $(form);
|
|
294
309
|
|
|
295
|
-
|
|
310
|
+
if ($form.find('#order').val().length &&
|
|
311
|
+
$form.find('#tel').val().length &&
|
|
312
|
+
$form.find('#email').val().length &&
|
|
313
|
+
$form.find('#postcode').val().length) {
|
|
314
|
+
clearValidationErrors(this);
|
|
315
|
+
} else if (!$form.hasClass(formInvalid)) {
|
|
316
|
+
$form.addClass(formInvalid);
|
|
317
|
+
|
|
318
|
+
$(fieldRow).each(function() {
|
|
319
|
+
$(this).addClass(rowValidationError)
|
|
320
|
+
.append('<div class="form-row__error">' + $(this).data('message') + '</div>');
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return false;
|
|
296
325
|
}
|
|
297
326
|
|
|
298
327
|
if ($(form).is('#edit-billing-address')) {
|
|
@@ -308,28 +337,28 @@ Wick.Forms = (function(){
|
|
|
308
337
|
};
|
|
309
338
|
|
|
310
339
|
var scrollLocatorListPage = function() {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
340
|
+
var isLocatorListPage = $('.cards-store-list').length;
|
|
341
|
+
var isScrollNeeded = window.location.hash === '#stores-list';
|
|
342
|
+
if (isLocatorListPage && isScrollNeeded) {
|
|
343
|
+
handleSmoothScroll();
|
|
344
|
+
}
|
|
316
345
|
};
|
|
317
346
|
|
|
318
|
-
let bindEvents = function
|
|
347
|
+
let bindEvents = function() {
|
|
319
348
|
let selector = excludedClassesForForm.reduce((acc, className) => {
|
|
320
349
|
return acc + ':not([class^="' + className + '"])';
|
|
321
350
|
}, 'form');
|
|
322
351
|
$(document).on('submit', selector, handleFormSubmit);
|
|
323
352
|
$forgotPassword.on('click', scenarios[2].action);
|
|
324
|
-
$('.btn-cancel').on('click', function(){
|
|
353
|
+
$('.btn-cancel').on('click', function() {
|
|
325
354
|
window.location.href = './page_my-account.html';
|
|
326
355
|
});
|
|
327
|
-
$('.btn-previous').on('click', function(){
|
|
356
|
+
$('.btn-previous').on('click', function() {
|
|
328
357
|
window.location.href = './page_login.html';
|
|
329
358
|
});
|
|
330
359
|
};
|
|
331
360
|
|
|
332
|
-
var init = function
|
|
361
|
+
var init = function() {
|
|
333
362
|
bindEvents();
|
|
334
363
|
scrollLocatorListPage();
|
|
335
364
|
};
|
|
@@ -338,6 +367,6 @@ Wick.Forms = (function(){
|
|
|
338
367
|
|
|
339
368
|
return {
|
|
340
369
|
showValidationErrors: showValidationErrors,
|
|
341
|
-
clearValidationErrors: clearValidationErrors
|
|
342
|
-
}
|
|
370
|
+
clearValidationErrors: clearValidationErrors,
|
|
371
|
+
};
|
|
343
372
|
})();
|