tin-spa 2.0.0 → 2.1.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 (241) hide show
  1. package/README.md +2 -2
  2. package/{esm2015/lib/classes/Classes.js → esm2020/lib/classes/Classes.mjs} +15 -55
  3. package/esm2020/lib/classes/TinCore.mjs +148 -0
  4. package/esm2020/lib/components/activity/activity.component.mjs +24 -0
  5. package/esm2020/lib/components/attach/attach.component.mjs +105 -0
  6. package/esm2020/lib/components/change-password/change-password.component.mjs +92 -0
  7. package/esm2020/lib/components/check/check.component.mjs +56 -0
  8. package/esm2020/lib/components/chips/chips.component.mjs +58 -0
  9. package/esm2020/lib/components/create-account/create-account.component.mjs +72 -0
  10. package/esm2020/lib/components/date/date.component.mjs +64 -0
  11. package/esm2020/lib/components/datetime/datetime.component.mjs +39 -0
  12. package/esm2020/lib/components/filter/filter.component.mjs +46 -0
  13. package/esm2020/lib/components/form/form.component.mjs +63 -0
  14. package/esm2020/lib/components/label/label.component.mjs +25 -0
  15. package/esm2020/lib/components/loader/loader.component.mjs +24 -0
  16. package/esm2020/lib/components/login/login.component.mjs +113 -0
  17. package/esm2020/lib/components/logs/logs.component.mjs +37 -0
  18. package/esm2020/lib/components/message/messageDialog.component.mjs +32 -0
  19. package/esm2020/lib/components/money/currency-input-mask.directive.mjs +185 -0
  20. package/esm2020/lib/components/money/currency-input-mask.module.mjs +28 -0
  21. package/esm2020/lib/components/money/money.component.mjs +64 -0
  22. package/esm2020/lib/components/nav-menu/nav-menu.component.mjs +49 -0
  23. package/esm2020/lib/components/number/number.component.mjs +86 -0
  24. package/esm2020/lib/components/option/option.component.mjs +59 -0
  25. package/esm2020/lib/components/profile/profile.component.mjs +93 -0
  26. package/esm2020/lib/components/recover-account/recover-account.component.mjs +46 -0
  27. package/esm2020/lib/components/roles/addRoleDialog.component.mjs +61 -0
  28. package/esm2020/lib/components/roles/roles.component.mjs +91 -0
  29. package/esm2020/lib/components/select/select.component.mjs +71 -0
  30. package/esm2020/lib/components/settings/settings.component.mjs +63 -0
  31. package/esm2020/lib/components/signup/signup.component.mjs +50 -0
  32. package/esm2020/lib/components/steps/steps.component.mjs +90 -0
  33. package/esm2020/lib/components/table/detailsDialog.component.mjs +149 -0
  34. package/esm2020/lib/components/table/table.component.mjs +341 -0
  35. package/esm2020/lib/components/text/text.component.mjs +166 -0
  36. package/esm2020/lib/components/tiles/tiles.component.mjs +41 -0
  37. package/esm2020/lib/components/tin-spa.component.mjs +19 -0
  38. package/esm2020/lib/components/users/users.component.mjs +119 -0
  39. package/esm2020/lib/modules/admin/admin-routing.module.mjs +29 -0
  40. package/esm2020/lib/modules/admin/admin.module.mjs +26 -0
  41. package/esm2020/lib/modules/index/index-routing.module.mjs +27 -0
  42. package/esm2020/lib/modules/index/index.module.mjs +26 -0
  43. package/esm2020/lib/modules/spa-admin.module.mjs +73 -0
  44. package/esm2020/lib/modules/spa-index.module.mjs +52 -0
  45. package/esm2020/lib/modules/spa-mat.module.mjs +67 -0
  46. package/esm2020/lib/modules/spa-user.module.mjs +49 -0
  47. package/esm2020/lib/modules/user/user-routing.module.mjs +23 -0
  48. package/esm2020/lib/modules/user/user.module.mjs +26 -0
  49. package/esm2020/lib/pipes/camelToWords.pipe.mjs +23 -0
  50. package/esm2020/lib/services/auth.service.mjs +142 -0
  51. package/esm2020/lib/services/data.service.mjs +125 -0
  52. package/esm2020/lib/services/export.service.mjs +16 -0
  53. package/esm2020/lib/services/http.service.mjs +79 -0
  54. package/esm2020/lib/services/loader-interceptor.service.mjs +77 -0
  55. package/esm2020/lib/services/loader.service.mjs +17 -0
  56. package/esm2020/lib/services/log.service.mjs +77 -0
  57. package/esm2020/lib/services/message.service.mjs +52 -0
  58. package/esm2020/lib/services/storage.service.mjs +34 -0
  59. package/esm2020/lib/services/tin-spa.service.mjs +14 -0
  60. package/esm2020/lib/tin-spa.module.mjs +114 -0
  61. package/esm2020/public-api.mjs +62 -0
  62. package/esm2020/tin-spa.mjs +5 -0
  63. package/fesm2015/tin-spa.mjs +3846 -0
  64. package/fesm2015/tin-spa.mjs.map +1 -0
  65. package/fesm2020/tin-spa.mjs +3829 -0
  66. package/fesm2020/tin-spa.mjs.map +1 -0
  67. package/index.d.ts +5 -0
  68. package/lib/classes/Classes.d.ts +58 -63
  69. package/lib/classes/TinCore.d.ts +1 -0
  70. package/lib/components/activity/activity.component.d.ts +3 -0
  71. package/lib/components/attach/attach.component.d.ts +4 -1
  72. package/lib/components/change-password/change-password.component.d.ts +3 -0
  73. package/lib/components/check/check.component.d.ts +3 -0
  74. package/lib/components/chips/chips.component.d.ts +3 -0
  75. package/lib/components/create-account/create-account.component.d.ts +3 -0
  76. package/lib/components/date/date.component.d.ts +14 -6
  77. package/lib/components/datetime/datetime.component.d.ts +3 -0
  78. package/lib/components/filter/filter.component.d.ts +4 -0
  79. package/lib/components/form/form.component.d.ts +16 -0
  80. package/lib/components/label/label.component.d.ts +3 -0
  81. package/lib/components/loader/loader.component.d.ts +3 -0
  82. package/lib/components/login/login.component.d.ts +6 -0
  83. package/lib/components/logs/logs.component.d.ts +3 -0
  84. package/lib/components/message/messageDialog.component.d.ts +3 -0
  85. package/lib/components/money/currency-input-mask.directive.d.ts +41 -0
  86. package/lib/components/money/currency-input-mask.module.d.ts +9 -0
  87. package/lib/components/money/money.component.d.ts +9 -1
  88. package/lib/components/nav-menu/nav-menu.component.d.ts +3 -0
  89. package/lib/components/number/number.component.d.ts +29 -0
  90. package/lib/components/option/option.component.d.ts +3 -0
  91. package/lib/components/profile/profile.component.d.ts +6 -2
  92. package/lib/components/recover-account/recover-account.component.d.ts +3 -0
  93. package/lib/components/roles/addRoleDialog.component.d.ts +3 -0
  94. package/lib/components/roles/roles.component.d.ts +3 -0
  95. package/lib/components/select/select.component.d.ts +5 -1
  96. package/lib/components/settings/settings.component.d.ts +3 -0
  97. package/lib/components/signup/signup.component.d.ts +3 -0
  98. package/lib/components/steps/steps.component.d.ts +3 -0
  99. package/lib/components/table/detailsDialog.component.d.ts +28 -0
  100. package/lib/components/table/table.component.d.ts +57 -17
  101. package/lib/components/text/text.component.d.ts +13 -9
  102. package/lib/components/tiles/tiles.component.d.ts +3 -0
  103. package/lib/components/tin-spa.component.d.ts +4 -4
  104. package/lib/components/users/users.component.d.ts +4 -0
  105. package/lib/modules/admin/admin-routing.module.d.ts +7 -0
  106. package/lib/modules/admin/admin.module.d.ts +9 -0
  107. package/lib/modules/index/index-routing.module.d.ts +7 -0
  108. package/lib/modules/index/index.module.d.ts +9 -0
  109. package/lib/modules/spa-admin.module.d.ts +13 -0
  110. package/lib/modules/spa-index.module.d.ts +10 -0
  111. package/lib/modules/spa-mat.module.d.ts +31 -0
  112. package/lib/modules/spa-user.module.d.ts +9 -0
  113. package/lib/modules/user/user-routing.module.d.ts +7 -0
  114. package/lib/modules/user/user.module.d.ts +9 -0
  115. package/lib/pipes/camelToWords.pipe.d.ts +7 -0
  116. package/lib/services/auth.service.d.ts +3 -0
  117. package/lib/services/data.service.d.ts +5 -1
  118. package/lib/services/export.service.d.ts +3 -4
  119. package/lib/services/http.service.d.ts +3 -0
  120. package/lib/services/loader-interceptor.service.d.ts +3 -0
  121. package/lib/services/loader.service.d.ts +3 -0
  122. package/lib/services/log.service.d.ts +3 -0
  123. package/lib/services/message.service.d.ts +3 -0
  124. package/lib/services/storage.service.d.ts +3 -0
  125. package/lib/services/tin-spa.service.d.ts +3 -0
  126. package/lib/tin-spa.module.d.ts +30 -0
  127. package/package.json +24 -23
  128. package/public-api.d.ts +7 -2
  129. package/bundles/tin-spa.umd.js +0 -3672
  130. package/bundles/tin-spa.umd.js.map +0 -1
  131. package/bundles/tin-spa.umd.min.js +0 -16
  132. package/bundles/tin-spa.umd.min.js.map +0 -1
  133. package/esm2015/lib/classes/TinCore.js +0 -139
  134. package/esm2015/lib/components/activity/activity.component.js +0 -26
  135. package/esm2015/lib/components/attach/attach.component.js +0 -107
  136. package/esm2015/lib/components/change-password/change-password.component.js +0 -102
  137. package/esm2015/lib/components/check/check.component.js +0 -63
  138. package/esm2015/lib/components/chips/chips.component.js +0 -66
  139. package/esm2015/lib/components/create-account/create-account.component.js +0 -78
  140. package/esm2015/lib/components/date/date.component.js +0 -45
  141. package/esm2015/lib/components/datetime/datetime.component.js +0 -44
  142. package/esm2015/lib/components/filter/filter.component.js +0 -40
  143. package/esm2015/lib/components/label/label.component.js +0 -29
  144. package/esm2015/lib/components/loader/loader.component.js +0 -29
  145. package/esm2015/lib/components/login/login.component.js +0 -114
  146. package/esm2015/lib/components/logs/logs.component.js +0 -39
  147. package/esm2015/lib/components/message/messageDialog.component.js +0 -31
  148. package/esm2015/lib/components/money/money.component.js +0 -52
  149. package/esm2015/lib/components/nav-menu/nav-menu.component.js +0 -51
  150. package/esm2015/lib/components/option/option.component.js +0 -63
  151. package/esm2015/lib/components/profile/profile.component.js +0 -98
  152. package/esm2015/lib/components/recover-account/recover-account.component.js +0 -53
  153. package/esm2015/lib/components/roles/addRoleDialog.component.js +0 -61
  154. package/esm2015/lib/components/roles/roles.component.js +0 -94
  155. package/esm2015/lib/components/select/select.component.js +0 -77
  156. package/esm2015/lib/components/settings/settings.component.js +0 -63
  157. package/esm2015/lib/components/signup/signup.component.js +0 -57
  158. package/esm2015/lib/components/steps/steps.component.js +0 -93
  159. package/esm2015/lib/components/table/table.component.js +0 -107
  160. package/esm2015/lib/components/text/text.component.js +0 -165
  161. package/esm2015/lib/components/tiles/tiles.component.js +0 -41
  162. package/esm2015/lib/components/timeout/timeout.component.js +0 -90
  163. package/esm2015/lib/components/tin-spa.component.js +0 -19
  164. package/esm2015/lib/components/users/users.component.js +0 -120
  165. package/esm2015/lib/dnd.directive.js +0 -51
  166. package/esm2015/lib/modules/spa-admin.module.js +0 -50
  167. package/esm2015/lib/modules/spa-index.module.js +0 -35
  168. package/esm2015/lib/modules/spa-mat.module.js +0 -53
  169. package/esm2015/lib/modules/spa-user.module.js +0 -33
  170. package/esm2015/lib/services/auth.service.js +0 -155
  171. package/esm2015/lib/services/data.service.js +0 -115
  172. package/esm2015/lib/services/export.service.js +0 -29
  173. package/esm2015/lib/services/http.service.js +0 -84
  174. package/esm2015/lib/services/loader-interceptor.service.js +0 -83
  175. package/esm2015/lib/services/loader.service.js +0 -17
  176. package/esm2015/lib/services/log.service.js +0 -76
  177. package/esm2015/lib/services/message.service.js +0 -58
  178. package/esm2015/lib/services/storage.service.js +0 -42
  179. package/esm2015/lib/services/tin-spa.service.js +0 -14
  180. package/esm2015/lib/tin-spa.module.js +0 -91
  181. package/esm2015/public-api.js +0 -56
  182. package/esm2015/tin-spa.js +0 -8
  183. package/esm5/lib/classes/Classes.js +0 -313
  184. package/esm5/lib/classes/TinCore.js +0 -166
  185. package/esm5/lib/components/activity/activity.component.js +0 -27
  186. package/esm5/lib/components/attach/attach.component.js +0 -119
  187. package/esm5/lib/components/change-password/change-password.component.js +0 -104
  188. package/esm5/lib/components/check/check.component.js +0 -64
  189. package/esm5/lib/components/chips/chips.component.js +0 -68
  190. package/esm5/lib/components/create-account/create-account.component.js +0 -80
  191. package/esm5/lib/components/date/date.component.js +0 -46
  192. package/esm5/lib/components/datetime/datetime.component.js +0 -45
  193. package/esm5/lib/components/filter/filter.component.js +0 -41
  194. package/esm5/lib/components/label/label.component.js +0 -30
  195. package/esm5/lib/components/loader/loader.component.js +0 -31
  196. package/esm5/lib/components/login/login.component.js +0 -117
  197. package/esm5/lib/components/logs/logs.component.js +0 -41
  198. package/esm5/lib/components/message/messageDialog.component.js +0 -32
  199. package/esm5/lib/components/money/money.component.js +0 -53
  200. package/esm5/lib/components/nav-menu/nav-menu.component.js +0 -53
  201. package/esm5/lib/components/option/option.component.js +0 -64
  202. package/esm5/lib/components/profile/profile.component.js +0 -102
  203. package/esm5/lib/components/recover-account/recover-account.component.js +0 -55
  204. package/esm5/lib/components/roles/addRoleDialog.component.js +0 -63
  205. package/esm5/lib/components/roles/roles.component.js +0 -100
  206. package/esm5/lib/components/select/select.component.js +0 -79
  207. package/esm5/lib/components/settings/settings.component.js +0 -66
  208. package/esm5/lib/components/signup/signup.component.js +0 -59
  209. package/esm5/lib/components/steps/steps.component.js +0 -105
  210. package/esm5/lib/components/table/table.component.js +0 -109
  211. package/esm5/lib/components/text/text.component.js +0 -168
  212. package/esm5/lib/components/tiles/tiles.component.js +0 -42
  213. package/esm5/lib/components/timeout/timeout.component.js +0 -92
  214. package/esm5/lib/components/tin-spa.component.js +0 -17
  215. package/esm5/lib/components/users/users.component.js +0 -126
  216. package/esm5/lib/dnd.directive.js +0 -52
  217. package/esm5/lib/modules/spa-admin.module.js +0 -53
  218. package/esm5/lib/modules/spa-index.module.js +0 -38
  219. package/esm5/lib/modules/spa-mat.module.js +0 -56
  220. package/esm5/lib/modules/spa-user.module.js +0 -36
  221. package/esm5/lib/services/auth.service.js +0 -157
  222. package/esm5/lib/services/data.service.js +0 -116
  223. package/esm5/lib/services/export.service.js +0 -30
  224. package/esm5/lib/services/http.service.js +0 -85
  225. package/esm5/lib/services/loader-interceptor.service.js +0 -85
  226. package/esm5/lib/services/loader.service.js +0 -18
  227. package/esm5/lib/services/log.service.js +0 -112
  228. package/esm5/lib/services/message.service.js +0 -59
  229. package/esm5/lib/services/storage.service.js +0 -74
  230. package/esm5/lib/services/tin-spa.service.js +0 -16
  231. package/esm5/lib/tin-spa.module.js +0 -94
  232. package/esm5/public-api.js +0 -56
  233. package/esm5/tin-spa.js +0 -8
  234. package/fesm2015/tin-spa.js +0 -3184
  235. package/fesm2015/tin-spa.js.map +0 -1
  236. package/fesm5/tin-spa.js +0 -3422
  237. package/fesm5/tin-spa.js.map +0 -1
  238. package/lib/components/timeout/timeout.component.d.ts +0 -21
  239. package/lib/dnd.directive.d.ts +0 -8
  240. package/tin-spa.d.ts +0 -7
  241. package/tin-spa.metadata.json +0 -1
package/fesm5/tin-spa.js DELETED
@@ -1,3422 +0,0 @@
1
- import { __decorate, __awaiter, __generator, __param, __values, __extends } from 'tslib';
2
- import { ɵɵdefineInjectable, Injectable, Inject, Component, ɵɵinject, Input, NgModule, EventEmitter, Output, ViewChild, HostBinding, HostListener, Directive } from '@angular/core';
3
- import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
4
- import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatDialogModule, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
5
- import { of, BehaviorSubject, Observable } from 'rxjs';
6
- import { mergeMap, startWith, map } from 'rxjs/operators';
7
- import { saveAs } from 'file-saver';
8
- import { utils, write } from 'xlsx';
9
- import { Router, ActivatedRoute } from '@angular/router';
10
- import { HttpHeaders, HttpClient, HttpResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
11
- import { CommonModule, LocationStrategy, HashLocationStrategy, Location } from '@angular/common';
12
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
13
- import { MatBadgeModule } from '@angular/material/badge';
14
- import { MatButtonModule } from '@angular/material/button';
15
- import { MatCardModule } from '@angular/material/card';
16
- import { MatCheckboxModule } from '@angular/material/checkbox';
17
- import { MatChipsModule } from '@angular/material/chips';
18
- import { MatNativeDateModule, MAT_DATE_LOCALE } from '@angular/material/core';
19
- import { MatDatepickerModule } from '@angular/material/datepicker';
20
- import { MatFormFieldModule } from '@angular/material/form-field';
21
- import { MatIconModule } from '@angular/material/icon';
22
- import { MatInputModule } from '@angular/material/input';
23
- import { MatListModule } from '@angular/material/list';
24
- import { MatMenuModule } from '@angular/material/menu';
25
- import { MatPaginatorModule } from '@angular/material/paginator';
26
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
27
- import { MatRadioModule } from '@angular/material/radio';
28
- import { MatSelectModule } from '@angular/material/select';
29
- import { MatSliderModule } from '@angular/material/slider';
30
- import { MatSortModule } from '@angular/material/sort';
31
- import { MatStepperModule } from '@angular/material/stepper';
32
- import { MatTableModule, MatTableDataSource } from '@angular/material/table';
33
- import { MatTabsModule } from '@angular/material/tabs';
34
- import { MatTooltipModule } from '@angular/material/tooltip';
35
- import { FormsModule, ReactiveFormsModule, FormControl, Validators } from '@angular/forms';
36
- import { Keepalive, NgIdleKeepaliveModule } from '@ng-idle/keepalive';
37
- import { MomentModule } from 'angular2-moment';
38
- import { DEFAULT_INTERRUPTSOURCES, Idle } from '@ng-idle/core';
39
- import { STEPPER_GLOBAL_OPTIONS } from '@angular/cdk/stepper';
40
-
41
- var TinSpaService = /** @class */ (function () {
42
- function TinSpaService() {
43
- }
44
- TinSpaService.ɵprov = ɵɵdefineInjectable({ factory: function TinSpaService_Factory() { return new TinSpaService(); }, token: TinSpaService, providedIn: "root" });
45
- TinSpaService = __decorate([
46
- Injectable({
47
- providedIn: 'root'
48
- })
49
- ], TinSpaService);
50
- return TinSpaService;
51
- }());
52
-
53
- var StorageService = /** @class */ (function () {
54
- function StorageService() {
55
- }
56
- // Store the value
57
- StorageService.prototype.store = function (storageKey, value) {
58
- return __awaiter(this, void 0, void 0, function () {
59
- var encryptedValue;
60
- return __generator(this, function (_a) {
61
- switch (_a.label) {
62
- case 0:
63
- encryptedValue = btoa(escape(JSON.stringify(value)));
64
- // const encryptedValue = JSON.stringify(value);
65
- return [4 /*yield*/, localStorage.setItem(storageKey, encryptedValue)];
66
- case 1:
67
- // const encryptedValue = JSON.stringify(value);
68
- _a.sent();
69
- return [2 /*return*/];
70
- }
71
- });
72
- });
73
- };
74
- // Get the value
75
- StorageService.prototype.get = function (storageKey) {
76
- return __awaiter(this, void 0, void 0, function () {
77
- var ret;
78
- return __generator(this, function (_a) {
79
- switch (_a.label) {
80
- case 0: return [4 /*yield*/, localStorage.getItem(storageKey)];
81
- case 1:
82
- ret = _a.sent();
83
- return [2 /*return*/, JSON.parse(unescape(atob(ret)))];
84
- }
85
- });
86
- });
87
- };
88
- // Remove
89
- StorageService.prototype.removeStorageItem = function (storageKey) {
90
- return __awaiter(this, void 0, void 0, function () {
91
- return __generator(this, function (_a) {
92
- switch (_a.label) {
93
- case 0: return [4 /*yield*/, localStorage.removeItem(storageKey)];
94
- case 1:
95
- _a.sent();
96
- return [2 /*return*/];
97
- }
98
- });
99
- });
100
- };
101
- // Clear storage
102
- StorageService.prototype.clear = function () {
103
- return __awaiter(this, void 0, void 0, function () {
104
- return __generator(this, function (_a) {
105
- switch (_a.label) {
106
- case 0: return [4 /*yield*/, localStorage.clear()];
107
- case 1:
108
- _a.sent();
109
- return [2 /*return*/];
110
- }
111
- });
112
- });
113
- };
114
- StorageService.ɵprov = ɵɵdefineInjectable({ factory: function StorageService_Factory() { return new StorageService(); }, token: StorageService, providedIn: "root" });
115
- StorageService = __decorate([
116
- Injectable({
117
- providedIn: 'root'
118
- })
119
- ], StorageService);
120
- return StorageService;
121
- }());
122
-
123
- var messageDialog = /** @class */ (function () {
124
- function messageDialog(dialogRef, data) {
125
- this.dialogRef = dialogRef;
126
- this.data = data;
127
- }
128
- messageDialog.prototype.ngOnInit = function () {
129
- this.messageType = this.data.type;
130
- this._messageSubject = this.data.subject;
131
- this._messageDetails = this.data.details;
132
- };
133
- messageDialog.prototype.response = function (resp) {
134
- this.dialogRef.close(resp);
135
- };
136
- messageDialog.ctorParameters = function () { return [
137
- { type: MatDialogRef },
138
- { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
139
- ]; };
140
- messageDialog = __decorate([
141
- Component({
142
- selector: 'lib-app-message',
143
- template: "\r\n <h2 mat-dialog-title>\r\n\r\n <mat-label *ngIf=\"messageType=='confirm'\">Confirm</mat-label>\r\n <mat-label *ngIf=\"messageType=='info'\">Information</mat-label>\r\n <mat-label *ngIf=\"messageType=='error'\">Error</mat-label>\r\n\r\n </h2>\r\n\r\n <mat-dialog-content class=\"mat-typography\">\r\n\r\n\r\n <!-- Confirm -->\r\n <p *ngIf=\"messageType=='confirm'\">{{_messageDetails}}</p>\r\n\r\n\r\n <!-- Information -->\r\n <div *ngIf=\"messageType=='info'\">\r\n\r\n <h3>{{_messageSubject}}</h3>\r\n <mat-label>{{_messageDetails}}</mat-label>\r\n\r\n </div>\r\n\r\n\r\n <!-- Error -->\r\n <div *ngIf=\"messageType=='error'\">\r\n\r\n <mat-label>{{_messageDetails}}</mat-label>\r\n\r\n </div>\r\n\r\n\r\n </mat-dialog-content>\r\n\r\n<mat-dialog-actions>\r\n\r\n <button id=\"btnYes\" mat-stroked-button *ngIf=\"messageType=='confirm'\" (click)=\"response('yes')\" cdkFocusInitial>Yes</button>\r\n\r\n <button id=\"btnNo\" mat-stroked-button *ngIf=\"messageType=='confirm'\" (click)=\"response('no')\" >No</button>\r\n\r\n <button id=\"btnOK\" mat-stroked-button *ngIf=\"messageType=='info' || messageType=='error'\" (click)=\"response('ok')\" cdkFocusInitial>OK</button>\r\n\r\n</mat-dialog-actions>\r\n\r\n\r\n\r\n"
144
- }),
145
- __param(1, Inject(MAT_DIALOG_DATA))
146
- ], messageDialog);
147
- return messageDialog;
148
- }());
149
- ;
150
-
151
- var MessageService = /** @class */ (function () {
152
- function MessageService(snackBar, dialog) {
153
- this.snackBar = snackBar;
154
- this.dialog = dialog;
155
- }
156
- MessageService.prototype.toast = function (msg) {
157
- this.snackBar.open(msg, "OK", { duration: 5000 });
158
- };
159
- MessageService.prototype.info = function (subject, details) {
160
- var type = "info";
161
- var dialogRef = this.dialog.open(messageDialog, {
162
- width: "600px",
163
- data: { type: type, subject: subject, details: details },
164
- });
165
- };
166
- MessageService.prototype.error = function (details) {
167
- var type = "error";
168
- var subject;
169
- var dialogRef = this.dialog.open(messageDialog, {
170
- width: "600px",
171
- data: { type: type, subject: subject, details: details },
172
- });
173
- };
174
- MessageService.prototype.confirm = function (msg) {
175
- var type = "confirm";
176
- var subject = "";
177
- var details = msg;
178
- var dialogRef = this.dialog.open(messageDialog, {
179
- width: "400px",
180
- data: { type: type, subject: subject, details: details },
181
- });
182
- return dialogRef.afterClosed().pipe(mergeMap(function (result) {
183
- return of(result);
184
- }));
185
- };
186
- MessageService.ctorParameters = function () { return [
187
- { type: MatSnackBar },
188
- { type: MatDialog }
189
- ]; };
190
- MessageService.ɵprov = ɵɵdefineInjectable({ factory: function MessageService_Factory() { return new MessageService(ɵɵinject(MatSnackBar), ɵɵinject(MatDialog)); }, token: MessageService, providedIn: "root" });
191
- MessageService = __decorate([
192
- Injectable({
193
- providedIn: "root",
194
- })
195
- ], MessageService);
196
- return MessageService;
197
- }());
198
-
199
- var ExportService = /** @class */ (function () {
200
- function ExportService() {
201
- this.fileType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
202
- this.fileExtension = '.xlsx';
203
- }
204
- ExportService.prototype.exportExcel = function (jsonData, fileName) {
205
- var ws = utils.json_to_sheet(jsonData);
206
- var wb = { Sheets: { 'data': ws }, SheetNames: ['data'] };
207
- var excelBuffer = write(wb, { bookType: 'xlsx', type: 'array' });
208
- this.saveExcelFile(excelBuffer, fileName);
209
- };
210
- ExportService.prototype.saveExcelFile = function (buffer, fileName) {
211
- var data = new Blob([buffer], { type: this.fileType });
212
- saveAs(data, fileName + this.fileExtension);
213
- };
214
- ExportService.ɵprov = ɵɵdefineInjectable({ factory: function ExportService_Factory() { return new ExportService(); }, token: ExportService, providedIn: "root" });
215
- ExportService = __decorate([
216
- Injectable({
217
- providedIn: 'root'
218
- })
219
- ], ExportService);
220
- return ExportService;
221
- }());
222
-
223
- var Core = /** @class */ (function () {
224
- function Core() {
225
- }
226
- Core.getClone = function (x) {
227
- return JSON.parse(JSON.stringify(x));
228
- };
229
- Core.getNumber = function (value) {
230
- if (value == null || value == "") {
231
- return 0;
232
- }
233
- var onlyNumbers = value.replace(/[^\d.-]/g, '');
234
- return onlyNumbers;
235
- };
236
- Core.getFirstDayOfMonth = function () {
237
- var date = new Date();
238
- return new Date(date.getFullYear(), date.getMonth(), 1);
239
- };
240
- Core.emailIsValid = function (email) {
241
- // return /\S+@\S+\.\S+/.test(email)
242
- return false;
243
- };
244
- Core.isValidUNCPath = function (path) {
245
- // return /\\\\([a-zA-Z0-9_.$●-]+)\\([a-zA-Z0-9_.$●-]+).*/.test(path)
246
- return false;
247
- };
248
- Core.isValidDate = function (date) {
249
- var parsedDate = Date.parse(date);
250
- if (isNaN(date) && !isNaN(parsedDate)) {
251
- return true;
252
- }
253
- else {
254
- return false;
255
- }
256
- };
257
- Core.isValidEmailList = function (list) {
258
- var e_1, _a;
259
- if (list.includes(";")) {
260
- var emails = list.split(";");
261
- try {
262
- for (var emails_1 = __values(emails), emails_1_1 = emails_1.next(); !emails_1_1.done; emails_1_1 = emails_1.next()) {
263
- var email = emails_1_1.value;
264
- if (this.emailIsValid(email) == false) {
265
- return false;
266
- }
267
- }
268
- }
269
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
270
- finally {
271
- try {
272
- if (emails_1_1 && !emails_1_1.done && (_a = emails_1.return)) _a.call(emails_1);
273
- }
274
- finally { if (e_1) throw e_1.error; }
275
- }
276
- }
277
- else {
278
- if (this.emailIsValid(list) == false) {
279
- return false;
280
- }
281
- }
282
- return true;
283
- };
284
- Core.isNumber = function (value) {
285
- return ((value != null) &&
286
- (value !== '') &&
287
- !isNaN(Number(value.toString())));
288
- };
289
- Core.getDiff = function (startDate, endDate) {
290
- if (endDate === void 0) { endDate = Date(); }
291
- var eventStartTime = new Date(startDate);
292
- var eventEndTime = new Date(endDate);
293
- var milliseconds = eventEndTime.valueOf() - eventStartTime.valueOf();
294
- function numberEnding(number) {
295
- if (number.toFixed() == '1') {
296
- return '';
297
- }
298
- else {
299
- return 's';
300
- }
301
- }
302
- var minutes = (milliseconds / (1000 * 60));
303
- var hours = (milliseconds / (1000 * 60 * 60));
304
- var days = (milliseconds / (1000 * 60 * 60 * 24));
305
- var weeks = (milliseconds / (1000 * 60 * 60 * 24 * 7));
306
- var months = (milliseconds / (1000 * 60 * 60 * 24 * 7 * 4));
307
- var years = (milliseconds / (1000 * 60 * 60 * 24 * 365));
308
- if (years >= 1) {
309
- return years.toFixed() + ' year' + numberEnding(years);
310
- }
311
- else if (months >= 1) {
312
- return months.toFixed() + ' month' + numberEnding(months);
313
- }
314
- else if (weeks >= 1) {
315
- return weeks.toFixed() + ' week' + numberEnding(weeks);
316
- }
317
- else if (days >= 1) {
318
- return days.toFixed() + ' day' + numberEnding(days);
319
- }
320
- else if (hours >= 1) {
321
- return hours.toFixed() + ' hour' + numberEnding(hours);
322
- }
323
- else if (minutes >= 1) {
324
- return minutes.toFixed() + ' minute' + numberEnding(minutes);
325
- }
326
- else if (milliseconds >= (-1000 * 60)) {
327
- return 'a minute';
328
- }
329
- else {
330
- return 'N/A';
331
- }
332
- };
333
- Core.nowDate = function (NoTime) {
334
- if (NoTime === void 0) { NoTime = false; }
335
- if (NoTime) {
336
- return this.getFormatedDate(Date(), true);
337
- }
338
- else {
339
- return this.getFormatedDate(Date());
340
- }
341
- };
342
- Core.getFormatedDate = function (dateString, NoTime) {
343
- if (NoTime === void 0) { NoTime = false; }
344
- var d = new Date(dateString);
345
- d.setHours(d.getHours() + 2);
346
- if (NoTime == true) {
347
- return d.toISOString().split('T')[0];
348
- }
349
- else {
350
- return d.toISOString().split('.')[0];
351
- }
352
- };
353
- Core.getBusinessDatesCount = function (startDate, endDate) {
354
- var count = 0;
355
- var _startDate = new Date(startDate);
356
- var _endDate = new Date(endDate);
357
- var curDate = _startDate;
358
- while (curDate < _endDate) {
359
- var dayOfWeek = curDate.getDay();
360
- if (!(dayOfWeek == 6 || dayOfWeek == 0))
361
- count++;
362
- curDate.setDate(curDate.getDate() + 1);
363
- }
364
- return count;
365
- };
366
- Core.nullDate = "01 Jan 1969";
367
- return Core;
368
- }());
369
- var ApiResponse = /** @class */ (function () {
370
- function ApiResponse() {
371
- }
372
- return ApiResponse;
373
- }());
374
- var Constants = /** @class */ (function () {
375
- function Constants() {
376
- }
377
- Constants.AUTH_USER = 'a';
378
- Constants.AUTH_NAME = 'b';
379
- Constants.AUTH_ROLES = 'c';
380
- Constants.AUTH_TOKEN = 'd';
381
- Constants.AUTH_TOKEN_EXPIRE = 'e';
382
- return Constants;
383
- }());
384
-
385
- var LogLevel;
386
- (function (LogLevel) {
387
- LogLevel[LogLevel["All"] = 0] = "All";
388
- LogLevel[LogLevel["Debug"] = 1] = "Debug";
389
- LogLevel[LogLevel["Info"] = 2] = "Info";
390
- LogLevel[LogLevel["Warn"] = 3] = "Warn";
391
- LogLevel[LogLevel["Error"] = 4] = "Error";
392
- LogLevel[LogLevel["Fatal"] = 5] = "Fatal";
393
- LogLevel[LogLevel["Off"] = 6] = "Off";
394
- })(LogLevel || (LogLevel = {}));
395
- var Tile = /** @class */ (function () {
396
- function Tile() {
397
- }
398
- return Tile;
399
- }());
400
- var Step = /** @class */ (function () {
401
- function Step() {
402
- }
403
- return Step;
404
- }());
405
- var TableConfig = /** @class */ (function () {
406
- function TableConfig() {
407
- this.enableFilter = false;
408
- this.create = new TableCreate();
409
- this.greyout = new Condition();
410
- }
411
- return TableConfig;
412
- }());
413
- var TableCreate = /** @class */ (function () {
414
- function TableCreate() {
415
- }
416
- return TableCreate;
417
- }());
418
- var TableColumn = /** @class */ (function () {
419
- function TableColumn() {
420
- this.name = "default";
421
- this.display = "default";
422
- this.type = TableColumnType.String;
423
- }
424
- return TableColumn;
425
- }());
426
- var TableColumnType;
427
- (function (TableColumnType) {
428
- TableColumnType[TableColumnType["String"] = 0] = "String";
429
- TableColumnType[TableColumnType["Date"] = 1] = "Date";
430
- TableColumnType[TableColumnType["DateTime"] = 2] = "DateTime";
431
- TableColumnType[TableColumnType["Image"] = 3] = "Image";
432
- TableColumnType[TableColumnType["Icon"] = 4] = "Icon";
433
- TableColumnType[TableColumnType["TextIcon"] = 5] = "TextIcon";
434
- TableColumnType[TableColumnType["Chip"] = 6] = "Chip";
435
- })(TableColumnType || (TableColumnType = {}));
436
- var Condition = /** @class */ (function () {
437
- function Condition() {
438
- this.field = "";
439
- this.operator = Operator.Equal;
440
- this.value = "";
441
- }
442
- return Condition;
443
- }());
444
- var Operator;
445
- (function (Operator) {
446
- Operator[Operator["Equal"] = 0] = "Equal";
447
- Operator[Operator["Less"] = 1] = "Less";
448
- Operator[Operator["Greater"] = 2] = "Greater";
449
- Operator[Operator["NotEqual"] = 3] = "NotEqual";
450
- })(Operator || (Operator = {}));
451
- var Color = /** @class */ (function (_super) {
452
- __extends(Color, _super);
453
- function Color() {
454
- return _super !== null && _super.apply(this, arguments) || this;
455
- }
456
- return Color;
457
- }(Condition));
458
- var Icon = /** @class */ (function (_super) {
459
- __extends(Icon, _super);
460
- function Icon() {
461
- return _super !== null && _super.apply(this, arguments) || this;
462
- }
463
- return Icon;
464
- }(Condition));
465
- var TableAction = /** @class */ (function () {
466
- function TableAction() {
467
- }
468
- return TableAction;
469
- }());
470
- var ActionResponse = /** @class */ (function () {
471
- function ActionResponse() {
472
- }
473
- return ActionResponse;
474
- }());
475
- var loginConfig = /** @class */ (function () {
476
- function loginConfig() {
477
- this.appName = "";
478
- this.selfService = false;
479
- this.logo = "";
480
- this.logoSize = "normal";
481
- }
482
- return loginConfig;
483
- }());
484
- var AppConfig = /** @class */ (function () {
485
- function AppConfig() {
486
- this.appName = "App Name";
487
- this.logo = "";
488
- this.logoSize = "normal";
489
- this.ADAuth = true;
490
- this.localAuth = true;
491
- this.selfService = false;
492
- }
493
- return AppConfig;
494
- }());
495
- var CapItem = /** @class */ (function () {
496
- function CapItem() {
497
- this.name = "";
498
- this.display = "New Cap Item";
499
- this.enabled = false;
500
- this.type = "";
501
- this.newLine = false;
502
- this.showMenu = true;
503
- this.ignoreSubsDisplay = false;
504
- this.link = "";
505
- this.icon = "navigate_next";
506
- }
507
- return CapItem;
508
- }());
509
- var Account = /** @class */ (function () {
510
- function Account() {
511
- }
512
- return Account;
513
- }());
514
- var User = /** @class */ (function () {
515
- function User() {
516
- this.userName = "";
517
- this.password = "";
518
- this.tries = "0";
519
- this.locked = "0";
520
- this.logged = "0";
521
- this.disabled = "0";
522
- this.changepassword = "0";
523
- this.dateCreated = Core.nowDate();
524
- this.dateUpdated = Core.nowDate();
525
- this.token = "";
526
- this.dateExpire = Core.nowDate();
527
- this.tokenExpire = Core.nowDate();
528
- this.authType = "";
529
- }
530
- return User;
531
- }());
532
- var ChangeUserPassword = /** @class */ (function () {
533
- function ChangeUserPassword() {
534
- this.userName = "";
535
- this.currentPassword = "";
536
- this.newPassword = "";
537
- this.confirmPassword = "";
538
- }
539
- return ChangeUserPassword;
540
- }());
541
- var Register = /** @class */ (function () {
542
- function Register() {
543
- this.userName = "";
544
- this.roleID = 1;
545
- this.firstName = "";
546
- this.lastName = "";
547
- this.email = "";
548
- this.authType = "";
549
- this.password = "";
550
- }
551
- return Register;
552
- }());
553
- var Profile = /** @class */ (function () {
554
- function Profile() {
555
- this.profileID = "";
556
- this.userName = "";
557
- this.roleID = 1;
558
- this.firstName = "";
559
- this.lastName = "";
560
- this.email = "";
561
- this.empID = "";
562
- this.arID = "0";
563
- this.authType = "";
564
- this.password = "";
565
- this.role = new Role();
566
- }
567
- return Profile;
568
- }());
569
- var Role = /** @class */ (function () {
570
- function Role() {
571
- this.roleID = 0;
572
- this.roleName = "New Role";
573
- this.cap1 = false;
574
- this.cap2 = false;
575
- this.cap3 = false;
576
- this.cap4 = false;
577
- this.cap5 = false;
578
- this.cap6 = false;
579
- this.cap7 = false;
580
- this.cap8 = false;
581
- this.cap9 = false;
582
- this.cap10 = false;
583
- this.cap11 = false;
584
- this.cap12 = false;
585
- this.cap13 = false;
586
- this.cap14 = false;
587
- this.cap15 = false;
588
- this.cap16 = false;
589
- this.cap17 = false;
590
- this.cap18 = false;
591
- this.cap19 = false;
592
- this.cap20 = false;
593
- this.cap21 = false;
594
- this.cap22 = false;
595
- this.cap23 = false;
596
- this.cap24 = false;
597
- this.cap25 = false;
598
- this.cap26 = false;
599
- this.cap27 = false;
600
- this.cap28 = false;
601
- this.cap29 = false;
602
- this.cap30 = false;
603
- this.cap31 = false;
604
- this.cap32 = false;
605
- this.cap33 = false;
606
- this.cap34 = false;
607
- this.cap35 = false;
608
- this.cap36 = false;
609
- this.cap37 = false;
610
- this.cap38 = false;
611
- this.cap39 = false;
612
- this.cap40 = false;
613
- this.cap41 = false;
614
- this.cap42 = false;
615
- this.cap43 = false;
616
- this.cap44 = false;
617
- this.cap45 = false;
618
- this.cap46 = false;
619
- this.cap47 = false;
620
- this.cap48 = false;
621
- this.cap49 = false;
622
- this.cap50 = false;
623
- this.cap51 = false;
624
- this.cap52 = false;
625
- this.cap53 = false;
626
- this.cap54 = false;
627
- this.cap55 = false;
628
- this.cap56 = false;
629
- this.cap57 = false;
630
- this.cap58 = false;
631
- this.cap59 = false;
632
- this.cap60 = false;
633
- this.cap61 = false;
634
- this.cap62 = false;
635
- this.cap63 = false;
636
- this.cap64 = false;
637
- this.cap65 = false;
638
- this.cap66 = false;
639
- this.cap67 = false;
640
- this.cap68 = false;
641
- this.cap69 = false;
642
- this.cap70 = false;
643
- this.cap71 = false;
644
- this.cap72 = false;
645
- this.cap73 = false;
646
- this.cap74 = false;
647
- this.cap75 = false;
648
- this.cap76 = false;
649
- this.cap77 = false;
650
- this.cap78 = false;
651
- this.cap79 = false;
652
- this.cap80 = false;
653
- this.cap81 = false;
654
- this.cap82 = false;
655
- this.cap83 = false;
656
- this.cap84 = false;
657
- this.cap85 = false;
658
- this.cap86 = false;
659
- this.cap87 = false;
660
- this.cap88 = false;
661
- this.cap89 = false;
662
- this.cap90 = false;
663
- this.cap91 = false;
664
- this.cap92 = false;
665
- this.cap93 = false;
666
- this.cap94 = false;
667
- this.cap95 = false;
668
- this.cap96 = false;
669
- this.cap97 = false;
670
- this.cap98 = false;
671
- this.cap99 = false;
672
- this.cap100 = false;
673
- }
674
- return Role;
675
- }());
676
-
677
- var LogService = /** @class */ (function () {
678
- function LogService() {
679
- this.level = LogLevel.All;
680
- this.logToConsole = true;
681
- this.logToApi = false;
682
- }
683
- LogService.prototype.debug = function (msg) {
684
- var optionalParams = [];
685
- for (var _i = 1; _i < arguments.length; _i++) {
686
- optionalParams[_i - 1] = arguments[_i];
687
- }
688
- this.writeToLog(msg, LogLevel.Debug, optionalParams);
689
- };
690
- LogService.prototype.info = function (msg) {
691
- var optionalParams = [];
692
- for (var _i = 1; _i < arguments.length; _i++) {
693
- optionalParams[_i - 1] = arguments[_i];
694
- }
695
- this.writeToLog(msg, LogLevel.Info, optionalParams);
696
- };
697
- LogService.prototype.warn = function (msg) {
698
- var optionalParams = [];
699
- for (var _i = 1; _i < arguments.length; _i++) {
700
- optionalParams[_i - 1] = arguments[_i];
701
- }
702
- this.writeToLog(msg, LogLevel.Warn, optionalParams);
703
- };
704
- LogService.prototype.error = function (msg) {
705
- var optionalParams = [];
706
- for (var _i = 1; _i < arguments.length; _i++) {
707
- optionalParams[_i - 1] = arguments[_i];
708
- }
709
- this.writeToLog(msg, LogLevel.Error, optionalParams);
710
- };
711
- LogService.prototype.fatal = function (msg) {
712
- var optionalParams = [];
713
- for (var _i = 1; _i < arguments.length; _i++) {
714
- optionalParams[_i - 1] = arguments[_i];
715
- }
716
- this.writeToLog(msg, LogLevel.Fatal, optionalParams);
717
- };
718
- LogService.prototype.log = function (msg) {
719
- var optionalParams = [];
720
- for (var _i = 1; _i < arguments.length; _i++) {
721
- optionalParams[_i - 1] = arguments[_i];
722
- }
723
- this.writeToLog(msg, LogLevel.All, optionalParams);
724
- };
725
- LogService.prototype.writeToLog = function (msg, level, params) {
726
- if (this.shouldLog(level)) {
727
- // Build log string
728
- var value = Core.getFormatedDate(Date(), false).replace("T", " ");
729
- // value += " - Type: " + LogLevel[this.level];
730
- value += " - Message: " + msg;
731
- if (params.length) {
732
- value += " - Extra Info: " + this.formatParams(params);
733
- }
734
- // Log the value
735
- if (this.logToConsole) {
736
- console.log(value);
737
- }
738
- if (this.logToApi) {
739
- //Call API post
740
- }
741
- }
742
- };
743
- LogService.prototype.formatParams = function (params) {
744
- var e_1, _a;
745
- var ret = params.join(",");
746
- // Is there at least one object in the array?
747
- if (params.some(function (p) { return typeof p == "object"; })) {
748
- ret = "";
749
- try {
750
- // Build comma-delimited string
751
- for (var params_1 = __values(params), params_1_1 = params_1.next(); !params_1_1.done; params_1_1 = params_1.next()) {
752
- var item = params_1_1.value;
753
- ret += JSON.stringify(item) + ",";
754
- }
755
- }
756
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
757
- finally {
758
- try {
759
- if (params_1_1 && !params_1_1.done && (_a = params_1.return)) _a.call(params_1);
760
- }
761
- finally { if (e_1) throw e_1.error; }
762
- }
763
- }
764
- return ret;
765
- };
766
- LogService.prototype.shouldLog = function (level) {
767
- var ret = false;
768
- if ((level >= this.level && level !== LogLevel.Off) ||
769
- this.level === LogLevel.All) {
770
- ret = true;
771
- }
772
- return ret;
773
- };
774
- LogService.ɵprov = ɵɵdefineInjectable({ factory: function LogService_Factory() { return new LogService(); }, token: LogService, providedIn: "root" });
775
- LogService = __decorate([
776
- Injectable({
777
- providedIn: "root",
778
- })
779
- ], LogService);
780
- return LogService;
781
- }());
782
-
783
- var HttpService = /** @class */ (function () {
784
- function HttpService(httpClient, router) {
785
- this.httpClient = httpClient;
786
- this.router = router;
787
- //----Set apiUrl from the data service of the project---//
788
- this.apiUrl = "https://api.solinc.co.zw/"; //default
789
- this.httpOptions_Legacy = {
790
- headers: new HttpHeaders({
791
- Accept: "application/json",
792
- "Content-Type": "application/json",
793
- Authorization: "Basic " + btoa("emptyUser:emptyToken"),
794
- }),
795
- resposeType: "json",
796
- };
797
- this.httpOptions_Files = {
798
- headers: new HttpHeaders({
799
- Authorization: "Basic " + btoa("tnyagato:j5Toszfr@ys"),
800
- }),
801
- resposeType: "json",
802
- };
803
- }
804
- //POST
805
- HttpService.prototype.Post = function (service, data) {
806
- return this.httpClient.post(this.apiUrl + service, data, this.httpOptions_Legacy);
807
- };
808
- //PUT
809
- HttpService.prototype.Put = function (service, data) {
810
- return this.httpClient.put(this.apiUrl + service, data, this.httpOptions_Legacy);
811
- };
812
- //POST RAW
813
- HttpService.prototype.Post_Raw = function (url, data) {
814
- return this.httpClient.post(url, data, this.httpOptions_Legacy);
815
- };
816
- //POST with file
817
- HttpService.prototype.Post_WithFile = function (service, data, file) {
818
- var formData = new FormData();
819
- if (file) {
820
- formData.append("uploadFile", file, file.name);
821
- }
822
- formData.append("data", JSON.stringify(data));
823
- return this.httpClient.post(this.apiUrl + service, formData, this.httpOptions_Files);
824
- };
825
- // //POST with files
826
- HttpService.prototype.Post_FormData = function (service, formData) {
827
- return this.httpClient.post(this.apiUrl + service, formData, this.httpOptions_Files);
828
- };
829
- //GET
830
- HttpService.prototype.Get = function (service) {
831
- return this.httpClient.get(this.apiUrl + service, this.httpOptions_Legacy);
832
- };
833
- //Get RAW
834
- HttpService.prototype.Get_Raw = function (url) {
835
- return this.httpClient.get(url, this.httpOptions_Legacy);
836
- };
837
- //ERROR
838
- HttpService.prototype.Error = function (error) {
839
- if (error.statusText == "Unauthorized") {
840
- this.router.navigate(["login"]);
841
- return "Unauthorized";
842
- }
843
- else {
844
- return "Connection failed";
845
- }
846
- };
847
- HttpService.ctorParameters = function () { return [
848
- { type: HttpClient },
849
- { type: Router }
850
- ]; };
851
- HttpService.ɵprov = ɵɵdefineInjectable({ factory: function HttpService_Factory() { return new HttpService(ɵɵinject(HttpClient), ɵɵinject(Router)); }, token: HttpService, providedIn: "root" });
852
- HttpService = __decorate([
853
- Injectable({
854
- providedIn: "root",
855
- })
856
- ], HttpService);
857
- return HttpService;
858
- }());
859
-
860
- var AuthService = /** @class */ (function () {
861
- function AuthService(_route, storage, router, httpService, messageService, logService) {
862
- this._route = _route;
863
- this.storage = storage;
864
- this.router = router;
865
- this.httpService = httpService;
866
- this.messageService = messageService;
867
- this.logService = logService;
868
- //Logged in
869
- this.loggedin = false;
870
- this.loggedinSource = new BehaviorSubject(this.loggedin);
871
- this.loggedinObserv = this.loggedinSource.asObservable();
872
- //Token
873
- this.token = "";
874
- this.tokenSource = new BehaviorSubject(this.token);
875
- this.tokenObserv = this.tokenSource.asObservable();
876
- //TokenExpire
877
- this.tokenExpire = "";
878
- this.tokenExpireSource = new BehaviorSubject(this.tokenExpire);
879
- this.tokenExpireObserv = this.tokenExpireSource.asObservable();
880
- //Current User
881
- this.currentUser = "tnyagato";
882
- this.currentUserSource = new BehaviorSubject(this.currentUser);
883
- this.currentUserObserv = this.currentUserSource.asObservable();
884
- //Line Manager
885
- this.islineManager = false;
886
- this.isLineManagerSource = new BehaviorSubject(this.islineManager);
887
- this.isLineManagerObserv = this.isLineManagerSource.asObservable();
888
- //Roles
889
- this.currentRole = new Role;
890
- this.currentRoleSource = new BehaviorSubject(this.currentRole);
891
- this.myRoleObserv = this.currentRoleSource.asObservable();
892
- //Logged in FirstName
893
- this.loggedUserSource = new BehaviorSubject("tnyagato");
894
- this.loggedUserFullName = this.loggedUserSource.asObservable();
895
- }
896
- AuthService.prototype.Updateloggedin = function (loggedin) {
897
- this.loggedinSource.next(loggedin);
898
- this.loggedin = loggedin;
899
- };
900
- AuthService.prototype.UpdateToken = function (newToken) {
901
- this.tokenSource.next(newToken);
902
- };
903
- AuthService.prototype.UpdateTokenExpire = function (newTokenExpire) {
904
- this.tokenExpireSource.next(newTokenExpire);
905
- };
906
- AuthService.prototype.UpdateCurrentUser = function (newUser) {
907
- this.currentUserSource.next(newUser.toLocaleLowerCase());
908
- this.currentUser = newUser.toLocaleLowerCase();
909
- };
910
- AuthService.prototype.UpdateIsLineManager = function (manager) {
911
- this.isLineManagerSource.next(manager);
912
- };
913
- AuthService.prototype.UpdateRole = function (role) {
914
- this.currentRoleSource.next(role);
915
- };
916
- AuthService.prototype.updateLoggedUserFullName = function (userName) {
917
- this.loggedUserSource.next(userName);
918
- };
919
- //Authorisation
920
- AuthService.prototype.isAuthorised = function (capName) {
921
- if (!this.currentRoleSource.value[capName]) {
922
- // this.logService.info(`authorise: ${this.currentRoleSource.value.roleName} not authorised for ${capName}`);
923
- this.router.navigate(["home"]);
924
- this.messageService.toast("Unauthorised: " + capName);
925
- return false;
926
- }
927
- else {
928
- return true;
929
- }
930
- };
931
- AuthService.prototype.isValidToken = function () {
932
- var tokenExpire = new Date(this.tokenExpireSource.value);
933
- var nowDate = new Date();
934
- var valid = tokenExpire > nowDate;
935
- if (!valid) {
936
- this.router.navigate(["login"]);
937
- this.messageService.toast("Expired Session");
938
- }
939
- return valid;
940
- };
941
- AuthService.prototype.canActivate = function () {
942
- var _this = this;
943
- if (this.loggedin && this.isValidToken()) {
944
- // this.logService.info("authentication: logged in");
945
- return true;
946
- }
947
- if (localStorage.getItem(Constants.AUTH_USER) === null) {
948
- // this.logService.info("authentication: not logged and no cache");
949
- this.Updateloggedin(false);
950
- var url = new URL(window.location.href);
951
- var path = url.hash.replace("#/", "");
952
- this.router.navigate(["login"], {
953
- relativeTo: this._route,
954
- queryParams: { redirectTo: path },
955
- queryParamsHandling: 'merge',
956
- skipLocationChange: false
957
- });
958
- return false;
959
- }
960
- else {
961
- // this.logService.info("authentication: not logged but allowed login");
962
- this.Updateloggedin(true);
963
- this.storage.get(Constants.AUTH_USER).then(function (resp) {
964
- _this.UpdateCurrentUser(resp);
965
- });
966
- this.storage.get(Constants.AUTH_NAME).then(function (resp) {
967
- _this.updateLoggedUserFullName(resp);
968
- });
969
- this.storage.get(Constants.AUTH_ROLES).then(function (resp) {
970
- var ret = JSON.parse(resp);
971
- _this.UpdateRole(ret);
972
- });
973
- this.storage.get(Constants.AUTH_TOKEN).then(function (resp) {
974
- _this.UpdateToken(resp);
975
- });
976
- this.storage.get(Constants.AUTH_TOKEN_EXPIRE).then(function (resp) {
977
- _this.UpdateTokenExpire(resp);
978
- _this.isValidToken();
979
- });
980
- return true;
981
- }
982
- };
983
- AuthService.ctorParameters = function () { return [
984
- { type: ActivatedRoute },
985
- { type: StorageService },
986
- { type: Router },
987
- { type: HttpService },
988
- { type: MessageService },
989
- { type: LogService }
990
- ]; };
991
- AuthService.ɵprov = ɵɵdefineInjectable({ factory: function AuthService_Factory() { return new AuthService(ɵɵinject(ActivatedRoute), ɵɵinject(StorageService), ɵɵinject(Router), ɵɵinject(HttpService), ɵɵinject(MessageService), ɵɵinject(LogService)); }, token: AuthService, providedIn: "root" });
992
- AuthService = __decorate([
993
- Injectable({
994
- providedIn: 'root'
995
- })
996
- ], AuthService);
997
- return AuthService;
998
- }());
999
-
1000
- var DataServiceLib = /** @class */ (function () {
1001
- function DataServiceLib(httpService) {
1002
- this.httpService = httpService;
1003
- this.appConfig = new AppConfig();
1004
- this.appConfigSource = new BehaviorSubject(this.appConfig);
1005
- this.appConfigObserv = this.appConfigSource.asObservable();
1006
- // caps: CapItem[];
1007
- this.capHome = new CapItem;
1008
- this.capAdmin = new CapItem;
1009
- this.capUsers = new CapItem;
1010
- this.capRoles = new CapItem;
1011
- this.capLogs = new CapItem;
1012
- this.capSettings = new CapItem;
1013
- this.tmpProfileuserName = "";
1014
- this.appConfig.appName = "App-Name";
1015
- this.appConfig.logo = "./assets/logo.png";
1016
- this.appConfig.ADAuth = true;
1017
- this.appConfig.capItems = [this.capAdmin, this.capHome];
1018
- this.capHome.name = "cap1";
1019
- this.capHome.display = "Home";
1020
- this.capHome.link = "home";
1021
- this.capAdmin.name = "cap2";
1022
- this.capAdmin.display = "Admin";
1023
- this.capAdmin.capSubItems = [this.capUsers, this.capRoles, this.capLogs, this.capSettings];
1024
- this.capUsers.name = "cap3";
1025
- this.capUsers.display = "Users";
1026
- this.capUsers.link = "home/admin/users";
1027
- this.capRoles.name = "cap4";
1028
- this.capRoles.display = "Roles";
1029
- this.capRoles.link = "home/admin/roles";
1030
- this.capLogs.name = "cap5";
1031
- this.capLogs.display = "Logs";
1032
- this.capLogs.link = "home/admin/logs";
1033
- this.capSettings.name = "cap6";
1034
- this.capSettings.display = "Settings";
1035
- this.capSettings.link = "home/admin/settings";
1036
- }
1037
- DataServiceLib.prototype.UpdateAppConfig = function (config) {
1038
- this.appConfigSource.next(config);
1039
- this.appConfig = config;
1040
- };
1041
- //Users
1042
- DataServiceLib.prototype.GetUser = function () {
1043
- return this.httpService.Get("User/all/x");
1044
- };
1045
- DataServiceLib.prototype.RegisterAccount = function (u) {
1046
- return this.httpService.Post("User/register", u);
1047
- };
1048
- DataServiceLib.prototype.GetUserByID = function (val) {
1049
- return this.httpService.Get("User/id/" + val);
1050
- };
1051
- DataServiceLib.prototype.UpdateUser = function (profile) {
1052
- return this.httpService.Post("User/edit", profile);
1053
- };
1054
- DataServiceLib.prototype.UnlockUser = function (user) {
1055
- return this.httpService.Post("User/unlock", user);
1056
- };
1057
- DataServiceLib.prototype.LockUser = function (user) {
1058
- return this.httpService.Post("User/lock", user);
1059
- };
1060
- DataServiceLib.prototype.DeleteUser = function (user) {
1061
- return this.httpService.Post("User/delete", user);
1062
- };
1063
- DataServiceLib.prototype.Login = function (u) {
1064
- return this.httpService.Post("User/login", u);
1065
- };
1066
- DataServiceLib.prototype.ChangePassword = function (u) {
1067
- return this.httpService.Post("User/changepassword-self", u);
1068
- };
1069
- DataServiceLib.prototype.ChangePasswordAdmin = function (u) {
1070
- return this.httpService.Post("User/changepassword-admin", u);
1071
- };
1072
- DataServiceLib.prototype.SelfReset = function (u) {
1073
- return this.httpService.Post("Basic/SelfReset", u);
1074
- };
1075
- //Roles
1076
- DataServiceLib.prototype.PostRole = function (role, action) {
1077
- return this.httpService.Post("Role?action=" + action, role);
1078
- };
1079
- DataServiceLib.prototype.PutRole = function (role) {
1080
- return this.httpService.Put("Role", role);
1081
- };
1082
- DataServiceLib.prototype.GetRole = function (by, val) {
1083
- return this.httpService.Get("Role/all/x");
1084
- };
1085
- //Logs
1086
- DataServiceLib.prototype.GetLog = function (by, val) {
1087
- return this.httpService.Get("Log/all/x");
1088
- };
1089
- //Settings
1090
- DataServiceLib.prototype.GetSetting = function (by, val) {
1091
- return this.httpService.Get("Setting/all/x");
1092
- };
1093
- DataServiceLib.prototype.UpdateSetting = function (setting, action) {
1094
- return this.httpService.Post("Setting?action=" + action, setting);
1095
- };
1096
- DataServiceLib.ctorParameters = function () { return [
1097
- { type: HttpService }
1098
- ]; };
1099
- DataServiceLib.ɵprov = ɵɵdefineInjectable({ factory: function DataServiceLib_Factory() { return new DataServiceLib(ɵɵinject(HttpService)); }, token: DataServiceLib, providedIn: "root" });
1100
- DataServiceLib = __decorate([
1101
- Injectable({
1102
- providedIn: 'root'
1103
- })
1104
- ], DataServiceLib);
1105
- return DataServiceLib;
1106
- }());
1107
-
1108
- var LoaderService = /** @class */ (function () {
1109
- function LoaderService() {
1110
- this.isLoading = new BehaviorSubject(false);
1111
- }
1112
- LoaderService.ɵprov = ɵɵdefineInjectable({ factory: function LoaderService_Factory() { return new LoaderService(); }, token: LoaderService, providedIn: "root" });
1113
- LoaderService = __decorate([
1114
- Injectable({
1115
- providedIn: 'root'
1116
- })
1117
- ], LoaderService);
1118
- return LoaderService;
1119
- }());
1120
-
1121
- var LoaderComponent = /** @class */ (function () {
1122
- function LoaderComponent(loaderService) {
1123
- var _this = this;
1124
- this.loaderService = loaderService;
1125
- this.logo = "";
1126
- this.loaderService.isLoading.subscribe(function (v) {
1127
- _this.loading = v;
1128
- });
1129
- }
1130
- LoaderComponent.prototype.ngOnInit = function () {
1131
- };
1132
- LoaderComponent.ctorParameters = function () { return [
1133
- { type: LoaderService }
1134
- ]; };
1135
- __decorate([
1136
- Input()
1137
- ], LoaderComponent.prototype, "logo", void 0);
1138
- LoaderComponent = __decorate([
1139
- Component({
1140
- selector: 'spa-loader',
1141
- template: "<div class=\"progress-loader\" style=\"z-index: 9999;\" [hidden]=\"!loading\">\r\n <div class=\"loading-spinner\">\r\n\r\n <img *ngIf=\"logo==''\" style=\"width: 100px;\"\r\n src=\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==\"\r\n\r\n >\r\n\r\n <img *ngIf=\"logo!=''\" [src]=\"logo\" style=\"width: 100px;\" />\r\n\r\n\r\n <span id=\"loadingMessage\" class=\"loading-message\">Please wait...</span>\r\n </div>\r\n</div>\r\n",
1142
- styles: [".loading-spinner{background-color:#0000001f;position:absolute;width:100%;top:0;left:0;height:100vh;align-items:center;justify-content:center;display:-ms-grid;display:grid}.loading-spinner img{-ms-grid-row-align:end;align-self:end}.loading-message{text-align:center;-ms-grid-row-align:start;align-self:start}"]
1143
- })
1144
- ], LoaderComponent);
1145
- return LoaderComponent;
1146
- }());
1147
-
1148
- var ɵ0 = { disableClose: true, hasBackdrop: true };
1149
- var SpaMatModule = /** @class */ (function () {
1150
- function SpaMatModule() {
1151
- }
1152
- SpaMatModule = __decorate([
1153
- NgModule({
1154
- declarations: [],
1155
- imports: [],
1156
- exports: [
1157
- CommonModule, FormsModule, ReactiveFormsModule,
1158
- MatMenuModule, MatSliderModule, MatTableModule, MatPaginatorModule,
1159
- MatCheckboxModule, MatBadgeModule, MatButtonModule, MatIconModule, MatDialogModule, MatSnackBarModule,
1160
- MatTabsModule, MatFormFieldModule, MatInputModule, MatCardModule, MatChipsModule, MatSelectModule,
1161
- MatNativeDateModule, MatProgressSpinnerModule, MatListModule, MatAutocompleteModule, MatTooltipModule, MatSortModule,
1162
- MatDatepickerModule, MatStepperModule, MatRadioModule,
1163
- ],
1164
- providers: [
1165
- { provide: MAT_DIALOG_DEFAULT_OPTIONS, useValue: ɵ0 },
1166
- { provide: MAT_DATE_LOCALE, useValue: "en-GB" },
1167
- ]
1168
- })
1169
- ], SpaMatModule);
1170
- return SpaMatModule;
1171
- }());
1172
-
1173
- var LoaderInterceptor = /** @class */ (function () {
1174
- function LoaderInterceptor(loaderService, messageService, authService, router, logService) {
1175
- this.loaderService = loaderService;
1176
- this.messageService = messageService;
1177
- this.authService = authService;
1178
- this.router = router;
1179
- this.logService = logService;
1180
- this.requests = [];
1181
- }
1182
- LoaderInterceptor.prototype.removeRequest = function (req) {
1183
- var i = this.requests.indexOf(req);
1184
- if (i >= 0) {
1185
- this.requests.splice(i, 1);
1186
- }
1187
- this.loaderService.isLoading.next(this.requests.length > 0);
1188
- };
1189
- LoaderInterceptor.prototype.intercept = function (request, next) {
1190
- var _this = this;
1191
- var requestClone = request.clone({
1192
- setHeaders: {
1193
- Authorization: "Bearer " + this.authService.tokenSource.value
1194
- }
1195
- });
1196
- this.requests.push(requestClone);
1197
- if (this.requests.length > 1) {
1198
- this.logService.info("Multiple connections detected > " + this.requests.length);
1199
- }
1200
- this.loaderService.isLoading.next(true);
1201
- return Observable.create(function (observer) {
1202
- var subscription = next.handle(requestClone).subscribe(function (event) {
1203
- if (event instanceof HttpResponse) {
1204
- _this.removeRequest(requestClone);
1205
- observer.next(event);
1206
- }
1207
- }, function (error) {
1208
- _this.removeRequest(requestClone);
1209
- observer.error(error);
1210
- if (error.status === 401) {
1211
- _this.router.navigate(["login"]);
1212
- _this.messageService.toast('Unauthorised: Please login again');
1213
- }
1214
- else if (error.status === 500) {
1215
- console.log(error.error);
1216
- _this.messageService.toast('System Error');
1217
- }
1218
- else if (error.statusText == 'Unknown Error') {
1219
- _this.messageService.toast('Connection Error');
1220
- }
1221
- else {
1222
- _this.messageService.toast('Error: ' + error.statusText);
1223
- }
1224
- }, function () {
1225
- _this.removeRequest(requestClone);
1226
- observer.complete();
1227
- });
1228
- // remove request from queue when cancelled
1229
- return function () {
1230
- _this.removeRequest(requestClone);
1231
- subscription.unsubscribe();
1232
- };
1233
- });
1234
- };
1235
- LoaderInterceptor.ctorParameters = function () { return [
1236
- { type: LoaderService },
1237
- { type: MessageService },
1238
- { type: AuthService },
1239
- { type: Router },
1240
- { type: LogService }
1241
- ]; };
1242
- LoaderInterceptor = __decorate([
1243
- Injectable()
1244
- ], LoaderInterceptor);
1245
- return LoaderInterceptor;
1246
- }());
1247
-
1248
- var TinSpaComponent = /** @class */ (function () {
1249
- function TinSpaComponent() {
1250
- }
1251
- TinSpaComponent.prototype.ngOnInit = function () {
1252
- };
1253
- TinSpaComponent = __decorate([
1254
- Component({
1255
- selector: 'lib-tin-spa',
1256
- template: "\n <p>\n tin-spa works!\n </p>\n "
1257
- })
1258
- ], TinSpaComponent);
1259
- return TinSpaComponent;
1260
- }());
1261
-
1262
- var NavMenuComponent = /** @class */ (function () {
1263
- function NavMenuComponent(router, authService) {
1264
- this.router = router;
1265
- this.authService = authService;
1266
- this.isExpanded = false;
1267
- this.appConfig = new AppConfig();
1268
- }
1269
- NavMenuComponent.prototype.ngOnInit = function () {
1270
- var _this = this;
1271
- this.authService.loggedUserFullName.subscribe(function (user) { return _this.loggedUserFullName = user; });
1272
- this.authService.myRoleObserv.subscribe(function (rol) { return _this.myRole = rol; });
1273
- this.authService.loggedinObserv.subscribe(function (obj) { return _this.loggedin = obj; });
1274
- };
1275
- NavMenuComponent.prototype.collapse = function () {
1276
- this.isExpanded = false;
1277
- };
1278
- NavMenuComponent.prototype.toggle = function () {
1279
- this.isExpanded = !this.isExpanded;
1280
- };
1281
- // logoff() {
1282
- // // this.authService.updateloggedin(false);
1283
- // // this.authService.updateRole(new Role());
1284
- // this.router.navigate(["login"]);
1285
- // // this.storageService.clear();
1286
- // }
1287
- NavMenuComponent.prototype.redirectTo = function (link) {
1288
- if (link != "") {
1289
- this.router.navigate([link]);
1290
- }
1291
- };
1292
- NavMenuComponent.ctorParameters = function () { return [
1293
- { type: Router },
1294
- { type: AuthService }
1295
- ]; };
1296
- __decorate([
1297
- Input()
1298
- ], NavMenuComponent.prototype, "appConfig", void 0);
1299
- NavMenuComponent = __decorate([
1300
- Component({
1301
- selector: 'spa-nav-menu',
1302
- template: "<header *ngIf=\"loggedin\">\r\n <nav class=\"toolbar navbar navbar-expand-sm navbar-toggleable-sm navbar-light border-bottom box-shadow mb-3 \" style=\"padding-right: 10px;\">\r\n <div class=\"container-fluid\" style=\"padding-right: 0px;\">\r\n <!--<a class=\"navbar-brand\" [routerLink]=\"['/']\">Orbit</a>-->\r\n\r\n <img *ngIf=\"appConfig.logo!=''\" [src]=\"appConfig.logo\" style=\"height: 50px; margin-right: 2em\" />\r\n\r\n\r\n <div style=\"font-size: 20px;\">\r\n {{appConfig.appName}}\r\n </div>\r\n\r\n\r\n <button class=\"navbar-toggler\"\r\n type=\"button\"\r\n data-toggle=\"collapse\"\r\n data-target=\".navbar-collapse\"\r\n aria-label=\"Toggle navigation\"\r\n [attr.aria-expanded]=\"isExpanded\"\r\n (click)=\"toggle()\">\r\n <span class=\"navbar-toggler-icon\"></span>\r\n </button>\r\n\r\n <div *ngIf=\"myRole\" class=\"navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse stack-top\" style=\"margin-right: 0px;\" [ngClass]=\"{ show: isExpanded }\" >\r\n\r\n <button mat-icon-button (click)=\"redirectTo('login')\"> <mat-icon>logout</mat-icon> </button>\r\n\r\n <button id=\"btnUser\" mat-button [matMenuTriggerFor]=\"profileMenu\" style=\"margin-left:2em\"><mat-icon>account_circle</mat-icon> &nbsp;{{loggedUserFullName}}</button>\r\n\r\n <mat-menu #profileMenu=\"matMenu\">\r\n <button id=\"btnProfile\" mat-menu-item (click)=\"redirectTo('home/user/profile')\" >Profile</button>\r\n <button id=\"btnLogOff\" mat-menu-item (click)=\"redirectTo('login')\">Log Off</button>\r\n </mat-menu>\r\n\r\n <div *ngFor=\"let item of appConfig.capItems\">\r\n\r\n <!-- Menu Item -->\r\n <button id=\"btnMenu\" *ngIf=\"myRole[item.name] && !item.capSubItems && item.showMenu\" mat-button (click)=\"redirectTo(item.link)\">{{item.display}}</button>\r\n\r\n <!-- Menu Item with Sub items ignored -->\r\n <button id=\"btnMenu\" *ngIf=\"myRole[item.name] && item.capSubItems && item.showMenu && item.ignoreSubsDisplay\" mat-button (click)=\"redirectTo(item.link)\">{{item.display}}</button>\r\n\r\n <!-- Menu Item with Sub items to display-->\r\n <button id=\"btnMenu\" *ngIf=\"myRole[item.name] && item.capSubItems && item.showMenu && !item.ignoreSubsDisplay\" mat-button [matMenuTriggerFor]=\"adminMenu\">{{item.display}}</button>\r\n\r\n\r\n <!-- Sub Menu Items -->\r\n <mat-menu #adminMenu=\"matMenu\">\r\n\r\n <div *ngFor=\"let subItem of item.capSubItems\">\r\n\r\n <button *ngIf=\"myRole[subItem.name] && subItem.showMenu\" mat-menu-item (click)=\"redirectTo(subItem.link)\">{{subItem.display}}</button>\r\n\r\n </div>\r\n\r\n </mat-menu>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n </div>\r\n\r\n </nav>\r\n</header>\r\n",
1303
- styles: ["a.navbar-brand{white-space:normal;text-align:center;word-break:break-all}html{font-size:14px}@media (min-width:768px){html{font-size:16px}}.box-shadow{box-shadow:0 .25rem .75rem rgba(0,0,0,.05)}.toolbar{height:60px;display:flex;align-items:center;background-color:#03a;color:#fff;font-weight:600}.stack-top{z-index:9;margin:20px}"]
1304
- })
1305
- ], NavMenuComponent);
1306
- return NavMenuComponent;
1307
- }());
1308
-
1309
- var TimeoutComponent = /** @class */ (function () {
1310
- function TimeoutComponent(idle, keepalive, authService, router) {
1311
- var _this = this;
1312
- this.idle = idle;
1313
- this.keepalive = keepalive;
1314
- this.authService = authService;
1315
- this.router = router;
1316
- this.loggedin = false;
1317
- this.idleState = 'Not started.';
1318
- this.timedOut = false;
1319
- this.lastPing = null;
1320
- this.isWarning = false;
1321
- this.authService.loggedinObserv.subscribe(function (obj) {
1322
- _this.loggedin = obj;
1323
- // if (this.loggedin){
1324
- // this.startWatch();
1325
- // }else{
1326
- // this.stopWatch();
1327
- // }
1328
- });
1329
- // sets an idle timeout of 5 seconds, for testing purposes.
1330
- idle.setIdle(900);
1331
- // sets a timeout period of 5 seconds. after 10 seconds of inactivity, the user will be considered timed out.
1332
- idle.setTimeout(10);
1333
- // sets the default interrupts, in this case, things like clicks, scrolls, touches to the document
1334
- idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);
1335
- idle.onIdleStart.subscribe(function () {
1336
- _this.idleState = 'You\'ve gone idle!';
1337
- });
1338
- idle.onIdleEnd.subscribe(function () {
1339
- _this.idleState = 'No longer idle.';
1340
- _this.isWarning = false;
1341
- });
1342
- idle.onTimeoutWarning.subscribe(function (countdown) {
1343
- _this.idleState = 'You will be signed out in ' + countdown + ' seconds!';
1344
- if (_this.loggedin) {
1345
- _this.isWarning = true;
1346
- }
1347
- });
1348
- idle.onTimeout.subscribe(function () {
1349
- _this.idleState = 'Timed out!';
1350
- _this.timedOut = true;
1351
- //action
1352
- _this.stopWatch();
1353
- });
1354
- // sets the ping interval to 15 seconds
1355
- keepalive.interval(15);
1356
- keepalive.onPing.subscribe(function () {
1357
- _this.lastPing = new Date();
1358
- });
1359
- this.startWatch();
1360
- }
1361
- TimeoutComponent.prototype.ngOnInit = function () {
1362
- };
1363
- TimeoutComponent.prototype.startWatch = function () {
1364
- this.idle.watch();
1365
- this.idleState = 'Started.';
1366
- this.timedOut = false;
1367
- this.isWarning = false;
1368
- };
1369
- TimeoutComponent.prototype.stopWatch = function () {
1370
- this.idle.stop();
1371
- this.isWarning = false;
1372
- this.router.navigate(['login']);
1373
- };
1374
- TimeoutComponent.prototype.using = function () {
1375
- //remove message and continue
1376
- this.isWarning = false;
1377
- };
1378
- TimeoutComponent.ctorParameters = function () { return [
1379
- { type: Idle },
1380
- { type: Keepalive },
1381
- { type: AuthService },
1382
- { type: Router }
1383
- ]; };
1384
- TimeoutComponent = __decorate([
1385
- Component({
1386
- selector: 'spa-timeout',
1387
- template: "\r\n<div class=\"loading-spinner\" [hidden]=\"!isWarning\" >\r\n\r\n <div style=\"width: 500px; text-align: center;\">\r\n\r\n\r\n\r\n <div class=\"row\">\r\n <div class=\"col\">\r\n <img style=\"width: 100px;\"\r\n src=\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==\">\r\n </div>\r\n </div>\r\n\r\n <mat-card class=\"mat-elevation-z3\" >\r\n\r\n <mat-card-header>\r\n\r\n <h5>Are you still there ?</h5>\r\n\r\n </mat-card-header>\r\n\r\n <mat-card-content>\r\n\r\n <br>\r\n <span>{{idleState}}</span>\r\n\r\n <br>\r\n\r\n </mat-card-content>\r\n\r\n <mat-card-actions>\r\n\r\n <div class=\"row justify-content-around\">\r\n\r\n <div class=\"col-2\">\r\n <button style=\"width: 100px;\" mat-stroked-button color=\"primary\" (click)=\"using()\">Yes</button>\r\n </div>\r\n\r\n <div class=\"col-4\">\r\n <button style=\"width: 100px;\" mat-stroked-button color=\"primary\" (click)=\"stopWatch()\">No</button>\r\n </div>\r\n\r\n </div>\r\n\r\n </mat-card-actions>\r\n\r\n </mat-card>\r\n\r\n\r\n</div>\r\n\r\n</div>\r\n",
1388
- styles: [".loading-spinner{background-color:#0000001f;position:absolute;width:100%;top:0;left:0;height:100vh;align-items:center;justify-content:center;display:-ms-grid;display:grid}.loading-spinner img{-ms-grid-row-align:end;align-self:end}.loading-message{text-align:center;-ms-grid-row-align:start;align-self:start}"]
1389
- })
1390
- ], TimeoutComponent);
1391
- return TimeoutComponent;
1392
- }());
1393
-
1394
- var TableComponent = /** @class */ (function () {
1395
- function TableComponent() {
1396
- this.dataChange = new EventEmitter();
1397
- this.buttonClick = new EventEmitter();
1398
- this.loadClick = new EventEmitter();
1399
- this.createClick = new EventEmitter();
1400
- this.colType = TableColumnType;
1401
- this.op = Operator;
1402
- this.displayedColumns = [];
1403
- this._filterText = "";
1404
- }
1405
- TableComponent.prototype.ngOnInit = function () {
1406
- var _this = this;
1407
- this.config.columns.forEach(function (element) {
1408
- _this.displayedColumns.push(element.name);
1409
- });
1410
- this.displayedColumns.push("Action");
1411
- this.styleString = "width: " + 50 * this.config.actions.length + "px";
1412
- };
1413
- TableComponent.prototype.ngOnChanges = function () {
1414
- this.data = new MatTableDataSource(this.data);
1415
- this.data.paginator = this.tablePaginator;
1416
- this.applyFilter(this._filterText);
1417
- };
1418
- TableComponent.prototype.applyFilter = function (filterValue) {
1419
- this.data.filter = filterValue.trim().toLowerCase();
1420
- };
1421
- TableComponent.prototype.do = function (name, item) {
1422
- var resp = new ActionResponse();
1423
- resp.name = name;
1424
- resp.value = item;
1425
- this.buttonClick.emit(resp);
1426
- };
1427
- TableComponent.prototype.create = function () {
1428
- this.createClick.emit();
1429
- };
1430
- TableComponent.prototype.load = function () {
1431
- this.loadClick.emit();
1432
- };
1433
- TableComponent.prototype.test = function (a, op, b) {
1434
- if (op == Operator.Equal) {
1435
- if (a == b) {
1436
- return true;
1437
- }
1438
- else {
1439
- return false;
1440
- }
1441
- }
1442
- if (op == Operator.Greater) {
1443
- if (a > b) {
1444
- return true;
1445
- }
1446
- else {
1447
- return false;
1448
- }
1449
- }
1450
- if (op == Operator.Less) {
1451
- if (a < b) {
1452
- return true;
1453
- }
1454
- else {
1455
- return false;
1456
- }
1457
- }
1458
- if (op == Operator.NotEqual) {
1459
- if (a != b) {
1460
- return true;
1461
- }
1462
- else {
1463
- return false;
1464
- }
1465
- }
1466
- };
1467
- __decorate([
1468
- Input()
1469
- ], TableComponent.prototype, "config", void 0);
1470
- __decorate([
1471
- Input()
1472
- ], TableComponent.prototype, "data", void 0);
1473
- __decorate([
1474
- Output()
1475
- ], TableComponent.prototype, "dataChange", void 0);
1476
- __decorate([
1477
- Output()
1478
- ], TableComponent.prototype, "buttonClick", void 0);
1479
- __decorate([
1480
- Output()
1481
- ], TableComponent.prototype, "loadClick", void 0);
1482
- __decorate([
1483
- Output()
1484
- ], TableComponent.prototype, "createClick", void 0);
1485
- __decorate([
1486
- ViewChild('tablePaginator')
1487
- ], TableComponent.prototype, "tablePaginator", void 0);
1488
- TableComponent = __decorate([
1489
- Component({
1490
- selector: 'spa-table',
1491
- template: "<div >\r\n\r\n<div *ngIf=\"config.create.enabled || config.enableFilter\" class=\"row justify-content-between\" style=\"padding-bottom: 10px\">\r\n <div class=\"col\">\r\n<button *ngIf=\"config.create\" [disabled]=\"!config.create.enabled\" mat-raised-button color=\"primary\" (click)=\"create()\">{{config.create.display}}</button>\r\n</div>\r\n <div *ngIf=\"config.enableFilter\" class=\"col d-flex justify-content-end\">\r\n<mat-form-field style=\"font-size:12px;margin-right: 5px;\">\r\n<mat-label>Filter</mat-label>\r\n<input matInput [(ngModel)]=\"_filterText\" (keyup)=\"applyFilter($event.target.value)\" placeholder=\"Enter Filter text\" autocomplete=\"off\">\r\n</mat-form-field>\r\n<button mat-mini-fab color=\"primary\" (click)=\"load()\" style=\"margin-top:5px\" matTooltip=\"refresh data\" matTooltipPosition=\"right\"><mat-icon class=\"refreshIcon\">refresh</mat-icon></button>\r\n</div>\r\n</div>\r\n\r\n<div class=\"mat-elevation-z8\" *ngIf=\"data\">\r\n\r\n <table mat-table [dataSource]=\"data\">\r\n\r\n <ng-container *ngFor=\"let col of config.columns; let i = index\"\r\n\r\n [matColumnDef]=\"col.name\">\r\n <th mat-header-cell *matHeaderCellDef> {{col.display}} </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n\r\n <!-- String -->\r\n <div *ngIf=\"(col.type==colType.String || col.type == null) && col.color == null\"> {{row[col.name]}}</div>\r\n\r\n <div [ngStyle]=\"{'color':col.color.name}\"\r\n *ngIf=\"(col.type==colType.String || col.type == null) && col.color != null && test(row[col.color.field], col.color.operator, col.color.value )\" >\r\n {{row[col.name]}}\r\n </div>\r\n\r\n <div\r\n *ngIf=\"(col.type==colType.String || col.type == null) && col.color != null && !test(row[col.color.field], col.color.operator, col.color.value )\" >\r\n {{row[col.name]}}\r\n </div>\r\n\r\n <!-- <div [ngStyle]=\"{'color':col.color.name}\"\r\n *ngIf=\"(col.type==colType.String || col.type == null) && col.color != null &&\r\n col.color.operator==op.Equal && row[col.color.field]==col.color.value\" >\r\n {{row[col.name]}}\r\n </div>\r\n\r\n <div [ngStyle]=\"{'color':col.color.name}\"\r\n *ngIf=\"(col.type==colType.String || col.type == null) && col.color != null &&\r\n col.color.operator==op.Greater && row[col.color.field]>col.color.value\" >\r\n {{row[col.name]}}\r\n </div>\r\n\r\n <div [ngStyle]=\"{'color':col.color.name}\"\r\n *ngIf=\"(col.type==colType.String || col.type == null) && col.color != null &&\r\n col.color.operator==op.Less && row[col.color.field]<col.color.value\" >\r\n {{row[col.name]}}\r\n </div>\r\n\r\n <div [ngStyle]=\"{'color':col.color.name}\"\r\n *ngIf=\"(col.type==colType.String || col.type == null) && col.color != null &&\r\n col.color.operator==op.NotEqual && row[col.color.field]!=col.color.value\" >\r\n {{row[col.name]}}\r\n </div> -->\r\n\r\n\r\n <!-- Date -->\r\n <div *ngIf=\"col.type==colType.Date\"> {{row[col.name] | date:'dd/MM/yyyy'}}</div>\r\n\r\n\r\n <!-- DateTime -->\r\n <div *ngIf=\"col.type==colType.DateTime\"> {{row[col.name] | date:'dd/MM/yyyy HH:mm'}}</div>\r\n\r\n\r\n <ng-container *ngFor=\"let icon of col.icons;\">\r\n <!-- <mat-icon *ngIf=\"col.type==colType.Icon && icon.operator==op.Equal && row[icon.field]==icon.value\"\r\n [ngStyle]=\"{'color':icon.color}\"\r\n [matTooltip]=\"icon.hint\" matTooltipPosition=\"above\">\r\n {{icon.name}}\r\n </mat-icon>\r\n\r\n <mat-icon *ngIf=\"col.type==colType.Icon && icon.operator==op.Greater && row[icon.field]>icon.value\"\r\n [ngStyle]=\"{'color':icon.color}\"\r\n [matTooltip]=\"icon.hint\" matTooltipPosition=\"above\">\r\n {{icon.name}}\r\n </mat-icon>\r\n\r\n <mat-icon *ngIf=\"col.type==colType.Icon && icon.operator==op.Less && row[icon.field]<icon.value\"\r\n [ngStyle]=\"{'color':icon.color}\"\r\n [matTooltip]=\"icon.hint\" matTooltipPosition=\"above\">\r\n {{icon.name}}\r\n </mat-icon>\r\n <mat-icon *ngIf=\"col.type==colType.Icon && icon.operator==op.NotEqual && row[icon.field]!=icon.value\"\r\n [ngStyle]=\"{'color':icon.color}\"\r\n [matTooltip]=\"icon.hint\" matTooltipPosition=\"above\">\r\n {{icon.name}}\r\n </mat-icon> -->\r\n\r\n <mat-icon *ngIf=\"col.type==colType.Icon && test(row[icon.field],icon.operator,icon.value)\"\r\n [ngStyle]=\"{'color':icon.color}\"\r\n [matTooltip]=\"icon.hint\" matTooltipPosition=\"above\">\r\n {{icon.name}}\r\n </mat-icon>\r\n\r\n </ng-container>\r\n\r\n </td>\r\n\r\n </ng-container>\r\n\r\n\r\n\r\n\r\n <ng-container matColumnDef=\"Action\">\r\n\r\n <th mat-header-cell *matHeaderCellDef> Action </th>\r\n <td mat-cell *matCellDef=\"let row\" [style]=\"styleString+';padding-right: 0px;'\">\r\n\r\n <ng-container *ngFor=\"let act of config.actions\">\r\n\r\n <button *ngIf=\" (act.disappear && (row[act.disappear.field] != act.disappear.value)) || !act.disappear\" mat-mini-fab\r\n\r\n [disabled]=\"(act.disable && (row[act.disable.field] == act.disable.value))\"\r\n [color]=\"act.color==null? 'primary' : act.color\"\r\n [matTooltip]=\"act.hint\" matTooltipPosition=\"above\"\r\n (click)=\"do(act.name,row)\" style=\"margin-right:5px\">\r\n <mat-icon>{{act.icon}}</mat-icon>\r\n\r\n </button>\r\n\r\n </ng-container>\r\n\r\n </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\" [ngClass]=\"{'make-gray': row[config.greyout.field]==config.greyout.value}\"></tr>\r\n\r\n </table>\r\n</div>\r\n<mat-paginator #tablePaginator [pageSizeOptions]=\"[10, 50, 100]\" showFirstLastButtons></mat-paginator>\r\n</div>\r\n\r\n",
1492
- styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.make-gray{background-color:#d3d3d3}"]
1493
- })
1494
- ], TableComponent);
1495
- return TableComponent;
1496
- }());
1497
-
1498
- var TilesComponent = /** @class */ (function () {
1499
- function TilesComponent() {
1500
- this.clickable = false;
1501
- this.tileClick = new EventEmitter();
1502
- this.selected = "";
1503
- }
1504
- TilesComponent.prototype.ngOnInit = function () {
1505
- };
1506
- TilesComponent.prototype.clicked = function (v) {
1507
- if (!this.clickable)
1508
- return;
1509
- if (this.selected == v.tileName) {
1510
- this.tileClick.emit("");
1511
- this.selected = "";
1512
- }
1513
- else {
1514
- this.tileClick.emit(v.tileName);
1515
- this.selected = v.tileName;
1516
- }
1517
- };
1518
- __decorate([
1519
- Input()
1520
- ], TilesComponent.prototype, "tiles", void 0);
1521
- __decorate([
1522
- Input()
1523
- ], TilesComponent.prototype, "clickable", void 0);
1524
- __decorate([
1525
- Output()
1526
- ], TilesComponent.prototype, "tileClick", void 0);
1527
- TilesComponent = __decorate([
1528
- Component({
1529
- selector: 'spa-tiles',
1530
- template: " <div class=\"row align-items-center\">\r\n\r\n <!-- <div class=\"col\" *ngFor=\"let row of tiles\" >\r\n\r\n <mat-card *ngIf=\"row.visible\">\r\n <div class=\"row d-flex justify-content-center\">\r\n\r\n <mat-label style=\"font-size:30px;font-weight:bold\" [ngStyle]=\"{'color':row.tileColor}\">{{row.tileValue}}</mat-label>\r\n\r\n </div>\r\n\r\n <div class=\"row d-flex justify-content-center\">\r\n\r\n <mat-label [ngStyle]=\"{'color':row.selected == true ? 'darkorange' : 'black' }\" style=\"font-size:12px;padding-left:5px;padding-right:5px\">{{row.tileName}}</mat-label>\r\n <mat-icon style=\"font-size: 17px; color:steelblue;\">info</mat-icon>\r\n\r\n </div>\r\n </mat-card>\r\n\r\n </div> -->\r\n\r\n <ng-container *ngFor=\"let row of tiles\">\r\n\r\n <mat-card class=\"col\" style=\"margin-left: 10px;margin-right: 10px\" *ngIf=\"row.visible\" (click)=\"clicked(row)\">\r\n\r\n <div class=\"row d-flex justify-content-center\">\r\n\r\n <mat-label style=\"font-weight:bold\" [ngStyle]=\"{'color':row.tileColor,'font-size':row.tileName == selected ? '35px' : '30px' }\">{{row.tileValue}}</mat-label>\r\n\r\n </div>\r\n\r\n <div class=\"row d-flex justify-content-center row align-items-center\">\r\n\r\n <mat-label [ngStyle]=\"{'font-size':row.tileName == selected ? '18px' : '12px' }\" style=\"padding-left:5px;padding-right:5px\">{{row.tileName}}</mat-label>\r\n <mat-icon [matTooltip]=\"row.info\" matTooltipPosition=\"above\" [ngStyle]=\"{'font-size':row.tileName == selected ? '20px' : '17px' }\" style=\" color:steelblue;\">info</mat-icon>\r\n\r\n </div>\r\n\r\n </mat-card>\r\n\r\n\r\n </ng-container>\r\n\r\n </div>\r\n",
1531
- styles: [""]
1532
- })
1533
- ], TilesComponent);
1534
- return TilesComponent;
1535
- }());
1536
-
1537
- var DateComponent = /** @class */ (function () {
1538
- function DateComponent() {
1539
- this.date = new FormControl(new Date());
1540
- this.display = "";
1541
- this.readonly = false;
1542
- this.currentYear = new Date().getFullYear();
1543
- this.min = new FormControl(new Date(this.currentYear - 50, 0, 1));
1544
- this.max = new FormControl(new Date(this.currentYear + 50, 0, 1));
1545
- }
1546
- DateComponent.prototype.ngOnInit = function () {
1547
- };
1548
- // @Output() dateChange = new EventEmitter();
1549
- // minDate: Date = new Date(this.currentYear, 2, 2);
1550
- // maxDate: Date = new Date(this.currentYear, 2, 10);
1551
- DateComponent.prototype.onChangeEvent = function (d) {
1552
- // this.dateChange.emit(d);
1553
- };
1554
- __decorate([
1555
- Input()
1556
- ], DateComponent.prototype, "date", void 0);
1557
- __decorate([
1558
- Input()
1559
- ], DateComponent.prototype, "display", void 0);
1560
- __decorate([
1561
- Input()
1562
- ], DateComponent.prototype, "readonly", void 0);
1563
- __decorate([
1564
- Input()
1565
- ], DateComponent.prototype, "min", void 0);
1566
- __decorate([
1567
- Input()
1568
- ], DateComponent.prototype, "max", void 0);
1569
- DateComponent = __decorate([
1570
- Component({
1571
- selector: 'spa-date',
1572
- template: "\r\n<mat-form-field style=\"width:150px;margin-right:20px\">\r\n<input [formControl]=\"date\" [min]=\"min.value\" [max]=\"max.value\" matInput [matDatepicker]=\"picker_date\" [placeholder]=\"display\" [readonly]=\"true\" [disabled]=\"readonly\">\r\n<mat-datepicker-toggle matSuffix [for]=\"picker_date\"></mat-datepicker-toggle>\r\n<mat-datepicker #picker_date></mat-datepicker>\r\n</mat-form-field>\r\n",
1573
- styles: [""]
1574
- })
1575
- ], DateComponent);
1576
- return DateComponent;
1577
- }());
1578
-
1579
- var TextComponent = /** @class */ (function () {
1580
- function TextComponent() {
1581
- // options: FormGroup;
1582
- this.hideRequiredControl = new FormControl(true);
1583
- this.readonly = false;
1584
- this.hint = "";
1585
- this.display = "";
1586
- this.placeholder = "";
1587
- this.value = "";
1588
- this.valueChange = new EventEmitter();
1589
- this.format = "text";
1590
- this.type = "";
1591
- this.leave = new EventEmitter();
1592
- this.enterPress = new EventEmitter();
1593
- this.rows = "";
1594
- this.width = "100%";
1595
- //Autocomplete items
1596
- this.options = [];
1597
- this.optionValue = "";
1598
- this.optionDisplay = "";
1599
- this.myControl = new FormControl();
1600
- //validations
1601
- this.required = true;
1602
- this.min = 0;
1603
- this.max = 9000000000000000; //Math.max
1604
- this.regex = ""; //"[a-zA-Z ]*" //"/\S+@\S+\.\S+/";
1605
- this.control = new FormControl(this.value, [Validators.required, Validators.minLength(this.min), Validators.maxLength(this.max), Validators.pattern(this.regex)]);
1606
- }
1607
- TextComponent.prototype.ngOnInit = function () {
1608
- if (this.options.length > 0) {
1609
- this.initFilter();
1610
- }
1611
- if (this.placeholder == "") {
1612
- this.placeholder = "Enter " + this.display;
1613
- }
1614
- };
1615
- TextComponent.prototype.ngAfterViewInit = function () {
1616
- if (this.readonly) {
1617
- this.control.setValidators(null);
1618
- this.control.updateValueAndValidity();
1619
- }
1620
- if (!this.required && !this.readonly) {
1621
- this.control.setValidators([Validators.minLength(this.min), Validators.maxLength(this.max), Validators.pattern(this.regex)]);
1622
- this.control.updateValueAndValidity();
1623
- }
1624
- };
1625
- TextComponent.prototype.initFilter = function () {
1626
- var _this = this;
1627
- this.filteredOptions = this.myControl.valueChanges.pipe(startWith(""), map(function (value) { return _this._filter(value); }));
1628
- };
1629
- TextComponent.prototype._filter = function (value) {
1630
- var _this = this;
1631
- var filterValue = value.toLowerCase();
1632
- return this.options.filter(function (option) { return option["" + _this.optionDisplay].toLowerCase().includes(filterValue); });
1633
- };
1634
- TextComponent.prototype.changed = function () {
1635
- // if (this.options.length > 0) {
1636
- // this.value = this.myControl.value;
1637
- // }
1638
- this.valueChange.emit(this.value);
1639
- };
1640
- TextComponent.prototype.changed2 = function () {
1641
- // if (this.options.length > 0) {
1642
- // this.value = this.myControl.value;
1643
- // }
1644
- this.valueChange.emit(this.myControl.value);
1645
- };
1646
- TextComponent.prototype.leaved = function () {
1647
- this.leave.emit();
1648
- };
1649
- TextComponent.prototype.enterPressed = function () {
1650
- this.enterPress.emit();
1651
- };
1652
- TextComponent.prototype.validate = function () {
1653
- if ((this.required || this.min > 0) && this.control.hasError('required')) {
1654
- return "Required";
1655
- }
1656
- if (this.control.hasError('minlength')) {
1657
- return "Minimun length is " + this.min;
1658
- }
1659
- if (this.control.hasError('maxlength')) {
1660
- return "Maximum length is " + this.max;
1661
- }
1662
- if (this.control.hasError('pattern')) {
1663
- return "Invalid Input";
1664
- }
1665
- // if (this.regex != ""){
1666
- // let r = new RegExp(this.regex, "g");
1667
- // if (!r.test(this.value)){
1668
- // this.valid = false;
1669
- // this.errorMessage = "Invalid input";
1670
- // return this.errorMessage;
1671
- // }
1672
- // }
1673
- return "";
1674
- };
1675
- __decorate([
1676
- Input()
1677
- ], TextComponent.prototype, "readonly", void 0);
1678
- __decorate([
1679
- Input()
1680
- ], TextComponent.prototype, "hint", void 0);
1681
- __decorate([
1682
- Input()
1683
- ], TextComponent.prototype, "display", void 0);
1684
- __decorate([
1685
- Input()
1686
- ], TextComponent.prototype, "placeholder", void 0);
1687
- __decorate([
1688
- Input()
1689
- ], TextComponent.prototype, "value", void 0);
1690
- __decorate([
1691
- Output()
1692
- ], TextComponent.prototype, "valueChange", void 0);
1693
- __decorate([
1694
- Input()
1695
- ], TextComponent.prototype, "format", void 0);
1696
- __decorate([
1697
- Input()
1698
- ], TextComponent.prototype, "type", void 0);
1699
- __decorate([
1700
- Output()
1701
- ], TextComponent.prototype, "leave", void 0);
1702
- __decorate([
1703
- Output()
1704
- ], TextComponent.prototype, "enterPress", void 0);
1705
- __decorate([
1706
- Input()
1707
- ], TextComponent.prototype, "rows", void 0);
1708
- __decorate([
1709
- Input()
1710
- ], TextComponent.prototype, "width", void 0);
1711
- __decorate([
1712
- Input()
1713
- ], TextComponent.prototype, "options", void 0);
1714
- __decorate([
1715
- Input()
1716
- ], TextComponent.prototype, "optionValue", void 0);
1717
- __decorate([
1718
- Input()
1719
- ], TextComponent.prototype, "optionDisplay", void 0);
1720
- __decorate([
1721
- Input()
1722
- ], TextComponent.prototype, "required", void 0);
1723
- __decorate([
1724
- Input()
1725
- ], TextComponent.prototype, "min", void 0);
1726
- __decorate([
1727
- Input()
1728
- ], TextComponent.prototype, "max", void 0);
1729
- __decorate([
1730
- Input()
1731
- ], TextComponent.prototype, "regex", void 0);
1732
- TextComponent = __decorate([
1733
- Component({
1734
- selector: 'spa-text',
1735
- template: "<mat-form-field *ngIf=\"rows == '' && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" style=\"padding-right: 20px;\" [ngStyle]=\"{'width':width}\" >\r\n<mat-label *ngIf=\"format=='text'\">{{display}}</mat-label>\r\n<mat-label *ngIf=\"format=='date'\">{{display | date:'dd/MM/yyyy'}}</mat-label>\r\n<!-- <mat-label *ngIf=\"format=='datetime'\">{{display | date:'dd/MM/yyyy HH:mm'}}</mat-label> -->\r\n<input matInput autocomplete=\"off\" [(ngModel)]=\"value\" (change)=\"changed()\" (blur)=\"leaved()\" (keyup.enter)=\"enterPressed()\" [type]=\"type\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"/>\r\n<mat-error *ngIf=\"control.invalid\">{{validate()}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n<!-- TextArea copy - Only change input to textarea and change ngif to not -->\r\n\r\n<mat-form-field *ngIf=\"rows != '' && options.length==0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" style=\"padding-right: 20px;\" [ngStyle]=\"{'width':width}\">\r\n<mat-label>{{display}}</mat-label>\r\n<textarea matInput autocomplete=\"off\" [rows]=\"rows\" [(ngModel)]=\"value\" (change)=\"changed()\" (keyup.enter)=\"enterPressed()\" [placeholder]=\"placeholder\" [formControl]=\"control\" [required]=\"required\" [readonly]=\"readonly\"></textarea>\r\n<mat-error *ngIf=\"control.invalid\">{{validate()}}</mat-error>\r\n</mat-form-field>\r\n\r\n\r\n\r\n<!-- Work in progress cant bind to value -->\r\n\r\n <!-- <mat-form-field *ngIf=\"options.length !=0\" hideRequiredMarker=\"true\" [hintLabel]=\"hint\" style=\"padding-right: 20px;\" [ngStyle]=\"{'width':width}\">\r\n <input type=\"text\" autocomplete=\"off\" [placeholder]=\"display\" (change)=\"changed2()\" matInput [formControl]=\"myControl\" [matAutocomplete]=\"auto\" [readonly]=\"readonly\">\r\n <mat-autocomplete #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let row of filteredOptions | async\" [value]=\"row[optionValue]\">\r\n {{row[optionDisplay]}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field> -->\r\n\r\n",
1736
- styles: [""]
1737
- })
1738
- ], TextComponent);
1739
- return TextComponent;
1740
- }());
1741
-
1742
- var SelectComponent = /** @class */ (function () {
1743
- function SelectComponent() {
1744
- this.width = "100%";
1745
- this.readonly = false;
1746
- this.readonlyMode = "";
1747
- this.hint = "";
1748
- this.placeholder = "";
1749
- this.display = "";
1750
- this.value = "";
1751
- this.optionValue = "";
1752
- this.optionDisplay = "";
1753
- this.optionDisplayExtra = "";
1754
- this.valueChange = new EventEmitter();
1755
- }
1756
- SelectComponent.prototype.ngOnInit = function () {
1757
- // this.displayValue = this.options.filter((m) => m.optionValue == this.value)
1758
- // this.displayValue = this.value
1759
- if (this.placeholder == "") {
1760
- this.placeholder = "Select " + this.display;
1761
- }
1762
- };
1763
- SelectComponent.prototype.ngOnChanges = function () {
1764
- var _this = this;
1765
- if (this.readonlyMode != "" && this.options.length > 0) {
1766
- this.displayValue = this.options.filter(function (m) { return m["" + _this.optionValue] == _this.value; })[0]["" + this.optionDisplay];
1767
- }
1768
- };
1769
- SelectComponent.prototype.changed = function () {
1770
- this.valueChange.emit(this.value);
1771
- };
1772
- __decorate([
1773
- Input()
1774
- ], SelectComponent.prototype, "width", void 0);
1775
- __decorate([
1776
- Input()
1777
- ], SelectComponent.prototype, "readonly", void 0);
1778
- __decorate([
1779
- Input()
1780
- ], SelectComponent.prototype, "readonlyMode", void 0);
1781
- __decorate([
1782
- Input()
1783
- ], SelectComponent.prototype, "hint", void 0);
1784
- __decorate([
1785
- Input()
1786
- ], SelectComponent.prototype, "placeholder", void 0);
1787
- __decorate([
1788
- Input()
1789
- ], SelectComponent.prototype, "display", void 0);
1790
- __decorate([
1791
- Input()
1792
- ], SelectComponent.prototype, "value", void 0);
1793
- __decorate([
1794
- Input()
1795
- ], SelectComponent.prototype, "options", void 0);
1796
- __decorate([
1797
- Input()
1798
- ], SelectComponent.prototype, "optionValue", void 0);
1799
- __decorate([
1800
- Input()
1801
- ], SelectComponent.prototype, "optionDisplay", void 0);
1802
- __decorate([
1803
- Input()
1804
- ], SelectComponent.prototype, "optionDisplayExtra", void 0);
1805
- __decorate([
1806
- Output()
1807
- ], SelectComponent.prototype, "valueChange", void 0);
1808
- SelectComponent = __decorate([
1809
- Component({
1810
- selector: 'spa-select',
1811
- template: "\r\n<mat-form-field *ngIf=\"readonlyMode==''\" style=\"padding-right: 20px;\" floatLabel=\"always\" [ngStyle]=\"{'width':width}\">\r\n <mat-label>{{display}}</mat-label>\r\n <mat-select [(value)]=\"value\" (selectionChange)=\"changed()\" [disabled]=\"readonly\" [placeholder]=\"placeholder\" >\r\n <mat-option *ngFor=\"let row of options\" [value]=\"row[optionValue]\">\r\n {{row[optionDisplay]}} <label *ngIf=\"optionDisplayExtra!='' && row[optionDisplayExtra] && row[optionDisplayExtra] != ''\">({{row[optionDisplayExtra]}})</label>\r\n </mat-option>\r\n </mat-select>\r\n <mat-hint *ngIf=\"hint!=''\">{{hint}}</mat-hint>\r\n</mat-form-field>\r\n\r\n<!-- ReadOnlyModes original, text, label -->\r\n<!-- <spa-text *ngIf=\"readonlyMode=='text' && readonly\" [display]=\"display\" [(value)]=\"displayValue\" [readonly]=\"true\" ></spa-text> -->\r\n",
1812
- styles: [""]
1813
- })
1814
- ], SelectComponent);
1815
- return SelectComponent;
1816
- }());
1817
-
1818
- var CheckComponent = /** @class */ (function () {
1819
- function CheckComponent() {
1820
- this.readonly = false;
1821
- this.display = "";
1822
- this.value = false;
1823
- this.valueChange = new EventEmitter();
1824
- this.click = new EventEmitter();
1825
- this.check = new EventEmitter();
1826
- this.uncheck = new EventEmitter();
1827
- }
1828
- CheckComponent.prototype.ngOnInit = function () {
1829
- };
1830
- CheckComponent.prototype.changed = function () {
1831
- this.valueChange.emit(this.value);
1832
- };
1833
- CheckComponent.prototype.clicked = function () {
1834
- this.click.emit();
1835
- if (!this.value) {
1836
- this.checked();
1837
- }
1838
- else {
1839
- this.unchecked();
1840
- }
1841
- };
1842
- CheckComponent.prototype.checked = function () {
1843
- this.check.emit();
1844
- };
1845
- CheckComponent.prototype.unchecked = function () {
1846
- this.uncheck.emit();
1847
- };
1848
- __decorate([
1849
- Input()
1850
- ], CheckComponent.prototype, "readonly", void 0);
1851
- __decorate([
1852
- Input()
1853
- ], CheckComponent.prototype, "display", void 0);
1854
- __decorate([
1855
- Input()
1856
- ], CheckComponent.prototype, "value", void 0);
1857
- __decorate([
1858
- Output()
1859
- ], CheckComponent.prototype, "valueChange", void 0);
1860
- __decorate([
1861
- Output()
1862
- ], CheckComponent.prototype, "click", void 0);
1863
- __decorate([
1864
- Output()
1865
- ], CheckComponent.prototype, "check", void 0);
1866
- __decorate([
1867
- Output()
1868
- ], CheckComponent.prototype, "uncheck", void 0);
1869
- CheckComponent = __decorate([
1870
- Component({
1871
- selector: 'spa-check',
1872
- template: " <mat-checkbox color=\"primary\" style=\"margin-right:50px; font-size:14px\" [(ngModel)]=\"value\" (change)=\"changed()\" (click)=\"clicked()\" [disabled]=\"readonly\">{{display}}</mat-checkbox>\r\n",
1873
- styles: [""]
1874
- })
1875
- ], CheckComponent);
1876
- return CheckComponent;
1877
- }());
1878
-
1879
- var AttachComponent = /** @class */ (function () {
1880
- function AttachComponent() {
1881
- this.message = "Drag and drop files here";
1882
- this.files = [];
1883
- this.filesChange = new EventEmitter();
1884
- this.upload = new EventEmitter();
1885
- this.enableUpload = false;
1886
- }
1887
- AttachComponent.prototype.ngOnInit = function () {
1888
- };
1889
- /**
1890
- * on file drop handler
1891
- */
1892
- AttachComponent.prototype.onFileDropped = function ($event) {
1893
- this.prepareFilesList($event);
1894
- };
1895
- /**
1896
- * handle file from browsing
1897
- */
1898
- AttachComponent.prototype.fileBrowseHandler = function (files) {
1899
- this.prepareFilesList(files);
1900
- };
1901
- /**
1902
- * Delete file from files list
1903
- * @param index (File index)
1904
- */
1905
- AttachComponent.prototype.deleteFile = function (index) {
1906
- this.files.splice(index, 1);
1907
- };
1908
- /**
1909
- * Simulate the upload process
1910
- */
1911
- // uploadFilesSimulator(index: number) {
1912
- // setTimeout(() => {
1913
- // if (index === this.files.length) {
1914
- // return;
1915
- // } else {
1916
- // const progressInterval = setInterval(() => {
1917
- // if (this.files[index].progress === 100) {
1918
- // clearInterval(progressInterval);
1919
- // this.uploadFilesSimulator(index + 1);
1920
- // } else {
1921
- // this.files[index].progress += 5;
1922
- // }
1923
- // }, 200);
1924
- // }
1925
- // }, 1000);
1926
- // }
1927
- /**
1928
- * Convert Files list to normal array list
1929
- * @param files (Files List)
1930
- */
1931
- AttachComponent.prototype.prepareFilesList = function (files) {
1932
- var e_1, _a;
1933
- try {
1934
- for (var files_1 = __values(files), files_1_1 = files_1.next(); !files_1_1.done; files_1_1 = files_1.next()) {
1935
- var item = files_1_1.value;
1936
- item.progress = 0;
1937
- this.files.push(item);
1938
- }
1939
- }
1940
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1941
- finally {
1942
- try {
1943
- if (files_1_1 && !files_1_1.done && (_a = files_1.return)) _a.call(files_1);
1944
- }
1945
- finally { if (e_1) throw e_1.error; }
1946
- }
1947
- // this.uploadFilesSimulator(0);
1948
- };
1949
- /**
1950
- * format bytes
1951
- * @param bytes (File size in bytes)
1952
- * @param decimals (Decimals point)
1953
- */
1954
- AttachComponent.prototype.formatBytes = function (bytes, decimals) {
1955
- if (bytes === 0) {
1956
- return '0 Bytes';
1957
- }
1958
- var k = 1024;
1959
- var dm = decimals <= 0 ? 0 : decimals || 2;
1960
- var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
1961
- var i = Math.floor(Math.log(bytes) / Math.log(k));
1962
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
1963
- };
1964
- AttachComponent.prototype.uploaded = function () {
1965
- this.upload.emit();
1966
- };
1967
- AttachComponent.prototype.filesChanged = function () {
1968
- this.filesChange.emit(this.files);
1969
- };
1970
- __decorate([
1971
- Input()
1972
- ], AttachComponent.prototype, "message", void 0);
1973
- __decorate([
1974
- Input()
1975
- ], AttachComponent.prototype, "files", void 0);
1976
- __decorate([
1977
- Output()
1978
- ], AttachComponent.prototype, "filesChange", void 0);
1979
- __decorate([
1980
- Output()
1981
- ], AttachComponent.prototype, "upload", void 0);
1982
- __decorate([
1983
- Input()
1984
- ], AttachComponent.prototype, "enableUpload", void 0);
1985
- AttachComponent = __decorate([
1986
- Component({
1987
- selector: 'spa-attach',
1988
- template: "<div class=\"tin-input-row\" style=\"width: 100%;\">\r\n\r\n <div class=\"col\">\r\n <div class=\"container\" appDnd (fileDropped)=\"onFileDropped($event)\">\r\n <input type=\"file\" #fileDropRef id=\"fileDropRef\" multiple (change)=\"fileBrowseHandler($event.target.files)\" />\r\n <h4>{{message}}</h4>\r\n <h4>or</h4>\r\n <label for=\"fileDropRef\">Click to Browse</label>\r\n </div>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <div class=\"files-list \">\r\n <div class=\"single-file \" style=\"width: 100%;\" *ngFor=\"let file of files; let i = index\">\r\n\r\n <div class=\"tin-input-row info\" >\r\n <h4 class=\"name\">\r\n {{ file?.name }}\r\n </h4>\r\n <p class=\"size\">\r\n {{ formatBytes(file?.size, 2) }}\r\n </p>\r\n </div>\r\n\r\n <div class=\"delete\" (click)=\"deleteFile(i)\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"18\" viewBox=\"0 0 14 18\">\r\n <path fill=\"#B1B1B1\" fill-rule=\"nonzero\"\r\n d=\"M1 16c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H3c-1.1 0-2 .9-2 2v10zm3.17-7.83a.996.996 0 0 1 1.41 0L7 9.59l1.42-1.42a.996.996 0 1 1 1.41 1.41L8.41 11l1.42 1.42a.996.996 0 1 1-1.41 1.41L7 12.41l-1.42 1.42a.996.996 0 1 1-1.41-1.41L5.59 11 4.17 9.58a.996.996 0 0 1 0-1.41zM10.5 1L9.79.29C9.61.11 9.35 0 9.09 0H4.91c-.26 0-.52.11-.7.29L3.5 1H1c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1h-2.5z\" />\r\n </svg>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"files.length > 0 && enableUpload\" class=\"tin-input-row d-flex justify-content-center\" style=\"width: 100%;\" >\r\n <button mat-button color=\"primary\" (click)=\"uploaded()\" matTooltip=\"Upload New Documents\" matTooltipPosition=\"above\" ><mat-icon>file_upload</mat-icon> Upload</button>\r\n </div>\r\n </div>\r\n\r\n</div>\r\n",
1989
- styles: [".container{width:100%;height:200px;padding:2rem;text-align:center;border:2px dashed #2a7b94;position:relative;margin:0 auto}.container input{opacity:0;position:absolute;z-index:2;width:100%;height:100%;top:0;left:0}.container label{color:#fff;width:183px;height:44px;border-radius:21.5px;background-color:#db202f;padding:8px 16px}.container h3{font-size:20px;font-weight:600;color:#38424c}.fileover{-webkit-animation:1s infinite shake;animation:1s infinite shake}.files-list{margin-top:1.5rem}.files-list .single-file{display:flex;padding:.5rem;justify-content:space-between;align-items:center;border:1px dashed #1c824d;margin-bottom:1rem;margin-right:1rem;display:flex;flex-grow:1}.files-list .single-file .delete{display:flex;margin-left:.5rem;cursor:pointer;align-self:flex-end}.files-list .single-file .name{font-size:14px;font-weight:500;color:#353f4a;margin:0}.files-list .single-file .size{font-size:12px;font-weight:500;color:#a4a4a4;margin:0 0 0 1rem}.files-list .single-file .info{width:100%}@-webkit-keyframes shake{0%{transform:translate(1px,1px) rotate(0)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px,0) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0)}100%{transform:translate(1px,-2px) rotate(-1deg)}}@keyframes shake{0%{transform:translate(1px,1px) rotate(0)}10%{transform:translate(-1px,-2px) rotate(-1deg)}20%{transform:translate(-3px,0) rotate(1deg)}30%{transform:translate(3px,2px) rotate(0)}40%{transform:translate(1px,-1px) rotate(1deg)}50%{transform:translate(-1px,2px) rotate(-1deg)}60%{transform:translate(-3px,1px) rotate(0)}70%{transform:translate(3px,1px) rotate(-1deg)}80%{transform:translate(-1px,-1px) rotate(1deg)}90%{transform:translate(1px,2px) rotate(0)}100%{transform:translate(1px,-2px) rotate(-1deg)}}"]
1990
- })
1991
- ], AttachComponent);
1992
- return AttachComponent;
1993
- }());
1994
-
1995
- var DatetimeComponent = /** @class */ (function () {
1996
- function DatetimeComponent() {
1997
- this.display = "";
1998
- this.value = "";
1999
- this.valueChange = new EventEmitter();
2000
- this.readonly = false;
2001
- this.min = "01 jan 1900";
2002
- this.max = "31 dec 9999";
2003
- }
2004
- DatetimeComponent.prototype.ngOnInit = function () {
2005
- };
2006
- DatetimeComponent.prototype.changed = function () {
2007
- this.valueChange.emit(this.value);
2008
- };
2009
- __decorate([
2010
- Input()
2011
- ], DatetimeComponent.prototype, "display", void 0);
2012
- __decorate([
2013
- Input()
2014
- ], DatetimeComponent.prototype, "value", void 0);
2015
- __decorate([
2016
- Output()
2017
- ], DatetimeComponent.prototype, "valueChange", void 0);
2018
- __decorate([
2019
- Input()
2020
- ], DatetimeComponent.prototype, "readonly", void 0);
2021
- __decorate([
2022
- Input()
2023
- ], DatetimeComponent.prototype, "min", void 0);
2024
- __decorate([
2025
- Input()
2026
- ], DatetimeComponent.prototype, "max", void 0);
2027
- DatetimeComponent = __decorate([
2028
- Component({
2029
- selector: 'spa-datetime',
2030
- template: "<mat-form-field style=\"width:150px;margin-right:20px\">\r\n<mat-label>{{display}}</mat-label>\r\n<input matInput autocomplete=\"off\" type=\"datetime-local\" [(ngModel)]=\"value\" [min]=\"min\" [max]=\"max\" (change)=\"changed()\" [placeholder]=\"display\" [readonly]=\"readonly\" />\r\n</mat-form-field>\r\n",
2031
- styles: [""]
2032
- })
2033
- ], DatetimeComponent);
2034
- return DatetimeComponent;
2035
- }());
2036
-
2037
- // import { CurrencyPipe } from '@angular/common';
2038
- // import { Core } from 'tin-core';
2039
- var MoneyComponent = /** @class */ (function () {
2040
- function MoneyComponent() {
2041
- this.readonly = false;
2042
- this.display = "";
2043
- this.value = "";
2044
- this.valueChange = new EventEmitter();
2045
- this.width = "100%";
2046
- this.hint = "";
2047
- this.currency = "$";
2048
- }
2049
- MoneyComponent.prototype.ngOnInit = function () {
2050
- };
2051
- MoneyComponent.prototype.ngOnChanges = function () {
2052
- };
2053
- MoneyComponent.prototype.changed = function () {
2054
- this.valueChange.emit(this.value);
2055
- };
2056
- __decorate([
2057
- Input()
2058
- ], MoneyComponent.prototype, "readonly", void 0);
2059
- __decorate([
2060
- Input()
2061
- ], MoneyComponent.prototype, "display", void 0);
2062
- __decorate([
2063
- Input()
2064
- ], MoneyComponent.prototype, "value", void 0);
2065
- __decorate([
2066
- Output()
2067
- ], MoneyComponent.prototype, "valueChange", void 0);
2068
- __decorate([
2069
- Input()
2070
- ], MoneyComponent.prototype, "width", void 0);
2071
- __decorate([
2072
- Input()
2073
- ], MoneyComponent.prototype, "hint", void 0);
2074
- __decorate([
2075
- Input()
2076
- ], MoneyComponent.prototype, "currency", void 0);
2077
- MoneyComponent = __decorate([
2078
- Component({
2079
- selector: 'spa-money',
2080
- template: "\r\n<div class=\"tin-input-row\">\r\n\r\n<Label>{{currency}}</Label>\r\n<mat-form-field [hintLabel]=\"hint\" style=\"padding-right: 20px;\" [ngStyle]=\"{'width':width}\" >\r\n <mat-label>{{display}}</mat-label>\r\n <!-- <span>$</span> -->\r\n <input matInput class=\"example-right-align\" autocomplete=\"off\" type=\"number\" min=\"0.00\" step=\"0.01\" [(ngModel)]=\"value \" [placeholder]=\"display\" (change)=\"changed()\" [readonly]=\"readonly\" />\r\n<!-- <span matTextSuffix>.00</span> -->\r\n</mat-form-field>\r\n</div>\r\n\r\n\r\n\r\n\r\n",
2081
- styles: ["input.example-right-align{-moz-appearance:textfield}.example-right-align{text-align:right}input.example-right-align::-webkit-inner-spin-button,input.example-right-align::-webkit-outer-spin-button{display:none}.curr{background-color:red}"]
2082
- })
2083
- ], MoneyComponent);
2084
- return MoneyComponent;
2085
- }());
2086
-
2087
- var DndDirective = /** @class */ (function () {
2088
- function DndDirective() {
2089
- this.fileDropped = new EventEmitter();
2090
- }
2091
- // Dragover listener
2092
- DndDirective.prototype.onDragOver = function (evt) {
2093
- evt.preventDefault();
2094
- evt.stopPropagation();
2095
- this.fileOver = true;
2096
- };
2097
- // Dragleave listener
2098
- DndDirective.prototype.onDragLeave = function (evt) {
2099
- evt.preventDefault();
2100
- evt.stopPropagation();
2101
- this.fileOver = false;
2102
- };
2103
- // Drop listener
2104
- DndDirective.prototype.ondrop = function (evt) {
2105
- evt.preventDefault();
2106
- evt.stopPropagation();
2107
- this.fileOver = false;
2108
- var files = evt.dataTransfer.files;
2109
- if (files.length > 0) {
2110
- this.fileDropped.emit(files);
2111
- }
2112
- };
2113
- __decorate([
2114
- HostBinding('class.fileover')
2115
- ], DndDirective.prototype, "fileOver", void 0);
2116
- __decorate([
2117
- Output()
2118
- ], DndDirective.prototype, "fileDropped", void 0);
2119
- __decorate([
2120
- HostListener('dragover', ['$event'])
2121
- ], DndDirective.prototype, "onDragOver", null);
2122
- __decorate([
2123
- HostListener('dragleave', ['$event'])
2124
- ], DndDirective.prototype, "onDragLeave", null);
2125
- __decorate([
2126
- HostListener('drop', ['$event'])
2127
- ], DndDirective.prototype, "ondrop", null);
2128
- DndDirective = __decorate([
2129
- Directive({
2130
- selector: '[appDnd]'
2131
- })
2132
- ], DndDirective);
2133
- return DndDirective;
2134
- }());
2135
-
2136
- var ChipsComponent = /** @class */ (function () {
2137
- function ChipsComponent(messageService) {
2138
- this.messageService = messageService;
2139
- this.icon = "";
2140
- this.removable = false;
2141
- this.addable = false;
2142
- // @Output() chipClick = new EventEmitter();
2143
- this.click = new EventEmitter();
2144
- this.remove = new EventEmitter();
2145
- }
2146
- ChipsComponent.prototype.ngOnInit = function () {
2147
- };
2148
- ChipsComponent.prototype.clicked = function (chip) {
2149
- if (typeof chip != 'string') {
2150
- return;
2151
- }
2152
- if (chip) {
2153
- this.click.emit(chip);
2154
- }
2155
- };
2156
- ChipsComponent.prototype.removed = function (chip) {
2157
- // const index = this.chips.indexOf(chip);
2158
- var _this = this;
2159
- // if (index >= 0) {
2160
- // this.chips.splice(index, 1);
2161
- // }
2162
- this.messageService.confirm("Remove " + chip + " ?").subscribe(function (result) {
2163
- if (result == "yes") {
2164
- _this.remove.emit(chip);
2165
- }
2166
- ;
2167
- });
2168
- };
2169
- ChipsComponent.ctorParameters = function () { return [
2170
- { type: MessageService }
2171
- ]; };
2172
- __decorate([
2173
- Input()
2174
- ], ChipsComponent.prototype, "icon", void 0);
2175
- __decorate([
2176
- Input()
2177
- ], ChipsComponent.prototype, "removable", void 0);
2178
- __decorate([
2179
- Input()
2180
- ], ChipsComponent.prototype, "addable", void 0);
2181
- __decorate([
2182
- Input()
2183
- ], ChipsComponent.prototype, "chips", void 0);
2184
- __decorate([
2185
- Output()
2186
- ], ChipsComponent.prototype, "click", void 0);
2187
- __decorate([
2188
- Output()
2189
- ], ChipsComponent.prototype, "remove", void 0);
2190
- ChipsComponent = __decorate([
2191
- Component({
2192
- selector: 'spa-chips',
2193
- template: "\r\n\r\n\r\n<div class=\"row mt-1\" style=\"margin-left: 1em;\">\r\n <mat-chip-list #chipList >\r\n <mat-chip *ngFor=\"let chip of chips let i = index\" selectable [removable]=\"removable\" style=\"font-size: 12px;\" [ngStyle]=\"{'padding-right': removable ? '5px':'12px'}\" (click)=\"clicked(chip)\" >\r\n <mat-icon *ngIf=\"icon != ''\" color=\"primary\" style=\"font-size: 22px;\">{{icon}}</mat-icon>\r\n\r\n {{chip}}\r\n\r\n <mat-icon *ngIf=\"removable\" style=\"font-size: 20px; margin-left: 5px;margin-top: 3px;margin-right: 0px; color: grey;\" (click)=\"removed(chip)\">cancel</mat-icon>\r\n </mat-chip>\r\n </mat-chip-list>\r\n</div>\r\n\r\n\r\n",
2194
- styles: [""]
2195
- })
2196
- ], ChipsComponent);
2197
- return ChipsComponent;
2198
- }());
2199
-
2200
- var ActivityComponent = /** @class */ (function () {
2201
- function ActivityComponent() {
2202
- this.notes = new Array();
2203
- this.notesMessage = "Empty";
2204
- this.title = "Notes";
2205
- }
2206
- ActivityComponent.prototype.ngOnInit = function () {
2207
- };
2208
- __decorate([
2209
- Input()
2210
- ], ActivityComponent.prototype, "notes", void 0);
2211
- __decorate([
2212
- Input()
2213
- ], ActivityComponent.prototype, "title", void 0);
2214
- ActivityComponent = __decorate([
2215
- Component({
2216
- selector: 'spa-activity',
2217
- template: "\r\n <div class=\"tin-input-row mt-3\" *ngIf=\"title != ''\">\r\n <mat-label style=\"font-size: 20px; font-weight: 300\" > {{title}}</mat-label >\r\n </div>\r\n\r\n <ul *ngIf=\"notes && notes.length>0\" class=\"list-group list-group-flush\" style=\"max-height:350px; margin-left:5px\">\r\n\r\n <li *ngFor=\"let note of notes\" class=\"list-group-item list-group-item-action flex-column align-items-start\">\r\n <div class=\"d-flex w-100 justify-content-between\">\r\n <div class=\"mb-0\">{{note.createdByName}}</div>\r\n <!-- <small class=\"text-muted\">{{note.expr1}} ago</small> -->\r\n </div>\r\n\r\n <small>{{note.details}} (<em>{{note.createdDate | date: 'dd MMM yyyy HH:mm'}}</em>) </small>\r\n </li>\r\n\r\n\r\n </ul>\r\n\r\n <div *ngIf=\"notes && notes.length==0\" class=\"d-flex justify-content-center row align-items-center\" style=\"max-height:200px\">\r\n\r\n No {{title.toLowerCase()}}\r\n\r\n </div>\r\n",
2218
- styles: [""]
2219
- })
2220
- ], ActivityComponent);
2221
- return ActivityComponent;
2222
- }());
2223
-
2224
- var OptionComponent = /** @class */ (function () {
2225
- function OptionComponent() {
2226
- this.optionValue = "";
2227
- this.optionDisplay = "";
2228
- this.readonly = false;
2229
- this.value = "";
2230
- this.display = "";
2231
- this.show = false;
2232
- this.valueChange = new EventEmitter();
2233
- this.enterPress = new EventEmitter();
2234
- }
2235
- OptionComponent.prototype.ngOnInit = function () {
2236
- this.OGValue = this.value;
2237
- };
2238
- OptionComponent.prototype.changed = function () {
2239
- this.valueChange.emit(this.value);
2240
- };
2241
- OptionComponent.prototype.enterPressed = function () {
2242
- this.valueChange.emit();
2243
- };
2244
- OptionComponent.prototype.resetValue = function () {
2245
- this.value = this.OGValue;
2246
- this.changed();
2247
- };
2248
- __decorate([
2249
- Input()
2250
- ], OptionComponent.prototype, "options", void 0);
2251
- __decorate([
2252
- Input()
2253
- ], OptionComponent.prototype, "optionValue", void 0);
2254
- __decorate([
2255
- Input()
2256
- ], OptionComponent.prototype, "optionDisplay", void 0);
2257
- __decorate([
2258
- Input()
2259
- ], OptionComponent.prototype, "readonly", void 0);
2260
- __decorate([
2261
- Input()
2262
- ], OptionComponent.prototype, "value", void 0);
2263
- __decorate([
2264
- Input()
2265
- ], OptionComponent.prototype, "display", void 0);
2266
- __decorate([
2267
- Input()
2268
- ], OptionComponent.prototype, "show", void 0);
2269
- __decorate([
2270
- Output()
2271
- ], OptionComponent.prototype, "valueChange", void 0);
2272
- __decorate([
2273
- Output()
2274
- ], OptionComponent.prototype, "enterPress", void 0);
2275
- OptionComponent = __decorate([
2276
- Component({
2277
- selector: 'spa-option',
2278
- template: "\r\n<mat-checkbox color=\"primary\" style=\"margin-right:5px\" [(ngModel)]=\"show\" (change)=\"resetValue()\" labelPosition=\"after\">{{display}}</mat-checkbox>\r\n\r\n\r\n<mat-form-field style=\"margin-right:10px;width: 0px;\" >\r\n<input matInput />\r\n</mat-form-field>\r\n\r\n\r\n<mat-form-field style=\"margin-right:30px\" *ngIf=\"show && !options\">\r\n<mat-label>{{display}}</mat-label>\r\n<input matInput [(ngModel)]=\"value\" width=\"100\" (change)=\"changed()\" (keyup.enter)=\"changed()\" [placeholder]=\"'Enter ' + display\" autocomplete=\"off\" />\r\n</mat-form-field>\r\n\r\n\r\n<mat-form-field style=\"margin-right: 20px;\" floatLabel=\"always\" width=\"100\" *ngIf=\"show && options\">\r\n <mat-label>{{display}}</mat-label>\r\n <mat-select [(value)]=\"value\" (selectionChange)=\"changed()\" [placeholder]=\"'Select ' + display\" [disabled]=\"readonly\" >\r\n <mat-option *ngFor=\"let row of options\" [value]=\"row[optionValue]\">\r\n {{row[optionDisplay]}}\r\n </mat-option>\r\n </mat-select>\r\n</mat-form-field>\r\n\r\n<!-- <spa-text *ngIf=\"show\" style=\"margin-right:30px\" [display]=\"'Enter ' + display\" (enterPress)=\"enterPressed()\" (valueChange)=\"changed($event.target.value)\" width=\"100\" [required]=\"false\" [(value)]=\"value\" ></spa-text> -->\r\n\r\n",
2279
- styles: [""]
2280
- })
2281
- ], OptionComponent);
2282
- return OptionComponent;
2283
- }());
2284
-
2285
- var LabelComponent = /** @class */ (function () {
2286
- function LabelComponent() {
2287
- this.display = "";
2288
- this.value = "";
2289
- this.format = "text";
2290
- }
2291
- LabelComponent.prototype.ngOnInit = function () {
2292
- };
2293
- __decorate([
2294
- Input()
2295
- ], LabelComponent.prototype, "display", void 0);
2296
- __decorate([
2297
- Input()
2298
- ], LabelComponent.prototype, "value", void 0);
2299
- __decorate([
2300
- Input()
2301
- ], LabelComponent.prototype, "format", void 0);
2302
- LabelComponent = __decorate([
2303
- Component({
2304
- selector: 'spa-label',
2305
- template: "<div *ngIf=\"format=='text'\">\r\n <label style=\"font-weight: 500\" >{{display}}: </label> &nbsp; <label>{{value}} </label> &nbsp;\r\n</div>\r\n\r\n<div *ngIf=\"format=='date'\">\r\n <label style=\"font-weight: 500\" >{{display}}: </label> &nbsp; <label>{{value | date:'dd/MM/yyyy'}} </label> &nbsp;\r\n</div>\r\n\r\n<div *ngIf=\"format=='datetime'\">\r\n <label style=\"font-weight: 500\" >{{display}}: </label> &nbsp; <label>{{value | date:'dd/MM/yyyy HH:mm'}} </label> &nbsp;\r\n</div>\r\n\r\n",
2306
- styles: [""]
2307
- })
2308
- ], LabelComponent);
2309
- return LabelComponent;
2310
- }());
2311
-
2312
- var ɵ0$1 = { displayDefaultIndicatorType: false };
2313
- var StepsComponent = /** @class */ (function () {
2314
- function StepsComponent() {
2315
- this.value = "";
2316
- }
2317
- StepsComponent.prototype.ngOnInit = function () {
2318
- };
2319
- StepsComponent.prototype.ngAfterViewInit = function () {
2320
- };
2321
- StepsComponent.prototype.ngOnChanges = function () {
2322
- this.pushSteps();
2323
- };
2324
- StepsComponent.prototype.setStepper = function () {
2325
- if (this.value == "")
2326
- return;
2327
- this.stepper.selectedIndex = 0;
2328
- switch (this.value) {
2329
- case "Draft":
2330
- this.stepper.selectedIndex = 0;
2331
- break;
2332
- case "Head Approval":
2333
- this.pushStepper(1);
2334
- break;
2335
- case "CE Approval":
2336
- this.pushStepper(2);
2337
- break;
2338
- case "Booking":
2339
- this.pushStepper(3);
2340
- break;
2341
- case "BTA Approval":
2342
- this.pushStepper(4);
2343
- break;
2344
- case "Travel":
2345
- this.pushStepper(5);
2346
- break;
2347
- case "BTR Approval":
2348
- this.pushStepper(6);
2349
- break;
2350
- case "Travel Closure":
2351
- this.pushStepper(7);
2352
- break;
2353
- }
2354
- };
2355
- StepsComponent.prototype.pushStepper = function (count) {
2356
- for (var index = 0; index < count + 1; index++) {
2357
- // const element = array[index];
2358
- this.stepper.selectedIndex = index;
2359
- }
2360
- };
2361
- StepsComponent.prototype.pushSteps = function () {
2362
- var e_1, _a;
2363
- if (this.steps.length == 0)
2364
- return;
2365
- if (this.value == "")
2366
- return;
2367
- this.stepper.selectedIndex = 0;
2368
- var i = 0;
2369
- try {
2370
- for (var _b = __values(this.steps), _c = _b.next(); !_c.done; _c = _b.next()) {
2371
- var step = _c.value;
2372
- if (step.name != this.value) {
2373
- this.stepper.selectedIndex = i;
2374
- i++;
2375
- }
2376
- else {
2377
- this.stepper.selectedIndex = i;
2378
- break;
2379
- }
2380
- }
2381
- }
2382
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2383
- finally {
2384
- try {
2385
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2386
- }
2387
- finally { if (e_1) throw e_1.error; }
2388
- }
2389
- };
2390
- __decorate([
2391
- ViewChild('stepper')
2392
- ], StepsComponent.prototype, "stepper", void 0);
2393
- __decorate([
2394
- Input()
2395
- ], StepsComponent.prototype, "value", void 0);
2396
- __decorate([
2397
- Input()
2398
- ], StepsComponent.prototype, "steps", void 0);
2399
- StepsComponent = __decorate([
2400
- Component({
2401
- selector: 'spa-steps',
2402
- template: "\r\n\r\n\r\n<!-- <mat-horizontal-stepper class=\"test\" labelPosition=\"bottom\" #stepper>\r\n <mat-step [editable]=\"false\" label=\"Draft\"> </mat-step>\r\n <mat-step [editable]=\"false\" label=\"Head Approval\" > </mat-step>\r\n <mat-step [editable]=\"false\" label=\"CE Approval\"> </mat-step>\r\n <mat-step [editable]=\"false\" label=\"Booking\" state=\"booking\"> </mat-step>\r\n <mat-step [editable]=\"false\" label=\"BTA Approval\"> </mat-step>\r\n <mat-step [editable]=\"false\" label=\"Travel\"> </mat-step>\r\n <mat-step [editable]=\"false\" label=\"BTR Approval\"> </mat-step>\r\n <mat-step [editable]=\"false\" label=\"Closure\"> </mat-step>\r\n <ng-template matStepperIcon=\"booking\"> <mat-icon>forum</mat-icon> </ng-template>\r\n</mat-horizontal-stepper> -->\r\n\r\n<mat-horizontal-stepper class=\"transparent\" labelPosition=\"bottom\" #stepper>\r\n\r\n <mat-step *ngFor=\"let row of steps\"\r\n [editable]=\"false\" [label]=\"row.name\">\r\n </mat-step>\r\n\r\n <!-- <ng-template *ngFor=\"let row of steps\"\r\n [matStepperIcon]=\"row.name\"> <mat-icon>{{row.icon}}</mat-icon>\r\n </ng-template> -->\r\n\r\n <!-- <ng-template matStepperIcon=\"booking\">\r\n <mat-icon>call_end</mat-icon>\r\n </ng-template> -->\r\n\r\n <!-- <ng-template ngFor let-xb [ngForOf]=\"steps\" matStepperIcon=\"Booking\"> <mat-icon>forum</mat-icon>\r\n\r\n </ng-template> -->\r\n\r\n</mat-horizontal-stepper>\r\n",
2403
- providers: [{
2404
- provide: STEPPER_GLOBAL_OPTIONS, useValue: ɵ0$1
2405
- }],
2406
- styles: [".transparent{background-color:rgba(0,0,0,0)}:host ::ng-deep.mat-step-header{padding:5px!important}:host ::ng-deep.mat-stepper-horizontal-line{min-width:5px!important}:host ::ng-deep .mat-horizontal-content-container{padding:0!important}:host ::ng-deep .mat-horizontal-stepper-header{pointer-events:none!important}"]
2407
- })
2408
- ], StepsComponent);
2409
- return StepsComponent;
2410
- }());
2411
-
2412
- var FilterComponent = /** @class */ (function () {
2413
- function FilterComponent() {
2414
- this.data = new MatTableDataSource();
2415
- this.refreshClick = new EventEmitter();
2416
- this._filterText = "";
2417
- }
2418
- FilterComponent.prototype.ngOnInit = function () {
2419
- };
2420
- FilterComponent.prototype.ngOnChanges = function () {
2421
- // console.log("OnChange")
2422
- this.applyFilter(this._filterText);
2423
- };
2424
- ;
2425
- FilterComponent.prototype.applyFilter = function (filterValue) {
2426
- if (this.data) {
2427
- this.data.filter = filterValue.trim().toLowerCase();
2428
- }
2429
- };
2430
- FilterComponent.prototype.refreshClicked = function () {
2431
- this.refreshClick.emit();
2432
- };
2433
- __decorate([
2434
- Input()
2435
- ], FilterComponent.prototype, "data", void 0);
2436
- __decorate([
2437
- Output()
2438
- ], FilterComponent.prototype, "refreshClick", void 0);
2439
- FilterComponent = __decorate([
2440
- Component({
2441
- selector: 'spa-filter',
2442
- template: "<mat-form-field style=\"font-size:12px\">\r\n <mat-label>Filter</mat-label>\r\n <input id=\"txtFilter\" matInput [(ngModel)]=\"_filterText\" (keyup)=\"applyFilter($event.target.value)\" placeholder=\"Enter Filter text\" autocomplete=\"off\">\r\n</mat-form-field>\r\n\r\n<button id=\"btnFilter\" mat-mini-fab color=\"primary\" matTooltip=\"Refresh Data\" matTooltipPosition=\"above\" (click)=\"refreshClicked()\" style=\"margin-right:1em;margin-top:5px\"><mat-icon class=\"refreshIcon\">refresh</mat-icon></button>\r\n",
2443
- styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}"]
2444
- })
2445
- ], FilterComponent);
2446
- return FilterComponent;
2447
- }());
2448
-
2449
- var TinSpaModule = /** @class */ (function () {
2450
- function TinSpaModule() {
2451
- }
2452
- TinSpaModule = __decorate([
2453
- NgModule({
2454
- declarations: [DndDirective, TinSpaComponent, messageDialog, NavMenuComponent, LoaderComponent,
2455
- TimeoutComponent, TableComponent, TilesComponent, DateComponent, TextComponent,
2456
- SelectComponent, CheckComponent, AttachComponent, DatetimeComponent,
2457
- MoneyComponent,
2458
- ChipsComponent,
2459
- ActivityComponent, OptionComponent, LabelComponent, StepsComponent, FilterComponent],
2460
- entryComponents: [messageDialog],
2461
- imports: [
2462
- ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: "never" }),
2463
- CommonModule,
2464
- FormsModule,
2465
- ReactiveFormsModule,
2466
- SpaMatModule,
2467
- MomentModule,
2468
- // NgxDocViewerModule,
2469
- // AngularEditorModule,
2470
- NgIdleKeepaliveModule.forRoot()
2471
- ],
2472
- exports: [
2473
- CommonModule,
2474
- FormsModule,
2475
- SpaMatModule,
2476
- TinSpaComponent,
2477
- messageDialog,
2478
- NavMenuComponent,
2479
- LoaderComponent,
2480
- TimeoutComponent,
2481
- TableComponent,
2482
- TilesComponent,
2483
- DateComponent,
2484
- SelectComponent,
2485
- TextComponent,
2486
- DatetimeComponent,
2487
- CheckComponent,
2488
- AttachComponent,
2489
- MoneyComponent,
2490
- ChipsComponent,
2491
- ActivityComponent,
2492
- OptionComponent,
2493
- LabelComponent,
2494
- StepsComponent,
2495
- FilterComponent
2496
- ],
2497
- providers: [
2498
- { provide: HTTP_INTERCEPTORS, useClass: LoaderInterceptor, multi: true },
2499
- { provide: LocationStrategy, useClass: HashLocationStrategy }
2500
- ],
2501
- })
2502
- ], TinSpaModule);
2503
- return TinSpaModule;
2504
- }());
2505
-
2506
- var LoginComponent = /** @class */ (function () {
2507
- function LoginComponent(httpService, storageService, router, messageService, dataService, authService, logService, route) {
2508
- this.httpService = httpService;
2509
- this.storageService = storageService;
2510
- this.router = router;
2511
- this.messageService = messageService;
2512
- this.dataService = dataService;
2513
- this.authService = authService;
2514
- this.logService = logService;
2515
- this.route = route;
2516
- this.user = new User();
2517
- this.hide = true;
2518
- this.isProcessing = false;
2519
- this.appConfig = new AppConfig();
2520
- }
2521
- LoginComponent.prototype.ngOnInit = function () {
2522
- var _this = this;
2523
- this.authService.Updateloggedin(false);
2524
- this.authService.UpdateRole(null);
2525
- this.storageService.clear();
2526
- this.dataService.appConfigObserv.subscribe(function (x) { return _this.appConfig = x; });
2527
- if (this.route.snapshot.queryParams.redirectTo != undefined) {
2528
- this.redirectPath = this.route.snapshot.queryParams.redirectTo;
2529
- }
2530
- else {
2531
- this.redirectPath = "home";
2532
- }
2533
- };
2534
- LoginComponent.prototype.signup = function () {
2535
- this.router.navigate(["signup"]);
2536
- };
2537
- LoginComponent.prototype.recoverAccount = function () {
2538
- this.router.navigate(["recover-account"]);
2539
- };
2540
- LoginComponent.prototype.login = function () {
2541
- var _this = this;
2542
- if (this.user.userName == "" || this.user.password == "") {
2543
- this.messageService.toast("Please enter your credentials");
2544
- return;
2545
- }
2546
- this.logService.info("logging in");
2547
- this.isProcessing = true;
2548
- this.user.userName = this.user.userName;
2549
- this.dataService.Login(this.user).subscribe(function (apiResponse) {
2550
- _this.isProcessing = false;
2551
- if (apiResponse.success) {
2552
- if (apiResponse.data.authType == 'local' && !_this.appConfig.localAuth) {
2553
- _this.messageService.toast("Contact Admin: Authentication Type error");
2554
- return;
2555
- }
2556
- if (apiResponse.data.authType == 'AD' && !_this.appConfig.ADAuth) {
2557
- _this.messageService.toast("Contact Admin: Authentication Type error");
2558
- return;
2559
- }
2560
- _this.authService.Updateloggedin(true);
2561
- _this.authService.UpdateToken(apiResponse.data.token);
2562
- _this.storageService.store(Constants.AUTH_TOKEN, apiResponse.data.token);
2563
- _this.authService.UpdateTokenExpire(apiResponse.data.expiration);
2564
- _this.storageService.store(Constants.AUTH_TOKEN_EXPIRE, apiResponse.data.expiration);
2565
- _this.authService.UpdateCurrentUser(_this.user.userName);
2566
- _this.storageService.store(Constants.AUTH_USER, _this.user.userName);
2567
- _this.authService.updateLoggedUserFullName(apiResponse.data.firstName);
2568
- _this.storageService.store(Constants.AUTH_NAME, apiResponse.data.firstName);
2569
- _this.authService.UpdateRole(apiResponse.data.role);
2570
- _this.storageService.store(Constants.AUTH_ROLES, JSON.stringify(apiResponse.data.role));
2571
- _this.logService.info("logged in");
2572
- if (apiResponse.data.changePassword == true && apiResponse.data.authType == 'local') {
2573
- _this.router.navigate(["home/user/change-password"], {
2574
- queryParams: { redirectTo: _this.redirectPath },
2575
- queryParamsHandling: 'merge',
2576
- skipLocationChange: false
2577
- });
2578
- return;
2579
- }
2580
- _this.router.navigate([_this.redirectPath]);
2581
- }
2582
- else {
2583
- _this.messageService.toast("Error: " + apiResponse.message);
2584
- _this.user.password = "";
2585
- }
2586
- }, function (error) {
2587
- _this.isProcessing = false;
2588
- _this.messageService.toast(_this.httpService.Error(error));
2589
- });
2590
- };
2591
- LoginComponent.ctorParameters = function () { return [
2592
- { type: HttpService },
2593
- { type: StorageService },
2594
- { type: Router },
2595
- { type: MessageService },
2596
- { type: DataServiceLib },
2597
- { type: AuthService },
2598
- { type: LogService },
2599
- { type: ActivatedRoute }
2600
- ]; };
2601
- LoginComponent = __decorate([
2602
- Component({
2603
- selector: "spa-login",
2604
- template: "\r\n <div class=\"tin-bg-login login-page\">\r\n\r\n <div *ngIf=\"appConfig.logo!=''\" class=\"d-flex justify-content-center row align-items-center\" style=\"margin-top:3em;margin-bottom:1em\">\r\n\r\n <img *ngIf=\"appConfig.logoSize=='normal'\" [src]=\"appConfig.logo\" style=\"height:100px;margin-right:3em;margin-left:3em\" />\r\n <img *ngIf=\"appConfig.logoSize=='medium'\" [src]=\"appConfig.logo\" style=\"height:150px;margin-right:3em;margin-left:3em\" />\r\n <img *ngIf=\"appConfig.logoSize=='large'\" [src]=\"appConfig.logo\" style=\"height:250px;margin-right:3em;margin-left:3em\" />\r\n\r\n </div>\r\n\r\n\r\n <div *ngIf=\"appConfig.logo ==''\" style=\"margin-top:2em\">\r\n <!-- Add margin top when there is no logo -->\r\n </div>\r\n\r\n\r\n <div class=\"d-flex justify-content-center row align-items-center\" style=\"margin-top:3em\">\r\n\r\n <div class=\"d-none d-sm-block\">\r\n </div>\r\n\r\n <div style=\"margin-left:1em\">\r\n\r\n <mat-card class=\"mat-elevation-z3\" style=\"width:400px; \">\r\n\r\n <mat-card-header>\r\n <mat-card-title>{{appConfig.appName}}</mat-card-title>\r\n </mat-card-header>\r\n\r\n <mat-card-content>\r\n\r\n <div class=\"tin-input mt-2\">\r\n\r\n <spa-text id=\"txtuserName\" display=\"Username\" [(value)]=\"user.userName\" ></spa-text>\r\n\r\n <mat-form-field >\r\n <mat-label>Password</mat-label>\r\n <input id=\"txtPassword\" matInput [type]=\"hide ? 'password' : 'text'\" (keyup.enter)=\"login()\" [(ngModel)]=\"user.password\" autocomplete=\"off\" >\r\n <button mat-icon-button matSuffix (click)=\"hide = !hide\" [attr.aria-label]=\"'Hide password'\" [attr.aria-pressed]=\"hide\">\r\n <mat-icon style=\"font-size: 18px;\">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>\r\n </button>\r\n </mat-form-field>\r\n\r\n </div>\r\n\r\n </mat-card-content>\r\n\r\n\r\n <mat-card-actions>\r\n\r\n <div class=\"row \">\r\n\r\n <div class=\"col d-flex justify-content-center\">\r\n <button id=\"btnLogin\" mat-raised-button [disabled]=\"isProcessing\" style=\"width: 100px;\" (click)=\"login()\" color=\"primary\">Login</button>\r\n </div>\r\n\r\n <div class=\"col d-flex justify-content-center\" *ngIf=\"appConfig.selfService\">\r\n <button id=\"btnSignup\" mat-stroked-button color=\"primary\" style=\"width: 100px;\" (click)=\"signup()\">Signup</button>\r\n </div>\r\n\r\n </div>\r\n\r\n </mat-card-actions>\r\n\r\n </mat-card>\r\n\r\n <div *ngIf=\"appConfig.selfService\">\r\n <br />\r\n <a mat-button id=\"lnkRecover\" style=\"margin-left: 1em\" (click)=\"recoverAccount()\">Forgot your password ?</a>\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n",
2605
- styles: [".login-page{position:absolute;top:0;left:0;right:0;bottom:0;overflow:auto}.tin-bg-login{background-image:url(~/assets/login-bg.jpg);background-size:100%}"]
2606
- })
2607
- ], LoginComponent);
2608
- return LoginComponent;
2609
- }());
2610
-
2611
- var SignupComponent = /** @class */ (function () {
2612
- function SignupComponent(httpService, messageService, dataService, authService) {
2613
- this.httpService = httpService;
2614
- this.messageService = messageService;
2615
- this.dataService = dataService;
2616
- this.authService = authService;
2617
- this.isProcessing = false;
2618
- this.user = new User();
2619
- this.profile = new Profile();
2620
- this.account = new Account();
2621
- }
2622
- SignupComponent.prototype.ngOnInit = function () {
2623
- this.account.user = this.user;
2624
- this.account.profile = this.profile;
2625
- };
2626
- SignupComponent.prototype.create = function () {
2627
- var _this = this;
2628
- this.profile.userName = this.user.userName;
2629
- this.isProcessing = true;
2630
- this.dataService.RegisterAccount(this.account).subscribe(function (apiResponse) {
2631
- _this.isProcessing = false;
2632
- if (apiResponse.message == "success") {
2633
- _this.messageService.toast("Account Created");
2634
- _this.user = new User();
2635
- _this.profile = new Profile();
2636
- }
2637
- else {
2638
- _this.messageService.toast("Error: " + apiResponse.message);
2639
- }
2640
- }, function (error) {
2641
- _this.isProcessing = false;
2642
- _this.messageService.toast(_this.httpService.Error(error));
2643
- });
2644
- };
2645
- SignupComponent.ctorParameters = function () { return [
2646
- { type: HttpService },
2647
- { type: MessageService },
2648
- { type: DataServiceLib },
2649
- { type: AuthService }
2650
- ]; };
2651
- SignupComponent = __decorate([
2652
- Component({
2653
- selector: 'spa-signup',
2654
- template: "\r\n<h4 style=\"margin-top: 1em;\">Signup</h4>\r\n\r\n<hr/>\r\nComplete the form below.\r\n\r\n<div class=\"d-flex justify-content-center row align-items-center\">\r\n\r\n <div class=\"tin-input\" style=\"font-size:14px; width: 50%;\">\r\n\r\n\r\n <div class=\"tin-input-row\">\r\n\r\n <div class=\"col\">\r\n\r\n <mat-form-field style=\"width:100%\">\r\n <mat-label>FirstName</mat-label>\r\n <input matInput autocomplete=\"off\" [(ngModel)]=\"account.profile.firstName\" placeholder=\"Enter FirstName\" />\r\n </mat-form-field>\r\n\r\n </div>\r\n\r\n <div class=\"col\">\r\n\r\n <mat-form-field style=\"width:100%\">\r\n <mat-label>LastName</mat-label>\r\n <input matInput autocomplete=\"off\" [(ngModel)]=\"profile.lastName\" placeholder=\"Enter LastName\" />\r\n </mat-form-field>\r\n\r\n </div>\r\n\r\n\r\n </div>\r\n\r\n <div class=\"tin-input-row mt-3\">\r\n\r\n <div class=\"col-6\">\r\n\r\n <mat-form-field style=\"width:100%\">\r\n <mat-label>userName</mat-label>\r\n <input matInput autocomplete=\"off\" [(ngModel)]=\"user.userName\" placeholder=\"Enter userName\" />\r\n </mat-form-field>\r\n </div>\r\n\r\n\r\n </div>\r\n\r\n <div class=\"tin-input-row\">\r\n\r\n <div class=\"col\">\r\n\r\n <mat-form-field style=\"width:100%\">\r\n <mat-label>Password</mat-label>\r\n <input matInput autocomplete=\"off\" type=\"password\" [(ngModel)]=\"user.password\" placeholder=\"Enter Password\" />\r\n </mat-form-field>\r\n\r\n </div>\r\n\r\n <div class=\"col\">\r\n\r\n <mat-form-field style=\"width:100%\">\r\n <mat-label>Confirm Password</mat-label>\r\n <input matInput autocomplete=\"off\" type=\"password\" [(ngModel)]=\"confirmPassword\" placeholder=\"Enter Confirm Password\" />\r\n </mat-form-field>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n\r\n\r\n <div class=\"tin-input-row mt-3\">\r\n <button mat-raised-button color=\"primary\" (click)=\"create()\" cdkFocusInitial>Create</button>\r\n </div>\r\n\r\n\r\n\r\n </div>\r\n\r\n\r\n\r\n</div>\r\n\r\n",
2655
- styles: [""]
2656
- })
2657
- ], SignupComponent);
2658
- return SignupComponent;
2659
- }());
2660
-
2661
- var RecoverAccountComponent = /** @class */ (function () {
2662
- function RecoverAccountComponent(location, dataService, authService, messageService) {
2663
- this.location = location;
2664
- this.dataService = dataService;
2665
- this.authService = authService;
2666
- this.messageService = messageService;
2667
- this.userName = "";
2668
- }
2669
- RecoverAccountComponent.prototype.ngOnInit = function () {
2670
- };
2671
- RecoverAccountComponent.prototype.recover = function () {
2672
- var _this = this;
2673
- if (this.userName == "") {
2674
- this.messageService.toast("Please enter your userName");
2675
- return;
2676
- }
2677
- else {
2678
- var u = new User();
2679
- u.userName = this.userName;
2680
- this.dataService.SelfReset(u).subscribe(function (apiResponse) {
2681
- if (apiResponse.message == "success") {
2682
- _this.messageService.toast("The password has been sent to your email");
2683
- _this.location.back();
2684
- }
2685
- else {
2686
- _this.messageService.toast("Error: " + apiResponse.message);
2687
- }
2688
- });
2689
- }
2690
- };
2691
- RecoverAccountComponent.ctorParameters = function () { return [
2692
- { type: Location },
2693
- { type: DataServiceLib },
2694
- { type: AuthService },
2695
- { type: MessageService }
2696
- ]; };
2697
- RecoverAccountComponent = __decorate([
2698
- Component({
2699
- selector: 'spa-recover-account',
2700
- template: "<h4 style=\"margin-top: 1em;\">Recover Account</h4>\r\n\r\n<hr/>\r\nSubmit your userName and we will send you details to your registered email address.\r\n\r\n<div class=\"mt-3\" >\r\n\r\n <div class=\"tin-input \" style=\"font-size:14px;\">\r\n\r\n <div class=\"col\">\r\n <spa-text display=\"Username\" [(value)]=\"userName\" ></spa-text>\r\n </div>\r\n\r\n <div class=\"col mt-3\">\r\n <button mat-raised-button color=\"primary\" (click)=\"recover()\" cdkFocusInitial>Submit</button>\r\n </div>\r\n\r\n </div>\r\n\r\n</div>\r\n",
2701
- styles: [""]
2702
- })
2703
- ], RecoverAccountComponent);
2704
- return RecoverAccountComponent;
2705
- }());
2706
-
2707
- var SpaIndexModule = /** @class */ (function () {
2708
- function SpaIndexModule() {
2709
- }
2710
- SpaIndexModule = __decorate([
2711
- NgModule({
2712
- declarations: [LoginComponent, SignupComponent, RecoverAccountComponent],
2713
- entryComponents: [],
2714
- imports: [
2715
- ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: "never" }),
2716
- CommonModule,
2717
- FormsModule,
2718
- ReactiveFormsModule,
2719
- SpaMatModule,
2720
- TinSpaModule
2721
- ],
2722
- exports: [
2723
- CommonModule,
2724
- FormsModule,
2725
- SpaMatModule,
2726
- LoginComponent,
2727
- SignupComponent,
2728
- RecoverAccountComponent,
2729
- ],
2730
- })
2731
- ], SpaIndexModule);
2732
- return SpaIndexModule;
2733
- }());
2734
-
2735
- var ChangePasswordComponent = /** @class */ (function () {
2736
- function ChangePasswordComponent(router, location, httpService, messageService, dataService, authService, route) {
2737
- this.router = router;
2738
- this.location = location;
2739
- this.httpService = httpService;
2740
- this.messageService = messageService;
2741
- this.dataService = dataService;
2742
- this.authService = authService;
2743
- this.route = route;
2744
- this.isProcessing = false;
2745
- this.changePassword = new ChangeUserPassword();
2746
- }
2747
- ChangePasswordComponent.prototype.ngOnInit = function () {
2748
- this.myRole = this.authService.currentRoleSource.value;
2749
- if (this.dataService.tmpProfileuserName == "") {
2750
- this.changePassword.userName = this.authService.currentUser;
2751
- }
2752
- else {
2753
- this.changePassword.userName = this.dataService.tmpProfileuserName;
2754
- this.dataService.tmpProfileuserName = "";
2755
- }
2756
- if (this.route.snapshot.queryParams.redirectTo != undefined) {
2757
- this.redirectPath = this.route.snapshot.queryParams.redirectTo;
2758
- }
2759
- else {
2760
- this.redirectPath = "home";
2761
- }
2762
- };
2763
- ChangePasswordComponent.prototype.change = function () {
2764
- var _this = this;
2765
- if (!this.myRole[this.dataService.capUsers.name]) {
2766
- if (this.changePassword.currentPassword == "") {
2767
- this.messageService.toast("Please enter current Password");
2768
- return;
2769
- }
2770
- }
2771
- if (this.changePassword.newPassword == "") {
2772
- this.messageService.toast("Please enter new Password");
2773
- return;
2774
- }
2775
- if (this.changePassword.confirmPassword == "") {
2776
- this.messageService.toast("Please confirm new Password");
2777
- return;
2778
- }
2779
- if (this.changePassword.confirmPassword != this.changePassword.newPassword) {
2780
- this.messageService.toast("Passwords do not match");
2781
- return;
2782
- }
2783
- this.isProcessing = true;
2784
- if (this.myRole[this.dataService.capUsers.name]) {
2785
- this.dataService.ChangePasswordAdmin(this.changePassword).subscribe(function (apiResponse) {
2786
- _this.isProcessing = false;
2787
- if (apiResponse.message == "success") {
2788
- _this.messageService.toast("Password Changed");
2789
- _this.router.navigate([_this.redirectPath]);
2790
- }
2791
- else {
2792
- _this.messageService.toast("Error: " + apiResponse.message);
2793
- }
2794
- });
2795
- }
2796
- else {
2797
- this.dataService.ChangePassword(this.changePassword).subscribe(function (apiResponse) {
2798
- _this.isProcessing = false;
2799
- if (apiResponse.message == "success") {
2800
- _this.messageService.toast("Password Changed");
2801
- _this.router.navigate([_this.redirectPath]);
2802
- }
2803
- else {
2804
- _this.messageService.toast("Error: " + apiResponse.message);
2805
- }
2806
- });
2807
- }
2808
- };
2809
- ChangePasswordComponent.ctorParameters = function () { return [
2810
- { type: Router },
2811
- { type: Location },
2812
- { type: HttpService },
2813
- { type: MessageService },
2814
- { type: DataServiceLib },
2815
- { type: AuthService },
2816
- { type: ActivatedRoute }
2817
- ]; };
2818
- ChangePasswordComponent = __decorate([
2819
- Component({
2820
- selector: 'spa-change-password',
2821
- template: "<h4>Change Password</h4>\r\n<hr>\r\n\r\n<div class=\"container\">\r\n\r\n <div class=\"d-flex justify-content-center row align-items-center\" >\r\n\r\n <div class=\"col\">\r\n\r\n <div class=\"tin-input \" style=\"font-size:14px;\">\r\n\r\n <div class=\"col\" *ngIf=\"changePassword.userName!=''\">\r\n <spa-text id=\"txtuserName\" display=\"Username\" [(value)]=\"changePassword.userName\" width=\"300px\" readonly=\"true\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\" *ngIf=\"!myRole[dataService.capUsers.name]\">\r\n <spa-text id=\"txtPassword\" display=\"Current Password\" [(value)]=\"changePassword.currentPassword\" width=\"300px\" type=\"password\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtNewPassword\" display=\"New Password\" [(value)]=\"changePassword.newPassword\" width=\"300px\" type=\"password\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtConfirmPassword\" display=\"Confirm Password\" [(value)]=\"changePassword.confirmPassword\" width=\"300px\" type=\"password\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col mt-3\">\r\n <button id=\"btnChange\" mat-raised-button color=\"primary\" (click)=\"change()\" cdkFocusInitial>Change</button>\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n <div class=\"col\">\r\n\r\n <div class=\"alert alert-info\" style=\"font-size: 14px;\" role=\"alert\">\r\n <b>*Please consider these requirements for your new password.</b> <br><br>\r\n\r\n At least 8 characters<br>\r\n At least 1 uppercase letter (A-Z)<br>\r\n At least 2 lowercase letters (a-z)<br>\r\n At least 1 digit (0-9)<br>\r\n At least 1 special character (~`! \u2026)<br>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n\r\n\r\n\r\n </div>\r\n</div>\r\n\r\n",
2822
- styles: [""]
2823
- })
2824
- ], ChangePasswordComponent);
2825
- return ChangePasswordComponent;
2826
- }());
2827
-
2828
- var ProfileComponent = /** @class */ (function () {
2829
- function ProfileComponent(dataService, messageService, httpService, router, authService) {
2830
- this.dataService = dataService;
2831
- this.messageService = messageService;
2832
- this.httpService = httpService;
2833
- this.router = router;
2834
- this.authService = authService;
2835
- this.appConfig = new AppConfig();
2836
- this.selfProfile = false;
2837
- this.profile = new Profile();
2838
- }
2839
- ProfileComponent.prototype.ngOnInit = function () {
2840
- this.myRole = this.authService.currentRoleSource.value;
2841
- if (this.dataService.tmpProfileuserName == "") {
2842
- this.loadProfile(this.authService.currentUser);
2843
- }
2844
- else {
2845
- this.loadProfile(this.dataService.tmpProfileuserName);
2846
- this.dataService.tmpProfileuserName = "";
2847
- }
2848
- };
2849
- ProfileComponent.prototype.loadProfile = function (userName) {
2850
- var _this = this;
2851
- var action = "all";
2852
- this.dataService.GetUserByID(userName).subscribe(function (apiResponse) {
2853
- _this.profile = apiResponse[0];
2854
- if (_this.profile.userName.toLocaleLowerCase() == _this.authService.currentUser.toLocaleLowerCase()) {
2855
- _this.selfProfile = true;
2856
- }
2857
- _this.loadRoles();
2858
- console.log(_this.profile);
2859
- }, function (error) {
2860
- _this.isProcessing = false;
2861
- _this.messageService.toast(_this.httpService.Error(error));
2862
- });
2863
- };
2864
- ProfileComponent.prototype.loadRoles = function () {
2865
- var _this = this;
2866
- this.dataService.GetRole("all", "").subscribe(function (apiResponse) {
2867
- _this.roles = apiResponse;
2868
- console.log(_this.roles);
2869
- }, function (error) {
2870
- _this.isProcessing = false;
2871
- _this.messageService.toast(_this.httpService.Error(error));
2872
- });
2873
- };
2874
- ProfileComponent.prototype.changePassword = function () {
2875
- this.dataService.tmpProfileuserName = this.profile.userName;
2876
- this.router.navigate(["home/user/change-password"]);
2877
- };
2878
- ProfileComponent.prototype.gotoUsers = function () {
2879
- this.router.navigate(["home/admin/users"]);
2880
- };
2881
- ProfileComponent.prototype.update = function () {
2882
- };
2883
- ProfileComponent.prototype.updateProfile = function () {
2884
- var _this = this;
2885
- this.isProcessing = true;
2886
- // console.log(this.profile)
2887
- // return
2888
- this.dataService.UpdateUser(this.profile).subscribe(function (apiResponse) {
2889
- _this.isProcessing = false;
2890
- if (apiResponse.success) {
2891
- _this.messageService.toast("Profile Updated");
2892
- }
2893
- else {
2894
- _this.messageService.toast("Error: " + apiResponse.message);
2895
- }
2896
- }, function (error) {
2897
- _this.messageService.toast("Connection failed ");
2898
- _this.isProcessing = false;
2899
- });
2900
- };
2901
- ProfileComponent.ctorParameters = function () { return [
2902
- { type: DataServiceLib },
2903
- { type: MessageService },
2904
- { type: HttpService },
2905
- { type: Router },
2906
- { type: AuthService }
2907
- ]; };
2908
- __decorate([
2909
- Input()
2910
- ], ProfileComponent.prototype, "appConfig", void 0);
2911
- ProfileComponent = __decorate([
2912
- Component({
2913
- selector: 'spa-profile',
2914
- template: "\r\n<div class=\"container\">\r\n\r\n <div class=\"row mt-3\" style=\"font-size:14px;\">\r\n\r\n <div class=\"col-2 mt-3 \">\r\n\r\n <div class=\"tin-input\">\r\n\r\n <div class=\"col\">\r\n <mat-icon style=\"font-size: 70px;\">account_circle</mat-icon>\r\n <!-- <img style=\"height: 40px\"> -->\r\n </div>\r\n\r\n <div class=\"col\">\r\n <mat-label id=\"lbluserName\" style=\"font-size: 14px;\">{{profile?.userName}}</mat-label>\r\n </div>\r\n\r\n\r\n </div>\r\n\r\n\r\n\r\n </div>\r\n\r\n <div class=\"col-8 mt-3\">\r\n\r\n <div class=\"tin-input\" style=\"width: 70%;\">\r\n\r\n <div class=\"tin-input-row\">\r\n\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtFirstName\" display=\"First Name\" [(value)]=\"profile.firstName\" [readonly]=\"selfProfile\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtLastName\" display=\"Last Name\" [(value)]=\"profile.lastName\" [readonly]=\"selfProfile\"></spa-text>\r\n </div>\r\n\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtAuth\" display=\"Authentication\" [(value)]=\"profile.authType\" [readonly]=\"true\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtEmail\" display=\"Email\" [(value)]=\"profile.email\" [readonly]=\"selfProfile\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-select id=\"cboRole\" display=\"Role\" [options]=\"roles\" optionDisplay=\"roleName\" optionValue=\"roleID\" [(value)]=\"profile.roleID\" [readonly]=\"selfProfile\"></spa-select>\r\n </div>\r\n\r\n\r\n <div class=\"tin-input-row mt-2\">\r\n <button id=\"btnUpdate\" mat-raised-button color=\"primary\" *ngIf=\"!selfProfile\" [disabled]=\"isProcessing\" (click)=\"updateProfile()\" >Update Profile</button>\r\n </div>\r\n\r\n\r\n </div>\r\n\r\n\r\n </div>\r\n\r\n <div class=\"col-2 mt-4\">\r\n\r\n <a mat-button id=\"lnkUserManager\" style=\"margin-left: 1em\" *ngIf=\"!selfProfile\" (click)=\"gotoUsers()\" >User Manager</a>\r\n <a mat-button id=\"lnkChangePassword\" style=\"margin-left: 1em\" *ngIf=\"(selfProfile || myRole[dataService.capUsers.name]) && profile.authType=='local'\" (click)=\"changePassword()\" >Change Password</a>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n</div>\r\n\r\n\r\n\r\n",
2915
- styles: [""]
2916
- })
2917
- ], ProfileComponent);
2918
- return ProfileComponent;
2919
- }());
2920
-
2921
- var SpaUserModule = /** @class */ (function () {
2922
- function SpaUserModule() {
2923
- }
2924
- SpaUserModule = __decorate([
2925
- NgModule({
2926
- declarations: [ChangePasswordComponent, ProfileComponent],
2927
- entryComponents: [],
2928
- imports: [
2929
- ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: "never" }),
2930
- CommonModule,
2931
- FormsModule,
2932
- ReactiveFormsModule,
2933
- SpaMatModule,
2934
- TinSpaModule
2935
- ],
2936
- exports: [
2937
- CommonModule,
2938
- FormsModule,
2939
- SpaMatModule,
2940
- ChangePasswordComponent,
2941
- ProfileComponent,
2942
- ],
2943
- })
2944
- ], SpaUserModule);
2945
- return SpaUserModule;
2946
- }());
2947
-
2948
- // import { ApiResponse } from 'tin-core';
2949
- var SettingsComponent = /** @class */ (function () {
2950
- function SettingsComponent(dataService, messageService) {
2951
- this.dataService = dataService;
2952
- this.messageService = messageService;
2953
- this._filterText = "";
2954
- this.isProcessing = false;
2955
- }
2956
- SettingsComponent.prototype.ngOnInit = function () {
2957
- this.loadSettings();
2958
- };
2959
- SettingsComponent.prototype.applyFilter = function (filterValue) {
2960
- this.settings.filter = filterValue.trim().toLowerCase();
2961
- };
2962
- SettingsComponent.prototype.loadSettings = function () {
2963
- var _this = this;
2964
- this.dataService.GetSetting("all", "").subscribe(function (apiResponse) {
2965
- _this.settings = apiResponse;
2966
- });
2967
- };
2968
- SettingsComponent.prototype.updateSetting = function (setting) {
2969
- var _this = this;
2970
- this.isProcessing = true;
2971
- this.dataService.UpdateSetting(setting, "edit").subscribe(function (apiResponse) {
2972
- _this.isProcessing = false;
2973
- if (apiResponse.success) {
2974
- _this.messageService.toast("Setting " + setting.sName + " Updated");
2975
- _this.loadSettings();
2976
- }
2977
- else {
2978
- _this.messageService.toast("Error: " + apiResponse.message);
2979
- }
2980
- });
2981
- };
2982
- ;
2983
- SettingsComponent.prototype.addSetting = function () {
2984
- // const dialogRef = this.dialog.open(addRoleDialog, {
2985
- // width: "1100px",
2986
- // data: "",
2987
- // });
2988
- // dialogRef.afterClosed().subscribe((result) => {
2989
- // if (result == "success") {
2990
- // this.loadRoles();
2991
- // }
2992
- // });
2993
- this.messageService.toast("Feature not Available");
2994
- };
2995
- SettingsComponent.ctorParameters = function () { return [
2996
- { type: DataServiceLib },
2997
- { type: MessageService }
2998
- ]; };
2999
- SettingsComponent = __decorate([
3000
- Component({
3001
- selector: 'spa-settings',
3002
- template: "<h4>Settings</h4>\r\n<hr>\r\n\r\n<div class=\"container\">\r\n\r\n <div class=\"row justify-content-between\" style=\"padding-bottom: 10px;padding-left:10px\">\r\n\r\n <div class=\"col-2\">\r\n <!-- <button mat-raised-button (click)=\"addSetting()\">New Setting</button> -->\r\n </div>\r\n <div class=\"col-2\">\r\n <button mat-raised-button (click)=\"loadSettings()\">Refresh</button>\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-1 mb-1\" style=\"margin-left:10px\" *ngFor=\"let setting of settings\">\r\n\r\n <mat-form-field style=\"width: 500px; font-size: 14px;\">\r\n <mat-label>{{setting.sName}}</mat-label>\r\n <input matInput autocomplete=\"off\" [(ngModel)]=\"setting.sValue\" >\r\n </mat-form-field>\r\n\r\n <button mat-mini-fab color=\"primary\" (click)=\"updateSetting(setting)\" style=\"margin-right:150px;\"><mat-icon>done_all</mat-icon></button>\r\n\r\n <mat-label style=\"font-size: small;\">Last Updated by {{setting.updatedBy}} on {{setting.updatedDate | date: 'dd MMM yy HH:mm'}}</mat-label>\r\n\r\n </div>\r\n\r\n\r\n</div>\r\n\r\n",
3003
- styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}"]
3004
- })
3005
- ], SettingsComponent);
3006
- return SettingsComponent;
3007
- }());
3008
-
3009
- var LogsComponent = /** @class */ (function () {
3010
- function LogsComponent(authService, dataService) {
3011
- this.authService = authService;
3012
- this.dataService = dataService;
3013
- this.isProcessing = false;
3014
- this.displayedColumns = ["dateLogged", "userName", "fullName", "source", "details"];
3015
- }
3016
- LogsComponent.prototype.ngOnInit = function () {
3017
- this.authService.isAuthorised(this.dataService.capLogs.name);
3018
- this.loadLogs();
3019
- };
3020
- LogsComponent.prototype.loadLogs = function () {
3021
- var _this = this;
3022
- this.dataService.GetLog("all", "").subscribe(function (apiResponse) {
3023
- _this.logs = new MatTableDataSource(apiResponse);
3024
- _this.logs.paginator = _this.logsPaginator;
3025
- });
3026
- };
3027
- LogsComponent.ctorParameters = function () { return [
3028
- { type: AuthService },
3029
- { type: DataServiceLib }
3030
- ]; };
3031
- __decorate([
3032
- ViewChild("logsPaginator")
3033
- ], LogsComponent.prototype, "logsPaginator", void 0);
3034
- LogsComponent = __decorate([
3035
- Component({
3036
- selector: 'spa-logs',
3037
- template: "<h4>Logs</h4>\r\n<hr />\r\n\r\n<div class=\"container-fluid\">\r\n\r\n <div class=\"row justify-content-between\" style=\"padding-bottom: 10px\">\r\n\r\n <div class=\"col-2\">\r\n </div>\r\n\r\n <div class=\"d-flex justify-content-end\">\r\n <spa-filter [data]=\"logs\" (refreshClick)=\"loadLogs()\"></spa-filter>\r\n </div>\r\n </div>\r\n\r\n\r\n\r\n <p *ngIf=\"!logs\"><em>Loading...</em></p>\r\n\r\n\r\n <div class=\"mat-elevation-z8\" *ngIf=\"logs\">\r\n\r\n <table id=\"tblTable\" mat-table [dataSource]=\"logs\">\r\n\r\n\r\n <ng-container matColumnDef=\"userName\">\r\n <th mat-header-cell *matHeaderCellDef> User </th>\r\n <td mat-cell *matCellDef=\"let log\"> {{log.userName}} </td>\r\n </ng-container>\r\n\r\n\r\n <ng-container matColumnDef=\"dateLogged\">\r\n <th mat-header-cell *matHeaderCellDef class=\"datetime\"> Date Logged </th>\r\n <td mat-cell *matCellDef=\"let log\"> {{log.dateLogged | date: 'dd MMM yy HH:mm:ss'}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"source\">\r\n <th mat-header-cell *matHeaderCellDef> Source </th>\r\n <td mat-cell *matCellDef=\"let log\"> {{log.source}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"details\">\r\n <th mat-header-cell *matHeaderCellDef> Details </th>\r\n <td mat-cell *matCellDef=\"let log\"> {{log.details}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"fullName\">\r\n <th mat-header-cell *matHeaderCellDef> Name </th>\r\n <td mat-cell *matCellDef=\"let log\">{{log.user.firstName}} {{log.user.lastName}}</td>\r\n </ng-container>\r\n\r\n\r\n\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\r\n\r\n\r\n </table>\r\n\r\n </div>\r\n\r\n <mat-paginator #logsPaginator [pageSizeOptions]=\"[50, 100, 200]\" showFirstLastButtons></mat-paginator>\r\n</div>\r\n\r\n",
3038
- styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}"]
3039
- })
3040
- ], LogsComponent);
3041
- return LogsComponent;
3042
- }());
3043
-
3044
- var UsersComponent = /** @class */ (function () {
3045
- function UsersComponent(httpService, router, authService, dataService, dialog, messageService) {
3046
- this.httpService = httpService;
3047
- this.router = router;
3048
- this.authService = authService;
3049
- this.dataService = dataService;
3050
- this.dialog = dialog;
3051
- this.messageService = messageService;
3052
- this.isProcessing = false;
3053
- this._filterText = "";
3054
- this.displayedColumns = ["userName", "fullName", "roleName", "locked", "dateCreated", "Action"];
3055
- }
3056
- UsersComponent.prototype.ngOnInit = function () {
3057
- this.authService.isAuthorised(this.dataService.capUsers.name);
3058
- this.UpdateData();
3059
- };
3060
- UsersComponent.prototype.UpdateData = function () {
3061
- var _this = this;
3062
- this.dataService.GetUser().subscribe(function (apiResponse) {
3063
- _this.users = new MatTableDataSource(apiResponse);
3064
- _this.users.paginator = _this.usersPaginator;
3065
- _this.applyFilter(_this._filterText);
3066
- }, function (error) {
3067
- _this.isProcessing = false;
3068
- _this.messageService.toast(_this.httpService.Error(error));
3069
- });
3070
- };
3071
- UsersComponent.prototype.applyFilter = function (filterValue) {
3072
- this.users.filter = filterValue.trim().toLowerCase();
3073
- };
3074
- UsersComponent.prototype.createAccount = function () {
3075
- this.router.navigate(["home/admin/create-account"]);
3076
- };
3077
- UsersComponent.prototype.viewProfile = function (user) {
3078
- this.dataService.tmpProfileuserName = user.userName;
3079
- this.router.navigate(["home/user/profile"]);
3080
- };
3081
- UsersComponent.prototype.lock = function (u) {
3082
- var _this = this;
3083
- var login = { userName: u.userName, password: "Abcdef@123" };
3084
- this.dataService.LockUser(login).subscribe(function (apiResponse) {
3085
- if (apiResponse.success) {
3086
- _this.messageService.toast("User Locked");
3087
- _this.UpdateData();
3088
- }
3089
- else {
3090
- _this.messageService.toast("Error: " + apiResponse);
3091
- }
3092
- });
3093
- };
3094
- UsersComponent.prototype.unlock = function (u) {
3095
- var _this = this;
3096
- var login = { userName: u.userName, password: "Abcdef@123" };
3097
- this.dataService.UnlockUser(login).subscribe(function (apiResponse) {
3098
- if (apiResponse.success) {
3099
- _this.messageService.toast("User Unlocked");
3100
- _this.UpdateData();
3101
- }
3102
- else {
3103
- _this.messageService.toast("Error: " + apiResponse);
3104
- }
3105
- });
3106
- };
3107
- UsersComponent.prototype.recover = function (u) {
3108
- var _this = this;
3109
- this.dataService.SelfReset(u).subscribe(function (apiResponse) {
3110
- if (apiResponse.message == "success") {
3111
- _this.messageService.toast("The password has been sent on email");
3112
- }
3113
- else {
3114
- _this.messageService.toast("Error: " + apiResponse.message);
3115
- }
3116
- });
3117
- };
3118
- UsersComponent.prototype.deleteUser = function (user) {
3119
- var _this = this;
3120
- this.messageService.confirm("Delete " + user.userName + " ?").subscribe(function (result) {
3121
- if (result == "yes") {
3122
- _this.isProcessing = true;
3123
- _this.dataService.DeleteUser(user).subscribe(function (apiResponse) {
3124
- _this.isProcessing = false;
3125
- if (apiResponse.message == "success") {
3126
- _this.messageService.toast("User Deleted");
3127
- _this.UpdateData();
3128
- }
3129
- else {
3130
- _this.messageService.toast("Error: " + apiResponse.message);
3131
- }
3132
- }, function (error) {
3133
- _this.messageService.toast("Connection failed ");
3134
- _this.isProcessing = false;
3135
- });
3136
- }
3137
- });
3138
- };
3139
- UsersComponent.ctorParameters = function () { return [
3140
- { type: HttpService },
3141
- { type: Router },
3142
- { type: AuthService },
3143
- { type: DataServiceLib },
3144
- { type: MatDialog },
3145
- { type: MessageService }
3146
- ]; };
3147
- __decorate([
3148
- ViewChild("usersPaginator")
3149
- ], UsersComponent.prototype, "usersPaginator", void 0);
3150
- UsersComponent = __decorate([
3151
- Component({
3152
- selector: "spa-users",
3153
- template: "\r\n<h4>Users</h4>\r\n<hr />\r\n\r\n<div class=\"container\">\r\n\r\n <div class=\"row justify-content-between\" style=\"padding-bottom: 10px\">\r\n <div class=\"col-2\">\r\n <button id=\"btnCreateAccount\" mat-raised-button color=\"primary\" (click)=\"createAccount()\">Create Account</button>\r\n </div>\r\n\r\n <div class=\"d-flex justify-content-end\">\r\n <spa-filter [data]=\"users\" (refreshClick)=\"UpdateData()\"></spa-filter>\r\n </div>\r\n </div>\r\n\r\n\r\n <p *ngIf=\"!users\"><em>Loading...</em></p>\r\n\r\n\r\n <div class=\"mat-elevation-z8\" *ngIf=\"users\">\r\n\r\n <table id=\"tblTable\" mat-table [dataSource]=\"users\">\r\n\r\n <ng-container matColumnDef=\"userName\">\r\n <th mat-header-cell *matHeaderCellDef> userName </th>\r\n <td mat-cell *matCellDef=\"let user\"> {{user.userName}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"locked\">\r\n <th mat-header-cell *matHeaderCellDef> Locked </th>\r\n <td mat-cell *matCellDef=\"let user\"> {{user.locked}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"fullName\">\r\n <th mat-header-cell *matHeaderCellDef> Name </th>\r\n <td mat-cell *matCellDef=\"let user\"> {{user.firstName}} {{user.lastName}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"roleName\">\r\n <th mat-header-cell *matHeaderCellDef> Role </th>\r\n <td mat-cell *matCellDef=\"let user\"> {{user.role.roleName}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"disabled\">\r\n <th mat-header-cell *matHeaderCellDef> Disabled </th>\r\n <td mat-cell *matCellDef=\"let user\"> {{user.disabled}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"dateCreated\">\r\n <th mat-header-cell *matHeaderCellDef> Created </th>\r\n <td mat-cell *matCellDef=\"let user\"> {{user.createdDate | date: 'dd/MM/yyyy'}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"dateUpdated\">\r\n <th mat-header-cell *matHeaderCellDef> Updated </th>\r\n <td mat-cell *matCellDef=\"let user\"> {{user.updatedDate | date: 'dd/MM/yyyy'}} </td>\r\n </ng-container>\r\n\r\n\r\n <ng-container matColumnDef=\"Action\">\r\n <th mat-header-cell *matHeaderCellDef> Action </th>\r\n <td mat-cell *matCellDef=\"let user\" style=\"width: 250px;\">\r\n\r\n <button mat-mini-fab color=\"primary\" (click)=\"viewProfile(user)\" style=\"margin-right:30px\" matTooltip=\"View Profile\" matTooltipPosition=\"above\"> <mat-icon>account_circle</mat-icon></button>\r\n\r\n <button *ngIf=\"user.locked=='0'\" mat-mini-fab color=\"warn\" (click)=\"lock(user)\" style=\"margin-right:10px\" matTooltip=\"Lock\" matTooltipPosition=\"above\"> <mat-icon>lock</mat-icon></button>\r\n <button *ngIf=\"user.locked=='1'\" mat-mini-fab (click)=\"unlock(user)\" style=\"margin-right:10px; background-color: green;\" matTooltip=\"Unlock\" matTooltipPosition=\"above\"> <mat-icon >lock_open</mat-icon></button>\r\n\r\n <!-- <button *ngIf=\"user.disabled=='0'\" mat-mini-fab color=\"warn\" (click)=\"disable(user)\" style=\"margin-right:10px\" matTooltip=\"Disable\" matTooltipPosition=\"above\"> <mat-icon>block</mat-icon></button>\r\n <button *ngIf=\"user.disabled=='1'\" mat-mini-fab (click)=\"enable(user)\" style=\"margin-right:10px; background-color: green\" matTooltip=\"Enable\" matTooltipPosition=\"above\"> <mat-icon>done</mat-icon></button> -->\r\n\r\n <button mat-mini-fab color=\"warn\" (click)=\"deleteUser(user)\" style=\"margin-right:10px\" matTooltip=\"Delete\" matTooltipPosition=\"above\"> <mat-icon>delete</mat-icon></button>\r\n <!-- <button mat-mini-fab color=\"primary\" (click)=\"recover(user)\" style=\"margin-right:10px\" matTooltip=\"Reset Password\" matTooltipPosition=\"above\"> <mat-icon>vpn_key</mat-icon></button> -->\r\n\r\n\r\n\r\n </td>\r\n </ng-container>\r\n\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\" [ngClass]=\"{'make-gray': row.disabled =='1'}\"></tr>\r\n\r\n </table>\r\n\r\n </div>\r\n\r\n <mat-paginator #usersPaginator [pageSizeOptions]=\"[10, 20, 50]\" showFirstLastButtons></mat-paginator>\r\n</div>\r\n",
3154
- styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}.make-gray{background-color:#d3d3d3}"]
3155
- })
3156
- ], UsersComponent);
3157
- return UsersComponent;
3158
- }());
3159
-
3160
- var addRoleDialog = /** @class */ (function () {
3161
- function addRoleDialog(messageService, dataService, authService, dialogRef, data) {
3162
- this.messageService = messageService;
3163
- this.dataService = dataService;
3164
- this.authService = authService;
3165
- this.dialogRef = dialogRef;
3166
- this.data = data;
3167
- this.role = new Role();
3168
- }
3169
- addRoleDialog.prototype.ngOnInit = function () {
3170
- this.capItems = this.data;
3171
- };
3172
- addRoleDialog.prototype.submit = function () {
3173
- var _this = this;
3174
- if (this.role.roleName == "New Role" || this.role.roleName == "") {
3175
- this.messageService.toast("Please enter Role Name");
3176
- return;
3177
- }
3178
- this.isProcessing = true;
3179
- this.dataService.PostRole(this.role, "add").subscribe(function (apiResponse) {
3180
- _this.isProcessing = false;
3181
- if (apiResponse.success) {
3182
- _this.messageService.toast("Role Added");
3183
- _this.dialogRef.close("success");
3184
- }
3185
- else {
3186
- _this.messageService.toast("Error: " + apiResponse.message);
3187
- }
3188
- }, function (error) {
3189
- _this.messageService.toast("Connection failed");
3190
- _this.isProcessing = false;
3191
- });
3192
- };
3193
- ;
3194
- addRoleDialog.ctorParameters = function () { return [
3195
- { type: MessageService },
3196
- { type: DataServiceLib },
3197
- { type: AuthService },
3198
- { type: MatDialogRef },
3199
- { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
3200
- ]; };
3201
- addRoleDialog = __decorate([
3202
- Component({
3203
- selector: 'app-addRole',
3204
- template: "<mat-form-field>\r\n <mat-label>Role Name</mat-label>\r\n <input matInput autocomplete=\"off\" [(ngModel)]=\"role.roleName\" placeholder=\"Enter Role Name\" />\r\n</mat-form-field>\r\n\r\n<mat-dialog-content class=\"mat-typography\">\r\n\r\n <div class=\"row\" >\r\n\r\n <!-- <div class=\" col-4\">\r\n\r\n <div class=\"row\">\r\n <mat-checkbox color=\"primary\" style=\"margin-right:20px; font-size:14px\" [(ngModel)]=\"role.cap1\">Admin</mat-checkbox>\r\n </div>\r\n\r\n </div> -->\r\n\r\n <div class=\"row\" style=\"margin-left: 2em;margin-right: 2em;\">\r\n\r\n <div class=\"row\" style=\"margin-left: 2em;\" *ngFor=\"let capItem of capItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"margin-right:20px; font-size:12px; width: 200px;\" [(ngModel)]=\"role[capItem.name]\">{{capItem.display}}</mat-checkbox>\r\n\r\n <div *ngFor=\"let capSubItem of capItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"margin-right:20px; font-size:12px; width: 200px;\" [(ngModel)]=\"role[capSubItem.name]\">{{capSubItem.display}}</mat-checkbox>\r\n\r\n </div>\r\n\r\n\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n</mat-dialog-content>\r\n\r\n<mat-dialog-actions>\r\n <button mat-button [disabled]=\"isProcessing\" (click)=\"submit()\" cdkFocusInitial>Submit</button>\r\n <button mat-button mat-dialog-close=\"success\">Cancel</button>\r\n</mat-dialog-actions>\r\n",
3205
- styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}"]
3206
- }),
3207
- __param(4, Inject(MAT_DIALOG_DATA))
3208
- ], addRoleDialog);
3209
- return addRoleDialog;
3210
- }());
3211
- ;
3212
-
3213
- var RolesComponent = /** @class */ (function () {
3214
- function RolesComponent(httpService, router, authService, dataService, dialog, messageService) {
3215
- this.httpService = httpService;
3216
- this.router = router;
3217
- this.authService = authService;
3218
- this.dataService = dataService;
3219
- this.dialog = dialog;
3220
- this.messageService = messageService;
3221
- this.isProcessing = false;
3222
- this.appConfig = new AppConfig();
3223
- }
3224
- RolesComponent.prototype.ngOnInit = function () {
3225
- var _this = this;
3226
- this.authService.isAuthorised(this.dataService.capRoles.name);
3227
- this.loadRoles();
3228
- this.dataService.appConfigObserv.subscribe(function (x) { return _this.appConfig = x; });
3229
- };
3230
- RolesComponent.prototype.loadRoles = function () {
3231
- var _this = this;
3232
- this.dataService.GetRole("all", "").subscribe(function (apiResponse) {
3233
- _this.roles = apiResponse;
3234
- });
3235
- };
3236
- RolesComponent.prototype.refresh = function () {
3237
- this.loadRoles();
3238
- };
3239
- RolesComponent.prototype.addRole = function () {
3240
- var _this = this;
3241
- var dialogRef = this.dialog.open(addRoleDialog, {
3242
- width: "1100px",
3243
- data: this.appConfig.capItems,
3244
- });
3245
- dialogRef.afterClosed().subscribe(function (result) {
3246
- if (result == "success") {
3247
- _this.loadRoles();
3248
- }
3249
- });
3250
- };
3251
- RolesComponent.prototype.updateRole = function (role) {
3252
- var _this = this;
3253
- this.messageService.confirm("UPDATE " + role.roleName + " ?").subscribe(function (result) {
3254
- if (result == "yes") {
3255
- _this.dataService.PostRole(role, "edit").subscribe(function (apiResponse) {
3256
- if (apiResponse.success) {
3257
- _this.messageService.toast("Role Updated");
3258
- _this.loadRoles();
3259
- }
3260
- else {
3261
- _this.messageService.toast("Error: " + apiResponse);
3262
- }
3263
- });
3264
- }
3265
- });
3266
- };
3267
- ;
3268
- RolesComponent.prototype.deleteRole = function (role) {
3269
- var _this = this;
3270
- this.messageService.confirm("DELETE " + role.roleName + " ?").subscribe(function (result) {
3271
- if (result == "yes") {
3272
- _this.dataService.PostRole(role, "delete").subscribe(function (apiResponse) {
3273
- if (apiResponse.success) {
3274
- _this.messageService.toast("Role Deleted");
3275
- _this.loadRoles();
3276
- }
3277
- else {
3278
- _this.messageService.toast("Error: " + apiResponse);
3279
- }
3280
- });
3281
- }
3282
- });
3283
- };
3284
- RolesComponent.ctorParameters = function () { return [
3285
- { type: HttpService },
3286
- { type: Router },
3287
- { type: AuthService },
3288
- { type: DataServiceLib },
3289
- { type: MatDialog },
3290
- { type: MessageService }
3291
- ]; };
3292
- RolesComponent = __decorate([
3293
- Component({
3294
- selector: "spa-roles",
3295
- template: "<h4> Roles </h4>\r\n<hr />\r\n\r\n<div class=\"container mb-5\">\r\n\r\n <div class=\"row justify-content-between\" style=\"padding-bottom: 10px;padding-left:10px\">\r\n <div class=\"col-2\">\r\n\r\n <button id=\"btnNewRole\" mat-raised-button color=\"primary\" (click)=\"addRole()\">New Role</button>\r\n </div>\r\n <div class=\"col-1\">\r\n\r\n <button id=\"btnRefresh\" mat-mini-fab color=\"primary\" (click)=\"refresh()\" style=\"margin-right:1em;margin-top:5px\" matTooltip=\"refresh data\" matTooltipPosition=\"right\"><mat-icon class=\"refreshIcon\">refresh</mat-icon></button>\r\n\r\n </div>\r\n </div>\r\n\r\n\r\n <div class=\"row mt-2 mb-1\" style=\"margin-left:10px\" *ngFor=\"let role of roles\">\r\n\r\n <mat-card class=\"mat-elevation-z8\" style=\"width:100%;padding-left:2em\">\r\n\r\n <h4>{{role.roleName}}</h4>\r\n <hr />\r\n\r\n <div class=\"row\" style=\"margin-left: 2em;\">\r\n\r\n\r\n <div class=\"row\" style=\"margin-right:20px;\" *ngFor=\"let capItem of appConfig.capItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\" font-size:12px; width: 200px;\" [(ngModel)]=\"role[capItem.name]\">{{capItem.display}}</mat-checkbox>\r\n\r\n <div class=\"row\" style=\"margin-right:20px;margin-left: 0px; \" *ngFor=\"let capSubItem of capItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\" font-size:12px; width: 200px;\" [(ngModel)]=\"role[capSubItem.name]\">{{capSubItem.display}}</mat-checkbox>\r\n\r\n <div class=\"row\" style=\"margin-right:20px;margin-left: 0px;\" *ngFor=\"let capSubSubItem of capSubItem.capSubItems\">\r\n\r\n <mat-checkbox color=\"primary\" style=\"font-size:12px; width: 200px;\" [(ngModel)]=\"role[capSubSubItem.name]\">{{capSubSubItem.display}}</mat-checkbox>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <mat-card-actions>\r\n\r\n <button mat-mini-fab color=\"primary\" (click)=\"updateRole(role)\" style=\"margin-right:10px;\">\r\n <mat-icon>done_all</mat-icon>\r\n </button>\r\n\r\n <!-- <button mat-mini-fab color=\"warn\" (click)=\"editRole(role)\" style=\"margin-right:10px\">\r\n <mat-icon>edit</mat-icon>\r\n </button> -->\r\n\r\n <button mat-mini-fab color=\"warn\" (click)=\"deleteRole(role)\" style=\"margin-right:10px\">\r\n <mat-icon>delete</mat-icon>\r\n </button>\r\n\r\n </mat-card-actions>\r\n\r\n </mat-card>\r\n\r\n </div>\r\n\r\n\r\n</div>\r\n\r\n",
3296
- styles: [".mat-mini-fab{width:32px;height:32px}.mat-mini-fab mat-icon{font-size:16px;margin-top:-3px}.refreshIcon{font-size:22px!important;margin-top:-7px!important}"]
3297
- })
3298
- ], RolesComponent);
3299
- return RolesComponent;
3300
- }());
3301
-
3302
- var CreateAccountComponent = /** @class */ (function () {
3303
- function CreateAccountComponent(httpService, messageService, dataService, authService, router) {
3304
- this.httpService = httpService;
3305
- this.messageService = messageService;
3306
- this.dataService = dataService;
3307
- this.authService = authService;
3308
- this.router = router;
3309
- this.appConfig = new AppConfig();
3310
- this.isProcessing = false;
3311
- this.register = new Register();
3312
- this.openProfile = true;
3313
- this.authTypes = [
3314
- { name: "Local Authentication", value: "local" },
3315
- { name: "AD Authentication", value: "AD" }
3316
- ];
3317
- }
3318
- CreateAccountComponent.prototype.ngOnInit = function () {
3319
- this.appConfig = this.dataService.appConfig;
3320
- };
3321
- CreateAccountComponent.prototype.create = function () {
3322
- var _this = this;
3323
- if (this.register.authType == "") {
3324
- this.messageService.toast("Choose Authentication Type");
3325
- return;
3326
- }
3327
- this.isProcessing = true;
3328
- this.dataService.RegisterAccount(this.register).subscribe(function (apiResponse) {
3329
- _this.isProcessing = false;
3330
- if (apiResponse.success) {
3331
- _this.messageService.toast("Account Created");
3332
- if (_this.openProfile) {
3333
- _this.viewProfile(_this.register.userName);
3334
- }
3335
- else {
3336
- // this.user = new User();
3337
- _this.register = new Register();
3338
- _this.confirmPassword = "";
3339
- }
3340
- }
3341
- else {
3342
- _this.messageService.toast("Error: " + apiResponse.message);
3343
- }
3344
- }, function (error) {
3345
- _this.isProcessing = false;
3346
- _this.messageService.toast(_this.httpService.Error(error));
3347
- });
3348
- };
3349
- CreateAccountComponent.prototype.viewProfile = function (userName) {
3350
- this.dataService.tmpProfileuserName = userName;
3351
- this.router.navigate(["home/user/profile"]);
3352
- };
3353
- CreateAccountComponent.ctorParameters = function () { return [
3354
- { type: HttpService },
3355
- { type: MessageService },
3356
- { type: DataServiceLib },
3357
- { type: AuthService },
3358
- { type: Router }
3359
- ]; };
3360
- __decorate([
3361
- Input()
3362
- ], CreateAccountComponent.prototype, "appConfig", void 0);
3363
- CreateAccountComponent = __decorate([
3364
- Component({
3365
- selector: 'spa-create-account',
3366
- template: "<h4>Create Account</h4>\r\n\r\n<hr/>\r\n\r\n<div class=\"container\">\r\n\r\n <div class=\"tin-input\" style=\"font-size:14px; width: 70%;\">\r\n\r\n\r\n <div class=\"tin-input-row\">\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtFirstName\" display=\"FirstName\" [(value)]=\"register.firstName\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtLastName\" display=\"LastName\" [(value)]=\"register.lastName\"></spa-text>\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <div class=\"tin-input-row mt-3\">\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtUserName\" display=\"Username\" [(value)]=\"register.userName\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-select id=\"cboAuth\" display=\"Authentication Type\" [options]=\"authTypes\" optionDisplay=\"name\" optionValue=\"value\" [(value)]=\"register.authType\" ></spa-select>\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <div class=\"tin-input-row\" *ngIf=\"register.authType=='local'\">\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtPassword\" display=\"Password\" [(value)]=\"register.password\" type=\"password\"></spa-text>\r\n </div>\r\n\r\n <div class=\"col\">\r\n <spa-text id=\"txtConfirmPassword\" display=\"Confirm Password\" [(value)]=\"confirmPassword\" type=\"password\"></spa-text>\r\n </div>\r\n\r\n </div>\r\n\r\n\r\n <div class=\"tin-input-row mt-3\" style=\"margin-left: 1em;\">\r\n <mat-checkbox id=\"cbkOpenAfter\" color=\"primary\" style=\"margin-right:100px; font-size:12px\" [(ngModel)]=\"openProfile\">Open profile after creation</mat-checkbox>\r\n </div>\r\n\r\n <div class=\"tin-input-row mt-3\">\r\n <button id=\"btnCreate\" [disabled]=\"register.authType ==''\" mat-raised-button color=\"primary\" (click)=\"create()\" cdkFocusInitial>Create</button>\r\n </div>\r\n\r\n </div>\r\n</div>\r\n\r\n",
3367
- styles: [""]
3368
- })
3369
- ], CreateAccountComponent);
3370
- return CreateAccountComponent;
3371
- }());
3372
-
3373
- var SpaAdminModule = /** @class */ (function () {
3374
- function SpaAdminModule() {
3375
- }
3376
- SpaAdminModule = __decorate([
3377
- NgModule({
3378
- declarations: [
3379
- UsersComponent,
3380
- RolesComponent,
3381
- addRoleDialog,
3382
- CreateAccountComponent,
3383
- LogsComponent,
3384
- SettingsComponent
3385
- ],
3386
- entryComponents: [
3387
- addRoleDialog,
3388
- ],
3389
- imports: [
3390
- ReactiveFormsModule.withConfig({ warnOnNgModelWithFormControl: "never" }),
3391
- CommonModule,
3392
- FormsModule,
3393
- ReactiveFormsModule,
3394
- SpaMatModule,
3395
- TinSpaModule
3396
- ],
3397
- exports: [
3398
- CommonModule,
3399
- FormsModule,
3400
- SpaMatModule,
3401
- UsersComponent,
3402
- RolesComponent,
3403
- addRoleDialog,
3404
- CreateAccountComponent,
3405
- LogsComponent,
3406
- SettingsComponent
3407
- ],
3408
- })
3409
- ], SpaAdminModule);
3410
- return SpaAdminModule;
3411
- }());
3412
-
3413
- /*
3414
- * Public API Surface of tin-spa
3415
- */
3416
-
3417
- /**
3418
- * Generated bundle index. Do not edit.
3419
- */
3420
-
3421
- export { Account, ActionResponse, ActivityComponent, ApiResponse, AppConfig, AttachComponent, AuthService, CapItem, ChangePasswordComponent, ChangeUserPassword, CheckComponent, ChipsComponent, Color, Condition, Constants, Core, CreateAccountComponent, DataServiceLib, DateComponent, DatetimeComponent, ExportService, FilterComponent, HttpService, Icon, LabelComponent, LoaderComponent, LogLevel, LogService, LoginComponent, LogsComponent, MessageService, MoneyComponent, NavMenuComponent, Operator, OptionComponent, Profile, ProfileComponent, RecoverAccountComponent, Register, Role, RolesComponent, SelectComponent, SettingsComponent, SignupComponent, SpaAdminModule, SpaIndexModule, SpaMatModule, SpaUserModule, Step, StepsComponent, StorageService, TableAction, TableColumn, TableColumnType, TableComponent, TableConfig, TableCreate, TextComponent, Tile, TilesComponent, TimeoutComponent, TinSpaComponent, TinSpaModule, TinSpaService, User, UsersComponent, addRoleDialog, loginConfig, messageDialog, ɵ0, DndDirective as ɵa, LoaderService as ɵb, LoaderInterceptor as ɵc };
3422
- //# sourceMappingURL=tin-spa.js.map