define(['dashboard/dashboard'], function (dashboard) { dashboard.controller('DashboardFinancialDetails', ['$scope', '$state', '$http', 'Helpers', '$mdDialog', function ($scope, $state, $http, Helpers, $mdDialog) { $scope.getAccountAmendEditUrl = function (account) { window.location = "/quote/?quoteType=amendment&amendmentType=banking&amendmentMode=edit&referenceNumber=" + $scope.Dashboard.Policy.ReferenceNumber + "&sequenceNumber=" + account.BankAccountSeqNo; } $scope.getAccountAmendAddUrl = function () { var url = '/quote/?quoteType=amendment&amendmentType=banking&amendmentMode=add&referenceNumber=' + $scope.Dashboard.Policy.ReferenceNumber; return url; } var removeDialog = function (ev) { return $mdDialog.confirm() .title('Are you sure?') .content('Remove this bank account from your policy? If this account is active, you may be required to add a new bank account to your policy.') .ok('Remove') .cancel('Cancel') .disableParentScroll(false) .targetEvent(ev); }; $scope.removeAccount = function (account, ev) { var confirm = removeDialog(ev); $mdDialog.show(confirm).then(function () { window.location = "/quote/?quoteType=amendment&amendmentType=banking&amendmentMode=delete&referenceNumber=" + $scope.Dashboard.Policy.ReferenceNumber + "&sequenceNumber=" + account.BankAccountSeqNo; }); }; var cashBackPlusDialogTemplate = Helpers.dialog("cashBackPlusDialog"); function cashBackPlusDialogFunction(template, accept, reject) { return function dialogFunction(event) { $scope.cashBackPlusDialog = $mdDialog.show({ clickOutsideToClose: false, disableParentScroll: false, scope: $scope, preserveScope: true, targetEvent: event, template: template, controller: ['$scope', '$mdDialog', function ($scope, $mdDialog) { $scope.cashBackPlusDialog.closeDialog = $mdDialog.hide; }] }).then(accept, reject); } } $scope.showCashBackPlusDialog = cashBackPlusDialogFunction(cashBackPlusDialogTemplate, function () { }); }]); });