1app.controller('main', ['$scope', function($scope) { 2 $scope.passthrough = { 3 amount: 5, 4 type: 'monthly' 5 }; 6 7 $scope.isOtherAmountRequired = function () 8 { 9 10 return $scope.passthrough.amount == -1; 11 } 12 13 $scope.passthroughSubmit = function () { 14 15 window.location.href = '/donate/#?amount=' + ($scope.passthrough.amount == -1 ? $scope.passthrough.otherAmount : $scope.passthrough.amount) + '&type=' + $scope.passthrough.type + "&name=" + $scope.passthrough.name + "&email=" + $scope.passthrough.email; 16 } 17}]); 18app.controller('donationFormCtrl', ['$scope', '$http', '$location', function ($scope, $http, $location) { 19 20 var qs = $location.search(); 21 22 $scope.form = { 23 //taxPayer: true, 24 type: 'single', 25 period : 'Monthly' 26 ,currency: 'GBP' 27 //,firstName : 'John', surname : 'Mullan', email : '[email protected]', address1 : '45 Loopland Park', city: 'Belfast', postcode : 'BT69DY' 28 } 29 try { 30 31 if (qs.type) { 32 $scope.form.type = qs.type === "monthly" ? "monthly" : "single"; 33 } 34 if (qs.name) { 35 var split = qs.name.split(' '); 36 $scope.form.firstName = split[0]; 37 if (split[1]) { 38 $scope.form.surname = split[1]; 39 } 40 } 41 if (qs.email) { 42 $scope.form.email = qs.email; 43 } 44 if (qs.amount) { 45 var amount = parseFloat(qs.amount); 46 $scope.form.amount = -1; 47 $scope.form.otherAmount = parseFloat(amount.toFixed(2)); 48 49 } 50 if (qs.currency) { 51 $scope.form.currency = qs.currency === "GBP" ? "GBP" : "EUR"; 52 } 53 } catch (ex) { 54 55 } 56 $scope.amounts = []; 57 $scope.reasons = []; 58 59 $scope.types = ["Monthly", "Quarterly", "Yearly"]; 60 61 $scope.init = function (id, amounts, amountsMonthly, reasons) { 62 $scope.form.id = id; 63 $scope.amounts = amounts == "" ? [] : amounts; 64 $scope.amountsMonthly = amountsMonthly == "" ? [] : amountsMonthly; 65 66 if (!$scope.amounts.length && !$scope.amountsMonthly.length) { 67 $scope.form.amount = -1; 68 $scope.hideOtherRadioButton = true; 69 } 70 71 $scope.reasons = reasons; 72 if ($scope.reasons && $scope.reasons.length) { 73 74 $scope.reasons.unshift('Please Select'); 75 76 $scope.form.reason = $scope.reasons[0]; 77 78 $scope.reasons.push('Other'); 79 $scope.showOther = false; 80 81 } 82 } 83 84 85 $scope.otherChange = function() { 86 $scope.form.amount = -1; 87 } 88 89 $scope.goBack = function() { 90 $scope.form.reason = $scope.reasons[0]; 91 $scope.showOther = false; 92 } 93 94 $scope.checkother = function() { 95 if ($scope.form.reason == $scope.reasons[$scope.reasons.length - 1]) { 96 $scope.showOther = true; 97 $scope.form.reason = ''; 98 } 99 } 100 101 102 $scope.getAmounts = function () { 103 104 if ($scope.form.type === 'monthly') { 105 console.log($scope.amountsMonthly); 106 return $scope.amountsMonthly; 107 } 108 console.log($scope.amounts); 109 return $scope.amounts; 110 } 111 112 $scope.submit = function () { 113 $scope.submitting = true; 114 console.log($scope.form); 115 console.log($scope.form.email); 116 if ($scope.form.reCaptcha === undefined) { 117 $http.post('/umbraco/surface/donation/send', $scope.form) 118 .then(function(res) { 119 120 121 window.location.href = res.data; 122 }, 123 function() { 124 $scope.submitting = false; 125 }); 126 127 } else { 128 $scope.submitting = false; 129 $('#recap-response-label').html('Sorry, the Captcha has failed, please try again.'); 130 } 131 } 132 133 $scope.setType = function (t) { 134 $scope.form.type = t; 135 } 136 $scope.changeCurrencyToGBP = function () { 137 $scope.form.currency = "GBP"; 138 } 139 $scope.changeCurrencyToEUR = function () { 140 $scope.form.currency = "EUR"; 141 } 142}])
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.