{"version":3,"sources":["../js/directives/signupLocation.js","../js/directives/signupVirtualLocation.js"],"names":["SUGApp","directive","restrict","transclude","scope","locationid","slotid","locationtype","autoupdateslots","onLocationSelection","search","templateUrl","replace","controller","$scope","SUGUtilities","timeout","loc","$modal","$compile","$window","searchEnabled","indexOf","toString","quickPop","box","boxtitle","$","get","rawcontent","content","angular","element","document","querySelector","html","append","dialog","height","streetaddress","addressDetails","undefined","split","locid","ajaxResultInvalid","Number","val","copy","geoinfo","mid","window","userdef","memberid","init","gapi","globalcfg","APISyncCall","then","response","r","lowerCaseKeys","data","variable","scrpt","createElement","src","async","type","getElementsByTagName","appendChild","result","success","dspSignupLocationModal","displaySignupLocationModal","open","resolve","locationname","name","locname","isDefined","locationObj","selectedAddress","e","signupLocationModal","$modalInstance","$timeout","$filter","parentid","ownerid","shouldclose","deleteid","obj","details","userlocations","defaultselection","selection","parentSelected","parentSelection","errormessages","address1","city","state","zipcode","country","add","edit","addEditMessage","showAddressForm","validation","editmode","locSpinr","getLocationsByMember","d","length","setLocation","getLocationBySlot","assignLocationToSlot","slotids","ok","geo","i","j","getSelection","createSignupLocation","msg","message","showMagnificAlert","buildMenuTitle","saveAddress","assignOnly","setAddress","shouldValidate","key","hasOwnProperty","clearform","sa","address","geocoder","newcoordinate","err","errorExists","coordinate","address2","google","maps","Geocoder","geocode","results","status","split1","accuracy","lat","geometry","location","lng","split2","Math","round","console","warn","deleteSignupLocation","deleteAddress","deleteAddressConfirmation","del","showConfirmationModal","txtConfirmationTitle","txtConfirmationMessage","lblYesButton","lblCancelButton","x","clearGapiAddress","clear","c","equals","setSelection","editAddress","editAddressConfirmation","grabObject","deleteAdd","addNewAddress","setAddressFields","streetKeys","streetKeysB","locationKeys","locationKeysB","addrObj","address_components","place","types","short_name","geocodeaddress","value","long_name","buildMenuItem","$watch","locationDetails","o","left","top","topPosition","leftPosition","opts","lines","width","radius","corners","rotate","direction","speed","color","trail","shadow","displayElem","hwaccel","className","zIndex","target","getElementById","Spinner","spin","stopSpinner","close","cancel","dismiss","require","ngModel","charlen","blur","focus","link","attrs","autoCompleteListener","sessionToken","places","AutocompleteSessionToken","fireListener","charLen","parseInt","nval","oval","setTimeout","gPlace","event","removeListener","clearInstanceListeners","remove","Autocomplete","sessiontoken","addListener","getPlace","$apply","$setViewValue","$render","$viewValue","virtuallocationid","str","icon","virtual","alreadyLoadedVirtualLocation","virtualinfo","meetingid","dspVirtualSignupLocationModal","displaySignupVirtualLocationModal","launchSignupVirtualLocationModal","$q","errorService","virtuallocvm","errorServiceInstance","newInstance","isProcessing","btnadd","btnremove","img","examplemeeting","showRemove","virtualinfoform","save","deferred","defer","validatedForm","trim","RegExp","test","reject","promise","setError"],"mappings":"AASIA,OAAOC,UAAU,iBAAkB,WAC/B,MAAO,CACHC,SAAU,KACVC,WAAY,CAAA,EACZC,MAAO,CAEHC,WAAa,cACbC,OAAS,UACTC,aAAe,gBACfC,gBAAkB,mBAClBC,oBAAsB,KACtBC,OAAS,SACb,EACAC,YAAa,4DACbC,QAAS,CAAA,EACTC,WAAY,CAAC,SAAU,eAAgB,WAAY,YAAa,SAAU,WAAY,UACtF,SAAUC,EAAQC,EAAcC,EAASC,EAAKC,EAAQC,EAAUC,GAQ3DN,EAAOO,cAAkE,GAAlD,CAAC,OAAO,KAAKC,QAAQR,EAAOJ,OAAOa,SAAS,CAAC,EACpEH,EAAQI,SAAW,SAASC,EAAIC,GAC7BC,EAAEC,IAAIH,EAAK,SAAUI,GAGbC,EADSX,EAASU,CAAU,EACXf,CAAM,EAC3BiB,QAAQC,QAAQC,SAASC,cAAc,WAAW,CAAC,EAAEC,KAAK,EAAE,EAC5DJ,QAAQC,QAAQC,SAASC,cAAc,WAAW,CAAC,EAAEE,OAAON,CAAO,EAElEH,EAAE,WAAW,EAAEU,OAAO,SAAU,QAASX,CAAQ,EACjDC,EAAE,WAAW,EAAEU,OAAO,MAAM,EAAEC,OAAO,MAAM,CAChD,CAAC,CACL,EAMAxB,EAAOyB,cAAgB,GAC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AQ,MAAO,EAAE,EAAEA,QAAQ,KAAM,EAAE,CAAC,GACtFyQ,EAASM,OAAO,2CAA2C,EAK/DJ,EAAcpN,KAAO,GAGzBkN,EAAS1M,QAAQ4M,CAAa,EACvBF,EAASO,QAmBsCnO,KAC9C,SAAU8N,GACNnM,EAAeyI,MAAM,CACjBsC,YAAaoB,CACjB,CAAC,CACL,EACA,SAAU5I,GACN7H,EAAO4P,aAAaC,qBAAqBkB,SAAS,kBAAmBlJ,CAAG,CAC5E,CACJ,CACJ,EACA0G,OAAQ,WACJjK,EAAeyI,MAAM,CACjBsC,YAAa,CACTL,kBAAmBK,EAAYL,kBAC/BM,UAAW,GACXjM,KAAM,EACV,CACJ,CAAC,CACL,EAEA4J,QAAS,WACL3I,EAAe2I,QAAQ,CAAA,CAAK,CAChC,CACJ,CACJ,GAGR,EAER,CACJ,CAAC","file":"signupLocations.min.js","sourcesContent":["/**\r\n* Directive for signup location\r\n**/\r\n\r\n(function(){\r\n\r\n /**\r\n * This directive handles all the interactivity between the Wizard and Google API\r\n **/\r\n SUGApp.directive('signupLocation', function(){\r\n return {\r\n restrict: 'EA',\r\n transclude: true,\r\n scope: {\r\n /*type \t: '@type'*/\r\n locationid : '@locationid',\r\n slotid : '@slotid',\r\n locationtype : '@locationtype',\r\n autoupdateslots : '@autoupdateslots',\r\n onLocationSelection : '&?',\r\n search : '@search'\r\n },\r\n templateUrl: \"/view/templates/signuplocation/signuplocation-button.html\",\r\n replace: true,\r\n controller: ['$scope', 'SUGUtilities', '$timeout', '$location', '$modal', '$compile', '$window',\r\n function( $scope, SUGUtilities, timeout, loc, $modal, $compile, $window ){\r\n \r\n /**\r\n * Translate jQuery Modal into something AngularJS can read\r\n * This enables the directive within the jQuery modal\r\n * discovered by Todd Bruss and Robert Waddell\r\n * this replaces the quickPop routine in dspDateOptions.cfm\r\n **/\r\n $scope.searchEnabled = [\"true\",\"1\"].indexOf($scope.search.toString()) >= 0 ? true : false;\r\n $window.quickPop = function(box,boxtitle){\r\n $.get(box, function (rawcontent) {\r\n\r\n var linkFn = $compile(rawcontent);\r\n var content = linkFn($scope);\r\n angular.element(document.querySelector('#quickBox')).html('');\r\n angular.element(document.querySelector('#quickBox')).append(content);\r\n\r\n $('#quickBox').dialog('option', 'title', boxtitle);\r\n $('#quickBox').dialog('open').height('auto');\r\n });\r\n };\r\n\r\n\r\n /**\r\n /*** Temp variables for Auto complete ***/\r\n\r\n $scope.streetaddress = '';\r\n $scope.addressDetails = '';\r\n\r\n /**\r\n * This takes an list of slotids and converts it into an array\r\n **/\r\n if ( $scope.slotid !== undefined ) {\r\n $scope.slotid = $scope.slotid.split(',');\r\n }\r\n\r\n var locid = angular.element( '#' + $scope.locationtype + 'locationid' );\r\n\r\n //read in locationid from form if it is not available from the directive\r\n if ( $scope.locationid === undefined && Number( locid.val() ) > 0 ) {\r\n $scope.locationid = angular.copy ( locid.val() );\r\n } else if ( $scope.locationid === undefined ){\r\n $scope.locationid = '';\r\n }\r\n\r\n //To store more info as needed\r\n $scope.geoinfo = {};\r\n $scope.geoinfo.mid = window.userdef.memberid; // standard memberid\r\n $scope.geoinfo.locationid = $scope.locationid; //easy way ot import this data to the modal\r\n $scope.geoinfo.slotid = $scope.slotid; //easy way ot import this data to the modal\r\n $scope.geoinfo.init = true;\r\n $scope.geoinfo.gapi = typeof window.globalcfg.gapi !== 'undefined' ? window.globalcfg.gapi : \"\";\r\n $scope.geoinfo.autoupdateslots = $scope.autoupdateslots;\r\n\r\n $scope.gapi = function( ){\r\n SUGUtilities.APISyncCall(\"post\", \"\", 'gapi', \"g.getGlobalVariable\", 15000)\r\n .then(function(response){\r\n // Test for malformed response\r\n if (ajaxResultInvalid(response)) {\r\n // invalid response\r\n $scope.geoinfo.gapi = '';\r\n return false;\r\n }\r\n else {\r\n var r = SUGUtilities.lowerCaseKeys( response );\r\n $scope.geoinfo.gapi = r.data.data.variable;\r\n var scrpt = document.createElement('script');\r\n scrpt.src = 'api/js?libraries=geometry,places&key=' + $scope.geoinfo.gapi;\r\n scrpt.async = true;\r\n scrpt.type = 'text/javascript';\r\n document.getElementsByTagName('head')[0].appendChild(scrpt);\r\n }\r\n });\r\n };\r\n\r\n // disabled for now - $scope.gapi()\r\n\r\n /** helpers **/\r\n var ajaxResultInvalid = function (result) {\r\n result = SUGUtilities.lowerCaseKeys( result );\r\n return (typeof result.data === 'undefined' || !result.data.success);\r\n };\r\n\r\n /* Show the modal */\r\n $scope.displaySignupLocationModal = function( geoinfo ){\r\n var signuplocationWindow = $modal.open({\r\n templateUrl: '/view/templates/signuplocation/signuplocation-modal.html',\r\n controller: dspSignupLocationModal,\r\n resolve : {\r\n geoinfo: function(){\r\n return geoinfo;\r\n },\r\n searchEnabled : function(){\r\n return $scope.searchEnabled;\r\n }\r\n }\r\n });\r\n\r\n signuplocationWindow.result\r\n .then( function(response){\r\n if ( response.success ) {\r\n try {\r\n //clear if it is not filled out\r\n if (response.data.locationid === 0) {\r\n response.data.locationid = '';\r\n }\r\n\r\n //get locationid\r\n $scope.geoinfo.locationid = response.data.locationid;\r\n\r\n //enter value in the element\r\n //This will only get inserted, updates are handled with the directive\r\n var locid = angular.element( '#' + $scope.locationtype + 'locationid' );\r\n locid.val( $scope.geoinfo.locationid );\r\n\r\n //bonus!\r\n //set location name\r\n $scope.locationname = response.data.name;\r\n var locname = angular.element( '#' + $scope.locationtype + 'locationname' );\r\n\r\n //fill out locationname\r\n if (locname.val() == '') {\r\n locname.val ( $scope.locationname );\r\n }\r\n\r\n // if provided, execute the callback\r\n if( angular.isDefined($scope.onLocationSelection) ){\r\n $scope.onLocationSelection({locationObj: response.data.selectedAddress});\r\n }\r\n\r\n } catch (e) {\r\n $scope.locationid = '';\r\n }\r\n\r\n try {\r\n $scope.slotid = response.data.slotid;\r\n } catch (e) {\r\n $scope.slotid = '';\r\n }\r\n\r\n } else {\r\n // do nothing\r\n }\r\n //\r\n });\r\n };\r\n\r\n /**\r\n * SignUp Location Helper Method\r\n * Displays the SignUp Location Modal\r\n **/\r\n $scope.signupLocationModal = function () {\r\n\r\n var geoinfo = $scope.geoinfo;\r\n //if this is moved, google variable complains. Weird!\r\n $scope.displaySignupLocationModal( geoinfo );\r\n\r\n };\r\n\r\n\r\n /* Delete Modal View Controller */\r\n var dspSignupLocationModal = ['$scope','$modalInstance', 'geoinfo', '$timeout', 'SUGUtilities','$window','$filter','searchEnabled',\r\n function( $scope, $modalInstance, geoinfo, $timeout, SUGUtilities, $window, $filter, searchEnabled) {\r\n\r\n /**\r\n * This takes care of the subadmin scenario\r\n * It now updates each time this is run.\r\n **/\r\n if ($window.userdef.parentid == $window.userdef.ownerid && Number($window.userdef.parentid !== 0) ) {\r\n geoinfo.mid = $window.userdef.parentid; // check for parentid //could possibly use owner id...\r\n } else {\r\n geoinfo.mid = window.userdef.memberid; // standard memberid\r\n }\r\n\r\n //pull info if available\r\n if ( geoinfo.locationid || geoinfo.slotid ) {\r\n geoinfo.init = true;\r\n }\r\n\r\n geoinfo.shouldclose = false;\r\n geoinfo.deleteid = 0;\r\n\r\n $scope.searchEnabled = searchEnabled;\r\n $scope.obj = {};\r\n $scope.obj.details = {};\r\n $scope.obj.streetaddress = \"Test\";\r\n $scope.obj.userlocations = [];\r\n $scope.obj.selectedAddress = {};\r\n $scope.obj.defaultselection = \"Select an Address\";\r\n $scope.obj.selection = angular.copy($scope.obj.defaultselection);\r\n $scope.obj.parentSelected = false;\r\n $scope.obj.parentSelection = {};\r\n $scope.obj.errormessages = {\r\n 'name': 'Please enter a name',\r\n 'address1' : 'Please enter the street address',\r\n 'city' : 'Please enter your city',\r\n 'state' : 'Enter your state',\r\n 'zipcode' : 'Enter your zip',\r\n 'country' : 'Please enter your country'\r\n };\r\n\r\n $scope.obj.add = \"Add New Address\";\r\n $scope.obj.edit = \"Edit Address\";\r\n $scope.obj.addEditMessage = \"Add New Address\";\r\n $scope.obj.showAddressForm = false;\r\n $scope.obj.validation = false;\r\n $scope.obj.editmode = false;\r\n\r\n $scope.loc = {};\r\n $scope.locSpinr = false;\r\n\r\n //get the user's locations, (if we have any)\r\n // get all geo location information based on IP\r\n $scope.getLocationsByMember = function( ){\r\n SUGUtilities.APISyncCall(\"post\", \"\", {'memberid': geoinfo.mid}, \"s.getLocationsByMember\", 15000)\r\n .then(function(response){\r\n // Test for malformed response\r\n if (ajaxResultInvalid(response)) {\r\n $scope.obj.userlocations = [];\r\n $scope.obj.showAddressForm = false;\r\n return false;\r\n }\r\n else {\r\n var r = SUGUtilities.lowerCaseKeys( response );\r\n var d = r.data.data;\r\n\r\n if ( d.length ) {\r\n $scope.obj.userlocations = $filter('orderBy')(d,['name'],false);\r\n\r\n //get the selected location\r\n //check if we have a location already\r\n if ( geoinfo.init == true) {\r\n if ( geoinfo.locationid !== '' && geoinfo.locationid !== undefined ) {\r\n $scope.setLocation();\r\n\r\n //fall back on what is in the database\r\n } else if ( geoinfo.init && geoinfo.slotid && !geoinfo.locationid ) {\r\n $scope.getLocationBySlot(geoinfo);\r\n }\r\n }\r\n\r\n } else {\r\n //clear the array and turn off the form\r\n $scope.obj.userlocations = [];\r\n $scope.obj.showAddressForm = false;\r\n }\r\n }\r\n });\r\n };\r\n\r\n /**\r\n /* assign Location To Slot\r\n **/\r\n $scope.assignLocationToSlot = function(){\r\n\r\n var slotids = [];\r\n if (typeof geoinfo.slotid == 'string' ) {\r\n //test for string, make it an array;\r\n slotids = [ geoinfo.slotid ];\r\n } else {\r\n //must be an array;\r\n slotids = geoinfo.slotid;\r\n }\r\n\r\n SUGUtilities.APISyncCall(\"post\", \"\", {'memberid': geoinfo.mid, 'locationid': geoinfo.locationid, 'slotids': slotids}, \"s.assignLocationToSlot\", 15000)\r\n .then(function(response){\r\n // Test for malformed response\r\n if (ajaxResultInvalid(response)) {\r\n return false;\r\n }\r\n else {\r\n var r = SUGUtilities.lowerCaseKeys( response );\r\n var d = r.data.data;\r\n\r\n // after everything close the window\r\n if ( geoinfo.shouldclose ) {\r\n $scope.ok();\r\n }\r\n\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * get Locations By Slot\r\n **/\r\n $scope.getLocationBySlot = function(geo){\r\n SUGUtilities.APISyncCall(\"post\", \"\", {'memberid': geo.mid, 'slotids': [geo.slotid]}, \"s.getLocationBySlot\", 15000)\r\n .then(function(response){\r\n // Test for malformed response\r\n if (ajaxResultInvalid(response)) {\r\n return false;\r\n }\r\n else {\r\n var r = SUGUtilities.lowerCaseKeys( response );\r\n var d = r.data.data;\r\n\r\n for (var i in d) {\r\n\r\n if ( d[i].slotid == geo.slotid ) {\r\n geoinfo.locationid = d[i].locationid;\r\n $scope.setLocation();\r\n\r\n }\r\n }\r\n }\r\n });\r\n };\r\n\r\n $scope.setLocation = function() {\r\n //Clear the menu\r\n for (var j in $scope.obj.userlocations) {\r\n\r\n\r\n if ( geoinfo.deleteid > 0 && $scope.obj.userlocations[j].locationid === geoinfo.deleteid ) {\r\n $scope.obj.selection = angular.copy($scope.obj.defaultselection);\r\n $scope.obj.selectedAddress = {};\r\n\r\n geoinfo.locationid = '';\r\n geoinfo.init = false; //turn off init\r\n geoinfo.deleteid = false;\r\n\r\n break;\r\n } else if ( geoinfo.locationid == $scope.obj.userlocations[j].locationid ) {\r\n $scope.getSelection( $scope.obj.userlocations[j] );\r\n\r\n geoinfo.init = false; //turn off init\r\n break;\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * Create a signup location\r\n **/\r\n $scope.createSignupLocation = function( selectedAddress ){\r\n SUGUtilities.APISyncCall(\"post\", \"\", selectedAddress, \"s.createSignupLocation\", 15000)\r\n .then(function(response){\r\n // Test for malformed response\r\n if (ajaxResultInvalid(response)) {\r\n var msg = 'Invalid Response.';\r\n var r = SUGUtilities.lowerCaseKeys( response );\r\n\r\n if ( r.data.message[0] ) {\r\n msg = r.data.message[0];\r\n } else {\r\n msg = 'An error has occurred during Save.';\r\n }\r\n\r\n SUGUtilities.showMagnificAlert(msg, '', '', 'Error');\r\n\r\n return false;\r\n }\r\n else {\r\n //SUGUtilities.showMagnificAlert('Your changes have been saved', '', '', 'Success!');\r\n var r = SUGUtilities.lowerCaseKeys( response );\r\n selectedAddress.locationid = r.data.data;\r\n\r\n //update geoinfo locationid as well\r\n geoinfo.locationid = selectedAddress.locationid;\r\n\r\n // $scope.getLocationsByMember(); //update menu\r\n $scope.buildMenuTitle(selectedAddress); // sets selected menu item\r\n\r\n geoinfo.shouldclose = true;\r\n\r\n /**\r\n * This the current wizard, this is not used often as it\r\n * handles most of the inserts and updates. where we moved most of its functionality\r\n * There may be more use for this in the new wizard\r\n **/\r\n if ( geoinfo.slotid && geoinfo.autoupdateslots == '1' ) {\r\n $scope.assignLocationToSlot(); //assign the location to slot(s), can be an array or single string\r\n } else {\r\n $scope.ok();\r\n }\r\n }\r\n });\r\n };\r\n\r\n\r\n /**\r\n * Save an Address\r\n **/\r\n $scope.saveAddress = function( selectedAddress, assignOnly ) {\r\n\r\n try {\r\n //fix for iPad\r\n if ( $scope.obj.parentSelected === true ) {\r\n $scope.setAddress($scope.obj.parentSelection);\r\n }\r\n } catch (e) {\r\n //Do nothing\r\n }\r\n\r\n var shouldValidate = false;\r\n // if any of the elements are filled in, we validate it\r\n if( typeof selectedAddress === 'object' ){\r\n for (var key in selectedAddress) {\r\n // skip prototype keys\r\n if (!selectedAddress.hasOwnProperty(key))\r\n continue;\r\n var obj = selectedAddress[key];\r\n if( obj !== 'undefined' && obj !== '' )\r\n shouldValidate = true;\r\n }\r\n }\r\n\r\n if ( !shouldValidate ) {\r\n /**\r\n * Initialize values before save\r\n **/\r\n shouldValidate = false;\r\n $scope.clearform(true);\r\n selectedAddress = $scope.obj.selectedAddress;\r\n geoinfo.locationid = 0;\r\n selectedAddress.locationid = 0;\r\n geoinfo.shouldclose = true;\r\n\r\n //assign the location to slot(s)\r\n //can be array or single string\r\n //slots are usually updated in the Wizard\r\n //this directive has additonal functionalilty for updating the locations for slots\r\n if ( geoinfo.slotid && geoinfo.autoupdateslots == '1' ) {\r\n $scope.assignLocationToSlot();\r\n } else {\r\n $scope.ok();\r\n }\r\n\r\n //commented out.. have a value of undefined error\r\n //$modalInstance.close({success:true,data:geoinfo,message:'success'});\r\n }\r\n\r\n var err = false;\r\n\r\n /**\r\n ** Validate the form before we try to save\r\n **/\r\n if ( shouldValidate ) {\r\n $scope.obj.validation = true;\r\n for (var key in $scope.obj.errormessages) {\r\n if ($scope.obj.errormessages.hasOwnProperty(key)) {\r\n\r\n err = $scope.errorExists( key );\r\n\r\n if (err) {\r\n break; // Displays the error(s)\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n ** We passed the check point, save the address\r\n **/\r\n if (!err && $scope.obj.validation) {\r\n $scope.obj.validation = false;\r\n\r\n var sa = angular.copy(selectedAddress);\r\n\r\n if ( sa.coordinate === '' || sa.coordinate == undefined ) {\r\n //selectedAddress.coordinate = 'null,null'\r\n sa.coordinate = '';\r\n } else {\r\n\r\n //here we will grab the address that we want to verify\r\n var address = '';\r\n\r\n if ( sa.address1 !== '' ) {\r\n address = address + sa.address1 + ', ';\r\n }\r\n\r\n if ( sa.address2 !== '' ) {\r\n address = address + sa.address2 + ', ';\r\n }\r\n\r\n if ( sa.city !== '' ) {\r\n address = address + sa.city + ', ';\r\n }\r\n\r\n if ( sa.zipcode !== '' ) {\r\n address = address + sa.zipcode + ', ';\r\n }\r\n\r\n if ( sa.country !== '' ) {\r\n address = address + sa.country;\r\n }\r\n\r\n var geocoder = new google.maps.Geocoder();\r\n var newcoordinate = '';\r\n\r\n /**\r\n * Verify that the coordinates are correct;\r\n **/\r\n geocoder.geocode( { 'address': address}, function(results, status) {\r\n if (status == 'OK') {\r\n var lat = results[0].geometry.location.lat();\r\n var lng = results[0].geometry.location.lng();\r\n newcoordinate = lat + ',' + lng;\r\n\r\n if ( newcoordinate !== sa.coordinate && newcoordinate !== '' ) {\r\n\r\n var split1 = newcoordinate.split(',');\r\n var split2 = sa.coordinate.split(',');\r\n var accuracy = 100; //100 = 0.01 two decimal places\r\n split1[0] = Math.round( split1[0] * accuracy ) / accuracy;\r\n split2[0] = Math.round( split2[0] * accuracy ) / accuracy;\r\n split1[1] = Math.round( split1[1] * accuracy ) / accuracy;\r\n split2[1] = Math.round( split2[1] * accuracy ) / accuracy;\r\n\r\n // If the numbers are off by more than our accuracy then get new coordinates\r\n if (split1[0] !== split2[0] || split1[1] !== split2[1] ) {\r\n selectedAddress.coordinate = newcoordinate;\r\n }\r\n }\r\n } else {\r\n console.warn('Geocode was not successful for the following reason: ' + status);\r\n }\r\n });\r\n }\r\n\r\n selectedAddress.memberid = geoinfo.mid;\r\n\r\n // if coorindates are missing\r\n // set it to an empty string\r\n if ( selectedAddress.coordinate == undefined ) {\r\n selectedAddress.coordinate = ''; //this is required\r\n }\r\n\r\n // if we're saving the data\r\n if( typeof assignOnly === 'undefined' ){\r\n $scope.createSignupLocation( selectedAddress );\r\n }\r\n else {\r\n geoinfo.locationid = selectedAddress.locationid;\r\n $scope.buildMenuTitle(selectedAddress); // sets selected menu item\r\n geoinfo.shouldclose = true;\r\n if ( geoinfo.slotid && geoinfo.autoupdateslots == '1' ) {\r\n $scope.assignLocationToSlot();\r\n } else {\r\n $scope.ok();\r\n }\r\n }\r\n }\r\n };\r\n\r\n /**\r\n /* Remove a signup location\r\n **/\r\n $scope.deleteSignupLocation = function( deleteAddress ){\r\n SUGUtilities.APISyncCall(\"post\", \"\", deleteAddress , \"s.deleteSignupLocation\", 15000)\r\n .then(function(response){\r\n // Test for malformed response\r\n if (ajaxResultInvalid(response)) {\r\n return false;\r\n }\r\n else {\r\n\r\n geoinfo.deleteid = deleteAddress.locationid;\r\n\r\n var r = SUGUtilities.lowerCaseKeys( response );\r\n $scope.setLocation();\r\n $scope.getLocationsByMember(); //update menu\r\n }\r\n });\r\n };\r\n\r\n /**\r\n /* Ask the user before we delete an address\r\n **/\r\n $scope.deleteAddressConfirmation = function(del){\r\n var msg = '
Are you sure you want to delete this address? The address link will be removed from any sign ups using the address.
';\r\n SUGUtilities.showConfirmationModal({\r\n txtConfirmationTitle: 'Are you sure?',\r\n txtConfirmationMessage: msg + del.name + '
' + del.address1 + ' ' + del.address2 + '
' + del.city + ', ' + del.state + ', ' + del.zipcode,\r\n lblYesButton: 'Yes, Delete',\r\n lblCancelButton: 'Cancel'\r\n }, function(x){\r\n\r\n del.memberid = geoinfo.mid;\r\n $scope.deleteSignupLocation( del );\r\n\r\n if ( del.locationid == $scope.obj.selectedAddress.locationid ) {\r\n var cleargapiaddress = true;\r\n $scope.clearform(cleargapiaddress);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n ** Clear the address form\r\n **/\r\n $scope.clearform = function(clearGapiAddress) {\r\n var clear = ['coordinate','locationid','memberid','lat','lng','coordinate','name','address1','address2','city','state','zipcode','country'];\r\n\r\n //clear the address form\r\n for (var i in clear) {\r\n var c = clear[i];\r\n $scope.obj.selectedAddress[ c ] = ''; //Fill the form out\r\n\r\n //remove locationid if its new\r\n if ( c == 'locationid' ) {\r\n delete $scope.obj.selectedAddress['locationid'];\r\n }\r\n }\r\n\r\n if (clearGapiAddress && typeof $scope.obj.selectedAddress === 'object' ) {\r\n $scope.obj.selectedAddress[ 'gapiaddress' ] = ''; //Fill the form out\r\n }\r\n };\r\n\r\n //get the member's locations\r\n $scope.getLocationsByMember();\r\n\r\n //builds the current menu title\r\n $scope.buildMenuTitle = function (selectedAddress) {\r\n $scope.obj.selection = '';\r\n\r\n if (angular.equals( selectedAddress, 'No Address' ) ) {\r\n $scope.obj.selection = \"Select an Address\";\r\n var cleargapiaddress = true;\r\n $scope.clearform(cleargapiaddress);\r\n $scope.obj.showAddressForm = false;\r\n } else {\r\n if ( $scope.obj.selectedAddress.name !== '' ) {\r\n $scope.obj.selection = $scope.obj.selection + $scope.obj.selectedAddress.name + ', ';\r\n }\r\n\r\n if ( $scope.obj.selectedAddress.address1 !== '' ) {\r\n $scope.obj.selection = $scope.obj.selection + $scope.obj.selectedAddress.address1 + ', ';\r\n }\r\n\r\n if ( $scope.obj.selectedAddress.address2 !== '' ) {\r\n $scope.obj.selection = $scope.obj.selection + $scope.obj.selectedAddress.address2 + ', ';\r\n }\r\n\r\n if ( $scope.obj.selectedAddress.city !== '' ) {\r\n $scope.obj.selection = $scope.obj.selection + $scope.obj.selectedAddress.city + ', ';\r\n }\r\n\r\n if ( $scope.obj.selectedAddress.zipcode !== '' ) {\r\n $scope.obj.selection = $scope.obj.selection + $scope.obj.selectedAddress.zipcode + ', ';\r\n }\r\n\r\n if ( $scope.obj.selectedAddress.country !== '' ) {\r\n $scope.obj.selection = $scope.obj.selection + $scope.obj.selectedAddress.country;\r\n }\r\n }\r\n };\r\n\r\n //set's the selection (edit)\r\n $scope.setSelection = function(selectedAddress) {\r\n var cleargapiaddress = true;\r\n $scope.clearform(cleargapiaddress);\r\n $scope.obj.showAddressForm = true;\r\n $scope.obj.selectedAddress = angular.copy(selectedAddress);\r\n $scope.buildMenuTitle(selectedAddress);\r\n\r\n };\r\n\r\n /**\r\n /* Ask the user before we delete an address\r\n **/\r\n $scope.editAddress = false;\r\n $scope.editAddressConfirmation = function(selectedAddress){\r\n var msg = '
Are you sure you want to edit this address? All sign ups using this address link will also be updated.
';\r\n SUGUtilities.showConfirmationModal({\r\n txtConfirmationTitle: 'Are you sure?',\r\n txtConfirmationMessage: msg + selectedAddress.name + '
' + selectedAddress.address1 + ' ' + selectedAddress.address2 + '
' + selectedAddress.city + ', ' + selectedAddress.state + ', ' + selectedAddress.zipcode,\r\n lblYesButton: 'Yes, Continue',\r\n lblCancelButton: 'Cancel'\r\n }, function(x){\r\n $scope.editAddress = true;\r\n $scope.setSelection(selectedAddress);\r\n }, function(){\r\n $scope.editAddress = false;\r\n });\r\n };\r\n\r\n //grabs the parent select incase this is on iPad\r\n $scope.grabObject = function(selectedAddress) {\r\n $scope.obj.parentSelected = true;\r\n $scope.obj.parentSelection = selectedAddress;\r\n };\r\n\r\n //get's the selection (grab)\r\n $scope.getSelection = function(selectedAddress) {\r\n\r\n $scope.obj.parentSelected = false;\r\n\r\n var cleargapiaddress = true;\r\n $scope.clearform(cleargapiaddress);\r\n $scope.obj.showAddressForm = false;\r\n $scope.obj.selectedAddress = angular.equals( selectedAddress, 'No Address' ) ? {} : angular.copy(selectedAddress);\r\n $scope.buildMenuTitle(selectedAddress);\r\n };\r\n\r\n //delete address confirmation helper method\r\n $scope.deleteAdd = function(del) {\r\n //get address confirmation first\r\n //then proceed\r\n $scope.deleteAddressConfirmation(del);\r\n };\r\n\r\n //invalid\r\n var ajaxResultInvalid = function (result) {\r\n result = SUGUtilities.lowerCaseKeys( result );\r\n return (typeof result.data === 'undefined' || !result.data.success);\r\n };\r\n\r\n /**\r\n ** Error exists on form, show the error(s)\r\n **/\r\n $scope.errorExists = function( key ) {\r\n\r\n if ( $scope.obj.validation ) {\r\n var err = $scope.obj.selectedAddress[key] ? $scope.obj.selectedAddress[key] : '';\r\n return !err;\r\n } else {\r\n return false;\r\n }\r\n\r\n };\r\n\r\n //add-address\r\n $scope.addNewAddress = function() {\r\n $scope.editAddress = false;\r\n $scope.obj.parentSelected = false;\r\n\r\n var cleargapiaddress = true;\r\n $scope.clearform(cleargapiaddress);\r\n\r\n $scope.obj.showAddressForm = true //!$scope.obj.showAddressForm;\r\n $scope.obj.selection = angular.copy($scope.obj.defaultselection);\r\n $scope.obj.selectedAddress = {};\r\n };\r\n\r\n /**\r\n ** Here are are translating the google address info, to our address\r\n **/\r\n $scope.setAddressFields = function(details) {\r\n\r\n var cleargapiaddress = false;\r\n $scope.clearform(cleargapiaddress);\r\n\r\n $scope.obj.showAddressForm = true;\r\n\r\n $scope.obj.selectedAddress.lat = details.geometry.location.lat();\r\n $scope.obj.selectedAddress.lng = details.geometry.location.lng();\r\n $scope.obj.selectedAddress.coordinate = $scope.obj.selectedAddress.lat + ',' + $scope.obj.selectedAddress.lng;\r\n\r\n //Google Keys\r\n var street_number = 'street_number';\r\n var streetKeys = ['route','place','address2']; //how google calls these\r\n var streetKeysB = ['address1','name','address2'];//how we call these\r\n var locationKeys = ['subpremise','locality','administrative_area_level_1','postal_code','country'];//google\r\n var locationKeysB = ['address2','city','state','zipcode','country'];//us\r\n\r\n var address1 = '';\r\n var addrObj = details.address_components;\r\n var place = details.name !== undefined ? details.name : \"\";\r\n var streetaddress = '';\r\n var loc = '';\r\n $scope.obj.selectedAddress.name = place;\r\n\r\n // The first two parts build the street address\r\n for (var x in addrObj) {\r\n\r\n //look at first key, but use short names\r\n loc = addrObj[x].types[0];\r\n\r\n //street number\r\n if ( loc == street_number ) {\r\n address1 = addrObj[x].short_name;\r\n //street name\r\n } else if ( loc == streetKeys[0] ) {\r\n\r\n streetaddress = address1 + ' ' + addrObj[x].short_name;\r\n $scope.obj.selectedAddress[ streetKeysB[0] ] = streetaddress; //save the street address and compare with name;\r\n\r\n //We can save this to use as a checksum later to validate the coordinates based on this address\r\n //If the user edits address1, we should pull new coordinates (set up later via geocode)\r\n //This part described is not done yet, we are using address as the primary location source\r\n //So a backup check on the coordinates has not been implemented yey andit will requires another Google API check\r\n\r\n $scope.obj.geocodeaddress = angular.copy(streetaddress);\r\n //fill out the name of the place\r\n if ( streetaddress !== place ) {\r\n $scope.obj.selectedAddress[ streetKeysB[1] ] = place; //save the street address and compare with name;\r\n }\r\n }\r\n }\r\n\r\n //fill out the rest\r\n for (var x in addrObj) {\r\n loc = addrObj[x].types[0];\r\n for (var i in locationKeys) {\r\n var key = locationKeys[i]; //google\r\n var keyB = locationKeysB[i]; //us\r\n var value = '';\r\n if ( loc == key ) {\r\n\r\n if ( key !== 'country') {\r\n value = addrObj[x].short_name;\r\n } else {\r\n value = addrObj[x].long_name;\r\n }\r\n\r\n $scope.obj.selectedAddress[ keyB ] = value; //Fill the form out\r\n }\r\n }\r\n }\r\n\r\n $scope.buildMenuItem();\r\n };\r\n\r\n /**\r\n ** This checks if the user selected an new address using the Google API\r\n **/\r\n $scope.$watch(\r\n function () {\r\n return $window.locationDetails;\r\n }, function(locationDetails,o){\r\n //gapi address lookup changed\r\n if ( locationDetails !== undefined && locationDetails !== null ) {\r\n try {\r\n if (locationDetails.address_components !== undefined ) {\r\n $scope.obj.parentSelected = false;\r\n $scope.setAddressFields(locationDetails);\r\n }\r\n } catch (e) {\r\n //do nothing because we have nothing to work with here!\r\n }\r\n }\r\n }\r\n );\r\n\r\n //Do not show the spinner\r\n //We may use this elsewhere\r\n $scope.locSpinr = false;\r\n\r\n /**\r\n * method loadSpinner, dependent on spin.js\r\n * the parameters can be turned into variables, too.\r\n **/\r\n function showLoading( displayElem, left, top ){\r\n\r\n var topPosition = '19px';\r\n var leftPosition = '14px';\r\n if( typeof top !== 'undefined' )\r\n topPosition = top;\r\n if( typeof left !== 'undefined' )\r\n leftPosition = left;\r\n var opts = {\r\n lines: 15, length: 8, width: 2, radius: 8, corners: 1, left: leftPosition, top: topPosition,\r\n rotate: 0, direction: 1, speed: 1, color: '#ef9934', trail: 60,\r\n shadow: false, hwaccel: false, className: 'spinner', zIndex: 2e9\r\n };\r\n\r\n var target = document.getElementById(displayElem);\r\n var spinner = new Spinner(opts).spin( target );\r\n }\r\n\r\n /**\r\n * show spinner\r\n **/\r\n\r\n /* Handler for Processing Status */\r\n $timeout ( function () {\r\n showLoading('locationSpinner');\r\n }, 1);\r\n\r\n /* stop the spinner */\r\n $scope.stopSpinner = function() {\r\n $timeout ( function () {\r\n $scope.locSpinr = false;\r\n }, 1);\r\n };\r\n\r\n /**\r\n * The user pressed Save.\r\n **/\r\n $scope.ok = function () {\r\n geoinfo.name = $scope.obj.selectedAddress.name;\r\n geoinfo.selectedAddress = angular.copy($scope.obj.selectedAddress);\r\n $scope.clearform(true);\r\n $scope.obj.showAddressForm = false;\r\n $window.locationDetails = null;\r\n $modalInstance.close({success:true,data:geoinfo,message:'success'});\r\n };\r\n\r\n /**\r\n * The user cancelled.\r\n **/\r\n $scope.cancel = function () {\r\n $scope.clearform(true);\r\n $scope.obj.showAddressForm = false;\r\n $window.locationDetails = null;\r\n $modalInstance.dismiss({success:false,data:'',message:'cancel'});\r\n };\r\n }];\r\n\r\n }]\r\n };\r\n });\r\n\r\n /* Begin Autocomplete Directive */\r\n\r\n /**\r\n * This directive talks to the Google API and pulls the address data\r\n * It is used on the signup-location-modal\r\n **/\r\n SUGApp.directive('ngAutocomplete', function() {\r\n return {\r\n require: 'ngModel',\r\n scope: {\r\n ngModel: '=',\r\n details: '=',\r\n charlen: '@',\r\n blur: '=',\r\n focus: '='\r\n },\r\n link: function(scope, element, attrs, controller) {\r\n var autoCompleteListener;\r\n var sessionToken = new google.maps.places.AutocompleteSessionToken();\r\n scope.charLen = typeof scope.charLen === 'undefined' || scope.charlen === '' ? 4 : parseInt(scope.charLen);\r\n scope.$watch(\"ngModel\", function(nval,oval){\r\n if( typeof nval !== 'undefined' && nval.length >= scope.charlen ){\r\n\r\n setTimeout(function(){ document.getElementById(\"GoogleAutocomplete\").blur(); }, scope.blur);\r\n if (typeof scope.gPlace === 'undefined') {\r\n fireListener();\r\n }\r\n setTimeout(function(){ document.getElementById(\"GoogleAutocomplete\").focus(); }, scope.focus);\r\n\r\n }\r\n else if ( typeof scope.gPlace !== 'undefined' ){\r\n //remove listener\r\n google.maps.event.removeListener(autoCompleteListener);\r\n\r\n //remove listener on the only elment are using\r\n google.maps.event.clearInstanceListeners(element[0]);\r\n\r\n //clear the gPlace variable, keeps just one instance of places in memory\r\n scope.gPlace = undefined;\r\n autoCompleteListener = undefined;\r\n\r\n //remove the pac-container, otherwise multiple containers will be on top of each other;\r\n angular.element(document.querySelector(\".pac-container\")).remove();\r\n }\r\n });\r\n\r\n //options for autocomplete\r\n var watchEnter = false;\r\n\r\n // start listener\r\n var fireListener = function(){\r\n scope.gPlace = new google.maps.places.Autocomplete(element[0], {sessiontoken:sessionToken});\r\n autoCompleteListener = google.maps.event.addListener(scope.gPlace, 'place_changed', function() {\r\n var result = scope.gPlace.getPlace();\r\n if (result !== undefined) {\r\n if (result.address_components !== undefined) {\r\n scope.$apply(function() {\r\n scope.details = result;\r\n controller.$setViewValue(element.val());\r\n window.locationDetails = result;\r\n });\r\n }\r\n else {\r\n if (watchEnter) {\r\n getPlace(result);\r\n }\r\n }\r\n }\r\n });\r\n };\r\n\r\n //function to get retrieve the autocompletes first result using the AutocompleteService\r\n var getPlace = function(result) {\r\n var autocompleteService = new google.maps.places.AutocompleteService();\r\n if (result.name.length > 0){\r\n autocompleteService.getPlacePredictions(\r\n {\r\n input: result.name,\r\n offset: result.name.length\r\n },\r\n function listentoresult(list, status) {\r\n if(list == null || list.length == 0) {\r\n scope.$apply(function() {\r\n scope.details = null;\r\n window.locationDetails = null;\r\n });\r\n } else {\r\n var placesService = new google.maps.places.PlacesService(element[0]);\r\n placesService.getDetails(\r\n {'reference': list[0].reference},\r\n function detailsresult(detailsResult, placesServiceStatus) {\r\n if (placesServiceStatus == google.maps.GeocoderStatus.OK) {\r\n scope.$apply(function() {\r\n controller.$setViewValue(detailsResult.formatted_address);\r\n element.val(detailsResult.formatted_address);\r\n scope.details = detailsResult;\r\n window.locationDetails = detailsResult;\r\n //on focusout the value reverts, need to set it again.\r\n var watchFocusOut = element.on('focusout', function(event) {\r\n scope.details = detailsResult;\r\n window.locationDetails = detailsResult;\r\n element.val(detailsResult.formatted_address);\r\n element.unbind('focusout')\r\n });\r\n });\r\n }\r\n }\r\n );\r\n }\r\n });\r\n }\r\n };\r\n controller.$render = function () {\r\n var location = controller.$viewValue;\r\n element.val(location);\r\n };\r\n }\r\n };\r\n });\r\n\r\n }());\r\n","/**\r\n * This directive handles all the interactivity between the Builder and the Virtual Location Modal\r\n **/\r\n(function(){\r\n SUGApp.directive('signupVirtualLocation', function () {\r\n return {\r\n restrict: 'EA',\r\n transclude: true,\r\n scope: {\r\n virtuallocationid: '@virtuallocationid',\r\n onLocationSelection: '&?'\r\n },\r\n templateUrl: \"/view/templates/signuplocation/signupvirtuallocation-button.html\",\r\n replace: true,\r\n controller: ['$scope', 'SUGUtilities', '$modal',\r\n function ($scope, SUGUtilities, $modal) {\r\n\r\n $scope.str = {\r\n icon: {\r\n virtual: 'glyphicon glyphicon-facetime-video'\r\n }\r\n };\r\n\r\n // if virtual location id is provided, look up the info\r\n $scope.virtualinfo = {\r\n virtuallocationid: $scope.virtuallocationid,\r\n meetingid: $scope.virtuallocationid ? ' ' : '' // this tricks the UI to understand there is a location present on initial load in case a virtuallocationid was provided\r\n };\r\n\r\n /* Show the modal */\r\n var alreadyLoadedVirtualLocation = false;\r\n $scope.displaySignupVirtualLocationModal = function () {\r\n var launchSignupVirtualLocationModal = function () {\r\n var templateCacheBuster = '1565966734';\r\n $modal.open({\r\n templateUrl: '/view/templates/signuplocation/signupvirtuallocation-modal.html?v=' + templateCacheBuster,\r\n controller: dspVirtualSignupLocationModal,\r\n resolve: {\r\n virtualinfo: function () {\r\n return $scope.virtualinfo;\r\n }\r\n }\r\n }).result.then(function (response) {\r\n if (response.virtualinfo) {\r\n $scope.virtualinfo = response.virtualinfo;\r\n // if provided, execute the callback\r\n if (angular.isDefined($scope.onLocationSelection)) {\r\n $scope.onLocationSelection({\r\n locationObj: {\r\n 'virtualinfo': $scope.virtualinfo\r\n }\r\n });\r\n }\r\n\r\n }\r\n });\r\n };\r\n\r\n // if there is already a virtual location, load related meta data\r\n if ($scope.virtuallocationid && !alreadyLoadedVirtualLocation) {\r\n SUGUtilities.APISyncCall(\"post\", \"\", {\r\n 'virtuallocationid': $scope.virtuallocationid\r\n }, \"w.getVirtualLocation\", 15000)\r\n .then(function (response) {\r\n if (!SUGUtilities.ajaxResultInvalid(response)) {\r\n alreadyLoadedVirtualLocation = true;\r\n var r = SUGUtilities.lowerCaseKeys(response);\r\n $scope.virtualinfo = r.data.data;\r\n launchSignupVirtualLocationModal();\r\n }\r\n });\r\n } else {\r\n launchSignupVirtualLocationModal();\r\n }\r\n };\r\n\r\n /* Virtual Location Modal Controller */\r\n var dspVirtualSignupLocationModal = ['$scope', '$modalInstance', 'virtualinfo', 'SUGUtilities', '$q', 'errorService',\r\n function ($scope, $modalInstance, virtualinfo, SUGUtilities, $q, errorService) {\r\n var validateForm = function (virtualinfoform) {\r\n var deferred = $q.defer();\r\n\r\n var validatedForm = {\r\n virtuallocationid: virtualinfoform.virtuallocationid,\r\n meetingid: virtualinfoform.meetingid ? virtualinfoform.meetingid.toString().trim() : '', // trim and strip optional dashes\r\n type: 'Zoom' // only zoom is an option now\r\n };\r\n\r\n if (validatedForm.meetingid.length) {\r\n var zoomMeetingValidate = new RegExp(/^[\\d]{9,11}$/); // 9-11 digits\r\n if (!zoomMeetingValidate.test(validatedForm.meetingid.replace(/\\s/g, '').replace(/-/g, ''))) {\r\n deferred.reject('The meeting ID can be 9, 10, or 11 digits');\r\n }\r\n\r\n } else {\r\n // if meeting id is empty, also clear the type, e.g. removing meeting\r\n validatedForm.type = '';\r\n }\r\n\r\n deferred.resolve(validatedForm);\r\n return deferred.promise;\r\n };\r\n\r\n $scope.virtuallocvm = {\r\n errorServiceInstance: errorService.newInstance(),\r\n isProcessing: false,\r\n str: {\r\n btnadd: virtualinfo.meetingid ? 'Update' : 'Add',\r\n btnremove: 'Remove',\r\n img: '/images/integrations/zoom.png',\r\n examplemeeting: 'e.g. 123-456-789'\r\n },\r\n showRemove: virtualinfo.meetingid ? true : false,\r\n virtualinfoform: {\r\n virtuallocationid: virtualinfo.virtuallocationid,\r\n type: virtualinfo.type ? virtualinfo.type : 'Zoom',\r\n meetingid: virtualinfo.meetingid ? virtualinfo.meetingid : '',\r\n },\r\n save: function () {\r\n validateForm($scope.virtuallocvm.virtualinfoform).then(\r\n function (validatedForm) {\r\n $modalInstance.close({\r\n virtualinfo: validatedForm\r\n });\r\n },\r\n function (err) {\r\n $scope.virtuallocvm.errorServiceInstance.setError('zoom-meeting-id', err);\r\n }\r\n );\r\n },\r\n remove: function () {\r\n $modalInstance.close({\r\n virtualinfo: {\r\n virtuallocationid: virtualinfo.virtuallocationid,\r\n meetingid: '',\r\n type: ''\r\n }\r\n });\r\n },\r\n // handle dismissal of the modal\r\n dismiss: function () {\r\n $modalInstance.dismiss(false);\r\n }\r\n };\r\n }\r\n ];\r\n\r\n }\r\n ]\r\n };\r\n });\r\n}());"]}