define(['dashboard/dashboard'], function (dashboard) { dashboard.controller('DashboardInsuredItems', ['$scope', '$http', '$filter', '$stateParams', '$location', '$anchorScroll', function ($scope, $http, $filter, $mdDialog, $stateParams, $location, $anchorScroll) { $scope.getNewQuote = false; $scope.getRiskItemUrl = function (riskItem, url) { return url + "?riskItem=" + riskItem.VehicleRiskType + "-" + riskItem.SequenceNumber } if ($scope.Dashboard.Policy.PolicyNumber) { $scope.ItemAddress = $scope.Dashboard.Policy.PolicyNumber; } $scope.offsetEdit = function () { return ($scope.Dashboard.Policy.CanAmmend) ? 'half-col-padding-right' : 'col-md-offset-6'; }; $scope.AddLoading = false; $scope.BrokerPrefix = ""; if (window.location.href.indexOf("brokers") > 0) $scope.BrokerPrefix = "/brokers"; $scope.AddRiskItem = function () { $scope.AddLoading = true; if ($scope.ItemAddress != 'Other...') { window.location = $scope.BrokerPrefix + '/quote/?quoteType=amendment&amendmentType=' + $scope.ItemToAdd + '&amendmentMode=add&referenceNumber=' + $scope.ItemAddress; return; } else if ($scope.ItemAddress == 'Other...' && ($scope.ItemToAdd == 'Watercraft' || $scope.ItemToAdd == 'Trailer' || $scope.ItemToAdd == 'Caravan' || $scope.ItemToAdd == 'GolfCart')) { var goTo = $scope.BrokerPrefix +'/quote/referredtoagent/'; if (_policyNumber) goTo += '?referenceNumber=' + _policyNumber; window.location = goTo; } else { window.location = $scope.BrokerPrefix +'/quote'; //todo: seems we have removed the functionality to redirect to quote with selection pre-checked? } }; //Nav to the add Card function NavToAddCard() { $location.hash('AddAnotherItemCard'); $anchorScroll(); } //Nav to the add card if requested if ($stateParams.scrollToAddCard) { NavToAddCard(); } }]); });