wickes-css2 2.112.0-develop.4 → 2.112.0-develop.6

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 (37) hide show
  1. package/build/css/category-main.css +1 -1
  2. package/build/css/components/global-search.css +1 -1
  3. package/build/css/homepage-main.css +1 -1
  4. package/build/css/kitchen-plp-main.css +1 -1
  5. package/build/css/main.css +1 -1
  6. package/build/css/my-account-main-v2.css +1 -1
  7. package/build/css/my-account-main.css +1 -1
  8. package/build/css/pages/page_product-details-critical.css +1 -1
  9. package/build/css/pages/page_product-details.css +1 -1
  10. package/build/css/pdp-main-before-combine.css +1 -1
  11. package/build/css/pdp-main-critical.css +1 -1
  12. package/build/css/pdp-main-non-critical.css +1 -1
  13. package/build/css/pdp-main.css +1 -1
  14. package/build/css/plp-main.css +1 -1
  15. package/build/css/store-locator-main.css +1 -1
  16. package/build/js/basket.min.js +1 -1
  17. package/build/js/emulation.min.js +330 -30
  18. package/build/js/page/basket-v2.js +29 -20
  19. package/package.json +1 -1
  20. package/src/components/my-account/order.hbs +6 -1
  21. package/src/components/order-item.hbs +7 -7
  22. package/src/components/potential-promotion.hbs +4 -4
  23. package/src/components/price-badges.hbs +12 -0
  24. package/src/components/price-block-v2.hbs +3 -12
  25. package/src/components/share-list-modal-without-social-icons.hbs +2 -2
  26. package/src/components/share-list-modal.hbs +7 -3
  27. package/src/data/data_shopping-cart-v2.json +46 -2
  28. package/src/data/data_shopping-cart-with-energy.json +26 -2
  29. package/src/data/my-account/data_my-order.json +8 -0
  30. package/src/js/emulation/basket-data.js +312 -0
  31. package/src/js/emulation/shopping-list.js +40 -49
  32. package/src/js/page/basket-v2.js +29 -20
  33. package/src/page_track-my-order-result.html +1 -0
  34. package/src/scss/components/_tradepro-discount-banner.scss +10 -14
  35. package/src/scss/components/global-search.scss +0 -6
  36. package/src/scss/pages/page_product-details-critical.scss +7 -0
  37. package/src/scss/pages/page_product-details.scss +7 -0
@@ -72,6 +72,18 @@ Wick.BasketData = (function () {
72
72
  currencyIso: 'GBP',
73
73
  formattedPriceWithoutCurrencySymbol: '4',
74
74
  },
75
+ displayBasePrice: {
76
+ value: 5.0,
77
+ formattedValue: '£5.00',
78
+ currencyIso: 'GBP',
79
+ formattedPriceWithoutCurrencySymbol: '5.00',
80
+ },
81
+ displayBasePriceExclusiveVat: {
82
+ value: 4,
83
+ formattedValue: '£4',
84
+ currencyIso: 'GBP',
85
+ formattedPriceWithoutCurrencySymbol: '4',
86
+ },
75
87
  totalPrice: {
76
88
  currencyIso: 'GBP',
77
89
  value: 3700.0,
@@ -413,6 +425,18 @@ Wick.BasketData = (function () {
413
425
  currencyIso: 'GBP',
414
426
  formattedPriceWithoutCurrencySymbol: '3600',
415
427
  },
428
+ displayItemTotalWithoutDiscount: {
429
+ value: 3700.0,
430
+ formattedValue: '£3700.00',
431
+ currencyIso: 'GBP',
432
+ formattedPriceWithoutCurrencySymbol: '3700.00',
433
+ },
434
+ displayItemTotalWithoutDiscountExclusiveVat: {
435
+ value: 3600,
436
+ formattedValue: '£3600',
437
+ currencyIso: 'GBP',
438
+ formattedPriceWithoutCurrencySymbol: '3600',
439
+ },
416
440
  appliedPromotions: null,
417
441
  tilingInstallationData: null,
418
442
  flooringInstallationData: null,
@@ -501,6 +525,18 @@ Wick.BasketData = (function () {
501
525
  currencyIso: 'GBP',
502
526
  formattedPriceWithoutCurrencySymbol: '99',
503
527
  },
528
+ displayBasePrice: {
529
+ value: 100.0,
530
+ formattedValue: '£100',
531
+ currencyIso: 'GBP',
532
+ formattedPriceWithoutCurrencySymbol: '100',
533
+ },
534
+ displayBasePriceExclusiveVat: {
535
+ value: 99,
536
+ formattedValue: '£99',
537
+ currencyIso: 'GBP',
538
+ formattedPriceWithoutCurrencySymbol: '99',
539
+ },
504
540
  product: {
505
541
  code: '221100',
506
542
  name: 'Blue Circle Ready To Use Postcrete - 20kg',
@@ -556,6 +592,18 @@ Wick.BasketData = (function () {
556
592
  currencyIso: 'GBP',
557
593
  formattedPriceWithoutCurrencySymbol: '99',
558
594
  },
595
+ displayItemTotalWithoutDiscount: {
596
+ value: 100.0,
597
+ formattedValue: '£100',
598
+ currencyIso: 'GBP',
599
+ formattedPriceWithoutCurrencySymbol: '100',
600
+ },
601
+ displayItemTotalWithoutDiscountExclusiveVat: {
602
+ value: 99,
603
+ formattedValue: '£99',
604
+ currencyIso: 'GBP',
605
+ formattedPriceWithoutCurrencySymbol: '99',
606
+ },
559
607
  orderFulfilmentControls: {
560
608
  availableForDelivery: true,
561
609
  availableForCollection: true,
@@ -588,6 +636,18 @@ Wick.BasketData = (function () {
588
636
  currencyIso: 'GBP',
589
637
  formattedPriceWithoutCurrencySymbol: '23',
590
638
  },
639
+ displayBasePrice: {
640
+ value: 24.0,
641
+ formattedValue: '£24',
642
+ currencyIso: 'GBP',
643
+ formattedPriceWithoutCurrencySymbol: '24',
644
+ },
645
+ displayBasePriceExclusiveVat: {
646
+ value: 23,
647
+ formattedValue: '£23',
648
+ currencyIso: 'GBP',
649
+ formattedPriceWithoutCurrencySymbol: '23',
650
+ },
591
651
  product: {
592
652
  code: '109450',
593
653
  name: 'Knauf Insulation Space Standard Top Up 170mm Loft Roll - 6.47m²',
@@ -640,6 +700,18 @@ Wick.BasketData = (function () {
640
700
  currencyIso: 'GBP',
641
701
  formattedPriceWithoutCurrencySymbol: '23',
642
702
  },
703
+ displayItemTotalWithoutDiscount: {
704
+ value: 24.0,
705
+ formattedValue: '£24',
706
+ currencyIso: 'GBP',
707
+ formattedPriceWithoutCurrencySymbol: '24',
708
+ },
709
+ displayItemTotalWithoutDiscountExclusiveVat: {
710
+ value: 23,
711
+ formattedValue: '£23',
712
+ currencyIso: 'GBP',
713
+ formattedPriceWithoutCurrencySymbol: '23',
714
+ },
643
715
  orderFulfilmentControls: {
644
716
  availableForDelivery: true,
645
717
  availableForCollection: true,
@@ -661,6 +733,18 @@ Wick.BasketData = (function () {
661
733
  currencyIso: 'GBP',
662
734
  formattedPriceWithoutCurrencySymbol: '0',
663
735
  },
736
+ displayBasePrice: {
737
+ value: 0.0,
738
+ formattedValue: '£0',
739
+ currencyIso: 'GBP',
740
+ formattedPriceWithoutCurrencySymbol: '0',
741
+ },
742
+ displayBasePriceExclusiveVat: {
743
+ value: 0,
744
+ formattedValue: '£0',
745
+ currencyIso: 'GBP',
746
+ formattedPriceWithoutCurrencySymbol: '0',
747
+ },
664
748
  product: {
665
749
  code: '103123',
666
750
  name: 'Wickes Passage Door Knob Set - Brass 1 Pair',
@@ -720,6 +804,18 @@ Wick.BasketData = (function () {
720
804
  currencyIso: 'GBP',
721
805
  formattedPriceWithoutCurrencySymbol: '0',
722
806
  },
807
+ displayItemTotalWithoutDiscount: {
808
+ value: 0.0,
809
+ formattedValue: '£0',
810
+ currencyIso: 'GBP',
811
+ formattedPriceWithoutCurrencySymbol: '0',
812
+ },
813
+ displayItemTotalWithoutDiscountExclusiveVat: {
814
+ value: 0,
815
+ formattedValue: '£0',
816
+ currencyIso: 'GBP',
817
+ formattedPriceWithoutCurrencySymbol: '0',
818
+ },
723
819
  orderFulfilmentControls: {
724
820
  availableForDelivery: true,
725
821
  availableForCollection: true,
@@ -754,6 +850,18 @@ Wick.BasketData = (function () {
754
850
  currencyIso: 'GBP',
755
851
  formattedPriceWithoutCurrencySymbol: '24',
756
852
  },
853
+ displayBasePrice: {
854
+ value: 25.0,
855
+ formattedValue: '£25',
856
+ currencyIso: 'GBP',
857
+ formattedPriceWithoutCurrencySymbol: '25',
858
+ },
859
+ displayBasePriceExclusiveVat: {
860
+ value: 24,
861
+ formattedValue: '£24',
862
+ currencyIso: 'GBP',
863
+ formattedPriceWithoutCurrencySymbol: '24',
864
+ },
757
865
  product: {
758
866
  code: '109451',
759
867
  name: 'Knauf Insulation Super Top Up 200mm Loft Roll - 5.61m²',
@@ -814,6 +922,18 @@ Wick.BasketData = (function () {
814
922
  currencyIso: 'GBP',
815
923
  formattedPriceWithoutCurrencySymbol: '24',
816
924
  },
925
+ displayItemTotalWithoutDiscount: {
926
+ value: 25.0,
927
+ formattedValue: '£25',
928
+ currencyIso: 'GBP',
929
+ formattedPriceWithoutCurrencySymbol: '25',
930
+ },
931
+ displayItemTotalWithoutDiscountExclusiveVat: {
932
+ value: 24,
933
+ formattedValue: '£24',
934
+ currencyIso: 'GBP',
935
+ formattedPriceWithoutCurrencySymbol: '24',
936
+ },
817
937
  orderFulfilmentControls: {
818
938
  availableForDelivery: true,
819
939
  availableForCollection: true,
@@ -835,6 +955,18 @@ Wick.BasketData = (function () {
835
955
  currencyIso: 'GBP',
836
956
  formattedPriceWithoutCurrencySymbol: '24',
837
957
  },
958
+ displayBasePrice: {
959
+ value: 25.0,
960
+ formattedValue: '£25',
961
+ currencyIso: 'GBP',
962
+ formattedPriceWithoutCurrencySymbol: '25',
963
+ },
964
+ displayBasePriceExclusiveVat: {
965
+ value: 24,
966
+ formattedValue: '£24',
967
+ currencyIso: 'GBP',
968
+ formattedPriceWithoutCurrencySymbol: '24',
969
+ },
838
970
  product: {
839
971
  code: '123143',
840
972
  name: '6 Wickes General Purpose Claw test',
@@ -884,6 +1016,18 @@ Wick.BasketData = (function () {
884
1016
  currencyIso: 'GBP',
885
1017
  formattedPriceWithoutCurrencySymbol: '24',
886
1018
  },
1019
+ displayItemTotalWithoutDiscount: {
1020
+ value: 25.0,
1021
+ formattedValue: '£25',
1022
+ currencyIso: 'GBP',
1023
+ formattedPriceWithoutCurrencySymbol: '25',
1024
+ },
1025
+ displayItemTotalWithoutDiscountExclusiveVat: {
1026
+ value: 24,
1027
+ formattedValue: '£24',
1028
+ currencyIso: 'GBP',
1029
+ formattedPriceWithoutCurrencySymbol: '24',
1030
+ },
887
1031
  orderFulfilmentControls: {
888
1032
  availableForDelivery: true,
889
1033
  availableForCollection: true,
@@ -989,6 +1133,18 @@ Wick.BasketData = (function () {
989
1133
  currencyIso: 'GBP',
990
1134
  formattedPriceWithoutCurrencySymbol: '99',
991
1135
  },
1136
+ displayBasePrice: {
1137
+ value: 100.0,
1138
+ formattedValue: '£100',
1139
+ currencyIso: 'GBP',
1140
+ formattedPriceWithoutCurrencySymbol: '100',
1141
+ },
1142
+ displayBasePriceExclusiveVat: {
1143
+ value: 99,
1144
+ formattedValue: '£99',
1145
+ currencyIso: 'GBP',
1146
+ formattedPriceWithoutCurrencySymbol: '99',
1147
+ },
992
1148
  product: {
993
1149
  code: '221100',
994
1150
  name: 'Blue Circle Ready To Use Postcrete - 20kg',
@@ -1044,6 +1200,18 @@ Wick.BasketData = (function () {
1044
1200
  currencyIso: 'GBP',
1045
1201
  formattedPriceWithoutCurrencySymbol: '99',
1046
1202
  },
1203
+ displayItemTotalWithoutDiscount: {
1204
+ value: 100.0,
1205
+ formattedValue: '£100',
1206
+ currencyIso: 'GBP',
1207
+ formattedPriceWithoutCurrencySymbol: '100',
1208
+ },
1209
+ displayItemTotalWithoutDiscountExclusiveVat: {
1210
+ value: 99,
1211
+ formattedValue: '£99',
1212
+ currencyIso: 'GBP',
1213
+ formattedPriceWithoutCurrencySymbol: '99',
1214
+ },
1047
1215
  orderFulfilmentControls: {
1048
1216
  availableForDelivery: true,
1049
1217
  availableForCollection: true,
@@ -1076,6 +1244,18 @@ Wick.BasketData = (function () {
1076
1244
  currencyIso: 'GBP',
1077
1245
  formattedPriceWithoutCurrencySymbol: '23',
1078
1246
  },
1247
+ displayBasePrice: {
1248
+ value: 24.0,
1249
+ formattedValue: '£24',
1250
+ currencyIso: 'GBP',
1251
+ formattedPriceWithoutCurrencySymbol: '24',
1252
+ },
1253
+ displayBasePriceExclusiveVat: {
1254
+ value: 23,
1255
+ formattedValue: '£23',
1256
+ currencyIso: 'GBP',
1257
+ formattedPriceWithoutCurrencySymbol: '23',
1258
+ },
1079
1259
  product: {
1080
1260
  code: '109450',
1081
1261
  name: 'Knauf Insulation Space Standard Top Up 170mm Loft Roll - 6.47m²',
@@ -1128,6 +1308,18 @@ Wick.BasketData = (function () {
1128
1308
  currencyIso: 'GBP',
1129
1309
  formattedPriceWithoutCurrencySymbol: '23',
1130
1310
  },
1311
+ displayItemTotalWithoutDiscount: {
1312
+ value: 24.0,
1313
+ formattedValue: '£24',
1314
+ currencyIso: 'GBP',
1315
+ formattedPriceWithoutCurrencySymbol: '24',
1316
+ },
1317
+ displayItemTotalWithoutDiscountExclusiveVat: {
1318
+ value: 23,
1319
+ formattedValue: '£23',
1320
+ currencyIso: 'GBP',
1321
+ formattedPriceWithoutCurrencySymbol: '23',
1322
+ },
1131
1323
  orderFulfilmentControls: {
1132
1324
  availableForDelivery: true,
1133
1325
  availableForCollection: true,
@@ -1149,6 +1341,18 @@ Wick.BasketData = (function () {
1149
1341
  currencyIso: 'GBP',
1150
1342
  formattedPriceWithoutCurrencySymbol: '0',
1151
1343
  },
1344
+ displayBasePrice: {
1345
+ value: 0.0,
1346
+ formattedValue: '£0',
1347
+ currencyIso: 'GBP',
1348
+ formattedPriceWithoutCurrencySymbol: '0',
1349
+ },
1350
+ displayBasePriceExclusiveVat: {
1351
+ value: 0,
1352
+ formattedValue: '£0',
1353
+ currencyIso: 'GBP',
1354
+ formattedPriceWithoutCurrencySymbol: '0',
1355
+ },
1152
1356
  product: {
1153
1357
  code: '103123',
1154
1358
  name: 'Wickes Passage Door Knob Set - Brass 1 Pair',
@@ -1208,6 +1412,18 @@ Wick.BasketData = (function () {
1208
1412
  currencyIso: 'GBP',
1209
1413
  formattedPriceWithoutCurrencySymbol: '0',
1210
1414
  },
1415
+ displayItemTotalWithoutDiscount: {
1416
+ value: 0.0,
1417
+ formattedValue: '£0',
1418
+ currencyIso: 'GBP',
1419
+ formattedPriceWithoutCurrencySymbol: '0',
1420
+ },
1421
+ displayItemTotalWithoutDiscountExclusiveVat: {
1422
+ value: 0,
1423
+ formattedValue: '£0',
1424
+ currencyIso: 'GBP',
1425
+ formattedPriceWithoutCurrencySymbol: '0',
1426
+ },
1211
1427
  orderFulfilmentControls: {
1212
1428
  availableForDelivery: true,
1213
1429
  availableForCollection: true,
@@ -1242,6 +1458,18 @@ Wick.BasketData = (function () {
1242
1458
  currencyIso: 'GBP',
1243
1459
  formattedPriceWithoutCurrencySymbol: '24',
1244
1460
  },
1461
+ displayBasePrice: {
1462
+ value: 25.0,
1463
+ formattedValue: '£25',
1464
+ currencyIso: 'GBP',
1465
+ formattedPriceWithoutCurrencySymbol: '25',
1466
+ },
1467
+ displayBasePriceExclusiveVat: {
1468
+ value: 24,
1469
+ formattedValue: '£24',
1470
+ currencyIso: 'GBP',
1471
+ formattedPriceWithoutCurrencySymbol: '24',
1472
+ },
1245
1473
  product: {
1246
1474
  code: '109451',
1247
1475
  name: 'Knauf Insulation Super Top Up 200mm Loft Roll - 5.61m²',
@@ -1302,6 +1530,18 @@ Wick.BasketData = (function () {
1302
1530
  currencyIso: 'GBP',
1303
1531
  formattedPriceWithoutCurrencySymbol: '24',
1304
1532
  },
1533
+ displayItemTotalWithoutDiscount: {
1534
+ value: 25.0,
1535
+ formattedValue: '£25',
1536
+ currencyIso: 'GBP',
1537
+ formattedPriceWithoutCurrencySymbol: '25',
1538
+ },
1539
+ displayItemTotalWithoutDiscountExclusiveVat: {
1540
+ value: 24,
1541
+ formattedValue: '£24',
1542
+ currencyIso: 'GBP',
1543
+ formattedPriceWithoutCurrencySymbol: '24',
1544
+ },
1305
1545
  orderFulfilmentControls: {
1306
1546
  availableForDelivery: true,
1307
1547
  availableForCollection: true,
@@ -1323,6 +1563,18 @@ Wick.BasketData = (function () {
1323
1563
  currencyIso: 'GBP',
1324
1564
  formattedPriceWithoutCurrencySymbol: '24',
1325
1565
  },
1566
+ displayBasePrice: {
1567
+ value: 25.0,
1568
+ formattedValue: '£25',
1569
+ currencyIso: 'GBP',
1570
+ formattedPriceWithoutCurrencySymbol: '25',
1571
+ },
1572
+ displayBasePriceExclusiveVat: {
1573
+ value: 24,
1574
+ formattedValue: '£24',
1575
+ currencyIso: 'GBP',
1576
+ formattedPriceWithoutCurrencySymbol: '24',
1577
+ },
1326
1578
  product: {
1327
1579
  code: '123143',
1328
1580
  name: '6 Wickes General Purpose Claw test',
@@ -1372,6 +1624,18 @@ Wick.BasketData = (function () {
1372
1624
  currencyIso: 'GBP',
1373
1625
  formattedPriceWithoutCurrencySymbol: '24',
1374
1626
  },
1627
+ displayItemTotalWithoutDiscount: {
1628
+ value: 25.0,
1629
+ formattedValue: '£25',
1630
+ currencyIso: 'GBP',
1631
+ formattedPriceWithoutCurrencySymbol: '25',
1632
+ },
1633
+ displayItemTotalWithoutDiscountExclusiveVat: {
1634
+ value: 24,
1635
+ formattedValue: '£24',
1636
+ currencyIso: 'GBP',
1637
+ formattedPriceWithoutCurrencySymbol: '24',
1638
+ },
1375
1639
  orderFulfilmentControls: {
1376
1640
  availableForDelivery: true,
1377
1641
  availableForCollection: true,
@@ -1430,6 +1694,18 @@ Wick.BasketData = (function () {
1430
1694
  currencyIso: 'GBP',
1431
1695
  formattedPriceWithoutCurrencySymbol: '17',
1432
1696
  },
1697
+ displayBasePrice: {
1698
+ value: 18.0,
1699
+ formattedValue: '£18.00',
1700
+ currencyIso: 'GBP',
1701
+ formattedPriceWithoutCurrencySymbol: '18.00',
1702
+ },
1703
+ displayBasePriceExclusiveVat: {
1704
+ value: 17,
1705
+ formattedValue: '£17',
1706
+ currencyIso: 'GBP',
1707
+ formattedPriceWithoutCurrencySymbol: '17',
1708
+ },
1433
1709
  totalPrice: {
1434
1710
  currencyIso: 'GBP',
1435
1711
  value: 36.0,
@@ -1910,6 +2186,18 @@ Wick.BasketData = (function () {
1910
2186
  currencyIso: 'GBP',
1911
2187
  formattedPriceWithoutCurrencySymbol: '35',
1912
2188
  },
2189
+ displayItemTotalWithoutDiscount: {
2190
+ value: 36.0,
2191
+ formattedValue: '£36.00',
2192
+ currencyIso: 'GBP',
2193
+ formattedPriceWithoutCurrencySymbol: '36.00',
2194
+ },
2195
+ displayItemTotalWithoutDiscountExclusiveVat: {
2196
+ value: 35,
2197
+ formattedValue: '£35',
2198
+ currencyIso: 'GBP',
2199
+ formattedPriceWithoutCurrencySymbol: '35',
2200
+ },
1913
2201
  appliedPromotions: null,
1914
2202
  tilingInstallationData: null,
1915
2203
  flooringInstallationData: null,
@@ -1960,6 +2248,18 @@ Wick.BasketData = (function () {
1960
2248
  currencyIso: 'GBP',
1961
2249
  formattedPriceWithoutCurrencySymbol: '3',
1962
2250
  },
2251
+ displayBasePrice: {
2252
+ value: 4.0,
2253
+ formattedValue: '£4.00',
2254
+ currencyIso: 'GBP',
2255
+ formattedPriceWithoutCurrencySymbol: '4.00',
2256
+ },
2257
+ displayBasePriceExclusiveVat: {
2258
+ value: 3,
2259
+ formattedValue: '£3',
2260
+ currencyIso: 'GBP',
2261
+ formattedPriceWithoutCurrencySymbol: '3',
2262
+ },
1963
2263
  totalPrice: {
1964
2264
  currencyIso: 'GBP',
1965
2265
  value: 24.0,
@@ -2165,6 +2465,18 @@ Wick.BasketData = (function () {
2165
2465
  currencyIso: 'GBP',
2166
2466
  formattedPriceWithoutCurrencySymbol: '23',
2167
2467
  },
2468
+ displayItemTotalWithoutDiscount: {
2469
+ value: 24.0,
2470
+ formattedValue: '£24.00',
2471
+ currencyIso: 'GBP',
2472
+ formattedPriceWithoutCurrencySymbol: '24.00',
2473
+ },
2474
+ displayItemTotalWithoutDiscountExclusiveVat: {
2475
+ value: 23,
2476
+ formattedValue: '£23',
2477
+ currencyIso: 'GBP',
2478
+ formattedPriceWithoutCurrencySymbol: '23',
2479
+ },
2168
2480
  appliedPromotions: null,
2169
2481
  tilingInstallationData: null,
2170
2482
  flooringInstallationData: null,
@@ -1,11 +1,13 @@
1
1
  var Wick = Wick || {};
2
2
 
3
3
  Wick.ShoppingList = {
4
- bindAll : function () {
4
+ invalidEmailMessage: 'Please enter a valid email address',
5
+
6
+ bindAll: function () {
5
7
  Wick.ShoppingList.bindButtons();
6
8
  },
7
9
 
8
- bindButtons : function () {
10
+ bindButtons: function () {
9
11
  $('.btn-share-confirmation .btn-primary').on('click', function (e) {
10
12
  e.preventDefault();
11
13
  $('#share-via-email').prop('required', false);
@@ -13,7 +15,7 @@ Wick.ShoppingList = {
13
15
  });
14
16
  },
15
17
 
16
- submitSharingShoppingList : function () {
18
+ submitSharingShoppingList: function () {
17
19
  var forms = Wick.ShoppingList.getRecipientEmailsForms();
18
20
 
19
21
  if (Wick.ShoppingList.isFormsValid(forms)) {
@@ -21,82 +23,71 @@ Wick.ShoppingList = {
21
23
  }
22
24
  },
23
25
 
24
- onSuccessSharingShoppingList : function () {
26
+ onSuccessSharingShoppingList: function () {
25
27
  Wick.ShoppingList.resetFormErrors();
26
28
  },
27
29
 
28
- getRecipientEmailsForms : function () {
30
+ getRecipientEmailsForms: function () {
29
31
  var forms = new Array();
30
32
 
31
33
  forms.push($('#share-via-email'));
32
34
  $('.share-via-email-box').each(function () {
33
- forms.push($(this).find('[type="email"]'));
35
+ forms.push($(this).find('[name="share-list-modal"]'));
34
36
  });
35
37
 
36
38
  return forms;
37
39
  },
38
40
 
39
- isFormsValid : function (forms) {
40
- var oneFieldFilledIn = false;
41
+ clearValidationErrors: function (forms) {
42
+ forms.forEach(function (form) {
43
+ window.Wick.Validation.removeValidationError(form);
44
+ });
45
+ },
41
46
 
42
- forms.forEach(function(form) {
43
- if ($(form).val() !== '') {
44
- oneFieldFilledIn = true;
45
- }
47
+ isFormsValid: function (forms) {
48
+ Wick.ShoppingList.clearValidationErrors(forms);
49
+
50
+ var oneFieldFilledIn = forms.some(function (form) {
51
+ return $(form).val() !== '';
46
52
  });
47
53
 
48
54
  if (!oneFieldFilledIn) {
49
- Wick.ShoppingList.showEmptyFormsWarning(forms[0]);
55
+ window.Wick.Validation.displayValidationError(
56
+ forms[0],
57
+ Wick.ShoppingList.invalidEmailMessage
58
+ );
50
59
  return false;
51
60
  }
52
61
 
53
62
  var isFormsValid = true;
54
63
 
55
- forms.forEach(function(form) {
56
- console.log(form[0]);
57
- if (!form[0].checkValidity()) {
58
- Wick.ShoppingList.showInvalidEmailWarning(form);
59
- isFormsValid = false;
60
- }
61
- });
64
+ forms
65
+ .filter(function (form) {
66
+ return $(form).val() !== '';
67
+ })
68
+ .forEach(function (form) {
69
+ if (window.Wick.Validation.isValidEmail($(form).val())) {
70
+ window.Wick.Validation.removeValidationError(form);
71
+ } else {
72
+ window.Wick.Validation.displayValidationError(
73
+ form,
74
+ Wick.ShoppingList.invalidEmailMessage
75
+ );
76
+ isFormsValid = false;
77
+ }
78
+ });
62
79
 
63
80
  return isFormsValid;
64
81
  },
65
82
 
66
- showEmptyFormsWarning : function (form) {
67
- form.prop('required', true);
68
-
69
- try {
70
- form.get(0).reportValidity();
71
- } catch (e) {
72
- Wick.ShoppingList.resetFormErrors();
73
-
74
- form.closest('.form-row').addClass('form-row_validation-error');
75
- form.closest('.form-row__field').append('<div class="form-row__error">Please fill in the field</div>');
76
- }
77
- },
78
-
79
- showInvalidEmailWarning : function (form) {
80
- try {
81
- form.get(0).reportValidity();
82
- } catch (e) {
83
- Wick.ShoppingList.resetFormErrors();
84
-
85
- form.closest('.form-row').addClass('form-row_validation-error');
86
- form.closest('.form-row__field').append('<div class="form-row__error">Please fill in the field</div>');
87
- }
88
- },
89
-
90
83
  resetFormErrors: function () {
91
- $('#share-list-form .form-row').each(function() {
84
+ $('#share-list-form .form-row').each(function () {
92
85
  $(this).removeClass('form-row_validation-error');
93
86
  $(this).find('.form-row__error').remove();
94
87
  });
95
- }
88
+ },
96
89
  };
97
90
 
98
-
99
-
100
- $(document).ready(function() {
91
+ $(document).ready(function () {
101
92
  Wick.ShoppingList.bindAll();
102
93
  });