@sgcloud-sgsistemas/base 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sgcloud-sgsistemas/base",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Base para os sistemas da mobiage",
5
5
  "repository": {
6
6
  "type": "private",
@@ -193,16 +193,33 @@ const controller = function ($scope, $timeout, mbUserService, $state) {
193
193
  mbUserService.setComponentCallback((user) => { $scope.user = user; });
194
194
  mbUserService.setUser(this.config);
195
195
  $scope.user = mbUserService.getUser();
196
- $scope.currentCompany = JSON.parse(localStorage.getItem('currentCompany')).data
197
- $scope.menu = {info:[
198
- {title: 'Usuario', text: $scope.user.name},
199
- {title: 'Nome abreviado', text: $scope.currentCompany.shortName},
200
- {title: 'Razão social', text: $scope.currentCompany.name},
201
- {title: 'Nome fantasia', text: $scope.currentCompany.nickname}
202
- ] }
203
-
196
+ if (JSON.parse(localStorage.getItem('currentCompany'))) {
197
+ $scope.setCompanyInfo()
198
+ } else {
199
+ $scope.setCompanyInfoRecursive()
200
+ }
204
201
  $scope.focusCompany()
205
202
  };
203
+
204
+ $scope.setCompanyInfoRecursive = () => {
205
+ $timeout(() => {
206
+ if (JSON.parse(localStorage.getItem('currentCompany'))) {
207
+ $scope.setCompanyInfo()
208
+ } else {
209
+ $scope.setCompanyInfoRecursive()
210
+ }
211
+ }, 1000);
212
+ }
213
+
214
+ $scope.setCompanyInfo = () => {
215
+ $scope.currentCompany = JSON.parse(localStorage.getItem('currentCompany')).data
216
+ $scope.menu = {info:[
217
+ {title: 'Usuário', text: $scope.user.name},
218
+ {title: 'Nome abreviado', text: $scope.currentCompany.shortName},
219
+ {title: 'Razão social', text: $scope.currentCompany.name},
220
+ {title: 'Nome fantasia', text: $scope.currentCompany.nickname}
221
+ ] }
222
+ }
206
223
  };
207
224
 
208
225
  export default controller;