1angular.module('dpiApp') 2 .controller('agentregistermodalcontroller', function ($scope, $timeout, $http, configService, $rootScope, $location, $route, $routeParams, $localStorage) { 3 $scope.loginUrl = $location.protocol() + "://" + $location.host() + "/user-login"; 4 $scope.popupProfileImage = modal_pic ? base_url + '/uploads/profile_pic/' + modal_pic : base_url + "/uploads/index_files/register-left-col-image.jpg"; 5 $scope.agent_register_form = {}; 6 $scope.agentform = {}; 7 $scope.sociallyRegistered = 0; 8 $scope.sociallyRegisteredText = "Register"; 9 $scope.loginUrl = $location.protocol() + "://" + $location.host() + "/user-login"; 10 11 // Create Agent Form Submission 12 $scope.saveAnAgent = function () { 13 var data = $scope.agent_register_form; 14 data.member_id = $rootScope.agentid; //Agent id Website owner 15 16 var httpRequest = $http({ 17 method: "POST", 18 url: base_url + "/firsthometheme/create-agent-from-website", 19 data: data 20 }).success(function (data, status) { 21 if (data.success == 1) { 22 $("#agentRegisterModal").modal("hide"); 23 $scope.agent_register_form = {}; 24 $rootScope.is_front_logged = 1; 25 localStorage.setItem("usr_info", data.usr_info); 26 localStorage.setItem("access_token", data.token); 27 28 var client_details = []; 29 client_details = $scope.userDetails(); 30 $rootScope.logged_user_id = client_details[0]; 31 $rootScope.logged_user_name = client_details[1]; 32 33 if (localStorage.getItem("prevroute") !== null) { 34 window.location = localStorage.getItem("prevroute"); 35 } else { 36 window.location = "/my-profile"; 37 } 38 } else { 39 alert(data.message); 40 } 41 }) 42 .error(function (data, status, header, config) { 43 $("#agentRegisterModal").modal("hide"); 44 alert("Something went wrong. Please try again later."); 45 }); 46 } 47 $scope.goToSearchPage = function () { 48 // Go to search or relevant pages 49 const absoluteUrl = $location.absUrl(); 50 if (absoluteUrl.includes("property-details") && typeof $rootScope.previousRoute != "undefined") { 51 if ($rootScope.previousRoute == "search_property") { 52 // Search page 53 window.location.href = base_url + "/11/search/11"; 54 } else if ($rootScope.previousRoute == "mylisting") { 55 // Our listing 56 window.location.href = base_url + "/our_listings"; 57 } else if ($rootScope.previousRoute == "my_listings") { 58 // My Listing 59 window.location.href = base_url + "/my_listings"; 60 } else if ($rootScope.previousRoute == "property_criteria") { 61 // City page 62 $rootScope.location_id = $scope.location_id; 63 $rootScope.criteria_id = $scope.criteria_id; 64 $rootScope.menu_id = $scope.menu_id; 65 const cityPageUrl = "/propertylist-criteria/" + $rootScope.location_id + "/" + $rootScope.menu_id + "/" + $rootScope.criteria_id; 66 window.location.href = base_url + cityPageUrl; 67 } else { 68 // Defaults to search page 69 window.location.href = base_url + "/11/search/11"; 70 } 71 } else { 72 // Go to the absolute url 73 window.location.href = absoluteUrl; 74 } 75 76 }; 77 $scope.submitClientRegistration = function () { 78 // console.log("Forced Registration: " + $rootScope.previousRoute); 79 // return; 80 81 var data = $scope.agentform; 82 const absoluteUrl = $location.absUrl(); 83 data.redirect_url = absoluteUrl; 84 data.member_id = $rootScope.agentid; //Agent id Website owner 85 var httpRequest = $http({ 86 method: "POST", 87 url: base_url + "/shared/client/register", 88 data: data 89 }).success(function (data, status) { 90 if (data.success == 1) { 91 $("#clientRegistrationModal").modal("hide"); 92 $("#agentRegisterModal").modal("hide"); 93 $scope.agentform = {}; 94 $rootScope.is_front_logged = 1; 95 localStorage.setItem("usr_info", data.usr_info); 96 localStorage.setItem("access_token", data.token); 97 var client_details = []; 98 client_details = $rootScope.loggedUserDetails(); 99 $rootScope.logged_user_id = client_details[0]; 100 $rootScope.logged_user_name = client_details[1]; 101 102 if (localStorage.getItem("prevroute") !== null) { 103 window.location = localStorage.getItem("prevroute"); 104 } else { 105 // reload the window 106 $scope.goToSearchPage(); 107 // window.location = "/my-profile"; 108 } 109 } else { 110 alert(data.message); 111 } 112 }) 113 .error(function (data, status, header, config) { 114 $("#clientRegistrationModal").modal("hide"); 115 alert("Something went wrong. Please try again later."); 116 }); 117 }; 118 $scope.submitClientLogin = function () { 119 var data = {}; 120 data.client = $scope.agentform; 121 const absoluteUrl = $location.absUrl(); 122 data.redirect_url = absoluteUrl; 123 data.member_id = $rootScope.agentid; //Agent id Website owner 124 var httpRequest = $http({ 125 method: "POST", 126 url: base_url + "/shared/client/login", 127 data: data 128 }).success(function (data, status) { 129 if (data.success == 1) { 130 $("#clientLoginModal").modal("hide"); 131 $("#agentLoginModal").modal("hide"); 132 $scope.agentform = {}; 133 $rootScope.is_front_logged = 1; 134 localStorage.setItem("usr_info", data.usr_info); 135 localStorage.setItem("access_token", data.token); 136 var client_details = []; 137 client_details = $rootScope.loggedUserDetails(); 138 $rootScope.logged_user_id = client_details[0]; 139 $rootScope.logged_user_name = client_details[1]; 140 141 if (localStorage.getItem("prevroute") !== null) { 142 window.location = localStorage.getItem("prevroute"); 143 } else { 144 // reload the window 145 $scope.goToSearchPage(); 146 // window.location = "/my-profile"; 147 } 148 } else { 149 alert(data.message); 150 } 151 }) 152 .error(function (data, status, header, config) { 153 $("#clientLoginModal").modal("hide"); 154 alert("Something went wrong. Please try again later."); 155 }); 156 }; 157 158 // Afetr login All user data store and formated for work 159 $scope.userDetails = function () { 160 var user_info = atob(localStorage.getItem("usr_info")); 161 var user_array = new Array(); 162 var user_array = user_info.split("|@|"); 163 var user_id = user_array[0]; 164 var user_first_name = user_array[1]; 165 var user_email = user_array[2]; 166 167 return [user_id, user_first_name, user_email]; 168 } 169 }); 170 171angular.module('dpiApp') 172 .directive('modal', function () { 173 return { 174 restrict: 'EA', 175 templateUrl: base_url + '/resources/assets/themes/' + current_theme + '/views/shared/agent_register_modal.html', 176 transclude: true, 177 controller: function ($scope) { 178 179 }, 180 }; 181 });
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.