1; (function (ng) { 2 'use strict'; 3 4 var CartFullCtrl = function ($rootScope, cartService, moduleService) { 5 var ctrl = this; 6 7 cartService.getData().then(function (data) { 8 //debugger; 9 ctrl.cartData = data; 10 }); 11 12 ctrl.updateAmount = function (value, itemId) { 13 14 var item = { 15 Key: itemId, 16 Value: value 17 }; 18 19 cartService.updateAmount([item]).then(function () { 20 moduleService.update('fullcartmessage'); 21 22 //ISVR: Custom code starts 23 angular.element(document.body).injector().get("$rootScope").$emit('updateCheckoutData', {}); 24 //ISVR: Custom code ends 25 }); 26 }; 27 28 ctrl.remove = function (shoppingCartItemId) { 29 cartService.removeItem(shoppingCartItemId).then(function (result) { 30 moduleService.update('fullcartmessage'); 31 $(document).trigger("cart.remove", result.offerId); 32 33 //ISVR: Custom code starts 34 angular.element(document.body).injector().get("$rootScope").$emit('updateCheckoutData', {}); 35 36 var injector = angular.element(document.body).injector(); 37 var rootScope = injector.get("$rootScope"); 38 var eventData = {}; 39 eventData.productId = result.productId; 40 eventData.action = 'remove'; 41 42 rootScope.$emit("cartDataLoaded", eventData); 43 44 //ISVR: Custom code ends 45 }); 46 }; 47 48 ctrl.clear = function () { 49 cartService.clear().then(function () { 50 moduleService.update('fullcartmessage'); 51 $(document).trigger("cart.clear"); 52 //ISVR: Custom code starts 53 let injector = angular.element(document.body).injector(); 54 let rootScope = injector.get("$rootScope"); 55 56 if (!angular.isUndefined(rootScope)) { 57 let hasListeners = rootScope.$$listeners.hasOwnProperty('cartDataLoaded') ? rootScope.$$listeners.cartDataLoaded.length > 0 : false; 58 59 if (hasListeners) { 60 rootScope.$emit('cartDataLoaded', {}); 61 } 62 63 hasListeners = rootScope.$$listeners.hasOwnProperty('updateCheckoutData') ? rootScope.$$listeners.updateCheckoutData.length > 0 : false; 64 65 if (hasListeners) { 66 rootScope.$emit('updateCheckoutData', {}); 67 } 68 69 hasListeners = rootScope.$$listeners.hasOwnProperty('cartDataCleared') ? rootScope.$$listeners.cartDataCleared.length > 0 : false; 70 71 if (hasListeners) { 72 rootScope.$emit('cartDataCleared', {}); 73 } 74 } 75 //ISVR: Custom code ends 76 }); 77 }; 78 79 80 //ISVR: Custom code starts 81 $rootScope.$on("updateCartData", function () { 82 //debugger; 83 ctrl.refresh(); 84 }); 85 //ISVR: Custom code ends 86 87 ctrl.refresh = function () { 88 //debugger; 89 return cartService.getData(false).then(function (data) { 90 //debugger; 91 ctrl.cartData = data; 92 }); 93 }; 94 }; 95 96 ng.module('cart') 97 .controller('CartFullCtrl', CartFullCtrl); 98 99 CartFullCtrl.$inject = ['$rootScope','cartService', 'moduleService']; 100 101})(window.angular);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.