@sgcloud-sgsistemas/base 1.3.7 → 1.3.9

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.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "Base para os sistemas da mobiage",
5
5
  "repository": {
6
6
  "type": "private",
@@ -10,6 +10,12 @@ const controller = ($scope, CashierService, $state) => {
10
10
  $scope.setting.openState();
11
11
  }
12
12
  };
13
+ $scope.switchCashier = (event) => {
14
+ event.stopPropagation();
15
+ if ($scope.setting.switchState) {
16
+ $scope.setting.switchState();
17
+ }
18
+ };
13
19
  $scope.cashierIsEmpty = () => angular.equals($scope.setting, {});
14
20
  CashierService.registerCashier($scope.updateComponent);
15
21
  };
@@ -76,4 +76,36 @@
76
76
  width: 260px;
77
77
  }
78
78
  }
79
+
80
+ .mb-bt-switch-cashier {
81
+ display: flex;
82
+ align-items: center;
83
+ justify-content: center;
84
+ width: 32px;
85
+ min-width: 32px;
86
+ height: 38px;
87
+ padding: 0;
88
+ border: 0;
89
+ border-left: 1px solid rgba(255, 255, 255, .45);
90
+ border-radius: 0 6px 6px 0;
91
+ background-color: var(--secondary);
92
+ color: #fff;
93
+ font-size: 12px;
94
+ cursor: pointer;
95
+ transform: translateY(55%);
96
+
97
+ &:hover {
98
+ filter: brightness(0.92);
99
+ }
100
+
101
+ &:focus {
102
+ background-color: var(--secondary);
103
+ outline: none;
104
+ }
105
+
106
+ &:focus-visible {
107
+ outline: 2px solid rgba(255, 255, 255, .85);
108
+ outline-offset: 2px;
109
+ }
110
+ }
79
111
  }
@@ -1,6 +1,6 @@
1
1
  <div class="mb"
2
2
  tabindex="-1"
3
- ng-class="{'active' : setting.open}"
3
+ ng-class="{'active' : setting.open, 'has-switch-cashier': $ctrl.showSwitch && setting.open}"
4
4
  ng-style="setting.open && $ctrl.activeColor && {'background-color': $ctrl.activeColor }"
5
5
  cashier>
6
6
  <div class="mb-bt-cashier"
@@ -29,4 +29,14 @@
29
29
  </span>
30
30
  </div>
31
31
  </div>
32
+ <button type="button"
33
+ class="mb-bt-switch-cashier"
34
+ ng-show="$ctrl.showSwitch && setting.open"
35
+ ng-click="switchCashier($event)"
36
+ aria-label="Trocar de caixa"
37
+ uib-tooltip="Selecionar novo caixa"
38
+ tooltip-append-to-body="true"
39
+ tooltip-placement="bottom">
40
+ <i class="fas fa-exchange-alt" aria-hidden="true"></i>
41
+ </button>
32
42
  </div>
@@ -5,7 +5,8 @@ import './cashier.styles.scss';
5
5
  const component = {
6
6
  bindings: {
7
7
  config: '=',
8
- activeColor: '@?'
8
+ activeColor: '@?',
9
+ showSwitch: '<?'
9
10
  },
10
11
  template,
11
12
  controller
@@ -9,7 +9,7 @@
9
9
  padding-right: 15px;
10
10
  position: relative;
11
11
  z-index: 510;
12
- border-radius: 34px;
12
+ border-radius: 6px;
13
13
  border: none;
14
14
  padding-left: 10px;
15
15
  display: flex;
@@ -188,13 +188,22 @@ const controller = function ($scope, $timeout, mbUserService, $state) {
188
188
 
189
189
  $scope.changeOrganization = async () => {
190
190
  if ($scope.organizationSelected !== undefined) {
191
+ const selectedOrganization = $scope.user.otherOrganizations[$scope.organizationSelected];
192
+ const confirmation = await Swal.fire({
193
+ text: `Deseja trocar para a empresa "${selectedOrganization.name}"?`,
194
+ showCancelButton: true,
195
+ confirmButtonText: 'Sim',
196
+ cancelButtonText: 'Não',
197
+ reverseButtons: true
198
+ });
199
+ if (!confirmation.isConfirmed) return;
191
200
  if (!$scope.user.changeOrganizationAction) {
192
201
  mbUserService.setUser(this.config);
193
202
  $scope.user = mbUserService.getUser();
194
203
  }
195
204
  let result = (await mbUserService.validTime(
196
- $scope.user.otherOrganizations[$scope.organizationSelected].organizationHierarchyCode ||
197
- $scope.user.otherOrganizations[$scope.organizationSelected].hierarchyCode,
205
+ selectedOrganization.organizationHierarchyCode ||
206
+ selectedOrganization.hierarchyCode,
198
207
  SessionStorageBase.getItem('user').login,
199
208
  SessionStorageBase.getItem('user').token
200
209
  )).data
@@ -202,7 +211,7 @@ const controller = function ($scope, $timeout, mbUserService, $state) {
202
211
  $scope.outOfHourAccess(result.nextAccess || 'Próximo acesso: nunca. Entre em contato com o superior.')
203
212
  return
204
213
  } else {
205
- $scope.user.changeOrganizationAction($scope.user.otherOrganizations[$scope.organizationSelected]);
214
+ $scope.user.changeOrganizationAction(selectedOrganization);
206
215
  }
207
216
  }
208
217
  };
@@ -852,10 +852,11 @@
852
852
  }
853
853
  .mb-tu-m-ca-company {
854
854
  width: 100%;
855
+ min-height: 64px;
855
856
  display: flex;
856
857
  justify-content: flex-start;
857
858
  font-size: 14px;
858
- padding: 10px 15px 10px 10px;
859
+ padding: 14px 15px 14px 10px;
859
860
  align-items: center;
860
861
  flex-direction: row;
861
862
  font-weight: 700;
@@ -167,6 +167,19 @@
167
167
 
168
168
  > .mb-t-cashier{
169
169
  padding: 0px;
170
+
171
+ mb-cashier .mb[cashier] {
172
+ .mb-bt-cashier {
173
+ margin: 0;
174
+ border-radius: 6px;
175
+ }
176
+ }
177
+
178
+ mb-cashier .mb[cashier].has-switch-cashier {
179
+ .mb-bt-cashier {
180
+ border-radius: 6px 0 0 6px;
181
+ }
182
+ }
170
183
  }
171
184
 
172
185
  > .mb-t-notifications-container {
@@ -50,7 +50,8 @@
50
50
  <div class="mb-t-cashier" tabindex="-1">
51
51
  <mb-cashier config="vm.config.user"
52
52
  tabindex="-1"
53
- ng-if="!vm.config.hideCashier"></mb-cashier>
53
+ ng-if="!vm.config.hideCashier"
54
+ show-switch="true"></mb-cashier>
54
55
  </div>
55
56
 
56
57
  <div class="mb-price-check"