tin-spa 0.0.1

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