define(['quote/quote'], function (quote) {
quote.controller('QuickQuoteSummary', ['$scope', '$http', 'Helpers', '$timeout', '$mdDialog', function ($scope, $http, Helpers, $timeout, $mdDialog) {
$scope.SetStepHeader('
Here\'s your quick quote
', 'Your reference number is:' + $scope.Quote.ReferenceNumberDisplay + '. This quote will be valid for 30 days.');
$scope.initQuickQuoteSummary = function () {
eval(document.getElementById("QuickQuoteInit").innerHTML);
$scope.QuickQuoteResults = QuickQuoteResults;
};
$scope.SubmitQuickQuoteSummary = function () {
$scope.QuickQuoteSummarySubmit();
};
$scope.Print = function () {
var oldname = document.title;
document.title = "Auto and General - Quote " + $scope.Quote.ReferenceNumberDisplay;
window.print();
document.title = oldname;
};
$scope.Email = function (ev) {
$http({
method: 'POST',
url: '/Quote/QuickQuoteSummary/Email',
params: { referenceNumber: $scope.Quote.ReferenceNumber }
}).success(function (data, status, headers, config) {
$mdDialog.show(
$mdDialog.alert().clickOutsideToClose(true).disableParentScroll(false)
.title('Email Delivered')
.content('Your quotation has been emailed to: ' + $scope.Quote.Personal.Email)
.ok('Thanks!')
.targetEvent(ev)
);
});
};
$scope.StartQuote = function () {
$scope.QuoteStarting = true;
$scope.QuickQuoteSummarySubmit().then(function () {
$scope.QuoteStarting = false;
}, function () {
$scope.QuoteStarting = false;
});
};
$scope.initQuickQuoteSummary();
}]);
});