1'use strict'; 2angular.module('web') 3 .controller('web.home.request-datacard.controller', ['$scope', '$state', '$location', '$dataService', 'vcRecaptchaService', '$sce','$rootScope','$stateParams','DirectoryCountryService', 'DirectoryStateService', 'DirectoryCityService', function($scope, $state, $location, $dataService, vcRecaptchaService, $sce, $rootScope,$stateParams,DirectoryCountryService, DirectoryStateService, DirectoryCityService){ 4 $scope.reCaptchaPublicKey = RECAPTCHA_PUBLIC_KEY; 5 $scope.recaptchaWidgetId = { 6 datacard: null, 7 }; 8 $scope.setDataCardWidgetId = function (widgetId) { 9 $scope.recaptchaWidgetId.datacard = widgetId; 10 } 11 12 13 $scope.direcoryName = $rootScope.currentDirectory.name; 14 15 16 $scope.loading = false; 17 // if ($stateParams.navigateTo != '') setTimeout(function() { 18 // angular.element('html, body').stop().animate({ 19 // scrollTop: ((angular.element($stateParams.navigateTo).offset().top) - 40) 20 // }, 1500, 'easeInOutExpo'); 21 // }, 150); 22 /*if (!$stateParams.packageName) { 23 $state.go('core.ocdSales', { navigateTo: '#mailing-page' }); 24 } 25*/ 26 27 $dataService.get('web-data?pageName=request-datacard', 28 function(data){ 29 console.log(data); 30 if (data != null) { 31 $scope.sections = data; 32 } 33 },function(error){ 34 console.log(error) 35 }) 36 37 38 $scope.addDatacard = {"directoryId":$rootScope.currentDirectory.directoryId,"direcoryName":$scope.direcoryName,"requestType":"Request A Datacard","title":"","organization":"","organizationtype":"","name":{"first":"","last":""},"address":"","city":"","state":"","zip":"","email":"","needs":"","hearaboutus":""}; 39 $scope.ClickDatacard = function() { 40 41 $dataService.post('subscriber/web-request',$scope.addDatacard, 42 function(data) { 43 data = data.data; 44 if (data != null) { 45 $scope.addDatacard = {"directoryId":$rootScope.currentDirectory.directoryId,"direcoryName":$scope.direcoryName,"requestType":"Request A Datacard","title":"","organization":"","organizationtype":"","name":{"first":"","last":""},"address":"","city":"","state":"","zip":"","email":"","needs":"","hearaboutus":""}; 46 47 // $scope.addDatacardMsg = "Thank you for your inquiry! "; 48 // $scope.addDatacardMsg1 = "A list representative will contact you shortly via email. If you have any questions about the mailing list, please email: "; 49 50 // if ($scope.direcoryName == 'OCD') { 51 // $scope.addDatacardMsg2 = "[email protected]"; 52 // } 53 // else if ($scope.direcoryName == 'OMD'){ 54 // $scope.addDatacardMsg2 = "[email protected]"; 55 // } 56 showMessages([{ 57 type: 'success', 58 message: 'Thank you for your inquiry!', 59 header: 'Data Card Submission' 60 }]); 61 vcRecaptchaService.reload($scope.recaptchaWidgetId.datacard); 62 $state.go('core.mailing-list'); 63 //$state.go("core.home({navigateTo:'#mailingSection1'})"); 64 } 65 }, 66 function(error) { 67 $scope.addDatacard = {"directoryId":$rootScope.currentDirectory.directoryId,"direcoryName":$scope.direcoryName,"requestType":"Request A Datacard","title":"","organization":"","organizationtype":"","name":{"first":"","last":""},"address":"","city":"","state":"","zip":"","email":"","needs":"","hearaboutus":""}; 68 // $scope.addDatacardMsg = "Data Card not submitted successfully! "; 69 console.log('addDatacard',error) 70 showMessages([{ 71 type: 'error', 72 message: 'Datacard not submitted successfully! ', 73 header: 'Datacard Submission' 74 }]); 75 vcRecaptchaService.reload($scope.recaptchaWidgetId.datacard); 76 77 }) 78 }; 79 80
81 ////////////City 82 83 $scope.initAddressCities = function() { 84 $("#auto-complete-city") 85 .autocomplete({ 86 source: function(req, res) { 87 $scope.getAddressCities(req.term).then(function(data) { 88 res(data); 89 }); 90 }, 91 minLength: 3, 92 focus: function(event, ui) { 93 $("#auto-complete-city").val(ui.item.codeValue); 94 return false; 95 }, 96 select: function(evt, ui) { 97 $scope.selectAddressCityTypeAhead(ui.item, ui.item); 98 $('#auto-complete-city').val($scope.addDatacard.city); 99 $('#auto-complete-state').val($scope.addDatacard.state); 100 $('#auto-complete-country').val($scope.addDatacard.country); 101 return false; 102 } 103 }) 104 .autocomplete("instance")._renderItem = function(ul, item) { 105 return $("<li>") 106 .append("<div>" + item.codeValue + "<p>" + (item.parentId ? (item.parentId.codeValue + " (" + item.parentId.description + ")") : "") + "<span>, " + (item.parentId && item.parentId.parentId ? item.parentId.parentId.codeValue : "") + "</span>" + "</p>" + "</div>") 107 .appendTo(ul); 108 }; 109 }; 110 $scope.getAddressCities = function(val) { 111 $('[ng-show="noResultsCity"]').html('<i class="glyphicon glyphicon-remove"></i> No Results Found'); 112 if (val.length > 2) { 113 return DirectoryCityService.list({ 114 codeValue: { 115 _eval: 'regex', 116 value: val 117 }, 118 active: true 119 }).$promise; 120 } else $('[ng-show="noResultsCity"]').html('Enter minimum 3 characters'); 121 }; 122 $scope.selectAddressCityTypeAhead = function($item, $model, $label, $event) { 123 $scope.addDatacard.city = $model.codeValue; 124 $scope.addDatacard.state = $model.parentId ? $model.parentId.codeValue + " (" + $model.parentId.description + ")" : ""; 125 $scope.addDatacard.country = $model.parentId && $model.parentId.parentId ? $model.parentId.parentId.codeValue : ""; 126 }; 127 $scope.initAddressStates = function() { 128 $("#auto-complete-state") 129 .autocomplete({ 130 source: function(req, res) { 131 $scope.getAddressStates(req.term).then(function(data) { 132 res(data); 133 }); 134 }, 135 focus: function(event, ui) { 136 $("#auto-complete-state").val(ui.item.codeValue + " (" + ui.item.description + ")"); 137 return false; 138 }, 139 minLength: 3, 140 select: function(evt, ui) { 141 $scope.selectAddressStateTypeAhead(ui.item, ui.item); 142 $('#auto-complete-state').val($scope.addDatacard.state); 143 $('#auto-complete-country').val($scope.addDatacard.country); 144 return false; 145 } 146 }) 147 .autocomplete("instance")._renderItem = function(ul, item) { 148 return $("<li>") 149 .append("<div>" + item.codeValue + " (" + item.description + ")" + "<span>, " + (item.parentId ? item.parentId.codeValue : "") + "</span>" + "</div>") 150 .appendTo(ul); 151 }; 152 }; 153 $scope.getAddressStates = function(val) {
154 $('[ng-show="noResultsState"]').html('<i class="glyphicon glyphicon-remove"></i> No Results Found'); 155 if (val.length > 2) { 156 return DirectoryStateService.list({ 157 codeValue: { 158 _eval: 'regex', 159 value: val 160 }, 161 active: true 162 }).$promise; 163 } else $('[ng-show="noResultsState"]').html('Enter minimum 3 characters'); 164 }; 165 $scope.selectAddressStateTypeAhead = function($item, $model, $label, $event) { 166 $scope.addDatacard.state = $model.codeValue + " (" + $model.description + ")"; 167 $scope.addDatacard.country = $model.parentId.codeValue; 168 }; 169 $scope.initAddressCountries = function() { 170 $("#auto-complete-country") 171 .autocomplete({ 172 source: function(req, res) { 173 $scope.getAddressCountries(req.term).then(function(data) { 174 res(data); 175 }); 176 }, 177 focus: function(event, ui) { 178 $("#auto-complete-country").val(ui.item.codeValue); 179 return false; 180 }, 181 minLength: 3, 182 select: function(evt, ui) { 183 $scope.selectAddressCountryTypeAhead(ui.item, ui.item); 184 $('#auto-complete-country').val($scope.addDatacard.country); 185 return false; 186 } 187 }) 188 .autocomplete("instance")._renderItem = function(ul, item) { 189 return $("<li>") 190 .append("<div>" + item.codeValue + "</div>") 191 .appendTo(ul); 192 }; 193 }; 194 $scope.getAddressCountries = function(val) { 195 $('[ng-show="noResultsCountry"]').html('<i class="glyphicon glyphicon-remove"></i> No Results Found'); 196 if (val.length > 2) { 197 return DirectoryCountryService.list({ 198 codeValue: { 199 _eval: 'regex', 200 value: val 201 }, 202 active: true 203 }).$promise; 204 } else $('[ng-show="noResultsCountry"]').html('Enter minimum 3 characters'); 205 }; 206 $scope.selectAddressCountryTypeAhead = function($item, $model, $label, $event) { 207 $scope.addDatacard.country = $model.codeValue; 208 }; 209 210 211 212 setTimeout(function() { 213 $scope.initAddressCities(); 214 $scope.initAddressStates(); 215 $scope.initAddressCountries(); 216 }, 100); 217 218
219 ////////////City 220 221 222 223 }])
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.