PageSourceSearch

https://www.mwv-berlin.de/templates/default/angular/scripts/directives/cart/headerLink.js

js mwv-berlin.de collected 2026-10-02 16:29:54 UTC 1,916 bytes, 62 lines download raw bytes

1// $Id: headerLink.js 612 2017-06-15 12:18:40Z esc-wehlmann $
2angular.module('mwv').directive('cartHeaderLink', ['contentbuilder', 'magentoQuote', '$http', '$rootScope', '$filter', '$uibModal',
3	function (contentbuilder, magentoQuote, $http, $rootScope, $filter, $uibModal) {
4
5		var settings = contentbuilder.getFrontendSettings();
6
7		return {
8			restrict: 'E',
9			templateUrl: settings.templateUrl + 'angular/views/directives/cart/headerLink.html',
10			replace: true,
11
12			/**
13			 * @param $scope
14			 * @param element
15			 * @param attributes
16			 */
17			link: function ($scope, element, attributes) {
18
19				function reloadCartItemAmount() {
20					// get the cart item amount if the given quote
21					magentoQuote.getCartItemAmount().then(function successCallback(response) {
22						$scope.cartItemAmountLoading = false;
23						$scope.cartItemCounter = response.data.payload.amount;
24					}, function errorCallback(response) {
25						$scope.cartItemAmountLoading = false;
26					});
27				}
28
29                $scope.imageDir = settings.images;
30				$scope.cartItemCounter = 0;
31				$scope.cartItemAmountLoading = false;
32
33				if(settings.magentoOderStatus == 'order-success') {
34					settings.currentMagentoQuoteID = null;
35					magentoQuote.removeIDfromServer().then(function successCallback(response) {
36						// do nothing
37					}, function errorCallback(response) {
38						// do nothing
39					});
40				}
41
42				if(settings.currentMagentoQuoteID != null) {
43					$scope.cartItemAmountLoading = true;
44
45					// set the quote id if given from c*b
46					magentoQuote.setID(settings.currentMagentoQuoteID).then(function successCallback(response) {
47						// do nothing
48					}, function errorCallback(response) {
49						// do nothing
50					});
51
52					reloadCartItemAmount();
53				}
54
55				$rootScope.$watch('reloadCartTimeAmount', function(newValue, oldValue) {
56					if(newValue !== oldValue) {
57						reloadCartItemAmount();
58					}
59				});
60			}
61		};
62	}]);

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.