1var app = angular.module('bossApp'); 2 3app.factory('LegalEntityService', function($http, $q, CacheFactory,$rootScope) { 4 var _user = angular.copy($rootScope.currentUser); 5 if (!CacheFactory.get('entityCache')) { 6 CacheFactory.createCache('entityCache'); 7 } 8 var entityCache = CacheFactory.get('entityCache'); 9 return { 10 /*getAllLE: function() { 11 req = { 12 method: 'GET', 13 url: $rootScope.api_Path + 'legalEntity/getAllLegalEntities', 14 } 15 return $http(req).then(function(response) { 16 return response.data; 17 }); 18 },*/ 19 getLE: function() { 20 var deferred = $q.defer(); 21 //if (entityCache.get("getLE")) { 22 // deferred.resolve(entityCache.get("getLE")); 23 //} else { 24 req = { 25 method: 'GET', 26 url: $rootScope.api_Path + 'legalEntity/getLegalEntity', 27 params: { 28 id: _user.entityId 29 } 30 } 31 $http(req, { 32 cache: entityCache 33 }).then(function(response) { 34 //entityCache.put("getLE", response); 35 deferred.resolve(response.data); 36 }); 37 //} 38 return deferred.promise; 39 }, 40 getLogedInUserLE: function() { 41 var deferred = $q.defer(); 42 if (entityCache.get("getLogedInUserLE")) { 43 deferred.resolve(entityCache.get("getLogedInUserLE")); 44 } else { 45 req = { 46 method: 'GET', 47 url:$rootScope.api_Path + 'legalEntity/getLoggedUserEntity', 48 params: { 49 id: _user.id 50 } 51 } 52 $http(req, { 53 cache: entityCache 54 }).then(function(response) { 55 entityCache.put("getLogedInUserLE", response.data); 56 deferred.resolve(response.data); 57 }); 58 } 59 return deferred.promise; 60 }, 61 saveLE: function(_legalEntity) { 62 entityCache.removeAll(); 63 var entitlements = angular.copy(_legalEntity.entitlements); 64 delete _legalEntity.entitlements; 65 req = { 66 method: 'POST', 67 url: $rootScope.api_Path + 'legalEntity/saveLegalEntity', 68 data: _legalEntity 69 70 } 71 return $http(req).then(function(response) { 72 return response.data; 73 }); 74 }, 75 76 is2FARequiredForNewUser: function() { 77 req = { 78 method: 'POST', 79 url: $rootScope.api_Path + 'legalEntity/is2FARequiredForNewUser', 80 params: { 81 id: _user.entityId 82 } 83 } 84 return $http(req).then(function(response) { 85 return response.data; 86 }); 87 }, 88 is2FARequiredForNewVendor: function() { 89 req = { 90 method: 'POST', 91 url: $rootScope.api_Path + 'legalEntity/is2FARequiredForNewVendor', 92 params: { 93 id: _user.entityId 94 } 95 } 96 return $http(req).then(function(response) { 97 return response.data; 98 }); 99 }, 100 is2FARequiredForNewCustomer: function() { 101 req = { 102 method: 'POST', 103 url: $rootScope.api_Path + 'legalEntity/is2FARequiredForNewCustomer', 104 params: { 105 id: _user.entityId 106 } 107 } 108 return $http(req).then(function(response) { 109 return response.data; 110 }); 111 }, 112 getAllChildEntities: function() { 113 var deferred = $q.defer(); 114 if (entityCache.get("getAllChildEntities")) { 115 deferred.resolve(entityCache.get("getAllChildEntities")); 116 } else { 117 req = { 118 method: 'GET', 119 url: $rootScope.api_Path + 'legalEntity/getAllChildEntities', 120 params:{ 121 userId :_user.id 122 } 123 } 124 $http(req, { 125 cache: entityCache 126 }).then(function(response) { 127 entityCache.put("getAllChildEntities", response.data); 128 deferred.resolve(response.data); 129 }); 130 } 131 return deferred.promise; 132 } 133 }; 134}); 135app.factory('LOGOService', function($http, CacheFactory,$rootScope) { 136 return { 137 uploadLOGO: function(_file, _entityId) { 138 var formData = new FormData(); 139 formData.append('entityId', _entityId); 140 formData.append("file", _file); 141 142 return $http.post($rootScope.api_Path + 'legalEntity/uploadLogo', formData, { 143 withCredentials: true, 144 headers: { 145 'Content-Type': undefined 146 }, 147 transformRequest: angular.identity 148 }); 149 }, 150 getLOGO: function(_documentId) { 151 req = { 152 method: 'GET', 153 url: $rootScope.api_Path + 'legalEntity/getLOGO', 154 params: { 155 documentId: _documentId 156 } 157 } 158 159 return $http(req).then(function(response) { 160 return response.data; 161 }); 162 } 163 }; 164});
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.