@sgcloud-sgsistemas/base 1.0.0

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.
Files changed (140) hide show
  1. package/README.md +505 -0
  2. package/app.js +686 -0
  3. package/assets/img/custom-icon.svg +1 -0
  4. package/assets/img/logo-finance.png +0 -0
  5. package/assets/img/logo.png +0 -0
  6. package/assets/img/logo_company.png +0 -0
  7. package/assets/img/perfil.png +0 -0
  8. package/config/postcss.config.js +14 -0
  9. package/config/webpack.config.common.js +53 -0
  10. package/config/webpack.config.dev.js +50 -0
  11. package/config/webpack.config.prod.js +49 -0
  12. package/index.html +115 -0
  13. package/package.json +64 -0
  14. package/resources/audio/mouth-pop.mp3 +0 -0
  15. package/src/index.js +1 -0
  16. package/src/modules/base/components/container/container.style.scss +7 -0
  17. package/src/modules/base/components/container/container.template.html +2 -0
  18. package/src/modules/base/components/container/index.js +9 -0
  19. package/src/modules/base/components/content-container/content-container.style.scss +36 -0
  20. package/src/modules/base/components/content-container/content-container.template.html +8 -0
  21. package/src/modules/base/components/content-container/index.js +9 -0
  22. package/src/modules/base/controllers/base.controller.js +39 -0
  23. package/src/modules/base/index.js +42 -0
  24. package/src/modules/base/providers/theme.provider.js +12 -0
  25. package/src/modules/base/providers/themes.list.js +233 -0
  26. package/src/modules/base/styles/base.animations.scss +43 -0
  27. package/src/modules/base/styles/base.flex.scss +45 -0
  28. package/src/modules/base/styles/base.style.scss +169 -0
  29. package/src/modules/base/templates/base.template.html +6 -0
  30. package/src/modules/footer/components/footer/footer.controller.js +17 -0
  31. package/src/modules/footer/components/footer/footer.style.scss +0 -0
  32. package/src/modules/footer/components/footer/footer.template.html +25 -0
  33. package/src/modules/footer/components/footer/index.js +13 -0
  34. package/src/modules/footer/controllers/footer.controller.js +13 -0
  35. package/src/modules/footer/index.js +19 -0
  36. package/src/modules/footer/services/footer.service.js +24 -0
  37. package/src/modules/footer/styles/footer.animations.scss +11 -0
  38. package/src/modules/footer/styles/footer.style.scss +28 -0
  39. package/src/modules/footer/templates/footer.template.html +1 -0
  40. package/src/modules/pageloader/controllers/pageloader.controller.js +60 -0
  41. package/src/modules/pageloader/index.js +15 -0
  42. package/src/modules/pageloader/services/pageloader.service.js +15 -0
  43. package/src/modules/pageloader/styles/pageloader.style.scss +67 -0
  44. package/src/modules/pageloader/templates/pageloader.template.html +9 -0
  45. package/src/modules/side-content/components/btn/btn.controller.js +55 -0
  46. package/src/modules/side-content/components/btn/btn.style.scss +48 -0
  47. package/src/modules/side-content/components/btn/btn.template.html +18 -0
  48. package/src/modules/side-content/components/btn/index.js +17 -0
  49. package/src/modules/side-content/controllers/side-content.controller.js +93 -0
  50. package/src/modules/side-content/index.js +17 -0
  51. package/src/modules/side-content/services/side-content.service.js +49 -0
  52. package/src/modules/side-content/styles/side-content.style.scss +73 -0
  53. package/src/modules/side-content/templates/side-content.template.html +25 -0
  54. package/src/modules/side-menu/components/btn/btn.controller.js +13 -0
  55. package/src/modules/side-menu/components/btn/btn.style.scss +75 -0
  56. package/src/modules/side-menu/components/btn/btn.template.html +43 -0
  57. package/src/modules/side-menu/components/btn/index.js +26 -0
  58. package/src/modules/side-menu/components/category/category.style.scss +47 -0
  59. package/src/modules/side-menu/components/category/category.template.html +23 -0
  60. package/src/modules/side-menu/components/category/index.js +13 -0
  61. package/src/modules/side-menu/components/html/html.controller.js +5 -0
  62. package/src/modules/side-menu/components/html/html.template.html +3 -0
  63. package/src/modules/side-menu/components/html/index.js +14 -0
  64. package/src/modules/side-menu/components/item/index.js +29 -0
  65. package/src/modules/side-menu/components/item/item.template.html +40 -0
  66. package/src/modules/side-menu/components/link/index.js +18 -0
  67. package/src/modules/side-menu/components/link/link.controller.js +48 -0
  68. package/src/modules/side-menu/components/link/link.style.scss +10 -0
  69. package/src/modules/side-menu/components/link/link.template.html +21 -0
  70. package/src/modules/side-menu/components/quick-menu/index.js +14 -0
  71. package/src/modules/side-menu/components/quick-menu/quick-menu.controller.js +67 -0
  72. package/src/modules/side-menu/components/quick-menu/quick-menu.style.scss +151 -0
  73. package/src/modules/side-menu/components/quick-menu/quick-menu.template.html +44 -0
  74. package/src/modules/side-menu/components/sub-category/index.js +20 -0
  75. package/src/modules/side-menu/components/sub-category/sub-category.controller.js +16 -0
  76. package/src/modules/side-menu/components/sub-category/sub-category.style.scss +48 -0
  77. package/src/modules/side-menu/components/sub-category/sub-category.template.html +47 -0
  78. package/src/modules/side-menu/controllers/sideMenu.js +71 -0
  79. package/src/modules/side-menu/index.js +33 -0
  80. package/src/modules/side-menu/services/sideMenu.js +12 -0
  81. package/src/modules/side-menu/styles/side-menu.style.scss +86 -0
  82. package/src/modules/side-menu/templates/side-menu.template.html +30 -0
  83. package/src/modules/themes/themes.style.scss +227 -0
  84. package/src/modules/top-notifications/components/notification/index.js +17 -0
  85. package/src/modules/top-notifications/components/notification/notification.controller.js +168 -0
  86. package/src/modules/top-notifications/components/notification/notification.style.scss +210 -0
  87. package/src/modules/top-notifications/components/notification/notification.template.html +22 -0
  88. package/src/modules/top-notifications/controllers/top-notifications.controller.js +33 -0
  89. package/src/modules/top-notifications/index.js +18 -0
  90. package/src/modules/top-notifications/services/top-notifications.services.js +108 -0
  91. package/src/modules/top-notifications/styles/top-notifications.style.scss +0 -0
  92. package/src/modules/top-notifications/templates/top-notifications.template.html +5 -0
  93. package/src/modules/topbar/components/cashier/cashier.controller.js +17 -0
  94. package/src/modules/topbar/components/cashier/cashier.styles.scss +79 -0
  95. package/src/modules/topbar/components/cashier/cashier.template.html +32 -0
  96. package/src/modules/topbar/components/cashier/index.js +14 -0
  97. package/src/modules/topbar/components/cashier/service/cashier.service.js +43 -0
  98. package/src/modules/topbar/components/environment/environment.html +24 -0
  99. package/src/modules/topbar/components/environment/environment.js +16 -0
  100. package/src/modules/topbar/components/environment/environment.scss +137 -0
  101. package/src/modules/topbar/components/environment/index.js +11 -0
  102. package/src/modules/topbar/components/environment/service/environment.service.js +19 -0
  103. package/src/modules/topbar/components/notifications/index.js +13 -0
  104. package/src/modules/topbar/components/notifications/notifications.controller.js +108 -0
  105. package/src/modules/topbar/components/notifications/notifications.styles.scss +282 -0
  106. package/src/modules/topbar/components/notifications/notifications.template.html +154 -0
  107. package/src/modules/topbar/components/search/components/input/index.js +19 -0
  108. package/src/modules/topbar/components/search/components/input/input.controller.js +19 -0
  109. package/src/modules/topbar/components/search/components/input/input.style.scss +74 -0
  110. package/src/modules/topbar/components/search/components/input/input.template.html +8 -0
  111. package/src/modules/topbar/components/search/components/result-line/index.js +16 -0
  112. package/src/modules/topbar/components/search/components/result-line/result-line.controller.js +69 -0
  113. package/src/modules/topbar/components/search/components/result-line/result-line.style.scss +58 -0
  114. package/src/modules/topbar/components/search/components/result-line/result-line.template.html +29 -0
  115. package/src/modules/topbar/components/search/controllers/search.controller.js +298 -0
  116. package/src/modules/topbar/components/search/index.js +21 -0
  117. package/src/modules/topbar/components/search/styles/search.style.scss +114 -0
  118. package/src/modules/topbar/components/search/templates/search.template.html +48 -0
  119. package/src/modules/topbar/components/user/components/btn/btn.style.scss +35 -0
  120. package/src/modules/topbar/components/user/components/btn/btn.template.html +36 -0
  121. package/src/modules/topbar/components/user/components/btn/index.js +15 -0
  122. package/src/modules/topbar/components/user/components/link/index.js +18 -0
  123. package/src/modules/topbar/components/user/components/link/link.controller.js +15 -0
  124. package/src/modules/topbar/components/user/components/link/link.style.scss +13 -0
  125. package/src/modules/topbar/components/user/components/link/link.template.html +26 -0
  126. package/src/modules/topbar/components/user/components/loading/index.js +14 -0
  127. package/src/modules/topbar/components/user/components/loading/loading.animations.scss +9 -0
  128. package/src/modules/topbar/components/user/components/loading/loading.style.scss +12 -0
  129. package/src/modules/topbar/components/user/components/loading/loading.template.html +3 -0
  130. package/src/modules/topbar/components/user/controllers/user.controller.js +200 -0
  131. package/src/modules/topbar/components/user/index.js +27 -0
  132. package/src/modules/topbar/components/user/services/user.service.js +14 -0
  133. package/src/modules/topbar/components/user/styles/user.animations.scss +27 -0
  134. package/src/modules/topbar/components/user/styles/user.style.scss +997 -0
  135. package/src/modules/topbar/components/user/templates/user.template.html +252 -0
  136. package/src/modules/topbar/controllers/topbar.controller.js +27 -0
  137. package/src/modules/topbar/index.js +31 -0
  138. package/src/modules/topbar/services/base-notification-service.js +40 -0
  139. package/src/modules/topbar/styles/topbar.style.scss +211 -0
  140. package/src/modules/topbar/templates/topbar.template.html +93 -0
@@ -0,0 +1,168 @@
1
+ const controller = function ($timeout, MbgNotification, $element) {
2
+ const vm = this;
3
+ /* !!!! Definir esse som no componente pai !!!! */
4
+ // const mouthPop = new Audio('resources/audio/mouth-pop.mp3');
5
+ let animationDuration;
6
+ vm.config = undefined;
7
+ vm.notifHeight = {
8
+ fixed: 50,
9
+ float: 50,
10
+ toast: 60
11
+ };
12
+ vm.containerTransform = '';
13
+
14
+ const timeouts = [];
15
+
16
+ vm.open = (config) => {
17
+ const element = $element;
18
+ window.coisa = element;
19
+ /* Configura o estilo */
20
+ switch (config.type) {
21
+ case 'warn': {
22
+ element.children('.mb-n-container').children('.mb[mb-notification]').addClass('mb-n-warn');
23
+ break;
24
+ }
25
+ case 'error': {
26
+ element.children('.mb-n-container').children('.mb[mb-notification]').addClass('mb-n-err');
27
+ break;
28
+ }
29
+ case 'success': {
30
+ element.children('.mb-n-container').children('.mb[mb-notification]').addClass('mb-n-succ');
31
+ break;
32
+ }
33
+ default: {
34
+ element.children('.mb-n-container').children('.mb[mb-notification]').addClass('mb-n-info');
35
+ }
36
+ }
37
+
38
+ /* Configura o tipo */
39
+ switch (config.variation) {
40
+ case 'fixed': {
41
+ animationDuration = 500;
42
+ element.children('.mb-n-container').addClass('mb-n-fixed').children('.mb[mb-notification]').addClass('mb-n-fixed');
43
+ MbgNotification.registerFixed({ close: vm.close, config, update: vm.update });
44
+ const notifCount = MbgNotification.fixedNotifBuffer.length;
45
+ const translateY = `translateY(${(notifCount - 1) * vm.notifHeight.fixed}px)`;
46
+ const translateX = 'translateX(0%)';
47
+ vm.zIndex = 23700 - notifCount;
48
+ vm.containerTransform = `${translateX} ${translateY}`;
49
+ MbgNotification.updateContentTransform(`translateY(${(notifCount) * vm.notifHeight.fixed}px)`, `calc(100vh - ${(notifCount) * vm.notifHeight.fixed}px)`);
50
+ if (config.duration && config.duration !== 'fixed') {
51
+ const durationWait = $timeout(() => {
52
+ MbgNotification.closeFixedNotif(config.id);
53
+ }, config.duration);
54
+ timeouts.push(durationWait);
55
+ }
56
+ const activeWait = $timeout(() => {
57
+ element.children('.mb-n-container').children('.mb[mb-notification]').addClass('mb-n-active');
58
+ });
59
+ timeouts.push(activeWait);
60
+ break;
61
+ }
62
+ case 'float': {
63
+ MbgNotification.registerFloat({ close: vm.close, config, update: vm.update });
64
+ const notifCount = MbgNotification.floatNotifBuffer.length;
65
+ animationDuration = 500;
66
+ element.children('.mb-n-container').addClass('mb-n-float').children('.mb[mb-notification]').addClass('mb-n-float');
67
+ const fixedNotifHeight = MbgNotification.fixedNotifBuffer.length * vm.notifHeight.fixed;
68
+ const translateY = `translateY(calc(${(notifCount - 1) * 100}% + ${fixedNotifHeight}px))`;
69
+ const translateX = 'translateX(-50%)';
70
+ vm.containerTransform = `${translateX} ${translateY}`;
71
+ const durationWait = $timeout(() => {
72
+ MbgNotification.closeFloatNotif(config.id);
73
+ }, config.duration);
74
+ // const soundWait = $timeout(() => {
75
+ // mouthPop.play();
76
+ // }, 100);
77
+ // timeouts.push(soundWait);
78
+ const activeWait = $timeout(() => {
79
+ element.children('.mb-n-container').children('.mb[mb-notification]').addClass('mb-n-active');
80
+ });
81
+ timeouts.push(activeWait);
82
+ timeouts.push(durationWait);
83
+ break;
84
+ }
85
+ default: {
86
+ animationDuration = 250;
87
+ element.children('.mb-n-container').addClass('mb-n-toast').children('.mb[mb-notification]').addClass('mb-n-toast');
88
+ const translateY = 'translateY(0px)';
89
+ const translateX = 'translateX(-50%)';
90
+ vm.containerTransform = `${translateX} ${translateY}`;
91
+
92
+ const active = () => {
93
+ MbgNotification.registerToast({ close: vm.close, config });
94
+ if (config.duration && config.duration !== 'fixed') {
95
+ const durationWait = $timeout(() => {
96
+ MbgNotification.closeToastNotif(config.id);
97
+ }, config.duration);
98
+ timeouts.push(durationWait);
99
+ }
100
+ const activeWait = $timeout(() => {
101
+ element.children('.mb-n-container').children('.mb[mb-notification]').addClass('mb-n-active');
102
+ });
103
+ timeouts.push(activeWait);
104
+ };
105
+
106
+ if (MbgNotification.toastNotifBuffer.length > 0) {
107
+ MbgNotification.toastNotifBuffer.forEach((notif) => {
108
+ MbgNotification.closeToastNotif(notif.config.id);
109
+ });
110
+ const animationWait = $timeout(() => {
111
+ active();
112
+ }, animationDuration + 50);
113
+ timeouts.push(animationWait);
114
+ } else {
115
+ active();
116
+ }
117
+ break;
118
+ }
119
+ }
120
+ };
121
+
122
+ vm.close = (config) => {
123
+ const element = $element;
124
+ switch (config.variation) {
125
+ case 'fixed': {
126
+ MbgNotification.updateContentTransform(`translateY(${vm.notifHeight.fixed * MbgNotification.fixedNotifBuffer.length}px)`, `calc(100vh - ${vm.notifHeight.fixed * MbgNotification.fixedNotifBuffer.length}px)`);
127
+ break;
128
+ }
129
+ default: {
130
+ break;
131
+ }
132
+ }
133
+ element.children('.mb-n-container').children('.mb[mb-notification]').removeClass('mb-n-active');
134
+ $timeout(() => {
135
+ vm.closeNotification({ id: config.id, config });
136
+ }, animationDuration + 50);
137
+ timeouts.forEach((timeout) => { $timeout.cancel(timeout); });
138
+ };
139
+
140
+ vm.update = (stackLevel, config) => {
141
+ let translateX;
142
+ let translateY;
143
+ switch (config.variation) {
144
+ case 'fixed': {
145
+ translateX = 'translateX(0%)';
146
+ vm.zIndex = 23700 - stackLevel;
147
+ translateY = `translateY(${stackLevel * 100}%)`;
148
+ break;
149
+ }
150
+ case 'float': {
151
+ translateX = 'translateX(-50%)';
152
+ const fixedNotif = MbgNotification.fixedNotifBuffer.length * vm.notifHeight.fixed;
153
+ translateY = `translateY(calc(${stackLevel * 100}% + ${fixedNotif}px))`;
154
+ break;
155
+ }
156
+ default: {
157
+ break;
158
+ }
159
+ }
160
+ vm.containerTransform = `${translateX} ${translateY}`;
161
+ };
162
+
163
+ vm.$onInit = () => {
164
+ vm.open(vm.notif);
165
+ };
166
+ };
167
+
168
+ export default controller;
@@ -0,0 +1,210 @@
1
+ @keyframes mb-n-toast-enter {
2
+ 0% {
3
+ transform: translateY(-15%) scaleY(0);
4
+ }
5
+
6
+ 50% {
7
+ transform: translateY(-5%) scaleY(1.05);
8
+ }
9
+
10
+ 75% {
11
+ transform: translateY(0%) scaleY(1.025);
12
+ }
13
+
14
+ 100% {
15
+ transform: translateY(0%) scaleY(1);
16
+ }
17
+ }
18
+
19
+ .mb-n-container {
20
+ position: fixed;
21
+ will-change: transform;
22
+ transition: transform ease 0.5s;
23
+
24
+ &.mb-n-fixed {
25
+ top: 0px;
26
+ left: 0px;
27
+ right: 0px;
28
+ bottom: auto;
29
+ width: 100%;
30
+ height: 50px;
31
+ transform: translateX(0%);
32
+ z-index: 23700;
33
+ }
34
+
35
+ &.mb-n-float {
36
+ top: 0px;
37
+ left: 50%;
38
+ right: auto;
39
+ bottom: auto;
40
+ width: 100%;
41
+ max-width: 900px;
42
+ height: 60px;
43
+ padding-top: 10px;
44
+ transform: translateX(-50%);
45
+ z-index: 23800;
46
+ }
47
+
48
+ &.mb-n-toast {
49
+ top: auto;
50
+ left: 50%;
51
+ right: auto;
52
+ bottom: 0px;
53
+ width: 100%;
54
+ max-width: 500px;
55
+ padding-bottom: 10px;
56
+ height: 60px;
57
+ transform: translateX(-50%);
58
+ z-index: 23900;
59
+ }
60
+
61
+ .mb[mb-notification] {
62
+ width: 100%;
63
+ height: 100%;
64
+ display: flex;
65
+ justify-content: center;
66
+ font-family: 'Montserrat', sans-serif;
67
+ transition: transform 0.5s ease;
68
+
69
+ &.mb-n-warn {
70
+ background: linear-gradient(to right, #ff8a3f, #ff4444);
71
+ }
72
+
73
+ &.mb-n-info {
74
+ background: #50b2ed;
75
+ }
76
+
77
+ &.mb-n-err {
78
+ background: #ff4444;
79
+ }
80
+
81
+ &.mb-n-succ {
82
+ background: #1eb75c;
83
+ }
84
+
85
+ .mb-n-inside-container {
86
+ display: flex;
87
+ max-width: 1000px;
88
+ width: 100%;
89
+ height: 100%;
90
+ justify-content: space-around;
91
+ align-content: center;
92
+
93
+ @media screen and (max-width: 768px) {
94
+ padding: 0 14px;
95
+ }
96
+
97
+ .mb-n-text {
98
+ height: 100%;
99
+ color: #fff;
100
+ font-weight: 400;
101
+ display: flex;
102
+ font-size: 14px;
103
+ align-items: center;
104
+ max-width: 450px;
105
+ width: auto;
106
+
107
+ .mb-n-icon-container {
108
+ height: 100%;
109
+ color: #fff;
110
+ margin-right: 10px;
111
+ font-size: 20px;
112
+ line-height: 50px;
113
+ }
114
+ }
115
+
116
+ .mb-n-action-container {
117
+ height: 100%;
118
+ display: flex;
119
+ align-items: center;
120
+ max-width: 200px;
121
+
122
+ .mb-n-action-button {
123
+ width: 100%;
124
+ padding: 5px 20px 5px 20px;
125
+ background-color: transparent;
126
+ border: 1px solid #fff;
127
+ border-radius: 22.5px;
128
+ font-size: 12px;
129
+ font-weight: 400;
130
+ text-align: center;
131
+ color: #fff;
132
+ cursor: pointer;
133
+ transition: transform 200ms ease;
134
+
135
+ &:hover {
136
+ transform: scale(1.05);
137
+ }
138
+ }
139
+ }
140
+ }
141
+
142
+ &.mb-n-fixed {
143
+ transform: translate3d(0, -100%, 0);
144
+ transition: transform 450ms ease;
145
+ box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.075);
146
+
147
+ &.mb-n-active {
148
+ transform: translate3d(0, 0, 0);
149
+ }
150
+ }
151
+
152
+ &.mb-n-float {
153
+ border-radius: 5px;
154
+ opacity: 0;
155
+ transform: perspective(400px) translateY(-30%);
156
+ will-change: opacity, transform;
157
+ transition: opacity 500ms linear, transform 500ms ease;
158
+ box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.25);
159
+
160
+ &.mb-n-active {
161
+ opacity: 1;
162
+ transition: none;
163
+ animation: mb-n-toast-enter 0.5s ease;
164
+ transform: perspective(400px);
165
+ }
166
+ }
167
+
168
+ &.mb-n-toast {
169
+ top: auto;
170
+ bottom: 10px;
171
+ left: 50%;
172
+ transform: translate3d(0, calc(100% + 10px), 0);
173
+ width: 100%;
174
+ max-width: 500px;
175
+ border-radius: 3px;
176
+ box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.25);
177
+ will-change: transform;
178
+ transition: transform 0.25s ease;
179
+
180
+ &.mb-n-active {
181
+ transform: translate3d(0, 0, 0);
182
+ }
183
+
184
+ .mb-n-inside-container {
185
+ padding-left: 15px;
186
+ padding-right: 15px;
187
+
188
+ .mb-n-action-container {
189
+ width: 300px;
190
+
191
+ .mb-n-action-button {
192
+ border: none;
193
+ padding: 0px;
194
+ width: 100%;
195
+ text-align: right;
196
+ text-decoration: underline;
197
+ }
198
+ }
199
+
200
+ .mb-n-text {
201
+ font-size: 14px;
202
+
203
+ .mb-n-icon-container {
204
+ display: none;
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
@@ -0,0 +1,22 @@
1
+ <div class="mb-n-container"
2
+ ng-style="{'transform': vm.containerTransform, 'z-index': vm.zIndex !== undefined ? vm.zIndex : undefined}">
3
+ <div class="mb"
4
+ mb-notification>
5
+ <div class="mb-n-inside-container">
6
+ <div class="mb-n-text"
7
+ ng-style="vm.notif.textStyle">
8
+ <div class="mb-n-icon-container">
9
+ <i class="{{ vm.notif.icon }}"></i>
10
+ </div>
11
+ {{ vm.notif.text }}
12
+ </div>
13
+ <div ng-if="vm.notif.actionButton === true"
14
+ class="mb-n-action-container">
15
+ <div class="mb-n-action-button"
16
+ ng-click="vm.notif.action(vm.notif)">
17
+ {{ vm.notif.actionText }}
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </div>
@@ -0,0 +1,33 @@
1
+ const controller = function (MbgNotification) {
2
+ const vm = this;
3
+ vm.notificationsStack = [];
4
+
5
+ vm.defaults = {
6
+ type: 'info',
7
+ variation: 'toast',
8
+ text: 'Olá mundo, esta é uma notificação',
9
+ duration: 4000,
10
+ icon: 'fas fa-exclamation-circle',
11
+ actionButton: false,
12
+ action: undefined,
13
+ actionText: 'Clique aqui'
14
+ };
15
+
16
+ vm.notification = undefined;
17
+
18
+ vm.openNotification = (notif) => {
19
+ vm.notification = Object.assign({ id: Math.random().toString(36).slice(2) }, vm.defaults, notif);
20
+ vm.notificationsStack.push(vm.notification);
21
+ return vm.notification;
22
+ };
23
+
24
+ vm.closeNotification = (id) => {
25
+ vm.notificationsStack = vm.notificationsStack.filter((value) => value.id !== id);
26
+ };
27
+
28
+ vm.$onInit = () => {
29
+ MbgNotification.registerComponentCallbacks(vm.openNotification);
30
+ };
31
+ };
32
+
33
+ export default controller;
@@ -0,0 +1,18 @@
1
+ import template from './templates/top-notifications.template.html';
2
+ import controller from './controllers/top-notifications.controller';
3
+ import service from './services/top-notifications.services';
4
+
5
+ import './styles/top-notifications.style.scss';
6
+
7
+ import notification from './components/notification';
8
+
9
+ const component = {
10
+ template,
11
+ controller,
12
+ controllerAs: 'vm'
13
+ };
14
+
15
+ angular.module('mb.notifications', [])
16
+ .service('MbgNotification', service)
17
+ .component('mbNotification', notification)
18
+ .component('mbNotifications', component);
@@ -0,0 +1,108 @@
1
+ const service = function () {
2
+ /*
3
+ Essa service torna possível a comunicação entre
4
+ os componentes do modulo e a criação de novas notificações
5
+ em qualquer parte do software
6
+ */
7
+
8
+ const preRegisterNotificationBuffer = []
9
+ let preRegisterNotifFixedUpdate
10
+ this.openNotification = (notif) => {
11
+ preRegisterNotificationBuffer.push(notif)
12
+ }
13
+
14
+ /* Função responsável por atualizar o conteúdo do sistema quando uma notificação fixa abrir */
15
+ this.updateContentTransform = (update) => {
16
+ preRegisterNotifFixedUpdate = update
17
+ }
18
+
19
+ /* Registro da função que abrirá notificações */
20
+ this.registerComponentCallbacks = (open) => {
21
+ this.openNotification = open
22
+ /* Execução das notificações em buffer */
23
+ preRegisterNotificationBuffer.forEach((notif) => {
24
+ this.openNotification(notif)
25
+ })
26
+ }
27
+
28
+ /* Registro da função que atualizará a posição do conteúdo do sistema */
29
+ this.registerContentCallback = (update) => {
30
+ this.updateContentTransform = update
31
+ if (preRegisterNotifFixedUpdate !== undefined) {
32
+ this.updateContentTransform(preRegisterNotifFixedUpdate)
33
+ }
34
+ }
35
+
36
+ /* * Fixed Notification * */
37
+ this.fixedNotification = undefined
38
+ this.fixedNotifBuffer = []
39
+ this.registerFixed = (notification) => {
40
+ /* formato: { close: fn(), config } */
41
+ this.fixedNotifBuffer.push(notification)
42
+ this.updateFloatNotif()
43
+ }
44
+
45
+ this.getFixedOpened = () => {
46
+ return this.fixedNotifBuffer.length
47
+ }
48
+ this.updateFixedNotif = () => {
49
+ let stackLevel = 0
50
+ this.fixedNotifBuffer.forEach((notif) => {
51
+ notif.update(stackLevel, notif.config)
52
+ stackLevel += 1
53
+ })
54
+ }
55
+ this.closeFixedNotif = (id) => {
56
+ if (this.fixedNotifBuffer.length > 0) {
57
+ /* Notificação á ser fechada */
58
+ const notifToClose = this.fixedNotifBuffer.filter((value) => value.config.id === id)
59
+ /* Remoção da notificação á ser fechada */
60
+ this.fixedNotifBuffer = this.fixedNotifBuffer.filter((value) => value.config.id !== id)
61
+ notifToClose.forEach((notif) => {
62
+ notif.close(notif.config)
63
+ })
64
+ this.updateFloatNotif()
65
+ this.updateFixedNotif()
66
+ }
67
+ }
68
+
69
+ /* * Float Notification * */
70
+ this.floatNotifBuffer = []
71
+ this.registerFloat = (notification) => {
72
+ this.floatNotifBuffer.push(notification)
73
+ }
74
+ this.updateFloatNotif = () => {
75
+ let stackLevel = 0
76
+ this.floatNotifBuffer.forEach((notif) => {
77
+ notif.update(stackLevel, notif.config)
78
+ stackLevel += 1
79
+ })
80
+ }
81
+ this.closeFloatNotif = (id) => {
82
+ if (this.floatNotifBuffer.length > 0) {
83
+ const floatToClose = this.floatNotifBuffer.filter((value) => value.config.id === id)
84
+ floatToClose.forEach((float) => {
85
+ float.close(float.config)
86
+ })
87
+ this.floatNotifBuffer = this.floatNotifBuffer.filter((value) => value.config.id !== id)
88
+ this.updateFloatNotif()
89
+ }
90
+ }
91
+
92
+ /* * Toast Notification * */
93
+ this.toastNotifBuffer = []
94
+ this.registerToast = (notification) => {
95
+ this.toastNotifBuffer.push(notification)
96
+ }
97
+ this.closeToastNotif = (id) => {
98
+ if (this.toastNotifBuffer.length > 0) {
99
+ const toastToClose = this.toastNotifBuffer.filter((value) => value.config.id === id)
100
+ toastToClose.forEach((toast) => {
101
+ toast.close(toast.config)
102
+ })
103
+ this.toastNotifBuffer = this.toastNotifBuffer.filter((value) => value.config.id !== id)
104
+ }
105
+ }
106
+ }
107
+
108
+ export default service
@@ -0,0 +1,5 @@
1
+ <mb-notification ng-repeat="notification in vm.notificationsStack"
2
+ notif="notification"
3
+ close-notification="vm.closeNotification(id, config)"
4
+ notification-stack="vm.notificationsStack">
5
+ </mb-notification>
@@ -0,0 +1,17 @@
1
+ const controller = ($scope, CashierService, $state) => {
2
+ $scope.setting = {};
3
+ $scope.updateComponent = () => {
4
+ $scope.setting = CashierService.configCashier;
5
+ };
6
+ $scope.goCashierState = () => {
7
+ if ($scope.setting.open) {
8
+ $scope.setting.closeState();
9
+ } else {
10
+ $scope.setting.openState();
11
+ }
12
+ };
13
+ $scope.cashierIsEmpty = () => angular.equals($scope.setting, {});
14
+ CashierService.registerCashier($scope.updateComponent);
15
+ };
16
+
17
+ export default controller;
@@ -0,0 +1,79 @@
1
+ @import "../../../themes/themes.style.scss";
2
+ .mb[cashier] {
3
+ display: flex;
4
+ align-items: center;
5
+ justify-content: flex-end;
6
+ height: 1px;
7
+ margin-right: 10px;
8
+
9
+ .mb-bt-cashier {
10
+ transform: translateY(55%);
11
+ width: 220px;
12
+ height: 38px;
13
+ margin: 0px 10px;
14
+ text-align: center;
15
+ overflow: hidden;
16
+ word-wrap: normal;
17
+ border-radius: 35px ;
18
+
19
+ span {
20
+ position: relative;
21
+ line-height: 42px;
22
+ font-weight: 700;
23
+ font-size: 12px;
24
+ i.m-t {
25
+ margin-right: 8px;
26
+ }
27
+ }
28
+
29
+ &.ca-open {
30
+ @include themify(background-color, quickMenuBtnBackground);
31
+ color: #fff;
32
+ cursor: pointer;
33
+ }
34
+ &.ca-close {
35
+ background-color: #b5b5b5;
36
+ color: #fff;
37
+ cursor: pointer;
38
+ }
39
+
40
+ .mb-box-cashier {
41
+ transition: transform 300ms ease;
42
+ transform: translateY(2px);
43
+ &.active {
44
+ transform: none;
45
+ &:hover {
46
+ transform: translateY(-50%);
47
+ }
48
+ }
49
+ span {
50
+ display: block;
51
+ }
52
+ }
53
+
54
+ .caixa-aberto {
55
+ height: 40px;
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ flex-direction: column;
60
+ }
61
+
62
+ .nome-pdv {
63
+ font-size: 10px;
64
+ font-weight: 600;
65
+ }
66
+
67
+ .caixa-aberto-text {
68
+ font-weight: 700;
69
+ font-size: 12px;
70
+ i.m-t {
71
+ display: initial;
72
+ margin-right: 8px;
73
+ }
74
+ }
75
+ @media (max-width: 800px) {
76
+ width: 260px;
77
+ }
78
+ }
79
+ }
@@ -0,0 +1,32 @@
1
+ <div class="mb"
2
+ tabindex="-1"
3
+ ng-class="{'active' : setting.open}"
4
+ ng-style="setting.open && $ctrl.activeColor && {'background-color': $ctrl.activeColor }"
5
+ cashier>
6
+ <div class="mb-bt-cashier"
7
+ tabindex="-1"
8
+ ng-click="goCashierState()"
9
+ ng-class="setting.open ? 'ca-open' : 'ca-close'">
10
+ <span ng-show="cashierIsEmpty()" tabindex="-1">
11
+ <i class="fas fa-spinner fa-spin" tabindex="-1"></i>
12
+ </span>
13
+ <span ng-hide="cashierIsEmpty() || setting.open" tabindex="-1">
14
+ <i class="fas fa-coins m-t" tabindex="-1"></i> Abrir Novo Caixa
15
+ </span>
16
+
17
+ <div class="mb-box-cashier"
18
+ tabindex="-1"
19
+ ng-class="{'active' : setting.open}"
20
+ ng-hide="cashierIsEmpty()">
21
+
22
+ <div class="caixa-aberto" tabindex="-1">
23
+ <div class="nome-pdv" tabindex="-1">{{setting.name}}</div>
24
+ <div class="caixa-aberto-text" tabindex="-1"><i tabindex="-1"class="fas fa-coins m-t"></i>Caixa Aberto: {{setting.date}}</div>
25
+ </div>
26
+
27
+ <span style="line-height: 42px;" tabindex="-1">
28
+ <i class="fas fa-coins m-t" tabindex="-1"></i> Fechar Caixa
29
+ </span>
30
+ </div>
31
+ </div>
32
+ </div>