@sgcloud-sgsistemas/base 1.0.0 → 1.0.2

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.0",
3
+ "version": "1.0.2",
4
4
  "description": "Base para os sistemas da mobiage",
5
5
  "repository": {
6
6
  "type": "private",
@@ -53,8 +53,8 @@ const controller = function ($scope, $timeout, mbSidemenuService) {
53
53
  mbSidemenuService.setMenuConfig(config);
54
54
  mbSidemenuService.registerMenuCallback(openMenu, closeMenu);
55
55
 
56
- $scope.structure = config.structure;
57
- $scope.quickMenu = config.quickMenu;
56
+ $scope.structure = config ? config.structure: null;
57
+ $scope.quickMenu = config ? config.quickMenu: null;
58
58
  })
59
59
  $timeout(() => {
60
60
  document.addEventListener('touchstart', handleTouchStart);
@@ -281,10 +281,12 @@ const controller = function ($scope, $timeout, mbSidemenuService, hotkeys) {
281
281
 
282
282
  this.$onInit = () => {
283
283
  $scope.$watch('vm.configMenu', () => {
284
- $scope.indexFields = this.config.indexFields;
285
- prepareData(this.config.data);
284
+ if (this.config) {
285
+ $scope.indexFields = this.config ? this.config.indexFields : null;
286
+ prepareData(this.config.data);
287
+ }
286
288
  })
287
- if (this.config.setHotkeys === true) {
289
+ if (this.config && this.config.setHotkeys === true) {
288
290
  hotkeys.bindTo($scope).add({
289
291
  combo: 'ctrl+b',
290
292
  callback() {
@@ -193,8 +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
+ if (JSON.parse(localStorage.getItem('currentCompany'))) {
197
+ $scope.setCompanyInfo()
198
+ } else {
199
+ $scope.setCompanyInfoRecursive()
200
+ }
196
201
  $scope.focusCompany()
197
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: 'Usuario', 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
+ }
198
223
  };
199
224
 
200
225
  export default controller;
@@ -30,7 +30,7 @@
30
30
  ng-class="{'mb-tu-focus-company' : !vm.disabledUserFocus && focus === 'company'}">
31
31
  <div class="mb-tu-button-subtitle"tabindex="-1">
32
32
  <!-- {{ maxSize(user.actualOrganization.subTitle, 25, false) }} -->
33
- {{ maxSize(user.name, 17, true) }}
33
+ {{ maxSize(currentCompany.shortName, 50, true) }}
34
34
  </div>
35
35
  <mb-t-u-loading margin="'5px 0px 5px 5px'"
36
36
  height="20"
@@ -38,7 +38,7 @@
38
38
  width="100"
39
39
  ng-if="user.actualOrganization.subTitle === undefined"></mb-t-u-loading>
40
40
  <div class="mb-tu-button-title" tabindex="-1">
41
- {{ maxSize(user.actualOrganization.name, 17, true) }}
41
+ {{ maxSize(currentCompany.name, 50, true) }}
42
42
  </div>
43
43
  <mb-t-u-loading margin="'5px 0px 5px 5px'"
44
44
  height="20"
@@ -106,7 +106,7 @@
106
106
  <div class="mb-tu-menu-content" tabindex="-1">
107
107
  <div class="mb-tu-menu-company-content" tabindex="-1">
108
108
  <div class="mb-tu-menu-company-info-container" tabindex="-1">
109
- <div ng-repeat="info in user.actualOrganization.info"
109
+ <div ng-repeat="info in menu.info"
110
110
  tabindex="-1"
111
111
  class="mb-tu-menu-company-info">
112
112
  <div class="mb-tu-menu-company-info-title" tabindex="-1">
@@ -6,7 +6,7 @@ const controller = function (mbSidemenuService) {
6
6
  };
7
7
 
8
8
  vm.$onInit = () => {
9
- if (vm.config.usersBirthday) {
9
+ if (vm.config && vm.config.usersBirthday) {
10
10
  vm.config.usersBirthday.getUsers().then((response) => {
11
11
  vm.config.usersBirthday.users = response
12
12
  })
@@ -89,6 +89,7 @@
89
89
  align-items: left;
90
90
 
91
91
  > .mb-t-search-container {
92
+ max-width: 512px;
92
93
  height: 100%;
93
94
  flex-grow: 1;
94
95
  display: flex;
@@ -121,47 +122,6 @@
121
122
  }
122
123
  }
123
124
 
124
- > .mb-t-cashier{
125
- padding: 0px;
126
- padding-left: 15%;
127
- }
128
-
129
- > .mb-t-notifications-container {
130
- height: 100%;
131
- width: 100px;
132
- position: relative;
133
- }
134
-
135
- > .mb-birthday-wrapper {
136
- display: flex;
137
- align-items: center;
138
- justify-content: center;
139
- font-size: 25px;
140
- position: relative;
141
- text-align: center;
142
- cursor: pointer;
143
- i {
144
- color: #8034ad;
145
- @include themify(color, color1);
146
- }
147
- .mb-tn-number {
148
- position: absolute;
149
- top: 0;
150
- right: 0;
151
- line-height: 23px;
152
- width: 23px;
153
- height: 23px;
154
- border-radius: 11.5px;
155
- background-color: map-get($semantic, error);
156
- font-size: 12px;
157
- font-weight: 700;
158
- color: white;
159
- }
160
- .mb-tn-number, i.bell {
161
- transition: transform 350ms ease;
162
- }
163
- }
164
-
165
125
  > .sg-mode-on-wrapper {
166
126
  display: flex;
167
127
  align-items: center;
@@ -185,16 +145,63 @@
185
145
  text-align: center;
186
146
  cursor: pointer;
187
147
  }
188
-
189
- > .mb-t-user-container {
148
+ >.mb-tbar-right{
190
149
  height: 100%;
191
- position: relative;
192
- z-index: 550;
193
- font-size: 16px;
194
- min-width: 256px;
195
- margin-left: 8px;
196
- @media screen and (max-width: 768px) {
197
- // flex: 1;
150
+ display: flex;
151
+ flex-grow: 1;
152
+ flex-direction: row;
153
+ justify-content: right;
154
+
155
+ > .mb-t-user-container {
156
+ height: 100%;
157
+ position: relative;
158
+ z-index: 550;
159
+ font-size: 16px;
160
+ min-width: 256px;
161
+ margin-left: 8px;
162
+ @media screen and (max-width: 768px) {
163
+ // flex: 1;
164
+ }
165
+ }
166
+
167
+ > .mb-t-cashier{
168
+ padding: 0px;
169
+ }
170
+
171
+ > .mb-t-notifications-container {
172
+ height: 100%;
173
+ width: 100px;
174
+ position: relative;
175
+ }
176
+
177
+ > .mb-birthday-wrapper {
178
+ display: flex;
179
+ align-items: center;
180
+ justify-content: center;
181
+ font-size: 25px;
182
+ position: relative;
183
+ text-align: center;
184
+ cursor: pointer;
185
+ i {
186
+ color: #8034ad;
187
+ @include themify(color, color1);
188
+ }
189
+ .mb-tn-number {
190
+ position: absolute;
191
+ top: 0;
192
+ right: 0;
193
+ line-height: 23px;
194
+ width: 23px;
195
+ height: 23px;
196
+ border-radius: 11.5px;
197
+ background-color: map-get($semantic, error);
198
+ font-size: 12px;
199
+ font-weight: 700;
200
+ color: white;
201
+ }
202
+ .mb-tn-number, i.bell {
203
+ transition: transform 350ms ease;
204
+ }
198
205
  }
199
206
  }
200
207
 
@@ -48,44 +48,45 @@
48
48
  {{$root.windowTitle.toUpperCase()}}
49
49
  </span>
50
50
  </div>
51
-
52
- <div class="mb-t-cashier" tabindex="-1">
53
- <mb-cashier config="vm.config.user"
54
- tabindex="-1"
55
- ng-if="!vm.config.hideCashier"></mb-cashier>
56
- </div>
57
-
58
- <div class="mb-birthday-wrapper"
51
+ <div class="mb-tbar-right">
52
+ <div class="mb-t-cashier" tabindex="-1">
53
+ <mb-cashier config="vm.config.user"
54
+ tabindex="-1"
55
+ ng-if="!vm.config.hideCashier"></mb-cashier>
56
+ </div>
57
+
58
+ <div class="mb-birthday-wrapper"
59
+ tabindex="-1"
60
+ ng-click="vm.config.usersBirthday.onClick(vm.config.usersBirthday.users)"
61
+ ng-if="vm.config.showBirthday">
62
+ <i class="fas fa-gift" tabindex="-1"></i>
63
+ <div class="mb-tn-number"
64
+ tabindex="-1"
65
+ ng-show="vm.config.usersBirthday.count(vm.config.usersBirthday.users) > 0">
66
+ {{ vm.config.usersBirthday.count(vm.config.usersBirthday.users) }}
67
+ </div>
68
+ </div>
69
+
70
+ <mb-topbar-notifications tabindex="-1"></mb-topbar-notifications>
71
+
72
+ <div class="sg-mode-on-wrapper"
59
73
  tabindex="-1"
60
- ng-click="vm.config.usersBirthday.onClick(vm.config.usersBirthday.users)"
61
- ng-if="vm.config.showBirthday">
62
- <i class="fas fa-gift" tabindex="-1"></i>
63
- <div class="mb-tn-number"
74
+ ng-if="vm.config.modeOffline && vm.isOnline()"
75
+ ng-click="vm.changeStatusOnline()">
76
+ <cp-online-icon tabindex="-1" uib-tooltip="Online"></cp-online-icon>
77
+ </div>
78
+ <div class="sg-mode-off-wrapper"
64
79
  tabindex="-1"
65
- ng-show="vm.config.usersBirthday.count(vm.config.usersBirthday.users) > 0">
66
- {{ vm.config.usersBirthday.count(vm.config.usersBirthday.users) }}
80
+ ng-if="vm.config.modeOffline && !vm.isOnline()"
81
+ ng-click="vm.changeStatusOnline()">
82
+ <cp-offline-icon tabindex="-1" uib-tooltip="Offline"></cp-offline-icon>
83
+ </div>
84
+
85
+ <div class="mb-t-user-container" tabindex="-1">
86
+ <mb-t-user config="vm.config.user"
87
+ tabindex="-1"
88
+ disabled-user-focus="vm.config.disabledUserFocus"></mb-t-user>
67
89
  </div>
68
- </div>
69
-
70
- <mb-topbar-notifications tabindex="-1"></mb-topbar-notifications>
71
-
72
- <div class="sg-mode-on-wrapper"
73
- tabindex="-1"
74
- ng-if="vm.config.modeOffline && vm.isOnline()"
75
- ng-click="vm.changeStatusOnline()">
76
- <cp-online-icon tabindex="-1" uib-tooltip="Online"></cp-online-icon>
77
- </div>
78
- <div class="sg-mode-off-wrapper"
79
- tabindex="-1"
80
- ng-if="vm.config.modeOffline && !vm.isOnline()"
81
- ng-click="vm.changeStatusOnline()">
82
- <cp-offline-icon tabindex="-1" uib-tooltip="Offline"></cp-offline-icon>
83
- </div>
84
-
85
- <div class="mb-t-user-container" tabindex="-1">
86
- <mb-t-user config="vm.config.user"
87
- tabindex="-1"
88
- disabled-user-focus="vm.config.disabledUserFocus"></mb-t-user>
89
90
  </div>
90
91
  </div>
91
92
  </div>