'; } //Preview Table $scope.getPopup = function(brand){ $http({ method: "post", url: "//www.merch.commtogether.com.au/Angular/AngularPostQuickView", data: { option: 2, brand: brand } }).then(function successCallback(response) { console.log(response.data);var modalID=response.data,element=angular.element("#"+modalID+"Modal");element.modal("show"); }, function errorCallback(response) { console.log("Error quickview query"); }); } /* Footer next */ /* Menus */ $scope.menuClicked=!0,$scope.closeMenus=function(){$scope.menuClicked=!0,angular.element(".main-menus").css("visibility","hidden")}; //run default $scope.openMainMenu = function(opts, mens){ $scope.stateForm=!1,$scope.closeMenus();var element=angular.element("."+opts);element.css("visibility","visible"),$scope.menuClicked=!1,element.addClass("open_"+opts),element.hasClass("open_"+opts)&&0==mens&&(element.removeClass("open_"+opts),element.css("visibility","hidden"),$scope.closeMenus()); } var _menutimeout; $scope.openMainMenuHover = function(opts, mens){ $scope.closeMenus(),$scope.stateForm=!1,_menutimeout&&$timeout.cancel(_menutimeout),_menutimeout=$timeout(function(){angular.element("."+opts).css("visibility","visible"),_menutimeout=null},300); } $scope.stopMenu=function(){_menutimeout&&$timeout.cancel(_menutimeout)}; $scope.hideSearchPopup = function(){ $scope.stateForm = false; } $scope.hoverOut = function(){ $scope.closeMenus(); } $scope.resetMenu = function(){ $scope.menuClicked = true; } $scope.toggleSearchForm = function () { $scope.stateForm = !$scope.stateForm; }; $window.onclick = function (event) { $scope.closeMenus(); $scope.$apply(); }; $scope.searchAdvanceFormPopup = {}; $scope.searchAdvanceFormPopup.range = { from: 0, to: 200 }; $scope.maxx = 200; $scope.newFormUrl = $scope.location + 'category/products' + $scope.customIDURL; $scope.changeFormURL = function(value){ if(!value || value =="" || value==null){ $scope.newFormUrl = $scope.location + 'category/products' + $scope.customIDURL; return; } //var lastStr = value[value.length -1]; var lastStr = value.substr(value.length - 1); var all = ''; //console.log(lastStr); //if 10-10 or 10-15 etc if(value.length > 4){ lastStr = value.substr(value.length - 2); } if(lastStr != '0'){ all = '/all'; } $scope.newFormUrl = $scope.location + 'category/' + value + all + $scope.customIDURL; } $scope.toggleFullNameItem = function (prim, colors) { //console.log(prim + colors); var colors = colors || ""; var element = angular.element('.tooltip-'+ prim + colors); element.css('visibility', 'visible'); } $scope.toggleFullNameItemMouseleave = function (){ var element = angular.element('.tooltip-alternative'); element.css('visibility', 'hidden'); } $scope.toggleIcons = function (prim, colors) { // console.log(prim + colors); var colors = colors || ""; var element = angular.element('.tooltipicon-'+ prim + colors); element.css('visibility', 'visible'); } $scope.toggleIconsMouseleave = function (){ var element = angular.element('.tooltip-alternativeicon'); element.css('visibility', 'hidden'); } $scope.closeTheCollapse=function(e){angular.element("#"+e).removeClass("show")}; var _timeout; $scope.getHitPromoAPI = function(hitPromoAPIs, hitCode){ if(hitPromoAPIs != 0){ if(_timeout) { $timeout.cancel(_timeout); } _timeout = $timeout(function() {$http({ method: "post", url: "//www.merch.commtogether.com.au/Angular/HitPromoAngularPost", data: { option:1,hitPromoAPIs:hitPromoAPIs,hitCode:hitCode}}).then(function successCallback(response) {$scope.hitPromoAPITable = response.data; }, function errorCallback(response) { console.log("Error getting Hit API query"); });_timeout = null; }, 100); } } $scope.searchHoverForm=function(){$scope.searchHoverTrigger()}; $scope.searchHoverFormOut=function(){$scope.searchHoverTrigger()}; $scope.searchHoverTrigger=function(){var e=angular.element(".select2-container"),i=angular.element(".item-card .hover-icons");e.hasClass("select2-container--open")?i.css("visibility","hidden"):i.css("visibility","visible")}; $scope.switchAccount = function(id, userID){ $http({ method: "post", url: "//www.merch.commtogether.com.au/Switchaccount/requestSwitch", data: { option: 1, id: id, userID: userID } }).then(function successCallback(response) { 1==response.data&&$timeout(function(){var o=window.location.href.split("?");"all=1"==o[1]?window.location.href=o[0]:$window.location.reload()},600); }, function errorCallback(response) { console.log("Error switching account"); }); } $scope.backtoPrimaryAccount = function(userID){ $http({method: "post",url:"//www.merch.commtogether.com.au/Switchaccount/requestSwitch",data:{option:2,userID:userID}}).then(function successCallback(response) { 1==response.data&&$timeout(function(){var o=window.location.href.split("?");"all=1"==o[1]?window.location.href=o[0]:$window.location.reload()},600); }, function errorCallback(response) { console.log("Error switching to primary account"); }); } /************************Switch Accounts **************************************/ //Site wide image zooming $scope.imgZoom = function(itemCode, activeSlide){ activeSlide = activeSlide || 0; //Pull in image data for this item let data = { itemCode: itemCode }; let url = '/item/image-data/' + itemCode; $scope.imgZoomData = { initialSlide: activeSlide, data: {} }; //Request item image data $http .get(url, {data: data}) .then(function successCallback(response) { $scope.imgZoomData.data = response.data; $('#imgZoomModal').modal('show'); }, function errorCallback(response) { console.log('Error retrieving the image data for item: '+ itemCode); console.log(response); }); //Post image modal show actions $('#imgZoomModal').on('shown.bs.modal', function(){ //Focusing on navigation makes arrow keys work straight away $('#image-zoom-carousel .carousel-control-next').focus(); }); } $scope.viewImageInCard = function(img, prim, code, i, random, imgNum){ $scope.closeQuickView(); if(imgNum !== null){ imgNum = imgNum; var elementR = angular.element('.quickviewNewIMG' + prim + ' img' ); elementR.remove(); //console.log("THIS ONE "); } // if(i > 0){ var elementZ = angular.element('.zoomspan' + prim + ' span' ); elementZ.remove(); var elementSpanZoom = angular.element('.zoomspan' + prim ); var htmlx = '+'; // Step 1: parse HTML into DOM element var templatex = angular.element(htmlx); // Step 2: compile the template var linkFn = $compile(templatex); // Step 3: link the compiled template with the scope. var elementx = linkFn($scope); // Step 4: Append to DOM (optional) elementSpanZoom.append(elementx); //console.log("THIS TWO "); // } //$scope.viewImg = true; $scope.codeImg = code; $scope.viewImg = img; //$scope.imgx = i; var element = angular.element('.quickviewIMG' + prim); element.css('display', 'none'); var elementX = angular.element('.quickviewNewIMG' + prim + ' img' ); elementX.remove(); var element2 = angular.element('.quickviewNewIMG' + prim); element2.css('display', 'block'); var imgLoc = $scope.location + "Images/ProductImg/" + $scope.viewImg + "?" +random; var svg = angular.element(' '); element2.append(svg); // console.log(img + "/" +prim + " / " + $scope.imgx + " / " + imgNum) } }]); // end controller