cat-documents-ng 0.1.30 → 0.1.31

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 (92) hide show
  1. package/{src/Shared/constant/ERROR.ts → Shared/constant/ERROR.d.ts} +36 -38
  2. package/Shared/constant/PERMISSIONS.d.ts +14 -0
  3. package/Shared/constant/SHARED.d.ts +209 -0
  4. package/{src/Shared/constant/URLS.ts → Shared/constant/URLS.d.ts} +60 -65
  5. package/Shared/services/app-config.service.d.ts +51 -0
  6. package/{src/Shared/services/global-error.handler.ts → Shared/services/global-error.handler.d.ts} +27 -29
  7. package/Shared/services/session.service.d.ts +46 -0
  8. package/fesm2022/cat-documents-ng.mjs +2460 -0
  9. package/fesm2022/cat-documents-ng.mjs.map +1 -0
  10. package/index.d.ts +5 -0
  11. package/lib/document/components/document-container/document-container.component.d.ts +89 -0
  12. package/lib/document/components/document-list/document-list.component.d.ts +155 -0
  13. package/lib/document/components/document-list-item/document-list-item.component.d.ts +28 -0
  14. package/lib/document/components/document-upload/document-upload.component.d.ts +120 -0
  15. package/lib/document/components/document-viewer/document-viewer.component.d.ts +72 -0
  16. package/{src/lib/document/components/folder-block/folder-block.component.ts → lib/document/components/folder-block/folder-block.component.d.ts} +37 -53
  17. package/lib/document/components/folder-container/folder-container.component.d.ts +29 -0
  18. package/lib/document/components/linked-document/linked-document.component.d.ts +38 -0
  19. package/lib/document/directives/document.directive.d.ts +20 -0
  20. package/lib/document/directives/permission.directive.d.ts +38 -0
  21. package/lib/document/document.module.d.ts +40 -0
  22. package/{src/lib/document/models/document-alert.model.ts → lib/document/models/document-alert.model.d.ts} +38 -45
  23. package/lib/document/models/document-type.model.d.ts +37 -0
  24. package/lib/document/models/document.model.d.ts +44 -0
  25. package/{src/lib/document/models/folder.model.ts → lib/document/models/folder.model.d.ts} +29 -35
  26. package/lib/document/services/document-http.service.d.ts +69 -0
  27. package/lib/document/services/document-upload.service.d.ts +67 -0
  28. package/lib/document/services/document.service.d.ts +20 -0
  29. package/lib/document/services/file-format.service.d.ts +23 -0
  30. package/lib/document/state/document.query.d.ts +40 -0
  31. package/{src/lib/document/state/document.service.ts → lib/document/state/document.service.d.ts} +64 -95
  32. package/{src/lib/document/state/document.state.ts → lib/document/state/document.state.d.ts} +36 -52
  33. package/lib/document/state/document.store.d.ts +27 -0
  34. package/package.json +25 -20
  35. package/{src/public-api.ts → public-api.d.ts} +6 -10
  36. package/ng-package.json +0 -11
  37. package/src/Shared/constant/PERMISSIONS.ts +0 -16
  38. package/src/Shared/constant/SHARED.ts +0 -312
  39. package/src/Shared/services/app-config.service.spec.ts +0 -19
  40. package/src/Shared/services/app-config.service.ts +0 -73
  41. package/src/Shared/services/session.service.spec.ts +0 -16
  42. package/src/Shared/services/session.service.ts +0 -76
  43. package/src/assets/config/api.config.json +0 -20
  44. package/src/lib/document/components/document-container/document-container.component.html +0 -14
  45. package/src/lib/document/components/document-container/document-container.component.scss +0 -8
  46. package/src/lib/document/components/document-container/document-container.component.spec.ts +0 -110
  47. package/src/lib/document/components/document-container/document-container.component.ts +0 -173
  48. package/src/lib/document/components/document-list/document-list.component.html +0 -81
  49. package/src/lib/document/components/document-list/document-list.component.scss +0 -82
  50. package/src/lib/document/components/document-list/document-list.component.spec.ts +0 -96
  51. package/src/lib/document/components/document-list/document-list.component.ts +0 -244
  52. package/src/lib/document/components/document-list-item/document-list-item.component.html +0 -36
  53. package/src/lib/document/components/document-list-item/document-list-item.component.scss +0 -34
  54. package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +0 -75
  55. package/src/lib/document/components/document-list-item/document-list-item.component.ts +0 -40
  56. package/src/lib/document/components/document-upload/document-upload.component.html +0 -56
  57. package/src/lib/document/components/document-upload/document-upload.component.scss +0 -32
  58. package/src/lib/document/components/document-upload/document-upload.component.spec.ts +0 -95
  59. package/src/lib/document/components/document-upload/document-upload.component.ts +0 -162
  60. package/src/lib/document/components/document-viewer/document-viewer.component.html +0 -98
  61. package/src/lib/document/components/document-viewer/document-viewer.component.scss +0 -54
  62. package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +0 -79
  63. package/src/lib/document/components/document-viewer/document-viewer.component.ts +0 -106
  64. package/src/lib/document/components/folder-block/folder-block.component.html +0 -46
  65. package/src/lib/document/components/folder-block/folder-block.component.scss +0 -9
  66. package/src/lib/document/components/folder-block/folder-block.component.spec.ts +0 -70
  67. package/src/lib/document/components/folder-container/folder-container.component.html +0 -2
  68. package/src/lib/document/components/folder-container/folder-container.component.scss +0 -0
  69. package/src/lib/document/components/folder-container/folder-container.component.spec.ts +0 -27
  70. package/src/lib/document/components/folder-container/folder-container.component.ts +0 -37
  71. package/src/lib/document/components/linked-document/linked-document.component.html +0 -23
  72. package/src/lib/document/components/linked-document/linked-document.component.scss +0 -10
  73. package/src/lib/document/components/linked-document/linked-document.component.spec.ts +0 -61
  74. package/src/lib/document/components/linked-document/linked-document.component.ts +0 -49
  75. package/src/lib/document/directives/document.directive.ts +0 -32
  76. package/src/lib/document/directives/permission.directive.spec.ts +0 -0
  77. package/src/lib/document/directives/permission.directive.ts +0 -66
  78. package/src/lib/document/document.module.ts +0 -241
  79. package/src/lib/document/models/document-type.model.ts +0 -44
  80. package/src/lib/document/models/document.model.ts +0 -53
  81. package/src/lib/document/services/document-http.service.spec.ts +0 -119
  82. package/src/lib/document/services/document-http.service.ts +0 -125
  83. package/src/lib/document/services/document-upload.service.spec.ts +0 -99
  84. package/src/lib/document/services/document-upload.service.ts +0 -127
  85. package/src/lib/document/services/document.service.ts +0 -29
  86. package/src/lib/document/services/file-format.service.spec.ts +0 -16
  87. package/src/lib/document/services/file-format.service.ts +0 -41
  88. package/src/lib/document/state/document.query.ts +0 -52
  89. package/src/lib/document/state/document.store.ts +0 -51
  90. package/tsconfig.lib.json +0 -15
  91. package/tsconfig.lib.prod.json +0 -11
  92. package/tsconfig.spec.json +0 -15
@@ -0,0 +1,2460 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, Input, EventEmitter, Output, ViewEncapsulation, ViewChild, Directive, APP_INITIALIZER, NgModule } from '@angular/core';
3
+ import * as i5 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import { firstValueFrom, tap, EMPTY, catchError, throwError, BehaviorSubject, Subscription } from 'rxjs';
6
+ import { __decorate } from 'tslib';
7
+ import { EntityStore, StoreConfig, QueryEntity } from '@datorama/akita';
8
+ import * as i2 from '@angular/common/http';
9
+ import { HttpClientModule } from '@angular/common/http';
10
+ import * as i3 from 'primeng/api';
11
+ import { MessageService } from 'primeng/api';
12
+ import * as i5$1 from 'primeng/accordion';
13
+ import { AccordionModule } from 'primeng/accordion';
14
+ import * as i7 from 'primeng/button';
15
+ import { ButtonModule } from 'primeng/button';
16
+ import * as i8$1 from 'primeng/sidebar';
17
+ import { SidebarModule } from 'primeng/sidebar';
18
+ import * as i9 from 'primeng/messages';
19
+ import * as i10 from '@angular/forms';
20
+ import { FormsModule } from '@angular/forms';
21
+ import * as i11 from 'primeng/dialog';
22
+ import { DialogModule } from 'primeng/dialog';
23
+ import * as i12 from 'primeng/dropdown';
24
+ import { DropdownModule } from 'primeng/dropdown';
25
+ import * as i13 from 'primeng/inputtext';
26
+ import { InputTextModule } from 'primeng/inputtext';
27
+ import * as i7$1 from 'primeng/fileupload';
28
+ import { FileUploadModule } from 'primeng/fileupload';
29
+ import * as i8 from 'primeng/progressbar';
30
+ import { ProgressBarModule } from 'primeng/progressbar';
31
+ import * as i4 from 'ng2-pdf-viewer';
32
+ import { PdfViewerModule } from 'ng2-pdf-viewer';
33
+ import * as i1 from '@angular/router';
34
+ import { BadgeModule } from 'primeng/badge';
35
+ import { ListboxModule } from 'primeng/listbox';
36
+ import { TimelineModule } from 'primeng/timeline';
37
+ import { CheckboxModule } from 'primeng/checkbox';
38
+ import { InputTextareaModule } from 'primeng/inputtextarea';
39
+
40
+ /**
41
+ * The `SHARED` class contains shared constants used across the application.
42
+ * These constants are related to document statuses and other shared data.
43
+ */
44
+ class SHARED {
45
+ /**
46
+ * Represents the stores userData.
47
+ */
48
+ static SESSIONKEY = 'userData';
49
+ /**
50
+ * Represents the count of missing files.
51
+ */
52
+ static MISSINGCOUNT = 2;
53
+ /**
54
+ * Represents the count of pending files.
55
+ */
56
+ static PENDINGCOUNT = 3;
57
+ /**
58
+ * Represents an empty string.
59
+ */
60
+ static EMPTY = "";
61
+ /**
62
+ * Represents an true.
63
+ * @static
64
+ * @type {boolean}
65
+ */
66
+ static TRUE = true;
67
+ /**
68
+ * Represents an false.
69
+ * @static
70
+ * @type {boolean}
71
+ */
72
+ static FALSE = false;
73
+ /**
74
+ * Represents an INITIAL_COUNT.
75
+ */
76
+ static INITIAL_COUNT = 0;
77
+ /**
78
+ * Represents an INITIAL_VALUE.
79
+ */
80
+ static INITIAL_VALUE = 0;
81
+ /**
82
+ * Represents the constant value for one (1).
83
+ * @static
84
+ * @type {number}
85
+ */
86
+ static ONE = 1;
87
+ /**
88
+ * Represents the constant value for two (2).
89
+ * @static
90
+ * @type {number}
91
+ */
92
+ static TWO = 2;
93
+ /**
94
+ * Represents the constant value for ten (10).
95
+ * @static
96
+ * @type {number}
97
+ */
98
+ static TEN = 10;
99
+ /**
100
+ * Represents the constant string value 'files' used for file-related operations.
101
+ * @static
102
+ * @type {string}
103
+ */
104
+ static FILE = 'file';
105
+ /**
106
+ * Represents the array of file size units ('B', 'KB', 'MB') used for file size formatting.
107
+ * @static
108
+ * @type {string[]}
109
+ */
110
+ static FILE_SIZE_UNITS = ['B', 'KB', 'MB'];
111
+ /**
112
+ * Show SEVERITY value.
113
+ * @static
114
+ * @type {'error'}
115
+ */
116
+ static SEVERITY = 'error';
117
+ /**
118
+ * Show SEVERITY value.
119
+ * @static
120
+ * @type {'error'}
121
+ */
122
+ static SUCCESS_SEVERITY = 'success';
123
+ /**
124
+ * Show upload summery if it's failed.
125
+ * @static
126
+ * @type {'Upload Failed'}
127
+ */
128
+ static UPLOAD_SUMMERY = 'Upload Failed';
129
+ /**
130
+ * Show upload summery if it's success.
131
+ * @static
132
+ * @type {'Document uploaded successfully.'}
133
+ */
134
+ static UPLOAD_SUCCESS = 'Document uploaded successfully.';
135
+ /**
136
+ * Represent empty array.
137
+ * @static
138
+ * @type {{}}
139
+ */
140
+ static EMPTY_ARRAY = [];
141
+ /**
142
+ * Represent contextId.
143
+ * @static
144
+ * @type {string}
145
+ */
146
+ static CONTEXT_ID = 'contextId';
147
+ /**
148
+ * Represent fileSize.
149
+ * @static
150
+ * @type {string}
151
+ */
152
+ static FILE_SIZE = 'fileSize';
153
+ /**
154
+ * Represent documentName.
155
+ * @static
156
+ * @type {string}
157
+ */
158
+ static DOCUMENT_NAME = 'documentName';
159
+ /**
160
+ * Represent documentTypeId.
161
+ * @static
162
+ * @type {string}
163
+ */
164
+ static DOCUMENT_TYPE_ID = 'documentTypeId';
165
+ /**
166
+ * Represent upload summery.
167
+ * @static
168
+ * @type {string}
169
+ */
170
+ static UPLOAD_ERROR_SUMMERY = 'Form Data Missing';
171
+ /**
172
+ * Represent upload error details.
173
+ * @static
174
+ * @type {string}
175
+ */
176
+ static UPLOAD_ERROR_DETAILS = 'Required form data is missing. Please ensure the document and all required fields are provided.';
177
+ /**
178
+ * Represents the message prefix for a successful document name update.
179
+ * @static
180
+ * @type {string}
181
+ */
182
+ static UPDATE_DOCUMENT_NAME = 'Document name updated for ID:';
183
+ }
184
+ /**
185
+ * `DUMMYDOCUMENTLIST` is a mock list of document objects used for testing and development purposes.
186
+ * Each document includes an ID, file name, status, and document URL.
187
+ */
188
+ const DUMMYDOCUMENTLIST = [
189
+ {
190
+ _id: 1,
191
+ fileName: 'Document 1',
192
+ status: 'pending',
193
+ documentUrl: 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf',
194
+ },
195
+ {
196
+ _id: 2,
197
+ fileName: 'Document 2',
198
+ status: 'verified',
199
+ documentUrl: 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf',
200
+ },
201
+ {
202
+ _id: 3,
203
+ fileName: 'Document 3',
204
+ status: 'sentReminder',
205
+ documentUrl: 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf',
206
+ },
207
+ {
208
+ _id: 4,
209
+ fileName: 'Document 4',
210
+ status: 'pending',
211
+ documentUrl: 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf',
212
+ },
213
+ ];
214
+ /**
215
+ * `FOLDERPANEL` is a mock list of folder data representing various folders in the application.
216
+ * Each folder contains an ID, file count, text description, missing files count, and pending files count.
217
+ */
218
+ const FOLDERPANEL = [
219
+ {
220
+ _id: 'folder1',
221
+ fileCount: 10,
222
+ text: 'Documents',
223
+ missingFiles: 3,
224
+ pendingFiles: 2,
225
+ },
226
+ {
227
+ _id: 'folder2',
228
+ fileCount: 5,
229
+ text: 'Images',
230
+ missingFiles: 0,
231
+ pendingFiles: 1,
232
+ },
233
+ {
234
+ _id: 'folder3',
235
+ fileCount: 20,
236
+ text: 'Reports',
237
+ missingFiles: 5,
238
+ pendingFiles: 0,
239
+ },
240
+ {
241
+ _id: 'folder4',
242
+ fileCount: 8,
243
+ text: 'Videos',
244
+ missingFiles: 0,
245
+ pendingFiles: 0,
246
+ },
247
+ {
248
+ _id: 'folder5',
249
+ fileCount: 15,
250
+ text: 'Archives',
251
+ missingFiles: 1,
252
+ pendingFiles: 3,
253
+ }
254
+ ];
255
+ /**
256
+ * Dummy data for sumaery.
257
+ * @type {{}}
258
+ */
259
+ const DUMMYSUMMARY = [
260
+ {
261
+ status: 'Valuation report requested on 10th Oct 2024',
262
+ date: '15/10/2020 10:30',
263
+ icon: 'pi pi-shopping-cart',
264
+ color: '#9C27B0',
265
+ image: 'game-controller.jpg',
266
+ },
267
+ {
268
+ status: 'Valuation report received on 13th Oct 2024',
269
+ date: '15/10/2020 14:00',
270
+ icon: 'pi pi-cog',
271
+ color: '#673AB7',
272
+ },
273
+ {
274
+ status: 'Waiting for Valuation Report to be accepted',
275
+ date: '15/10/2020 16:15',
276
+ icon: 'pi pi-shopping-cart',
277
+ color: '#FF9800',
278
+ },
279
+ ];
280
+ /**
281
+ * Dummy data for list box.
282
+ * @type {{}}
283
+ */
284
+ const COUNTRIES = [
285
+ { name: 'Any Word', code: 'NY', checked: false },
286
+ { name: 'Case Sensitive', code: 'RM', checked: false },
287
+ { name: 'Wildcard Search', code: 'LDN', checked: false },
288
+ { name: 'Whole Word Only', code: 'IST', checked: false },
289
+ ];
290
+ /**
291
+ * Default supported image types.
292
+ * @type {{}}
293
+ */
294
+ const SUPPORTED_IMAGE_TYPES = [
295
+ 'image/png'
296
+ ];
297
+ /**
298
+ * @constant {Array<{label: string, value: string, files: string[]}>} DOCUMENTTYPES
299
+ * An array of document type objects containing labels, values, and associated files.
300
+ */
301
+ const DOCUMENTTYPES = [
302
+ {
303
+ label: "BankStatement",
304
+ value: "bank_statement",
305
+ },
306
+ {
307
+ label: "Payslip",
308
+ value: "payslip",
309
+ },
310
+ {
311
+ label: "Selfie",
312
+ value: "selfie",
313
+ },
314
+ {
315
+ label: "Other",
316
+ value: "other",
317
+ }
318
+ ];
319
+ const DocumentAlertList = [
320
+ { status: 'Pending', isAlert: true, alertMessage: 'The name on the payslip does not match either the driver name or the policyholder name.' },
321
+ { status: 'Verified', isAlert: false, alertMessage: 'Document is verified successfully.' },
322
+ ];
323
+
324
+ /**
325
+ * A utility class containing common error messages.
326
+ * @class ERRORS
327
+ */
328
+ class ERRORS {
329
+ /**
330
+ * Error message for invalid recipient.
331
+ * @static
332
+ * @type {string}
333
+ */
334
+ static INVALID_RECIPIENT = "Invalid recipient: The recipient cannot be empty.";
335
+ /**
336
+ * Error message for invalid document.
337
+ * @static
338
+ * @type {string}
339
+ */
340
+ static ERROR_FETCHING_DOCUMENTS = "Error fetching documents:";
341
+ /**
342
+ * Error message for invalid document.
343
+ * @static
344
+ * @type {string}
345
+ */
346
+ static ERROR_FETCHING_FOLDERS = "Error fetching folders:";
347
+ /**
348
+ * Error message for invalid document.
349
+ * @static
350
+ * @type {string}
351
+ */
352
+ static ERROR_ALLDOCUMENT_MISSING = "allDocumentTypes is missing in the response:";
353
+ /**
354
+ * Error message for invalid document.
355
+ * @static
356
+ * @type {string}
357
+ */
358
+ static ERROR_DOCUMENT_TYPES = "Error fetching document types:";
359
+ }
360
+
361
+ /**
362
+ * Creates the initial state for the `DocumentState` store.
363
+ * This function provides default values for all properties in the `DocumentState` interface,
364
+ * ensuring the store starts with a consistent initial structure.
365
+ * @returns {DocumentState} The initial state of the document store.
366
+ */
367
+ function createInitialState() {
368
+ return {
369
+ records: [],
370
+ filteredRecords: [],
371
+ folderId: null,
372
+ isDialogOpen: false,
373
+ dropdownOptions: [],
374
+ uploadedDocumentFiles: [],
375
+ parentDocumentTypeId: null,
376
+ documentAlert: { _id: '' },
377
+ folders: [],
378
+ messages: [],
379
+ documentList: []
380
+ };
381
+ }
382
+
383
+ /**
384
+ * Store that manages the state of documents in the application.
385
+ * The `DocumentStore` class extends Akita's `EntityStore` to manage the entity state for documents.
386
+ * It uses the `createInitialState` function to initialize the store with default values and
387
+ * is configured with the name `'documents'`.
388
+ * @augments EntityStore<DocumentState>
389
+ */
390
+ let DocumentStore = class DocumentStore extends EntityStore {
391
+ /**
392
+ * Creates an instance of `DocumentStore` with the initial state of the documents.
393
+ */
394
+ constructor() {
395
+ super(createInitialState());
396
+ }
397
+ setUploadedDocumentFiles(files) {
398
+ this.update({ uploadedDocumentFiles: files });
399
+ }
400
+ setFolders(folders) {
401
+ this.update({ folders: folders });
402
+ }
403
+ setDocumentTypes(documentType) {
404
+ this.update({ uploadedDocumentFiles: documentType });
405
+ }
406
+ setDocumentAlert(documentAlert) {
407
+ this.update({ documentAlert: documentAlert });
408
+ }
409
+ setParentDocumentTypeId(parentDocumentTypeId) {
410
+ this.update({ parentDocumentTypeId });
411
+ }
412
+ setMessage(message) {
413
+ this.update({ messages: message });
414
+ }
415
+ setDocumentList(documents) {
416
+ this.update({ documents: documents });
417
+ }
418
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
419
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentStore, providedIn: 'root' });
420
+ };
421
+ DocumentStore = __decorate([
422
+ StoreConfig({ name: 'documents' })
423
+ ], DocumentStore);
424
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentStore, decorators: [{
425
+ type: Injectable,
426
+ args: [{ providedIn: 'root' }]
427
+ }], ctorParameters: () => [] });
428
+
429
+ /**
430
+ * Class that holds the URLs used throughout the application.
431
+ * These URLs are typically used for making API requests and accessing various resources.
432
+ * @class URLS
433
+ * @typedef {URLS}
434
+ */
435
+ class URLS {
436
+ /**
437
+ * The URL to fetch the application configuration file.
438
+ * This JSON file typically contains settings and options for the application.
439
+ * @static
440
+ * @type {string}
441
+ */
442
+ static CONFIGFILEURL = "assets/config/api.config.json";
443
+ /**
444
+ * The URL endpoint for document uploads.
445
+ * Used to send documents to the server for storage or processing.
446
+ * @static
447
+ * @type {string}
448
+ */
449
+ static DOCUMENT_UPLOAD = "Documents";
450
+ /**
451
+ * The query parameter to pass a context ID in API requests.
452
+ * Used to specify the context for certain API calls, such as filtering or scoping the request.
453
+ * @static
454
+ * @type {string}
455
+ */
456
+ static CONTEXT = "?contextId=";
457
+ /**
458
+ * The query parameter to pass a document ID in API requests.
459
+ * @static
460
+ * @type {string}
461
+ */
462
+ static DOCUMENT_TYPES = "documentTypes";
463
+ /**
464
+ * The query parameter to pass a context ID in API requests.
465
+ * @static
466
+ * @type {string}
467
+ */
468
+ static FOLDERS = "/folders?contextId=";
469
+ /**
470
+ * The query parameter to pass a document ID in API requests.
471
+ * @static
472
+ * @type {string}
473
+ */
474
+ static ALERT_BY_DOCUMENT_ID = "alerts?documentId=";
475
+ /**
476
+ * The query parameter to pass a document ID in API requests.
477
+ * @static
478
+ * @type {string}
479
+ */
480
+ static PARENT_DOCUMENT_TYPE_ID = "parentDocumentType?parentDocumentTypeId=";
481
+ /**
482
+ * The query parameter to pass a context ID in API requests.
483
+ * Used to specify the context for certain API calls, such as filtering or scoping the request.
484
+ * @static
485
+ * @type {string}
486
+ */
487
+ static CONTEXT_ID = "&contextId=";
488
+ }
489
+
490
+ /**
491
+ * Service that handles loading and providing configuration settings for the application.
492
+ * It fetches configuration data from a remote server and exposes various configuration options.
493
+ * @class AppConfigService
494
+ * @typedef {AppConfigService}
495
+ */
496
+ class AppConfigService {
497
+ http;
498
+ /**
499
+ * Holds the configuration data loaded from the server.
500
+ * @private
501
+ * @type {*}
502
+ */
503
+ appConfig;
504
+ /**
505
+ * Creates an instance of AppConfigService.
506
+ * Initializes the HttpClient for making HTTP requests.
507
+ * @class
508
+ * @param {HttpClient} http - The HttpClient service used for making HTTP requests.
509
+ */
510
+ constructor(http) {
511
+ this.http = http;
512
+ }
513
+ /**
514
+ * Loads the application configuration from the server by making an HTTP request to the configuration URL.
515
+ * This method retrieves the configuration data and assigns it to the appConfig property.
516
+ * @async
517
+ * @returns {*}
518
+ */
519
+ async loadAppConfig() {
520
+ try {
521
+ this.appConfig = await firstValueFrom(this.http.get(URLS.CONFIGFILEURL));
522
+ }
523
+ catch (error) {
524
+ throw new Error("Api url is missing.");
525
+ }
526
+ }
527
+ /**
528
+ * Returns the base URL for the API from the loaded configuration.
529
+ * @readonly
530
+ * @type {*}
531
+ */
532
+ get apiBaseUrl() {
533
+ return this.appConfig?.documentApiUrl;
534
+ }
535
+ /**
536
+ * Returns the local server API URL from the loaded configuration.
537
+ * @readonly
538
+ * @type {*}
539
+ */
540
+ get localServerApi() {
541
+ return this.appConfig?.localServerApi;
542
+ }
543
+ /**
544
+ * Returns the visibility options from the loaded configuration.
545
+ * @readonly
546
+ * @type {*}
547
+ */
548
+ get visibilityOptions() {
549
+ return this.appConfig?.visibilityOption;
550
+ }
551
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AppConfigService, deps: [{ token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
552
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AppConfigService, providedIn: 'root' });
553
+ }
554
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AppConfigService, decorators: [{
555
+ type: Injectable,
556
+ args: [{
557
+ providedIn: 'root'
558
+ }]
559
+ }], ctorParameters: () => [{ type: i2.HttpClient }] });
560
+
561
+ /**
562
+ * Service for managing document-related operations.
563
+ * The `DocumentService` acts as a bridge between the application and the backend API for handling document-related data.
564
+ * It interacts with the `DocumentStore` for state management and uses `HttpClient` for making HTTP requests.
565
+ * Creates an instance of `DocumentService`.
566
+ * @param {DocumentStore} documentStore - The store that manages the state of documents.
567
+ * @param {HttpClient} http - The Angular HTTP client for making API requests.
568
+ */
569
+ let DocumentService$1 = class DocumentService {
570
+ documentStore;
571
+ http;
572
+ appConfigService;
573
+ /**
574
+ * Creates an instance of DocumentService.
575
+ * @param {DocumentStore} documentStore - Store managing the state of documents.
576
+ * @param {HttpClient} http - Angular HTTP client for making API requests.
577
+ * @param {AppConfigService} appConfigService - Service for retrieving application configuration, such as API base URL.
578
+ */
579
+ constructor(documentStore, http, appConfigService) {
580
+ this.documentStore = documentStore;
581
+ this.http = http;
582
+ this.appConfigService = appConfigService;
583
+ }
584
+ /**
585
+ * Get api url from appConfigService.
586
+ * @readonly
587
+ * @type {string}
588
+ */
589
+ get apiUrl() {
590
+ return this.appConfigService.apiBaseUrl;
591
+ }
592
+ /**
593
+ * Sends a request to create a new document.
594
+ * @param {*} entity - The data of the document to be created.
595
+ * @returns {Observable<any>} Observable that emits the newly created document.
596
+ */
597
+ create(entity) {
598
+ return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}`, entity).pipe(tap((newEntity) => this.documentStore.add(newEntity)));
599
+ }
600
+ /**
601
+ * Fetches all documents from the backend.
602
+ * @returns {Observable<DocumentModel[]>} Observable that emits an array of documents.
603
+ */
604
+ getAll() {
605
+ return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}`).pipe(tap((entities) => this.documentStore.set(entities)));
606
+ }
607
+ /**
608
+ * Fetches a document by its ID.
609
+ * @param {string} id - The unique identifier of the document.
610
+ * @returns {Observable<any>} Observable that emits the retrieved document.
611
+ */
612
+ getById(id) {
613
+ return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`).pipe(tap((entity) => this.documentStore.upsert(id, entity)));
614
+ }
615
+ /**
616
+ * Updates an existing document by its ID.
617
+ * @param {string} id - The unique identifier of the document.
618
+ * @param {DocumentModel} entity - The updated data of the document.
619
+ * @returns {Observable<DocumentModel>} Observable that emits the updated document.
620
+ */
621
+ update(id, entity) {
622
+ return this.http.put(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`, entity).pipe(tap((updatedEntity) => this.documentStore.update(id, updatedEntity)));
623
+ }
624
+ /**
625
+ * Deletes a document by its ID.
626
+ * @param {string} id - The unique identifier of the document to be deleted.
627
+ * @returns {Observable<void>} Observable that completes when the document is deleted.
628
+ */
629
+ delete(id) {
630
+ return this.http.delete(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`).pipe(tap(() => this.documentStore.remove(id)));
631
+ }
632
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService, deps: [{ token: DocumentStore }, { token: i2.HttpClient }, { token: AppConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
633
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService, providedIn: 'root' });
634
+ };
635
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService$1, decorators: [{
636
+ type: Injectable,
637
+ args: [{ providedIn: 'root' }]
638
+ }], ctorParameters: () => [{ type: DocumentStore }, { type: i2.HttpClient }, { type: AppConfigService }] });
639
+
640
+ /**
641
+ * Query service for managing document state.
642
+ * This class extends Akita's `QueryEntity` to provide additional functionality for querying document data.
643
+ * @class DocumentQuery
644
+ * @typedef {DocumentQuery}
645
+ * @augments {QueryEntity<DocumentState>}
646
+ */
647
+ class DocumentQuery extends QueryEntity {
648
+ store;
649
+ constructor(store) {
650
+ super(store);
651
+ this.store = store;
652
+ }
653
+ /**
654
+ * Selects the currently selected folder ID from the document state.
655
+ * @returns {Observable<string | null>} Observable that emits the currently selected folder ID.
656
+ */
657
+ getParentDocumentTypeId() {
658
+ return this.getValue()['parentDocumentTypeId'];
659
+ }
660
+ /**
661
+ * Selects the currently selected folder ID from the document state.
662
+ * @returns {Observable<string | null>} Observable that emits the currently selected folder ID.
663
+ */
664
+ selectParentDocumentTypeId() {
665
+ return this.select((state) => state['parentDocumentTypeId']);
666
+ }
667
+ /**
668
+ * Selects the set messages.
669
+ * @returns {Observable<Message>} Observable that emits the current Message.
670
+ */
671
+ selectMessages() {
672
+ return this.select((state) => state.messages);
673
+ }
674
+ /**
675
+ * Selects the set documents.
676
+ * @returns {Observable<DocumentModel[]>} Observable that emits the documets.
677
+ */
678
+ selectDocumets() {
679
+ return this.select((state) => state.documentList);
680
+ }
681
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentQuery, deps: [{ token: DocumentStore }], target: i0.ɵɵFactoryTarget.Injectable });
682
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentQuery, providedIn: 'root' });
683
+ }
684
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentQuery, decorators: [{
685
+ type: Injectable,
686
+ args: [{ providedIn: 'root' }]
687
+ }], ctorParameters: () => [{ type: DocumentStore }] });
688
+
689
+ /**
690
+ * Service for making HTTP requests related to documents.
691
+ * @class DocumentHttpService
692
+ * @typedef {DocumentHttpService}
693
+ */
694
+ class DocumentHttpService {
695
+ documentStore;
696
+ http;
697
+ appConfigService;
698
+ /**
699
+ * Creates an instance of DocumentService.
700
+ * @param {DocumentStore} documentStore - Store managing the state of documents.
701
+ * @param {HttpClient} http - Angular HTTP client for making API requests.
702
+ * @param {AppConfigService} appConfigService - Service for retrieving application configuration, such as API base URL.
703
+ */
704
+ constructor(documentStore, http, appConfigService) {
705
+ this.documentStore = documentStore;
706
+ this.http = http;
707
+ this.appConfigService = appConfigService;
708
+ }
709
+ /**
710
+ * Get api url from appConfigService.
711
+ * @readonly
712
+ * @type {string}
713
+ */
714
+ get apiUrl() {
715
+ return this.appConfigService.apiBaseUrl;
716
+ }
717
+ /**
718
+ * Fetches a document by its path name and transforms the response for dropdown options.
719
+ * Includes error handling for failed API requests.
720
+ * @param {string} contextId - The context ID to fetch the document.
721
+ * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
722
+ */
723
+ getFoldersData(contextId) {
724
+ if (!contextId)
725
+ return EMPTY;
726
+ return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}${URLS.FOLDERS}${contextId}`).pipe(tap((folders) => {
727
+ this.documentStore.setFolders(folders);
728
+ }), catchError((error) => {
729
+ return throwError(() => new Error(error));
730
+ }));
731
+ }
732
+ /**
733
+ * Fetches a document by its path name and transforms the response for dropdown options.
734
+ * Includes error handling for failed API requests.
735
+ * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
736
+ */
737
+ getDocumentTypes() {
738
+ return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${URLS.DOCUMENT_TYPES}`).pipe(tap((documentTypes) => {
739
+ this.documentStore.setDocumentTypes(documentTypes);
740
+ }), catchError((error) => {
741
+ return throwError(() => new Error(error));
742
+ }));
743
+ }
744
+ /**
745
+ * Fetches a document by its path name and transforms the response for dropdown options.
746
+ * @param {string} documentId - The document ID to fetch the document.
747
+ * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
748
+ */
749
+ getAlertsByDocumentID(documentId) {
750
+ return this.http.get(`${this.apiUrl}${URLS.ALERT_BY_DOCUMENT_ID}${documentId}`).pipe(tap((documentAlert) => {
751
+ this.documentStore.setDocumentAlert(documentAlert);
752
+ }), catchError((error) => {
753
+ return throwError(() => new Error(error));
754
+ }));
755
+ }
756
+ /**
757
+ * Fetches a document by its folder ID and transforms the response for dropdown options.
758
+ * @param {string} folderId - The folder ID to fetch the document.
759
+ * @param {string} contextId - The context ID to fetch the document.
760
+ * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
761
+ */
762
+ getDocumentByFolderID(folderId, contextId) {
763
+ return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${URLS.PARENT_DOCUMENT_TYPE_ID}${folderId}${URLS.CONTEXT_ID}${contextId}`).pipe(tap((records) => {
764
+ this.documentStore.set(records);
765
+ }), catchError((error) => {
766
+ return throwError(() => new Error(error));
767
+ }));
768
+ }
769
+ /**
770
+ * Updates the name of a document.
771
+ * This method sends an HTTP PUT request to update the document's file name using the provided document ID and payload.
772
+ * In case of an error, it will return an observable that throws an Error.
773
+ * @param {string} documentId - The unique identifier of the document to update.
774
+ * @param {any} payload - The payload containing the updated document data (e.g., fileName).
775
+ * @returns {Observable<DocumentModel>} An observable that emits the updated DocumentModel.
776
+ */
777
+ updateDocumentName(documentId, payload) {
778
+ return this.http.put(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${documentId}`, payload).pipe(catchError((error) => {
779
+ return throwError(() => new Error(error));
780
+ }));
781
+ }
782
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentHttpService, deps: [{ token: DocumentStore }, { token: i2.HttpClient }, { token: AppConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
783
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentHttpService, providedIn: 'root' });
784
+ }
785
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentHttpService, decorators: [{
786
+ type: Injectable,
787
+ args: [{
788
+ providedIn: 'root'
789
+ }]
790
+ }], ctorParameters: () => [{ type: DocumentStore }, { type: i2.HttpClient }, { type: AppConfigService }] });
791
+
792
+ /**
793
+ * The `FolderBlockComponent` is responsible for displaying a block of folders and
794
+ * providing filtering functionality based on folder IDs.
795
+ *
796
+ * It uses data from the `DocumentStore` and constants from the `SHARED` configuration
797
+ * to display missing and pending file counts.
798
+ */
799
+ class FolderBlockComponent {
800
+ documentStore;
801
+ /**
802
+ * Array of folder blocks data to display.
803
+ * Each folder is represented as a `FolderBlockModel`.
804
+ */
805
+ folderList = SHARED.EMPTY_ARRAY;
806
+ /** Number of missing files, sourced from the `SHARED` constants. */
807
+ missingFileCount = SHARED.MISSINGCOUNT;
808
+ /** Number of pending files, sourced from the `SHARED` constants. */
809
+ pendingFileCount = SHARED.PENDINGCOUNT;
810
+ /**
811
+ * Injects the `DocumentStore` service to manage and access document-related state.
812
+ * @param {DocumentStore} documentStore - The state management store for documents.
813
+ */
814
+ constructor(documentStore) {
815
+ this.documentStore = documentStore;
816
+ }
817
+ /**
818
+ * Handles the click event for filtering based on the provided folder ID.
819
+ * This method validates the folder ID and returns it for further processing.
820
+ * If the folder ID is not provided, an empty string is returned.
821
+ * @param {string} folderBlockId - The unique identifier of the folder to filter by.
822
+ * @returns {string} The validated folder ID, or an empty string if the input is invalid.
823
+ */
824
+ handleClickForFilter(folderBlockId) {
825
+ if (!folderBlockId) {
826
+ return SHARED.EMPTY;
827
+ }
828
+ this.documentStore.setParentDocumentTypeId(folderBlockId);
829
+ return folderBlockId;
830
+ }
831
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FolderBlockComponent, deps: [{ token: DocumentStore }], target: i0.ɵɵFactoryTarget.Component });
832
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: FolderBlockComponent, isStandalone: false, selector: "lib-folder-block", inputs: { folderList: "folderList" }, ngImport: i0, template: "<div class=\"card p-0 folder-info\">\r\n <div class=\"text-900 text-xl font-semibold ml-2 mb-1\">Folders</div>\r\n <div class=\"grid m-0\">\r\n <div *ngFor=\"let folder of folderList\" class=\"col-12 md:col-6 xl:col-4 container-wrapper\">\r\n <div\r\n class=\"p-3 border-1 h-full surface-border flex flex-column justify-content-between hover:surface-100 cursor-pointer border-round\"\r\n (click)=\"handleClickForFilter(folder._id)\"\r\n >\r\n <div class=\"icon\">\r\n <img src=\"../../../../assets/images/FolderImg.png\" alt=\"\" />\r\n </div>\r\n <div class=\"flex flex-column\">\r\n <span class=\"text-600 mt-2\"> {{ folder.documentCount }} Files </span>\r\n <span class=\"text-900 text-lg mt-2 mb-2 font-semibold font-medium\">\r\n {{ folder.folderName }}\r\n </span>\r\n </div>\r\n <hr />\r\n <div class=\"flex justify-content-between\">\r\n <div class=\"flex flex-column\">\r\n <span>Missing</span>\r\n <span\r\n [ngClass]=\"{\r\n 'text-pink-500': missingFileCount > 0,\r\n 'text-green-500': missingFileCount === 0\r\n }\"\r\n >\r\n {{ missingFileCount }}\r\n </span>\r\n </div>\r\n <div class=\"flex flex-column\">\r\n <span>Pending</span>\r\n <span\r\n [ngClass]=\"{\r\n 'text-yellow-500': pendingFileCount > 0,\r\n 'text-green-500': pendingFileCount === 0\r\n }\"\r\n >\r\n {{ pendingFileCount }}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".container-wrapper:nth-child(3n+1){padding-left:0}.container-wrapper:nth-child(3n){padding-right:0}\n"], dependencies: [{ kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
833
+ }
834
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FolderBlockComponent, decorators: [{
835
+ type: Component,
836
+ args: [{ selector: 'lib-folder-block', standalone: false, template: "<div class=\"card p-0 folder-info\">\r\n <div class=\"text-900 text-xl font-semibold ml-2 mb-1\">Folders</div>\r\n <div class=\"grid m-0\">\r\n <div *ngFor=\"let folder of folderList\" class=\"col-12 md:col-6 xl:col-4 container-wrapper\">\r\n <div\r\n class=\"p-3 border-1 h-full surface-border flex flex-column justify-content-between hover:surface-100 cursor-pointer border-round\"\r\n (click)=\"handleClickForFilter(folder._id)\"\r\n >\r\n <div class=\"icon\">\r\n <img src=\"../../../../assets/images/FolderImg.png\" alt=\"\" />\r\n </div>\r\n <div class=\"flex flex-column\">\r\n <span class=\"text-600 mt-2\"> {{ folder.documentCount }} Files </span>\r\n <span class=\"text-900 text-lg mt-2 mb-2 font-semibold font-medium\">\r\n {{ folder.folderName }}\r\n </span>\r\n </div>\r\n <hr />\r\n <div class=\"flex justify-content-between\">\r\n <div class=\"flex flex-column\">\r\n <span>Missing</span>\r\n <span\r\n [ngClass]=\"{\r\n 'text-pink-500': missingFileCount > 0,\r\n 'text-green-500': missingFileCount === 0\r\n }\"\r\n >\r\n {{ missingFileCount }}\r\n </span>\r\n </div>\r\n <div class=\"flex flex-column\">\r\n <span>Pending</span>\r\n <span\r\n [ngClass]=\"{\r\n 'text-yellow-500': pendingFileCount > 0,\r\n 'text-green-500': pendingFileCount === 0\r\n }\"\r\n >\r\n {{ pendingFileCount }}\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".container-wrapper:nth-child(3n+1){padding-left:0}.container-wrapper:nth-child(3n){padding-right:0}\n"] }]
837
+ }], ctorParameters: () => [{ type: DocumentStore }], propDecorators: { folderList: [{
838
+ type: Input
839
+ }] } });
840
+
841
+ /**
842
+ * The `FolderContainerComponent` is responsible for rendering a container
843
+ * that displays a list of documents and associated folder panel data.
844
+ *
845
+ * This component utilizes the `FOLDERPANEL` constant for folder panel data
846
+ * and accepts a document list input of type `DocumentModel`.
847
+ */
848
+ class FolderContainerComponent {
849
+ /**
850
+ * A list of documents passed as input to the component.
851
+ * Represents the document data to be displayed in the folder container.
852
+ */
853
+ documentList;
854
+ /**
855
+ * A list of documents passed as input to the component.
856
+ * Represents the document data to be displayed in the folder container.
857
+ */
858
+ folderList = SHARED.EMPTY_ARRAY;
859
+ /**
860
+ * The context ID for the folder container.
861
+ * @type {string}
862
+ */
863
+ contextId = SHARED.EMPTY;
864
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FolderContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
865
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: FolderContainerComponent, isStandalone: false, selector: "lib-folder-container", inputs: { documentList: "documentList", folderList: "folderList", contextId: "contextId" }, ngImport: i0, template: "\r\n<lib-folder-block [folderList]=\"folderList\"></lib-folder-block>", styles: [""], dependencies: [{ kind: "component", type: FolderBlockComponent, selector: "lib-folder-block", inputs: ["folderList"] }] });
866
+ }
867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FolderContainerComponent, decorators: [{
868
+ type: Component,
869
+ args: [{ selector: 'lib-folder-container', standalone: false, template: "\r\n<lib-folder-block [folderList]=\"folderList\"></lib-folder-block>" }]
870
+ }], propDecorators: { documentList: [{
871
+ type: Input
872
+ }], folderList: [{
873
+ type: Input
874
+ }], contextId: [{
875
+ type: Input
876
+ }] } });
877
+
878
+ /**
879
+ * Storing all permission properties.
880
+ * @export
881
+ * @class PERMISSIONS
882
+ * @typedef {PERMISSIONS}
883
+ */
884
+ class PERMISSIONS {
885
+ /**
886
+ * Access permission.
887
+ * @static
888
+ * @type {string}
889
+ */
890
+ static DOCUMENT_POST = 'Documents-POST';
891
+ }
892
+
893
+ /**
894
+ * Service for handling document uploads.
895
+ * @class DocumentUploadService
896
+ * @typedef {DocumentUploadService}
897
+ */
898
+ class DocumentUploadService {
899
+ documentService;
900
+ documentUploadStore;
901
+ messageService;
902
+ /**
903
+ * The file to upload.
904
+ * @type {*}
905
+ */
906
+ uploadedFile;
907
+ /**
908
+ * Represent contextId
909
+ * @type {string}
910
+ */
911
+ contextId = SHARED.EMPTY;
912
+ /**
913
+ * Represent document name
914
+ * @type {string}
915
+ */
916
+ docName = SHARED.EMPTY;
917
+ /**
918
+ * Represent document id
919
+ * @type {string}
920
+ */
921
+ docTypeId = SHARED.EMPTY;
922
+ /**
923
+ * Creates an instance of DocumentUploadService.
924
+ * @param {DocumentService} documentService - Service for handling document uploads.
925
+ * @param {DocumentStore} documentUploadStore - Store for managing uploaded documents.
926
+ * @param {MessageService} messageService - Service for displaying messages.
927
+ * @returns {void}
928
+ */
929
+ constructor(documentService, documentUploadStore, messageService) {
930
+ this.documentService = documentService;
931
+ this.documentUploadStore = documentUploadStore;
932
+ this.messageService = messageService;
933
+ }
934
+ /**
935
+ * Prepares the files for upload by creating a FormData object.
936
+ * This method appends each file to the FormData for submission.
937
+ * @returns {void}
938
+ */
939
+ handleTemplatedUpload() {
940
+ let formsData = this.handleCreateFormData();
941
+ if (!formsData) {
942
+ this.messageService.add({ severity: SHARED.SEVERITY, summary: SHARED.UPLOAD_ERROR_SUMMERY, detail: SHARED.UPLOAD_ERROR_DETAILS });
943
+ return;
944
+ }
945
+ this.documentService.create(formsData)
946
+ .subscribe({
947
+ /**
948
+ * Handles the successful upload event.
949
+ * Updates the list of uploaded files and emits the file ID.
950
+ * @param {any} event - The event emitted by the upload service on success.
951
+ */
952
+ next: (event) => {
953
+ this.documentUploadStore.setUploadedDocumentFiles(event);
954
+ this.documentUploadStore.setMessage([{
955
+ severity: SHARED.SUCCESS_SEVERITY,
956
+ detail: SHARED.UPLOAD_SUCCESS
957
+ }]);
958
+ },
959
+ /**
960
+ * Handles the error event during file upload.
961
+ * Updates the progress of the file to indicate failure.
962
+ * @param {any} error - The error object returned by the upload service.
963
+ */
964
+ error: (error) => {
965
+ this.documentUploadStore.setMessage([{ severity: SHARED.SEVERITY, summary: SHARED.UPLOAD_SUMMERY, detail: error?.message }]);
966
+ },
967
+ });
968
+ }
969
+ /**
970
+ * Get the file and contextId
971
+ * @param file - The file to upload.
972
+ * @param contextId - The contextId to upload.
973
+ */
974
+ getUploadFileData(file, contextId) {
975
+ if (file && contextId) {
976
+ this.uploadedFile = file;
977
+ this.contextId = contextId;
978
+ }
979
+ }
980
+ /**
981
+ * Get the document name and document type id
982
+ * @param documentName - The document name to upload.
983
+ * @param documentTypeId - The document type id to upload.
984
+ */
985
+ getDocumentNameAndType(documentTypeId) {
986
+ if (documentTypeId) {
987
+ this.docTypeId = documentTypeId;
988
+ }
989
+ }
990
+ /**
991
+ * Handle the creation of formdata.
992
+ * @returns {*} - The formdata object.
993
+ */
994
+ handleCreateFormData() {
995
+ if (this.uploadedFile && this.contextId && this.docTypeId) {
996
+ let formData = new FormData();
997
+ formData.append(SHARED.FILE, this.uploadedFile, this.uploadedFile.name);
998
+ formData.append(SHARED.CONTEXT_ID, this.contextId);
999
+ formData.append(SHARED.DOCUMENT_TYPE_ID, this.docTypeId);
1000
+ return formData;
1001
+ }
1002
+ else {
1003
+ return null;
1004
+ }
1005
+ }
1006
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadService, deps: [{ token: DocumentService$1 }, { token: DocumentStore }, { token: i3.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
1007
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadService, providedIn: 'root' });
1008
+ }
1009
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadService, decorators: [{
1010
+ type: Injectable,
1011
+ args: [{
1012
+ providedIn: 'root'
1013
+ }]
1014
+ }], ctorParameters: () => [{ type: DocumentService$1 }, { type: DocumentStore }, { type: i3.MessageService }] });
1015
+
1016
+ /**
1017
+ * DocumentListItemComponent
1018
+ *
1019
+ * This component displays individual document items within a list.
1020
+ * It accepts a list of documents as input and handles interactions with documents.
1021
+ */
1022
+ class DocumentListItemComponent {
1023
+ /**
1024
+ * Emit the selected document.
1025
+ * @type {EventEmitter<DocumentModel>}
1026
+ */
1027
+ documentClick = new EventEmitter();
1028
+ /**
1029
+ * The document to display.
1030
+ * @type {DocumentModel[]}
1031
+ */
1032
+ document;
1033
+ /**
1034
+ * Handles interactions with a document.
1035
+ * @param {DocumentModel} document - The document to be opened or interacted with.
1036
+ */
1037
+ handleOpenDocument(document) {
1038
+ if (!document) {
1039
+ console.error('Error: Document is null or undefined:', document);
1040
+ return;
1041
+ }
1042
+ this.documentClick.emit(document);
1043
+ }
1044
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1045
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DocumentListItemComponent, isStandalone: false, selector: "lib-document-list-item", inputs: { document: "document" }, outputs: { documentClick: "documentClick" }, ngImport: i0, template: "<div class=\"grid m-0\">\r\n <div\r\n class=\"col-12 flex align-items-center justify-content-between md:col-12 xl:col-12\"\r\n >\r\n <div\r\n class=\"col-5 flex cursor-pointer align-items-center pl-0\"\r\n (click)=\"handleOpenDocument(document)\"\r\n >\r\n <img src=\"../../../../assets/images/Frame.png\" alt=\"\" />\r\n <span class=\"ml-4 file-name-wrapper document-text-wrapper\">{{ document.fileName }}</span>\r\n </div>\r\n <div class=\"col-4 flex align-items-center justify-content-center\">\r\n <span\r\n [class]=\"'product-badge status-' + document.status?.toLowerCase()\"\r\n class=\"flex align-items-center justify-content-center pl-2 pr-2 pt-1 pb-1\"\r\n >\r\n <ng-container *ngIf=\"document.status?.toLowerCase() === 'pending'\">\r\n <i class=\"pi pi-clock pr-1\" style=\"font-size: 12px;\"></i>\r\n Pending\r\n </ng-container>\r\n <ng-container *ngIf=\"document.status?.toLowerCase() === 'verified'\">\r\n <i class=\"pi pi-check-circle pr-1\" style=\"font-size: 12px;\"></i>\r\n Verified\r\n </ng-container>\r\n <ng-container *ngIf=\"document.status?.toLowerCase() === 'alert'\">\r\n <i class=\"pi pi-bell pr-1\" style=\"font-size: 12px;\"></i>\r\n Alert\r\n </ng-container>\r\n </span>\r\n </div>\r\n <div class=\"document-type file-name-wrapper document-text-wrapper\">\r\n {{document.documentTypeName}}\r\n </div>\r\n </div>\r\n </div>\r\n ", styles: [".product-badge.status-pending{background:#e9b127;color:#fff;border-radius:4px}.product-badge.status-verified{background:#4caf50;color:#fff;border-radius:4px}.product-badge.status-alert{background:#f57c00;color:#fff;border-radius:4px}.product-badge{text-transform:none;font-weight:500;font-size:12px}.file-name-wrapper{font-size:15px;font-weight:500}.document-text-wrapper{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1046
+ }
1047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentListItemComponent, decorators: [{
1048
+ type: Component,
1049
+ args: [{ selector: 'lib-document-list-item', standalone: false, template: "<div class=\"grid m-0\">\r\n <div\r\n class=\"col-12 flex align-items-center justify-content-between md:col-12 xl:col-12\"\r\n >\r\n <div\r\n class=\"col-5 flex cursor-pointer align-items-center pl-0\"\r\n (click)=\"handleOpenDocument(document)\"\r\n >\r\n <img src=\"../../../../assets/images/Frame.png\" alt=\"\" />\r\n <span class=\"ml-4 file-name-wrapper document-text-wrapper\">{{ document.fileName }}</span>\r\n </div>\r\n <div class=\"col-4 flex align-items-center justify-content-center\">\r\n <span\r\n [class]=\"'product-badge status-' + document.status?.toLowerCase()\"\r\n class=\"flex align-items-center justify-content-center pl-2 pr-2 pt-1 pb-1\"\r\n >\r\n <ng-container *ngIf=\"document.status?.toLowerCase() === 'pending'\">\r\n <i class=\"pi pi-clock pr-1\" style=\"font-size: 12px;\"></i>\r\n Pending\r\n </ng-container>\r\n <ng-container *ngIf=\"document.status?.toLowerCase() === 'verified'\">\r\n <i class=\"pi pi-check-circle pr-1\" style=\"font-size: 12px;\"></i>\r\n Verified\r\n </ng-container>\r\n <ng-container *ngIf=\"document.status?.toLowerCase() === 'alert'\">\r\n <i class=\"pi pi-bell pr-1\" style=\"font-size: 12px;\"></i>\r\n Alert\r\n </ng-container>\r\n </span>\r\n </div>\r\n <div class=\"document-type file-name-wrapper document-text-wrapper\">\r\n {{document.documentTypeName}}\r\n </div>\r\n </div>\r\n </div>\r\n ", styles: [".product-badge.status-pending{background:#e9b127;color:#fff;border-radius:4px}.product-badge.status-verified{background:#4caf50;color:#fff;border-radius:4px}.product-badge.status-alert{background:#f57c00;color:#fff;border-radius:4px}.product-badge{text-transform:none;font-weight:500;font-size:12px}.file-name-wrapper{font-size:15px;font-weight:500}.document-text-wrapper{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}\n"] }]
1050
+ }], propDecorators: { documentClick: [{
1051
+ type: Output
1052
+ }], document: [{
1053
+ type: Input
1054
+ }] } });
1055
+
1056
+ /**
1057
+ * Description placeholder
1058
+ * @class FileFormatService
1059
+ * @typedef {FileFormatService}
1060
+ */
1061
+ class FileFormatService {
1062
+ /**
1063
+ * Creates an instance of FileFormatService.
1064
+ * @constructor
1065
+ */
1066
+ constructor() { }
1067
+ /**
1068
+ * Description placeholder
1069
+ * @param {number} bytes
1070
+ * @param {PrimeNGConfig} config
1071
+ * @returns {string}
1072
+ */
1073
+ formatFileSize(bytes, config) {
1074
+ const kilobyte = 1024;
1075
+ const decimalPlaces = SHARED.ONE;
1076
+ const sizes = config.translation.fileSizeTypes || SHARED.FILE_SIZE_UNITS;
1077
+ if (bytes < kilobyte) {
1078
+ return `${bytes} ${sizes[SHARED.INITIAL_COUNT]}`;
1079
+ }
1080
+ else if (bytes < kilobyte * kilobyte) {
1081
+ const kbSize = bytes / kilobyte;
1082
+ return `${parseFloat(kbSize.toFixed(decimalPlaces))} ${sizes[SHARED.ONE]}`;
1083
+ }
1084
+ else {
1085
+ const mbSize = bytes / (kilobyte * kilobyte);
1086
+ return `${parseFloat(mbSize.toFixed(decimalPlaces))} ${sizes[SHARED.TWO]}`;
1087
+ }
1088
+ }
1089
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FileFormatService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1090
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FileFormatService, providedIn: 'root' });
1091
+ }
1092
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FileFormatService, decorators: [{
1093
+ type: Injectable,
1094
+ args: [{
1095
+ providedIn: 'root'
1096
+ }]
1097
+ }], ctorParameters: () => [] });
1098
+
1099
+ /**
1100
+ * A component for handling document uploads, including file selection, removal, and progress tracking.
1101
+ * @class DocumentUploadComponent
1102
+ */
1103
+ class DocumentUploadComponent {
1104
+ documentUpload;
1105
+ uploadService;
1106
+ config;
1107
+ fileFormatService;
1108
+ messageService;
1109
+ cdr;
1110
+ /**
1111
+ * Represents the file size.
1112
+ * @type {number}
1113
+ */
1114
+ fileSize = SHARED.EMPTY;
1115
+ /**
1116
+ * Represent contextId
1117
+ * @type {string}
1118
+ */
1119
+ contextId = SHARED.EMPTY;
1120
+ /**
1121
+ * To make file explorer visible.
1122
+ * @type {!FileUpload}
1123
+ */
1124
+ fileUploader;
1125
+ fileProgress = new Map();
1126
+ /**
1127
+ * List of files selected for upload.
1128
+ * @type {File[]}
1129
+ */
1130
+ uploadedFiles = [];
1131
+ /**
1132
+ * Percentage of the total size calculated for displaying upload progress.
1133
+ * @type {number}
1134
+ */
1135
+ totalSizePercent = SHARED.INITIAL_COUNT;
1136
+ /**
1137
+ * The current upload progress percentage (SHARED.INITIAL_VALUE-100).
1138
+ * @type {number}
1139
+ */
1140
+ uploadProgress = SHARED.INITIAL_COUNT;
1141
+ /**
1142
+ * Creates an instance of DocumentUploadComponent.
1143
+ * @class
1144
+ * @param {DocumentUploadService} documentUpload - Service for handling document upload.
1145
+ * @param {DocumentService} uploadService - Service for handling document upload.
1146
+ * @param {PrimeNGConfig} config - PrimeNG configuration.
1147
+ * @param {FileFormatService} fileFormatService - Service for formatting file sizes.
1148
+ * @param {MessageService} messageService - Service for displaying messages.
1149
+ * @param {ChangeDetectorRef} cdr - Service for detecting changes.
1150
+ */
1151
+ constructor(documentUpload, uploadService, config, fileFormatService, messageService, cdr) {
1152
+ this.documentUpload = documentUpload;
1153
+ this.uploadService = uploadService;
1154
+ this.config = config;
1155
+ this.fileFormatService = fileFormatService;
1156
+ this.messageService = messageService;
1157
+ this.cdr = cdr;
1158
+ }
1159
+ /**
1160
+ * Open the file explorer.
1161
+ * @param {*} event - The triggering event.
1162
+ * @param {() => void} callback - A callback function to execute.
1163
+ * @returns {void} - No return value.
1164
+ */
1165
+ choose(event, callback) {
1166
+ callback();
1167
+ }
1168
+ /**
1169
+ * Prepares the files for upload by creating a FormData object.
1170
+ * This method appends each file to the FormData for submission.
1171
+ * @param {File} file - The file to upload.
1172
+ * @returns {void}
1173
+ */
1174
+ handleTemplatedUpload(file) {
1175
+ this.documentUpload.getUploadFileData(file, this.contextId);
1176
+ const formattedSize = this.fileFormatService.formatFileSize(file.size, this.config);
1177
+ const progress = 100;
1178
+ this.uploadedFiles.push({ file, formattedSize, progress });
1179
+ this.fileProgress.set(file, progress);
1180
+ this.totalSizePercent = 100;
1181
+ }
1182
+ /**
1183
+ * Handle the creation of formdata.
1184
+ * @param {File} file - The file to append in formdata.
1185
+ * @returns {*} - The formdata object.
1186
+ */
1187
+ handleCreateFormData(file) {
1188
+ const formData = new FormData();
1189
+ formData.append(SHARED.FILE, file, file.name);
1190
+ formData.append(SHARED.CONTEXT_ID, this.contextId);
1191
+ return formData;
1192
+ }
1193
+ /**
1194
+ * Handles the event when new files are selected.
1195
+ * @param { { currentFiles: File[] } } event - The event containing the newly selected files.
1196
+ * @returns {void} - No return value.
1197
+ */
1198
+ onSelectedFiles(event) {
1199
+ event.currentFiles.forEach((file) => {
1200
+ this.handleTemplatedUpload(file);
1201
+ });
1202
+ this.fileUploader.clear();
1203
+ }
1204
+ /**
1205
+ * Formats the given file size in bytes into a readable format (e.g., KB, MB).
1206
+ * @param {number} bytes - The size of the file in bytes.
1207
+ * @returns {string} The formatted file size (e.g., '1.2 KB', '2.3 MB').
1208
+ */
1209
+ formatSize(bytes) {
1210
+ this.fileSize = this.fileFormatService.formatFileSize(bytes, this.config);
1211
+ }
1212
+ /**
1213
+ * Handles the removal of a file from the uploaded files list.
1214
+ * @param {File} file - The file to be removed.
1215
+ * @param {number} index - The index of the file in the uploaded files list.
1216
+ */
1217
+ handleDocumentRemove(file, index) {
1218
+ this.uploadedFiles.splice(index, 1);
1219
+ this.fileProgress.delete(file);
1220
+ this.cdr.detectChanges();
1221
+ }
1222
+ /**
1223
+ * Major progress for the progress bar.
1224
+ * @param {File} file - File to check progress for.
1225
+ * @returns {number} - The progress percentage for the file.
1226
+ */
1227
+ getProgress(file) {
1228
+ return this.fileProgress.get(file) || SHARED.INITIAL_COUNT;
1229
+ }
1230
+ /**
1231
+ * Triggers the file upload dialog.
1232
+ * Opens the file explorer for selecting files.
1233
+ * @returns {void}
1234
+ */
1235
+ triggerFileUpload() {
1236
+ this.fileUploader.choose();
1237
+ }
1238
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadComponent, deps: [{ token: DocumentUploadService }, { token: DocumentService$1 }, { token: i3.PrimeNGConfig }, { token: FileFormatService }, { token: i3.MessageService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1239
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DocumentUploadComponent, isStandalone: false, selector: "lib-document-upload", inputs: { contextId: "contextId" }, viewQueries: [{ propertyName: "fileUploader", first: true, predicate: ["fileUploader"], descendants: true }], ngImport: i0, template: "<div class=\"grid\">\r\n <div class=\"col-12 md:col-12\">\r\n <p-fileUpload #fileUploader [multiple]=\"true\" auto=\"true\" accept=\"image/png,application/pdf\" maxFileSize=\"26214400\"\r\n (onSelect)=\"onSelectedFiles($event)\">\r\n <ng-template pTemplate=\"header\" let-chooseCallback=\"chooseCallback\" let-clearCallback=\"clearCallback\">\r\n <div class=\"docHeader p-2 flex flex-wrap justify-content-between align-items-center flex-1 gap-2\">\r\n <div class=\"flex gap-2\">\r\n <p-button (onClick)=\"choose($event, chooseCallback)\" icon=\"pi pi-images\" [rounded]=\"true\"\r\n [outlined]=\"true\" />\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"content\" let-removeFileCallback=\"removeFileCallback\"\r\n let-removeUploadedFileCallback=\"removeUploadedFileCallback\">\r\n <div class=\"col-12 md:col-12 p-0\">\r\n <div class=\"col-12 md:col-12 p-0\" *ngIf=\"uploadedFiles.length > 0\">\r\n <div *ngFor=\"let uploadedFile of uploadedFiles; let i = index\"\r\n class=\"m-0 flex flex-column align-items-center gap-1 mt-3\">\r\n <div class=\"col-12 md:col-12 p-0 flex documentInfo\">\r\n <div class=\"documentImage\">\r\n <img src=\"../../../../assets/images/document.png\" [alt]=\"uploadedFile.file.name\" width=\"45\" height=\"50\"\r\n class=\"object-contain\" />\r\n </div>\r\n <div class=\"flex w-full flex-column mt-2 ml-2\">\r\n <div class=\"flex justify-content-between\">\r\n <div style=\" font-weight: bold;font-size: 14px\">\r\n {{ uploadedFile.file.name }}\r\n </div>\r\n <i class=\"pi pi-times cursor-pointer\" (click)=\"handleDocumentRemove(uploadedFile.file,i)\"></i>\r\n </div>\r\n <div class=\"flex justify-content-between mt-1\">\r\n <div style=\"color: #676B89; font-size: 12px; color: green;\" class=\"pi pi-verified \"> {{ uploadedFile.formattedSize }}</div>\r\n <div class=\"white-space-nowrap\" style=\"color: #0F8BFD; font-family: 14px;\"> {{ uploadedFile.progress }} %</div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 md:col-12 p-0\">\r\n <p-progressBar [value]=\"totalSizePercent\" [showValue]=\"false\" styleClass=\"h-1/2rem md:ml-auto relative\"\r\n [ngClass]=\"{ 'exceeded-progress-bar': totalSizePercent > 100 }\">\r\n </p-progressBar>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"empty\" let-chooseCallback=\"chooseCallback\">\r\n <div *ngIf=\"!uploadedFiles.length\" class=\"flex align-items-center justify-content-center flex-column\"\r\n (click)=\"triggerFileUpload()\">\r\n <i class=\"pi pi-cloud-upload border-2 border-circle p-5 text-8xl text-400 border-400\"></i>\r\n <p class=\"mt-4 mb-0\">Drag and drop files here to upload.</p>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"file\"> </ng-template>\r\n </p-fileUpload>\r\n </div>\r\n</div>", styles: [".flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.flex-col{flex-direction:column}.text-muted-color{color:#6c757d}.p-fileupload-buttonbar{padding:0}.p-fileupload-content{background-color:#0f8bfd1a}.p-fileupload .p-fileupload-content{padding:1rem}.docHeader .p-button-icon{padding:.5rem}\n"], dependencies: [{ kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i7.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i7$1.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "uploadStyleClass", "cancelStyleClass", "removeStyleClass", "chooseStyleClass", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler", "onImageError", "onRemoveUploadedFile"] }, { kind: "component", type: i8.ProgressBar, selector: "p-progressBar", inputs: ["value", "showValue", "styleClass", "style", "unit", "mode", "color"] }], encapsulation: i0.ViewEncapsulation.None });
1240
+ }
1241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadComponent, decorators: [{
1242
+ type: Component,
1243
+ args: [{ selector: 'lib-document-upload', standalone: false, encapsulation: ViewEncapsulation.None, template: "<div class=\"grid\">\r\n <div class=\"col-12 md:col-12\">\r\n <p-fileUpload #fileUploader [multiple]=\"true\" auto=\"true\" accept=\"image/png,application/pdf\" maxFileSize=\"26214400\"\r\n (onSelect)=\"onSelectedFiles($event)\">\r\n <ng-template pTemplate=\"header\" let-chooseCallback=\"chooseCallback\" let-clearCallback=\"clearCallback\">\r\n <div class=\"docHeader p-2 flex flex-wrap justify-content-between align-items-center flex-1 gap-2\">\r\n <div class=\"flex gap-2\">\r\n <p-button (onClick)=\"choose($event, chooseCallback)\" icon=\"pi pi-images\" [rounded]=\"true\"\r\n [outlined]=\"true\" />\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"content\" let-removeFileCallback=\"removeFileCallback\"\r\n let-removeUploadedFileCallback=\"removeUploadedFileCallback\">\r\n <div class=\"col-12 md:col-12 p-0\">\r\n <div class=\"col-12 md:col-12 p-0\" *ngIf=\"uploadedFiles.length > 0\">\r\n <div *ngFor=\"let uploadedFile of uploadedFiles; let i = index\"\r\n class=\"m-0 flex flex-column align-items-center gap-1 mt-3\">\r\n <div class=\"col-12 md:col-12 p-0 flex documentInfo\">\r\n <div class=\"documentImage\">\r\n <img src=\"../../../../assets/images/document.png\" [alt]=\"uploadedFile.file.name\" width=\"45\" height=\"50\"\r\n class=\"object-contain\" />\r\n </div>\r\n <div class=\"flex w-full flex-column mt-2 ml-2\">\r\n <div class=\"flex justify-content-between\">\r\n <div style=\" font-weight: bold;font-size: 14px\">\r\n {{ uploadedFile.file.name }}\r\n </div>\r\n <i class=\"pi pi-times cursor-pointer\" (click)=\"handleDocumentRemove(uploadedFile.file,i)\"></i>\r\n </div>\r\n <div class=\"flex justify-content-between mt-1\">\r\n <div style=\"color: #676B89; font-size: 12px; color: green;\" class=\"pi pi-verified \"> {{ uploadedFile.formattedSize }}</div>\r\n <div class=\"white-space-nowrap\" style=\"color: #0F8BFD; font-family: 14px;\"> {{ uploadedFile.progress }} %</div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 md:col-12 p-0\">\r\n <p-progressBar [value]=\"totalSizePercent\" [showValue]=\"false\" styleClass=\"h-1/2rem md:ml-auto relative\"\r\n [ngClass]=\"{ 'exceeded-progress-bar': totalSizePercent > 100 }\">\r\n </p-progressBar>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"empty\" let-chooseCallback=\"chooseCallback\">\r\n <div *ngIf=\"!uploadedFiles.length\" class=\"flex align-items-center justify-content-center flex-column\"\r\n (click)=\"triggerFileUpload()\">\r\n <i class=\"pi pi-cloud-upload border-2 border-circle p-5 text-8xl text-400 border-400\"></i>\r\n <p class=\"mt-4 mb-0\">Drag and drop files here to upload.</p>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"file\"> </ng-template>\r\n </p-fileUpload>\r\n </div>\r\n</div>", styles: [".flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.flex-col{flex-direction:column}.text-muted-color{color:#6c757d}.p-fileupload-buttonbar{padding:0}.p-fileupload-content{background-color:#0f8bfd1a}.p-fileupload .p-fileupload-content{padding:1rem}.docHeader .p-button-icon{padding:.5rem}\n"] }]
1244
+ }], ctorParameters: () => [{ type: DocumentUploadService }, { type: DocumentService$1 }, { type: i3.PrimeNGConfig }, { type: FileFormatService }, { type: i3.MessageService }, { type: i0.ChangeDetectorRef }], propDecorators: { contextId: [{
1245
+ type: Input
1246
+ }], fileUploader: [{
1247
+ type: ViewChild,
1248
+ args: ['fileUploader']
1249
+ }] } });
1250
+
1251
+ /**
1252
+ * Service to manage the document data
1253
+ */
1254
+ class DocumentService {
1255
+ documentSubject$ = new BehaviorSubject(null);
1256
+ /**
1257
+ * Set the document data
1258
+ * @param document the document data
1259
+ */
1260
+ set(document) {
1261
+ this.documentSubject$.next(document);
1262
+ }
1263
+ /**
1264
+ * Get the document data
1265
+ * @returns the document data
1266
+ */
1267
+ get() {
1268
+ return this.documentSubject$.asObservable();
1269
+ }
1270
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1271
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService, providedIn: 'root' });
1272
+ }
1273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService, decorators: [{
1274
+ type: Injectable,
1275
+ args: [{
1276
+ providedIn: 'root',
1277
+ }]
1278
+ }] });
1279
+
1280
+ /**
1281
+ * Description placeholder
1282
+ * @class LinkedDocumentComponent
1283
+ * @typedef {LinkedDocumentComponent}
1284
+ * @implements {OnChanges}
1285
+ */
1286
+ class LinkedDocumentComponent {
1287
+ /**
1288
+ * Selected document for view.
1289
+ * @type {?DocumentModel}
1290
+ */
1291
+ selectedDocument;
1292
+ /**
1293
+ * Whole document list.
1294
+ * @type {?DocumentModel[]}
1295
+ */
1296
+ documentList;
1297
+ /**
1298
+ * Changed selected document.
1299
+ * @type {*}
1300
+ */
1301
+ selectedDocumentChange = new EventEmitter();
1302
+ /**
1303
+ * Filtered documents.
1304
+ * @type {DocumentModel[]}
1305
+ */
1306
+ filteredDocuments = [];
1307
+ /**
1308
+ * Handle the click on the document.
1309
+ * @param {DocumentModel} document - Clicked document.
1310
+ */
1311
+ handleDocumentClick(document) {
1312
+ this.selectedDocument = document;
1313
+ this.selectedDocumentChange.emit(this.selectedDocument);
1314
+ }
1315
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinkedDocumentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1316
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: LinkedDocumentComponent, isStandalone: false, selector: "app-linked-document", inputs: { selectedDocument: "selectedDocument", documentList: "documentList" }, outputs: { selectedDocumentChange: "selectedDocumentChange" }, ngImport: i0, template: "<div class=\"summary-card mb-4 pb-1\">\r\n <div class=\"card p-0 mb-0\"\r\n style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px; background-color: #F9fafb;\">\r\n <div class=\"p-0\">\r\n <h4 class=\"m-0 pt-3 pl-3 mb-3\" style=\"font-size: 21px; font-weight: bold; \">Linked Documents</h4>\r\n </div>\r\n </div>\r\n <div class=\"card mb-0\" style=\"border-top-right-radius: 0px;border-top-left-radius: 0px;\">\r\n @for(document of documentList; track document){\r\n <div class=\"linkedDocument documentName m-2\">\r\n <div class=\"documentName\" [class.selected]=\"document._id === selectedDocument?._id\"\r\n (click)=\"handleDocumentClick(document)\">\r\n <span class=\"pi pi-link\"></span>\r\n {{document.fileName}}\r\n </div>\r\n </div>\r\n }\r\n\r\n </div>\r\n \r\n \r\n </div>\r\n ", styles: [".documentName{font-family:inherit;text-decoration:underline;cursor:pointer;width:max-content}.selected{color:var(--primary-color)}\n"] });
1317
+ }
1318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: LinkedDocumentComponent, decorators: [{
1319
+ type: Component,
1320
+ args: [{ selector: 'app-linked-document', standalone: false, template: "<div class=\"summary-card mb-4 pb-1\">\r\n <div class=\"card p-0 mb-0\"\r\n style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px; background-color: #F9fafb;\">\r\n <div class=\"p-0\">\r\n <h4 class=\"m-0 pt-3 pl-3 mb-3\" style=\"font-size: 21px; font-weight: bold; \">Linked Documents</h4>\r\n </div>\r\n </div>\r\n <div class=\"card mb-0\" style=\"border-top-right-radius: 0px;border-top-left-radius: 0px;\">\r\n @for(document of documentList; track document){\r\n <div class=\"linkedDocument documentName m-2\">\r\n <div class=\"documentName\" [class.selected]=\"document._id === selectedDocument?._id\"\r\n (click)=\"handleDocumentClick(document)\">\r\n <span class=\"pi pi-link\"></span>\r\n {{document.fileName}}\r\n </div>\r\n </div>\r\n }\r\n\r\n </div>\r\n \r\n \r\n </div>\r\n ", styles: [".documentName{font-family:inherit;text-decoration:underline;cursor:pointer;width:max-content}.selected{color:var(--primary-color)}\n"] }]
1321
+ }], propDecorators: { selectedDocument: [{
1322
+ type: Input
1323
+ }], documentList: [{
1324
+ type: Input
1325
+ }], selectedDocumentChange: [{
1326
+ type: Output
1327
+ }] } });
1328
+
1329
+ /**
1330
+ * Component for viewing and managing document details.
1331
+ * @class DocumentViewerComponent
1332
+ * @typedef {DocumentViewerComponent}
1333
+ */
1334
+ class DocumentViewerComponent {
1335
+ documentHttpService;
1336
+ documentService;
1337
+ /**
1338
+ * Get the selected document by user.
1339
+ * @type {*}
1340
+ */
1341
+ selectedDocument; // <-- Made optional to prevent undefined issues
1342
+ /**
1343
+ * Get the selected document by user.
1344
+ * @type {*}
1345
+ */
1346
+ documentList; // <-- Made optional to prevent undefined issues
1347
+ /**
1348
+ * Indicates whether a checkbox is selected.
1349
+ * @type {boolean}
1350
+ */
1351
+ checked = false;
1352
+ /**
1353
+ * Reference to the dynamic dialog used for displaying additional details.
1354
+ * @type {(DynamicDialogRef | undefined)}
1355
+ */
1356
+ ref;
1357
+ /**
1358
+ * Indicates whether the document has been verified.
1359
+ * @type {boolean}
1360
+ */
1361
+ isVerified = false;
1362
+ /**
1363
+ * Data used for displaying alert messages.
1364
+ * @type {any}
1365
+ */
1366
+ alertData;
1367
+ /**
1368
+ * Holds the subscription to manage observable cleanup.
1369
+ * @private
1370
+ * @type {Subscription}
1371
+ */
1372
+ subscription = new Subscription();
1373
+ /**
1374
+ * Initializes a new instance of the DocumentViewerComponent.
1375
+ * @param {DocumentHttpService} documentHttpService - Handle the http service.
1376
+ * @param {DocumentService} documentService - Handle the states.
1377
+ */
1378
+ constructor(documentHttpService, documentService) {
1379
+ this.documentHttpService = documentHttpService;
1380
+ this.documentService = documentService;
1381
+ }
1382
+ /**
1383
+ * Fetches the alerts for the selected document.
1384
+ * @returns {void}
1385
+ */
1386
+ ngOnChanges() {
1387
+ if (this.selectedDocument) {
1388
+ this.documentService.set(this.selectedDocument);
1389
+ this.alertData = DocumentAlertList.find((res) => res.status === this.selectedDocument?.status);
1390
+ }
1391
+ }
1392
+ handleSelectedDocument(document) {
1393
+ this.selectedDocument = document;
1394
+ this.documentService.set(this.selectedDocument);
1395
+ }
1396
+ /**
1397
+ * Determines if the given content type is an image.
1398
+ * @param {string | undefined} contentType - The MIME type of the content.
1399
+ * @returns {boolean} `true` if the content type is an image; otherwise, `false`.
1400
+ */
1401
+ isImage(contentType) {
1402
+ return contentType ? SUPPORTED_IMAGE_TYPES.includes(contentType) : false;
1403
+ }
1404
+ ngOnDestroy() {
1405
+ this.subscription.unsubscribe();
1406
+ }
1407
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentViewerComponent, deps: [{ token: DocumentHttpService }, { token: DocumentService }], target: i0.ɵɵFactoryTarget.Component });
1408
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DocumentViewerComponent, isStandalone: false, selector: "document-viewer", inputs: { selectedDocument: "selectedDocument", documentList: "documentList" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"grid\">\r\n <div class=\"col-12\">\r\n <div class=\"p-fluid p-formgrid grid m-0\">\r\n <div class=\"col-12 md:col-12 md:flex justify-content-evenly\">\r\n @if(selectedDocument){\r\n <div id=\"outerContainer col-12 md:col-7\">\r\n <div\r\n *ngIf=\"isImage(selectedDocument?.contentType)\"\r\n class=\"img-container\"\r\n >\r\n <img\r\n [src]=\"selectedDocument?.documentUrl || ''\"\r\n class=\"uploadedImages\"\r\n alt=\"Document Image\"\r\n />\r\n </div>\r\n @if(selectedDocument?.contentType && selectedDocument?.contentType === \"application/pdf\"){\r\n <div class=\"pdf-container\">\r\n <pdf-viewer\r\n [src]=\"selectedDocument?.documentUrl || ''\"\r\n [rotation]=\"0\"\r\n [original-size]=\"false\"\r\n [show-all]=\"true\"\r\n [fit-to-page]=\"false\"\r\n [zoom]=\"1\"\r\n [zoom-scale]=\"'page-width'\"\r\n [stick-to-page]=\"false\"\r\n [render-text]=\"true\"\r\n [external-link-target]=\"'blank'\"\r\n [autoresize]=\"true\"\r\n [show-borders]=\"false\"\r\n style=\"width: 50vw; height: 75vh\"\r\n ></pdf-viewer>\r\n </div>\r\n }@else{\r\n <div class=\"incorrect-docType\">\r\n ContentType is incorrect.\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"left-part col-12 md:col-3 pt-0\">\r\n <div class=\"alerts mb-4 pb-1\">\r\n <button\r\n type=\"button\"\r\n *ngIf=\"\r\n (alertData?.status !== 'Pending' && !!alertData?.status) ||\r\n alertData?.isAlert === false\r\n \"\r\n class=\"bg-green-500 border-none border-round-md flex align-items-center mb-3 p-2 px-3\"\r\n >\r\n <i\r\n class=\"pi pi-verified mr-2 cursor-pointer\"\r\n [ngStyle]=\"{\r\n color:\r\n alertData?.status === 'Pending' &&\r\n alertData?.isAlert !== false\r\n ? '#FFFFFF'\r\n : '#8A8EA6'\r\n }\"\r\n style=\"font-size: 20px\"\r\n ></i>\r\n <span class=\"font-semibold text-white\">Verified</span>\r\n </button>\r\n <div\r\n class=\"card mb-0\"\r\n [ngClass]=\"\r\n (alertData?.status === 'Pending' || !alertData?.status) &&\r\n alertData?.isAlert !== false\r\n ? 'alert-card'\r\n : 'success-alert'\r\n \"\r\n >\r\n <div class=\"flex align-items-center mb-2 pb-1\" *ngIf=\"alertData?.status !== 'Verified'\">\r\n <h4 class=\"mr-3 mt-0 mb-0 text-color font-bold\" style=\"font-size: 21px; font-weight: bold; border-color: rgba(68, 72, 109, 0.2) ;\" >Alerts</h4>\r\n <i\r\n class=\"pi pi-exclamation-triangle\"\r\n style=\"font-size: 20px\"\r\n [ngStyle]=\"{\r\n color:\r\n (alertData?.status === 'Pending' || !alertData?.status) &&\r\n alertData?.isAlert !== false\r\n ? '#FB392D'\r\n : '#8A8EA6'\r\n }\"\r\n ></i>\r\n </div>\r\n <p class=\"text-color mb-0\">{{ alertData?.alertMessage }}</p>\r\n </div>\r\n </div>\r\n <ng-content></ng-content>\r\n <app-linked-document (selectedDocumentChange)=\"handleSelectedDocument($event)\" [selectedDocument]=\"selectedDocument\" [documentList]=\"documentList\"></app-linked-document>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".alert-card{background-color:#fb392d1a}.success-alert{border-radius:10px;border:1px solid rgba(251,57,45,.1);background:linear-gradient(0deg,#dedede 0% 100%),#fff}.p-timeline-event-opposite{display:none}.decription{color:#676b89}.textAreaControl textarea{width:100%;resize:vertical;max-width:100%}.document-btn-wrapper .p-button-outlined{color:#f57c00}.document-viewer .p-dialog{width:100%;height:100%;max-height:100%!important;box-shadow:none!important}.document-viewer .p-dialog-header-close-icon{height:20px;width:20px}.document-viewer .p-dialog-header,.document-viewer .p-dialog-content{background-color:#fff;border-radius:0}.uploadedImages{width:95%;height:100%;object-fit:contain}\n"], dependencies: [{ kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i4.PdfViewerComponent, selector: "pdf-viewer", inputs: ["src", "c-maps-url", "page", "render-text", "render-text-mode", "original-size", "show-all", "stick-to-page", "zoom", "zoom-scale", "rotation", "external-link-target", "autoresize", "fit-to-page", "show-borders"], outputs: ["after-load-complete", "page-rendered", "pages-initialized", "text-layer-rendered", "error", "on-progress", "pageChange"] }, { kind: "component", type: LinkedDocumentComponent, selector: "app-linked-document", inputs: ["selectedDocument", "documentList"], outputs: ["selectedDocumentChange"] }], encapsulation: i0.ViewEncapsulation.None });
1409
+ }
1410
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentViewerComponent, decorators: [{
1411
+ type: Component,
1412
+ args: [{ selector: 'document-viewer', standalone: false, encapsulation: ViewEncapsulation.None, template: "<div class=\"grid\">\r\n <div class=\"col-12\">\r\n <div class=\"p-fluid p-formgrid grid m-0\">\r\n <div class=\"col-12 md:col-12 md:flex justify-content-evenly\">\r\n @if(selectedDocument){\r\n <div id=\"outerContainer col-12 md:col-7\">\r\n <div\r\n *ngIf=\"isImage(selectedDocument?.contentType)\"\r\n class=\"img-container\"\r\n >\r\n <img\r\n [src]=\"selectedDocument?.documentUrl || ''\"\r\n class=\"uploadedImages\"\r\n alt=\"Document Image\"\r\n />\r\n </div>\r\n @if(selectedDocument?.contentType && selectedDocument?.contentType === \"application/pdf\"){\r\n <div class=\"pdf-container\">\r\n <pdf-viewer\r\n [src]=\"selectedDocument?.documentUrl || ''\"\r\n [rotation]=\"0\"\r\n [original-size]=\"false\"\r\n [show-all]=\"true\"\r\n [fit-to-page]=\"false\"\r\n [zoom]=\"1\"\r\n [zoom-scale]=\"'page-width'\"\r\n [stick-to-page]=\"false\"\r\n [render-text]=\"true\"\r\n [external-link-target]=\"'blank'\"\r\n [autoresize]=\"true\"\r\n [show-borders]=\"false\"\r\n style=\"width: 50vw; height: 75vh\"\r\n ></pdf-viewer>\r\n </div>\r\n }@else{\r\n <div class=\"incorrect-docType\">\r\n ContentType is incorrect.\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n <div class=\"left-part col-12 md:col-3 pt-0\">\r\n <div class=\"alerts mb-4 pb-1\">\r\n <button\r\n type=\"button\"\r\n *ngIf=\"\r\n (alertData?.status !== 'Pending' && !!alertData?.status) ||\r\n alertData?.isAlert === false\r\n \"\r\n class=\"bg-green-500 border-none border-round-md flex align-items-center mb-3 p-2 px-3\"\r\n >\r\n <i\r\n class=\"pi pi-verified mr-2 cursor-pointer\"\r\n [ngStyle]=\"{\r\n color:\r\n alertData?.status === 'Pending' &&\r\n alertData?.isAlert !== false\r\n ? '#FFFFFF'\r\n : '#8A8EA6'\r\n }\"\r\n style=\"font-size: 20px\"\r\n ></i>\r\n <span class=\"font-semibold text-white\">Verified</span>\r\n </button>\r\n <div\r\n class=\"card mb-0\"\r\n [ngClass]=\"\r\n (alertData?.status === 'Pending' || !alertData?.status) &&\r\n alertData?.isAlert !== false\r\n ? 'alert-card'\r\n : 'success-alert'\r\n \"\r\n >\r\n <div class=\"flex align-items-center mb-2 pb-1\" *ngIf=\"alertData?.status !== 'Verified'\">\r\n <h4 class=\"mr-3 mt-0 mb-0 text-color font-bold\" style=\"font-size: 21px; font-weight: bold; border-color: rgba(68, 72, 109, 0.2) ;\" >Alerts</h4>\r\n <i\r\n class=\"pi pi-exclamation-triangle\"\r\n style=\"font-size: 20px\"\r\n [ngStyle]=\"{\r\n color:\r\n (alertData?.status === 'Pending' || !alertData?.status) &&\r\n alertData?.isAlert !== false\r\n ? '#FB392D'\r\n : '#8A8EA6'\r\n }\"\r\n ></i>\r\n </div>\r\n <p class=\"text-color mb-0\">{{ alertData?.alertMessage }}</p>\r\n </div>\r\n </div>\r\n <ng-content></ng-content>\r\n <app-linked-document (selectedDocumentChange)=\"handleSelectedDocument($event)\" [selectedDocument]=\"selectedDocument\" [documentList]=\"documentList\"></app-linked-document>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".alert-card{background-color:#fb392d1a}.success-alert{border-radius:10px;border:1px solid rgba(251,57,45,.1);background:linear-gradient(0deg,#dedede 0% 100%),#fff}.p-timeline-event-opposite{display:none}.decription{color:#676b89}.textAreaControl textarea{width:100%;resize:vertical;max-width:100%}.document-btn-wrapper .p-button-outlined{color:#f57c00}.document-viewer .p-dialog{width:100%;height:100%;max-height:100%!important;box-shadow:none!important}.document-viewer .p-dialog-header-close-icon{height:20px;width:20px}.document-viewer .p-dialog-header,.document-viewer .p-dialog-content{background-color:#fff;border-radius:0}.uploadedImages{width:95%;height:100%;object-fit:contain}\n"] }]
1413
+ }], ctorParameters: () => [{ type: DocumentHttpService }, { type: DocumentService }], propDecorators: { selectedDocument: [{
1414
+ type: Input
1415
+ }], documentList: [{
1416
+ type: Input
1417
+ }] } });
1418
+
1419
+ /**
1420
+ * Service for managing user session details.
1421
+ * @class SessionService
1422
+ * @typedef {SessionService}
1423
+ */
1424
+ class SessionService {
1425
+ router;
1426
+ /**
1427
+ * Creates an instance of SessionService.
1428
+ * @param {Router} router - Angular Router for navigation.
1429
+ */
1430
+ constructor(router) {
1431
+ this.router = router;
1432
+ }
1433
+ /**
1434
+ * Retrieves the current user's role from local storage.
1435
+ * @returns {string | null} The user's role, or null if not found.
1436
+ */
1437
+ getUserRole() {
1438
+ return localStorage.getItem('role');
1439
+ }
1440
+ /**
1441
+ * Stores the user session data in local storage.
1442
+ * @param {any} data - The session data to store.
1443
+ */
1444
+ setUserSession(data) {
1445
+ localStorage.setItem(SHARED.SESSIONKEY, JSON.stringify(data));
1446
+ }
1447
+ /**
1448
+ * Retrieves the stored user session data.
1449
+ * @returns {any | null} The parsed session data, or null if not found.
1450
+ */
1451
+ getUserSession() {
1452
+ const sessionData = localStorage.getItem(SHARED.SESSIONKEY);
1453
+ return sessionData ? JSON.parse(sessionData) : null;
1454
+ }
1455
+ /**
1456
+ * Retrieves the user's permissions from the stored session data.
1457
+ * @returns {any | null} The user's permissions, or null if not found.
1458
+ */
1459
+ getUserPermissions() {
1460
+ const sessionData = localStorage.getItem(SHARED.SESSIONKEY);
1461
+ return sessionData ? JSON.parse(sessionData).permissions : null;
1462
+ }
1463
+ /**
1464
+ * Retrieves the session ID from the stored session data.
1465
+ * @returns {any | null} The session ID, or null if not found.
1466
+ */
1467
+ getSessionID() {
1468
+ const sessionData = localStorage.getItem(SHARED.SESSIONKEY);
1469
+ console.log(sessionData);
1470
+ if (sessionData) {
1471
+ const sessionId = JSON.parse(sessionData);
1472
+ console.log(sessionId);
1473
+ return sessionId;
1474
+ }
1475
+ return null;
1476
+ }
1477
+ /**
1478
+ * Clears all stored session data from local storage.
1479
+ */
1480
+ clearSession() {
1481
+ localStorage.clear();
1482
+ }
1483
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SessionService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
1484
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SessionService, providedIn: 'root' });
1485
+ }
1486
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SessionService, decorators: [{
1487
+ type: Injectable,
1488
+ args: [{
1489
+ providedIn: 'root'
1490
+ }]
1491
+ }], ctorParameters: () => [{ type: i1.Router }] });
1492
+
1493
+ /**
1494
+ * Directive to conditionally show or hide elements based on user permissions.
1495
+ * @class HasPermissionDirective
1496
+ * @typedef {HasPermissionDirective}
1497
+ */
1498
+ class HasPermissionDirective {
1499
+ el;
1500
+ renderer;
1501
+ sessionService;
1502
+ /**
1503
+ * The required permission(s) to display the element.
1504
+ * Accepts a single string or an array of strings.
1505
+ * @type {string | string[]}
1506
+ */
1507
+ permission;
1508
+ /**
1509
+ * Creates an instance of HasPermissionDirective.
1510
+ * @param {ElementRef} el - Reference to the host element.
1511
+ * @param {Renderer2} renderer - Angular Renderer for DOM manipulation.
1512
+ * @param {SessionService} sessionService - Service to retrieve user permissions.
1513
+ */
1514
+ constructor(el, renderer, sessionService) {
1515
+ this.el = el;
1516
+ this.renderer = renderer;
1517
+ this.sessionService = sessionService;
1518
+ }
1519
+ /**
1520
+ * Lifecycle hook that is called when input properties change.
1521
+ * @param {SimpleChanges} changes - The changes in input properties.
1522
+ */
1523
+ ngOnChanges(changes) {
1524
+ if (changes['permission']) {
1525
+ this.checkPermission();
1526
+ }
1527
+ }
1528
+ /**
1529
+ * Checks if the user has the required permission(s).
1530
+ * Hides the element if the permission is not found.
1531
+ */
1532
+ checkPermission() {
1533
+ const userPermissionsObjects = this.sessionService.getUserPermissions();
1534
+ const userPermissionNames = userPermissionsObjects?.map((perm) => perm.name) || [];
1535
+ const requiredPermissions = Array.isArray(this.permission)
1536
+ ? this.permission
1537
+ : [this.permission];
1538
+ const hasPermission = requiredPermissions.some(permission => userPermissionNames.includes(permission));
1539
+ if (!hasPermission) {
1540
+ this.renderer.setStyle(this.el.nativeElement, 'display', 'none');
1541
+ }
1542
+ else {
1543
+ this.renderer.removeStyle(this.el.nativeElement, 'display');
1544
+ }
1545
+ }
1546
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: HasPermissionDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: SessionService }], target: i0.ɵɵFactoryTarget.Directive });
1547
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: HasPermissionDirective, isStandalone: false, selector: "[permission]", inputs: { permission: "permission" }, usesOnChanges: true, ngImport: i0 });
1548
+ }
1549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: HasPermissionDirective, decorators: [{
1550
+ type: Directive,
1551
+ args: [{
1552
+ selector: '[permission]',
1553
+ standalone: false
1554
+ }]
1555
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: SessionService }], propDecorators: { permission: [{
1556
+ type: Input
1557
+ }] } });
1558
+
1559
+ /**
1560
+ * This component is responsible for displaying and managing a list of documents.
1561
+ * Provides functionality for file upload, document selection, and dialog management.
1562
+ * @class DocumentListComponent
1563
+ */
1564
+ class DocumentListComponent {
1565
+ documentUploadService;
1566
+ documentHttpService;
1567
+ documentQuery;
1568
+ documentStore;
1569
+ onRefresh = new EventEmitter();
1570
+ /**
1571
+ * Represents the context ID for the document list.
1572
+ * This value is passed from the parent component.
1573
+ * @type {string}
1574
+ * @memberof DocumentListComponent
1575
+ */
1576
+ contextId = SHARED.EMPTY;
1577
+ /**
1578
+ * Default visibility of the upload button.
1579
+ * @type {boolean}
1580
+ * @memberof DocumentListComponent
1581
+ */
1582
+ isUploadButtonVisible = SHARED.TRUE;
1583
+ /**
1584
+ * The currently selected document.
1585
+ * @type {DocumentModel}
1586
+ * @memberof DocumentListComponent
1587
+ */
1588
+ selectedDocument;
1589
+ /**
1590
+ * Default visibility of the sidebar.
1591
+ * @type {boolean}
1592
+ * @memberof DocumentListComponent
1593
+ */
1594
+ isSidebarVisible = SHARED.FALSE;
1595
+ /**
1596
+ * Default visibility of the Accordion.
1597
+ * @type {boolean}
1598
+ * @memberof DocumentListComponent
1599
+ */
1600
+ isCollapsed = SHARED.FALSE;
1601
+ /**
1602
+ * Default visibility of the messages.
1603
+ * @type {Message[]}
1604
+ * @memberof DocumentListComponent
1605
+ */
1606
+ messages = SHARED.EMPTY_ARRAY;
1607
+ /**
1608
+ * Default visibility of the dialog.
1609
+ * @type {boolean}
1610
+ * @memberof DocumentListComponent
1611
+ */
1612
+ isdialogVisible = SHARED.FALSE;
1613
+ /**
1614
+ * The list of documents to display.
1615
+ * This value is passed from the parent component.
1616
+ * @type {DocumentModel[]}
1617
+ * @memberof DocumentListComponent
1618
+ */
1619
+ documentList = SHARED.EMPTY_ARRAY;
1620
+ /**
1621
+ * The name of the document being uploaded or managed.
1622
+ * @type {string}
1623
+ * @memberof DocumentListComponent
1624
+ */
1625
+ documentName = SHARED.EMPTY;
1626
+ /**
1627
+ * Available document types for selection.
1628
+ * @type {string[]}
1629
+ * @memberof DocumentListComponent
1630
+ */
1631
+ options = SHARED.EMPTY_ARRAY;
1632
+ /**
1633
+ * The selected option for the document type.
1634
+ * @type {(string | null)}
1635
+ * @memberof DocumentListComponent
1636
+ */
1637
+ selectedOption = null;
1638
+ /**
1639
+ * The set of permissions available for this component.
1640
+ */
1641
+ PERMISSION = PERMISSIONS;
1642
+ /**
1643
+ * The file name associated with the document.
1644
+ * It may be undefined until a file is selected or loaded.
1645
+ * @type {string | undefined}
1646
+ */
1647
+ fileName;
1648
+ /**
1649
+ * Creates an instance of DocumentListComponent.
1650
+ * @class
1651
+ * @param {DocumentUploadService} documentUploadService - The service responsible for uploading documents.
1652
+ * @param {DocumentHttpService} documentHttpService - The service responsible for fetching documents from the server.
1653
+ * @param {DocumentQuery} documentQuery - The service responsible for geting stored documents.
1654
+ * @param {DocumentStore} documentStore - The service responsible for storing documents.
1655
+ */
1656
+ constructor(documentUploadService, documentHttpService, documentQuery, documentStore) {
1657
+ this.documentUploadService = documentUploadService;
1658
+ this.documentHttpService = documentHttpService;
1659
+ this.documentQuery = documentQuery;
1660
+ this.documentStore = documentStore;
1661
+ }
1662
+ /**
1663
+ * Initializes the component by fetching the document type list.
1664
+ */
1665
+ ngOnInit() {
1666
+ this.getDocumentTypeList();
1667
+ }
1668
+ /**
1669
+ * Handles the click event for file upload.
1670
+ * Prevents event propagation and displays the sidebar.
1671
+ * @param {MouseEvent} event - The click event triggered by the user.
1672
+ * @memberof DocumentListComponent
1673
+ */
1674
+ handleFileUploadClick(event) {
1675
+ event.stopPropagation();
1676
+ this.documentStore.setMessage(SHARED.EMPTY_ARRAY);
1677
+ this.isSidebarVisible = SHARED.TRUE;
1678
+ }
1679
+ /**
1680
+ * Handles the selection of an individual document.
1681
+ * Opens a dialog to display or manage the selected document.
1682
+ * @param {DocumentModel} document - The document that was clicked by the user.
1683
+ * @memberof DocumentListComponent
1684
+ */
1685
+ handleClickForDocument(document) {
1686
+ this.isdialogVisible = SHARED.TRUE;
1687
+ this.selectedDocument = document;
1688
+ this.fileName = document.fileName;
1689
+ }
1690
+ /**
1691
+ * Handles the save click event to update the document's file name.
1692
+ * This method creates a payload with the updated file name and calls the
1693
+ * updateDocumentName() method from the documentHttpService. On a successful update,
1694
+ * it logs a message with the document's ID.
1695
+ * @returns {void}
1696
+ */
1697
+ handleSaveClick() {
1698
+ const payload = { fileName: this.fileName };
1699
+ this.documentHttpService.updateDocumentName(this.selectedDocument._id, payload)
1700
+ .subscribe((res) => {
1701
+ console.log(`${SHARED.UPDATE_DOCUMENT_NAME} ${this.selectedDocument._id}`);
1702
+ });
1703
+ }
1704
+ /**
1705
+ * Closes the dialog and resets the selected document.
1706
+ * @memberof DocumentListComponent
1707
+ */
1708
+ handleCloseModal() {
1709
+ this.selectedDocument = { _id: SHARED.EMPTY };
1710
+ this.isdialogVisible = SHARED.FALSE;
1711
+ this.onRefresh.emit();
1712
+ }
1713
+ /**
1714
+ * Handles the upload action for a document.
1715
+ * Validates if a document type is selected and logs the result.
1716
+ * @memberof DocumentListComponent
1717
+ */
1718
+ handleUploadDocument() {
1719
+ if (this.selectedOption) {
1720
+ this.documentUploadService.getDocumentNameAndType(this.selectedOption);
1721
+ this.documentUploadService.handleTemplatedUpload();
1722
+ this.documentQuery.selectMessages().subscribe((message) => {
1723
+ if (message.length > 0) {
1724
+ this.messages = message;
1725
+ this.onRefresh.emit();
1726
+ this.selectedOption = null;
1727
+ setTimeout(() => {
1728
+ this.messages = SHARED.EMPTY_ARRAY;
1729
+ this.handleOpenSideBar(false);
1730
+ }, 1000);
1731
+ }
1732
+ });
1733
+ }
1734
+ else {
1735
+ console.error(ERRORS.INVALID_RECIPIENT);
1736
+ }
1737
+ }
1738
+ /**
1739
+ * Fetches the list of document types from the server.
1740
+ * Updates the options array with the available document types.
1741
+ * @memberof DocumentListComponent
1742
+ * @returns {void}
1743
+ */
1744
+ getDocumentTypeList() {
1745
+ this.documentHttpService.getDocumentTypes().subscribe({
1746
+ /**
1747
+ * Handles the successful API response.
1748
+ * @param {DocumentTypeModel[]} documentTypes - The list of document types returned by the API.
1749
+ */
1750
+ next: (documentTypes) => {
1751
+ if (documentTypes) {
1752
+ this.options = documentTypes.map((doc) => ({
1753
+ label: doc.label,
1754
+ value: doc._id
1755
+ }));
1756
+ }
1757
+ else {
1758
+ console.error(ERRORS.ERROR_ALLDOCUMENT_MISSING, documentTypes);
1759
+ }
1760
+ },
1761
+ /**
1762
+ * Handles errors if the request fails.
1763
+ * @param {any} err - The error object returned by the server.
1764
+ */
1765
+ error: (err) => {
1766
+ console.error(ERRORS.ERROR_DOCUMENT_TYPES, err);
1767
+ }
1768
+ });
1769
+ }
1770
+ handleOpenSideBar(isVisible) {
1771
+ this.isSidebarVisible = isVisible;
1772
+ }
1773
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentListComponent, deps: [{ token: DocumentUploadService }, { token: DocumentHttpService }, { token: DocumentQuery }, { token: DocumentStore }], target: i0.ɵɵFactoryTarget.Component });
1774
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DocumentListComponent, isStandalone: false, selector: "lib-document-list", inputs: { contextId: "contextId", isUploadButtonVisible: "isUploadButtonVisible", isCollapsed: "isCollapsed", documentList: "documentList" }, outputs: { onRefresh: "onRefresh" }, ngImport: i0, template: "\r\n<div class=\"document-viewer\">\r\n <p-dialog [(visible)]=\"isdialogVisible\" [modal]=\"true\" (onHide)=\"handleCloseModal()\"\r\n class=\"w-full h-full document-dailog-wrapper\"\r\n [draggable]=\"false\" [closable]=\"true\">\r\n <document-viewer [selectedDocument]=\"selectedDocument\" [documentList]=\"documentList\">\r\n\r\n <ng-template pTemplate=\"header\">\r\n <div class=\"w-full flex align-items-center justify-content-between\">\r\n <input \r\n type=\"text\" \r\n class=\"w-full border-none bg-white h-3rem file-input-wrapper\"\r\n pInputText \r\n [(ngModel)]=\"fileName\" />\r\n <button \r\n pButton \r\n pRipple \r\n class=\"mx-3 w-6rem save-btn-wrapper\"\r\n label=\"Save\"\r\n (click)=\"handleSaveClick()\">\r\n </button>\r\n </div>\r\n </ng-template>\r\n\r\n\r\n <ng-content></ng-content>\r\n </document-viewer>\r\n </p-dialog>\r\n</div>\r\n\r\n<div class=\"col-12 p-0\">\r\n <div class=\"card p-0 mb-0 document-list-wrapper\">\r\n <p-accordion [activeIndex]=\"isCollapsed ? -1 : 0\">\r\n <p-accordionTab class=\"line-height-2 m-0\">\r\n <ng-template pTemplate=\"header\" let-active=\"active\">\r\n <div class=\"flex align-items-center justify-content-between w-full\">\r\n <span class=\"flex align-items-center gap-2 document-title-wrapper\">\r\n Documents\r\n </span>\r\n @if(isUploadButtonVisible){\r\n <button pButton pRipple class=\"p-button-raised col-3\" [permission]=\"PERMISSION.DOCUMENT_POST\" type=\"button\" label=\"Upload File\"\r\n style=\"border-radius: 10px;\" (click)=\"handleFileUploadClick($event)\"></button>\r\n }\r\n </div>\r\n </ng-template>\r\n @for(document of documentList; track document){\r\n <lib-document-list-item [document]=\"document\"\r\n (documentClick)=\"handleClickForDocument($event)\"></lib-document-list-item>\r\n }\r\n </p-accordionTab>\r\n </p-accordion>\r\n </div>\r\n</div>\r\n<div class=\"grid m-0\">\r\n <div class=\"col-12 p-0\">\r\n <p-sidebar [(visible)]=\"isSidebarVisible\" position=\"right\" [styleClass]=\"'right-sidebar'\" class=\"relative\">\r\n <ng-template pTemplate=\"header\">\r\n <p-messages [(value)]=\"messages\" [enableService]=\"false\" />\r\n </ng-template>\r\n <ng-template pTemplate=\"content\">\r\n <div class=\"side-bar-con\">\r\n <lib-document-upload [contextId]=\"contextId\"></lib-document-upload>\r\n <div class=\"p-fluid\">\r\n <div class=\"field\">\r\n <label for=\"city\">Select Folder</label>\r\n <p-dropdown id=\"city\" optionLabel=\"label\" optionValue=\"value\" [options]=\"options\"\r\n placeholder=\"Select a Folder\" [(ngModel)]=\"selectedOption\"></p-dropdown>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"footer\" class=\"bg-gray-100 p-0\">\r\n <div class=\"bg-gray-100 p-4\">\r\n <p-button label=\"Save\" class=\"p-button-rounded p-button-success save-btn\" (click)=\"handleUploadDocument()\"\r\n [disabled]=\"!selectedOption\">\r\n </p-button>\r\n </div>\r\n </ng-template>\r\n </p-sidebar>\r\n </div>\r\n</div>", styles: [".document-list-wrapper .p-accordion-header-link{padding:.5rem}.document-list-wrapper .p-sidebar-right,.right-sidebar{width:35%}.document-title-wrapper{font-size:20px;font-weight:700;color:var(--text-color)}.document-input-field{display:flex;flex-direction:column}.document-input-field input{width:100%;height:46px;padding:10px 15px;gap:10px;border-radius:10px;outline:none;border:1px solid rgba(76,98,146,.1019607843);font-size:15px}label{color:#0f1729;font-weight:600}.document-list-dropDown .p-element{padding:10px 0 10px 15px}.document-list-dropDown .p-dropdown{border-radius:10px!important}.side-bar-con{display:flex;flex-direction:column}.save-btn-con{width:100%;border-top:1px solid rgba(76,98,146,.2);background:#4c629214;padding:13px 40px}.save-btn-wrapper{padding:10px 4px}.save-btn .p-button{height:45px!important;width:140px;border-radius:10px}.p-sidebar-footer{padding:0}.file-input-wrapper.p-inputtext:enabled:focus{box-shadow:0 0 0 .2rem #a6d5fa!important}\n"], dependencies: [{ kind: "component", type: i5$1.Accordion, selector: "p-accordion", inputs: ["multiple", "style", "styleClass", "expandIcon", "collapseIcon", "activeIndex", "selectOnFocus", "headerAriaLevel"], outputs: ["onClose", "onOpen", "activeIndexChange"] }, { kind: "component", type: i5$1.AccordionTab, selector: "p-accordionTab", inputs: ["id", "header", "headerStyle", "tabStyle", "contentStyle", "tabStyleClass", "headerStyleClass", "contentStyleClass", "disabled", "cache", "transitionOptions", "iconPos", "selected", "headerAriaLevel"], outputs: ["selectedChange"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i7.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i7.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "style", "styleClass", "badgeClass", "ariaLabel", "autofocus"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i8$1.Sidebar, selector: "p-sidebar", inputs: ["appendTo", "blockScroll", "style", "styleClass", "ariaCloseLabel", "autoZIndex", "baseZIndex", "modal", "dismissible", "showCloseIcon", "closeOnEscape", "transitionOptions", "visible", "position", "fullScreen"], outputs: ["onShow", "onHide", "visibleChange"] }, { kind: "component", type: i9.Messages, selector: "p-messages", inputs: ["value", "closable", "style", "styleClass", "enableService", "key", "escape", "severity", "showTransitionOptions", "hideTransitionOptions"], outputs: ["valueChange", "onClose"] }, { kind: "directive", type: i10.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i10.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i10.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i11.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "component", type: i12.Dropdown, selector: "p-dropdown", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "autoShowPanelOnPrintableCharacterKeyDown", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: i13.InputText, selector: "[pInputText]", inputs: ["variant"] }, { kind: "component", type: DocumentListItemComponent, selector: "lib-document-list-item", inputs: ["document"], outputs: ["documentClick"] }, { kind: "component", type: DocumentUploadComponent, selector: "lib-document-upload", inputs: ["contextId"] }, { kind: "component", type: DocumentViewerComponent, selector: "document-viewer", inputs: ["selectedDocument", "documentList"] }, { kind: "directive", type: HasPermissionDirective, selector: "[permission]", inputs: ["permission"] }], encapsulation: i0.ViewEncapsulation.None });
1775
+ }
1776
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentListComponent, decorators: [{
1777
+ type: Component,
1778
+ args: [{ selector: 'lib-document-list', standalone: false, encapsulation: ViewEncapsulation.None, template: "\r\n<div class=\"document-viewer\">\r\n <p-dialog [(visible)]=\"isdialogVisible\" [modal]=\"true\" (onHide)=\"handleCloseModal()\"\r\n class=\"w-full h-full document-dailog-wrapper\"\r\n [draggable]=\"false\" [closable]=\"true\">\r\n <document-viewer [selectedDocument]=\"selectedDocument\" [documentList]=\"documentList\">\r\n\r\n <ng-template pTemplate=\"header\">\r\n <div class=\"w-full flex align-items-center justify-content-between\">\r\n <input \r\n type=\"text\" \r\n class=\"w-full border-none bg-white h-3rem file-input-wrapper\"\r\n pInputText \r\n [(ngModel)]=\"fileName\" />\r\n <button \r\n pButton \r\n pRipple \r\n class=\"mx-3 w-6rem save-btn-wrapper\"\r\n label=\"Save\"\r\n (click)=\"handleSaveClick()\">\r\n </button>\r\n </div>\r\n </ng-template>\r\n\r\n\r\n <ng-content></ng-content>\r\n </document-viewer>\r\n </p-dialog>\r\n</div>\r\n\r\n<div class=\"col-12 p-0\">\r\n <div class=\"card p-0 mb-0 document-list-wrapper\">\r\n <p-accordion [activeIndex]=\"isCollapsed ? -1 : 0\">\r\n <p-accordionTab class=\"line-height-2 m-0\">\r\n <ng-template pTemplate=\"header\" let-active=\"active\">\r\n <div class=\"flex align-items-center justify-content-between w-full\">\r\n <span class=\"flex align-items-center gap-2 document-title-wrapper\">\r\n Documents\r\n </span>\r\n @if(isUploadButtonVisible){\r\n <button pButton pRipple class=\"p-button-raised col-3\" [permission]=\"PERMISSION.DOCUMENT_POST\" type=\"button\" label=\"Upload File\"\r\n style=\"border-radius: 10px;\" (click)=\"handleFileUploadClick($event)\"></button>\r\n }\r\n </div>\r\n </ng-template>\r\n @for(document of documentList; track document){\r\n <lib-document-list-item [document]=\"document\"\r\n (documentClick)=\"handleClickForDocument($event)\"></lib-document-list-item>\r\n }\r\n </p-accordionTab>\r\n </p-accordion>\r\n </div>\r\n</div>\r\n<div class=\"grid m-0\">\r\n <div class=\"col-12 p-0\">\r\n <p-sidebar [(visible)]=\"isSidebarVisible\" position=\"right\" [styleClass]=\"'right-sidebar'\" class=\"relative\">\r\n <ng-template pTemplate=\"header\">\r\n <p-messages [(value)]=\"messages\" [enableService]=\"false\" />\r\n </ng-template>\r\n <ng-template pTemplate=\"content\">\r\n <div class=\"side-bar-con\">\r\n <lib-document-upload [contextId]=\"contextId\"></lib-document-upload>\r\n <div class=\"p-fluid\">\r\n <div class=\"field\">\r\n <label for=\"city\">Select Folder</label>\r\n <p-dropdown id=\"city\" optionLabel=\"label\" optionValue=\"value\" [options]=\"options\"\r\n placeholder=\"Select a Folder\" [(ngModel)]=\"selectedOption\"></p-dropdown>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"footer\" class=\"bg-gray-100 p-0\">\r\n <div class=\"bg-gray-100 p-4\">\r\n <p-button label=\"Save\" class=\"p-button-rounded p-button-success save-btn\" (click)=\"handleUploadDocument()\"\r\n [disabled]=\"!selectedOption\">\r\n </p-button>\r\n </div>\r\n </ng-template>\r\n </p-sidebar>\r\n </div>\r\n</div>", styles: [".document-list-wrapper .p-accordion-header-link{padding:.5rem}.document-list-wrapper .p-sidebar-right,.right-sidebar{width:35%}.document-title-wrapper{font-size:20px;font-weight:700;color:var(--text-color)}.document-input-field{display:flex;flex-direction:column}.document-input-field input{width:100%;height:46px;padding:10px 15px;gap:10px;border-radius:10px;outline:none;border:1px solid rgba(76,98,146,.1019607843);font-size:15px}label{color:#0f1729;font-weight:600}.document-list-dropDown .p-element{padding:10px 0 10px 15px}.document-list-dropDown .p-dropdown{border-radius:10px!important}.side-bar-con{display:flex;flex-direction:column}.save-btn-con{width:100%;border-top:1px solid rgba(76,98,146,.2);background:#4c629214;padding:13px 40px}.save-btn-wrapper{padding:10px 4px}.save-btn .p-button{height:45px!important;width:140px;border-radius:10px}.p-sidebar-footer{padding:0}.file-input-wrapper.p-inputtext:enabled:focus{box-shadow:0 0 0 .2rem #a6d5fa!important}\n"] }]
1779
+ }], ctorParameters: () => [{ type: DocumentUploadService }, { type: DocumentHttpService }, { type: DocumentQuery }, { type: DocumentStore }], propDecorators: { onRefresh: [{
1780
+ type: Output
1781
+ }], contextId: [{
1782
+ type: Input
1783
+ }], isUploadButtonVisible: [{
1784
+ type: Input
1785
+ }], isCollapsed: [{
1786
+ type: Input
1787
+ }], documentList: [{
1788
+ type: Input
1789
+ }] } });
1790
+
1791
+ /**
1792
+ *This component is responsible for managing and displaying a list of documents.
1793
+ * @class DocumentContainerComponent
1794
+ * @typedef {DocumentContainerComponent}
1795
+ */
1796
+ class DocumentContainerComponent {
1797
+ documentStore;
1798
+ documentService;
1799
+ documentQuery;
1800
+ documentHttpService;
1801
+ /**
1802
+ * Creates an instance of DocumentContainerComponent.
1803
+ * @param {DocumentStore} documentStore - Query Store service to manage store document-related state.
1804
+ * @param {DocumentService} documentService - Service to manage document-related operations.
1805
+ * @param {DocumentQuery} documentQuery - Query service to manage document-related state.
1806
+ * @param {DocumentHttpService} documentHttpService - Service to make HTTP requests related to documents.
1807
+ */
1808
+ constructor(documentStore, documentService, documentQuery, documentHttpService) {
1809
+ this.documentStore = documentStore;
1810
+ this.documentService = documentService;
1811
+ this.documentQuery = documentQuery;
1812
+ this.documentHttpService = documentHttpService;
1813
+ }
1814
+ /**
1815
+ * Get contextId in input.
1816
+ * @type {string}
1817
+ */
1818
+ contextId = SHARED.EMPTY;
1819
+ /**
1820
+ * Get isCollapsed in input.
1821
+ * @type {string}
1822
+ */
1823
+ isCollapsed = SHARED.FALSE;
1824
+ /**
1825
+ * Get showFolderList in input.
1826
+ * @type {boolean}
1827
+ */
1828
+ showFolderList = SHARED.TRUE;
1829
+ /**
1830
+ * Get isUploadButtonVisible in input.
1831
+ * @type {boolean}
1832
+ */
1833
+ isUploadButtonVisible = SHARED.TRUE;
1834
+ /**
1835
+ * The list of documents.
1836
+ * @type {Array}
1837
+ */
1838
+ documentList = [];
1839
+ /**
1840
+ * The list of folders.
1841
+ * @type {Array}
1842
+ */
1843
+ folderList = SHARED.EMPTY_ARRAY;
1844
+ /**
1845
+ * Holds the subscription to manage observable cleanup.
1846
+ * @private
1847
+ * @type {Subscription}
1848
+ */
1849
+ subscription = new Subscription();
1850
+ /**
1851
+ * Fetches the folder and document data on initialization.
1852
+ * @returns {void}
1853
+ */
1854
+ ngOnInit() {
1855
+ this.fetchFolder();
1856
+ const folderSubscription = this.documentQuery
1857
+ .selectParentDocumentTypeId()
1858
+ .subscribe((folderBlockId) => {
1859
+ const validFolders = this.folderList.filter(folder => (folder.documentCount ?? 0) > 0);
1860
+ const idToFetch = folderBlockId ?? validFolders[0]?._id;
1861
+ if (idToFetch) {
1862
+ this.fetchDocuments(idToFetch);
1863
+ }
1864
+ else {
1865
+ console.warn('No folders with documents available.');
1866
+ }
1867
+ });
1868
+ this.subscription.add(folderSubscription);
1869
+ }
1870
+ /**
1871
+ * Fetches the folder data from the API.
1872
+ * @returns {void}
1873
+ */
1874
+ /**
1875
+ * Fetches the folder data from the API.
1876
+ * @returns {void}
1877
+ */
1878
+ fetchFolder() {
1879
+ const folderSubscription = this.documentHttpService.getFoldersData(this.contextId).subscribe({
1880
+ /**
1881
+ * Handles the successful API response.
1882
+ * @param {FolderBlockModel[]} folder - The list of folders returned by the API.
1883
+ */
1884
+ next: (folder) => {
1885
+ if (folder && folder.length > 0) {
1886
+ this.folderList = folder.filter(f => (f.documentCount ?? 0) > 0);
1887
+ if (this.folderList.length > 0) {
1888
+ this.fetchDocuments(this.folderList[0]._id);
1889
+ }
1890
+ else {
1891
+ console.warn('No folders with documents found.');
1892
+ }
1893
+ }
1894
+ else {
1895
+ console.error(ERRORS.ERROR_ALLDOCUMENT_MISSING);
1896
+ }
1897
+ },
1898
+ /**
1899
+ * Handles errors if the request fails.
1900
+ * @param {any} err - The error object returned by the server.
1901
+ */
1902
+ error: (err) => {
1903
+ console.error(ERRORS.ERROR_DOCUMENT_TYPES, err);
1904
+ }
1905
+ });
1906
+ this.subscription.add(folderSubscription);
1907
+ }
1908
+ /**
1909
+ * Fetches the document data from the API.
1910
+ * @param {string} folderBlockId - The folder ID to fetch the document.
1911
+ * @returns {void}
1912
+ */
1913
+ fetchDocuments(folderBlockId) {
1914
+ const documentSubscription = this.documentHttpService.getDocumentByFolderID(folderBlockId, this.contextId).subscribe({
1915
+ /**
1916
+ * Handles the successful API response.
1917
+ * @param {DocumentModel[]} documentList - The list of documents returned by the API.
1918
+ */
1919
+ next: (documentList) => {
1920
+ if (documentList) {
1921
+ this.documentList = documentList;
1922
+ this.documentStore.setDocumentList(documentList);
1923
+ }
1924
+ else {
1925
+ console.error(ERRORS.ERROR_FETCHING_DOCUMENTS);
1926
+ }
1927
+ },
1928
+ /**
1929
+ * Handles errors if the request fails.
1930
+ * @param {any} err - The error object returned by the server.
1931
+ */
1932
+ error: (err) => {
1933
+ console.error(ERRORS.ERROR_FETCHING_DOCUMENTS, err);
1934
+ }
1935
+ });
1936
+ this.subscription.add(documentSubscription);
1937
+ }
1938
+ /**
1939
+ * Unsubscribe subscription on destroy of component .
1940
+ */
1941
+ ngOnDestroy() {
1942
+ this.subscription.unsubscribe();
1943
+ }
1944
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentContainerComponent, deps: [{ token: DocumentStore }, { token: DocumentService$1 }, { token: DocumentQuery }, { token: DocumentHttpService }], target: i0.ɵɵFactoryTarget.Component });
1945
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DocumentContainerComponent, isStandalone: false, selector: "lib-document-container", inputs: { contextId: "contextId", isCollapsed: "isCollapsed", showFolderList: "showFolderList", isUploadButtonVisible: "isUploadButtonVisible" }, ngImport: i0, template: "<div class=\"grid m-0 h-full\">\r\n <div class=\"col-12 md:col-12 lg:col-12 p-0 h-full\" [ngClass]=\"showFolderList ? 'custom-scroll' : ''\">\r\n @if(showFolderList){\r\n <div>\r\n <lib-folder-container [documentList]=\"documentList\" [folderList]=\"folderList\" [contextId]=\"contextId\"></lib-folder-container>\r\n </div>\r\n }\r\n <div [ngClass]=\"showFolderList ? 'mt-3' : ''\">\r\n <lib-document-list [isCollapsed]=\"isCollapsed\" [documentList]=\"documentList\" [contextId]=\"contextId\" [isUploadButtonVisible]=\"isUploadButtonVisible\" (onRefresh)=\"fetchFolder()\">\r\n <ng-content></ng-content>\r\n </lib-document-list>\r\n </div>\r\n </div>\r\n</div>", styles: [".custom-scroll{overflow-y:hidden;scrollbar-gutter:stable}.custom-scroll:hover{overflow-y:auto}\n"], dependencies: [{ kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: FolderContainerComponent, selector: "lib-folder-container", inputs: ["documentList", "folderList", "contextId"] }, { kind: "component", type: DocumentListComponent, selector: "lib-document-list", inputs: ["contextId", "isUploadButtonVisible", "isCollapsed", "documentList"], outputs: ["onRefresh"] }] });
1946
+ }
1947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentContainerComponent, decorators: [{
1948
+ type: Component,
1949
+ args: [{ selector: 'lib-document-container', standalone: false, template: "<div class=\"grid m-0 h-full\">\r\n <div class=\"col-12 md:col-12 lg:col-12 p-0 h-full\" [ngClass]=\"showFolderList ? 'custom-scroll' : ''\">\r\n @if(showFolderList){\r\n <div>\r\n <lib-folder-container [documentList]=\"documentList\" [folderList]=\"folderList\" [contextId]=\"contextId\"></lib-folder-container>\r\n </div>\r\n }\r\n <div [ngClass]=\"showFolderList ? 'mt-3' : ''\">\r\n <lib-document-list [isCollapsed]=\"isCollapsed\" [documentList]=\"documentList\" [contextId]=\"contextId\" [isUploadButtonVisible]=\"isUploadButtonVisible\" (onRefresh)=\"fetchFolder()\">\r\n <ng-content></ng-content>\r\n </lib-document-list>\r\n </div>\r\n </div>\r\n</div>", styles: [".custom-scroll{overflow-y:hidden;scrollbar-gutter:stable}.custom-scroll:hover{overflow-y:auto}\n"] }]
1950
+ }], ctorParameters: () => [{ type: DocumentStore }, { type: DocumentService$1 }, { type: DocumentQuery }, { type: DocumentHttpService }], propDecorators: { contextId: [{
1951
+ type: Input
1952
+ }], isCollapsed: [{
1953
+ type: Input
1954
+ }], showFolderList: [{
1955
+ type: Input
1956
+ }], isUploadButtonVisible: [{
1957
+ type: Input
1958
+ }] } });
1959
+
1960
+ /**
1961
+ * GlobalErrorHandler is a custom error handler that implements the ErrorHandler interface.
1962
+ * It is used to handle both HTTP errors and other types of errors globally in the application.
1963
+ * @class
1964
+ * @implements {ErrorHandler}
1965
+ * @decorator {Injectable}
1966
+ */
1967
+ class GlobalErrorHandler {
1968
+ injector;
1969
+ /**
1970
+ * Creates an instance of GlobalErrorHandler.
1971
+ * @constructor
1972
+ * @param {Injector} injector - The Angular injector used to get instances of services.
1973
+ */
1974
+ constructor(injector) {
1975
+ this.injector = injector;
1976
+ }
1977
+ /**
1978
+ * Handles errors globally in the application.
1979
+ *
1980
+ * @param {any} error - The error object that needs to be handled.
1981
+ * @returns {void}
1982
+ */
1983
+ handleError(error) {
1984
+ console.error('GlobalErrorHandler:', error);
1985
+ }
1986
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GlobalErrorHandler, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
1987
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GlobalErrorHandler });
1988
+ }
1989
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: GlobalErrorHandler, decorators: [{
1990
+ type: Injectable
1991
+ }], ctorParameters: () => [{ type: i0.Injector }] });
1992
+
1993
+ /**
1994
+ * Directive to display the document data
1995
+ */
1996
+ class DocumentDirective {
1997
+ documentService;
1998
+ templateRef;
1999
+ vcr;
2000
+ /**
2001
+ * Creates an instance of DocumentDirective.
2002
+ * @param documentService Service to get the document data.
2003
+ * @param templateRef Reference to the template.
2004
+ * @param vcr View container reference to manage the view.
2005
+ */
2006
+ constructor(documentService, templateRef, vcr) {
2007
+ this.documentService = documentService;
2008
+ this.templateRef = templateRef;
2009
+ this.vcr = vcr;
2010
+ this.documentService.get().subscribe((document) => {
2011
+ this.vcr.clear();
2012
+ if (document) {
2013
+ this.vcr.createEmbeddedView(this.templateRef, { $implicit: document });
2014
+ }
2015
+ });
2016
+ }
2017
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentDirective, deps: [{ token: DocumentService }, { token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
2018
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: DocumentDirective, isStandalone: false, selector: "[doc]", ngImport: i0 });
2019
+ }
2020
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentDirective, decorators: [{
2021
+ type: Directive,
2022
+ args: [{
2023
+ selector: '[doc]',
2024
+ standalone: false
2025
+ }]
2026
+ }], ctorParameters: () => [{ type: DocumentService }, { type: i0.TemplateRef }, { type: i0.ViewContainerRef }] });
2027
+
2028
+ /**
2029
+ * @module DocumentModule
2030
+ *
2031
+ * The `DocumentModule` handles the organization and display of document and folder components
2032
+ * in the application. This module is designed to support features like folder containers,
2033
+ * document lists, and individual document items.
2034
+ */
2035
+ class DocumentModule {
2036
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2037
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: DocumentModule, declarations: [
2038
+ /**
2039
+ * The main container for managing documents.
2040
+ * DocumentContainerComponent
2041
+ */
2042
+ DocumentContainerComponent,
2043
+ /**
2044
+ * A container component to manage folders.
2045
+ * FolderContainerComponent
2046
+ */
2047
+ FolderContainerComponent,
2048
+ /**
2049
+ * A block component that represents an individual folder.
2050
+ * FolderBlockComponent
2051
+ */
2052
+ FolderBlockComponent,
2053
+ /**
2054
+ * A component to display a list of documents.
2055
+ * DocumentListComponent
2056
+ */
2057
+ DocumentListComponent,
2058
+ /**
2059
+ * A component representing an individual item in the document list.
2060
+ * DocumentListItemComponent
2061
+ */
2062
+ DocumentListItemComponent,
2063
+ /**
2064
+ * A component representing to upload a file.
2065
+ */
2066
+ DocumentUploadComponent,
2067
+ /**
2068
+ * A component representing and allow you to view the document.
2069
+ */
2070
+ DocumentViewerComponent,
2071
+ /**
2072
+ * A directive to show the document.
2073
+ */
2074
+ DocumentDirective,
2075
+ /**
2076
+ * A directive to give permission.
2077
+ */
2078
+ HasPermissionDirective,
2079
+ /**
2080
+ * A component which have linked documents.
2081
+ */
2082
+ LinkedDocumentComponent], imports: [
2083
+ /**
2084
+ * Angular's CommonModule is imported to access common directives like `ngIf` and `ngFor`.
2085
+ */
2086
+ CommonModule,
2087
+ /**
2088
+ * PrimeNG AccordionModule is used for creating collapsible sections in the UI.
2089
+ */
2090
+ AccordionModule,
2091
+ /**
2092
+ * HttpClienModule for the http calls
2093
+ */
2094
+ HttpClientModule,
2095
+ /**
2096
+ * PrimeNG ButtonModule is used for creating buttons in the UI.
2097
+ */
2098
+ ButtonModule,
2099
+ /**
2100
+ * PrimeNG SidebarModule is used for creating sidebar in the UI.
2101
+ */
2102
+ SidebarModule,
2103
+ /**
2104
+ * PrimeNG FileUploadModule is used for uploading file.
2105
+ */
2106
+ FileUploadModule,
2107
+ /**
2108
+ * PrimeNG ProgressBarModule is used for showing progress.
2109
+ */
2110
+ ProgressBarModule,
2111
+ /**
2112
+ * PrimeNG BadgeModule is used for showing badge value.
2113
+ */
2114
+ BadgeModule,
2115
+ /**
2116
+ * PrimeNG ListboxModule is used for showing listbox value.
2117
+ */
2118
+ ListboxModule,
2119
+ /**
2120
+ * PrimeNG CheckboxModule is used for showing checkbox value.
2121
+ */
2122
+ CheckboxModule,
2123
+ /**
2124
+ * PrimeNG TimelineModule is used for showing timeline value.
2125
+ */
2126
+ TimelineModule,
2127
+ /**
2128
+ * PrimeNG InputTextareaModule is used for showing textarea value.
2129
+ */
2130
+ InputTextareaModule,
2131
+ /**
2132
+ * FormsModule to handle the forms.
2133
+ */
2134
+ FormsModule,
2135
+ /**
2136
+ * PdfViewerModule to handle and make visible the pdf.
2137
+ */
2138
+ PdfViewerModule,
2139
+ /**
2140
+ * PrimeNG DialogModule is used for showing dialog.
2141
+ */
2142
+ DialogModule,
2143
+ /**
2144
+ * PrimeNG DropdownModule is used for creating dropdown menus, allowing users to select options from a list.
2145
+ */
2146
+ DropdownModule,
2147
+ /**
2148
+ * PrimeNG InputTextModule is used for creating InputTextFeilds, allowing users to enter name for a document.
2149
+ */
2150
+ InputTextModule], exports: [
2151
+ /**
2152
+ * A directive to give permission.
2153
+ */
2154
+ HasPermissionDirective,
2155
+ /**
2156
+ * Exports the `DocumentContainerComponent` to be used in other modules.
2157
+ */
2158
+ DocumentContainerComponent,
2159
+ /**
2160
+ * Exports the `DocumentViewerComponent` to be used in other modules.
2161
+ */
2162
+ DocumentViewerComponent,
2163
+ /**
2164
+ * A component to display a list of documents.
2165
+ * DocumentListComponent
2166
+ */
2167
+ DocumentListComponent,
2168
+ /**
2169
+ * A directive to show the document.
2170
+ */
2171
+ DocumentDirective] });
2172
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentModule, providers: [
2173
+ /**
2174
+ * Provide the messageservice to be used in other components.
2175
+ */
2176
+ MessageService,
2177
+ /**
2178
+ * Provide the messageservice to be used in other components.
2179
+ */
2180
+ { provide: GlobalErrorHandler, useClass: GlobalErrorHandler },
2181
+ /**
2182
+ * Initializes the application configuration by loading it from the AppConfigService
2183
+ * before the application starts.
2184
+ * This ensures that the configuration is available for the rest of the app when needed.
2185
+ * The configuration is loaded asynchronously using the APP_INITIALIZER.
2186
+ * @returns {Function} - A function that loads the configuration from the AppConfigService.
2187
+ */
2188
+ {
2189
+ provide: APP_INITIALIZER,
2190
+ /**
2191
+ * This useFactory is executed when the app initializes.
2192
+ * It calls the AppConfigService to load the configuration.
2193
+ * If an error occurs, it throws an error.
2194
+ * @param {AppConfigService} configService - The service responsible for loading the application configuration.
2195
+ * @returns {Function} - A function that loads the configuration from the AppConfigService.
2196
+ */
2197
+ useFactory: (configService) => () => configService.loadAppConfig().catch((error) => {
2198
+ throw new Error(error);
2199
+ }),
2200
+ deps: [AppConfigService],
2201
+ multi: true,
2202
+ },
2203
+ ], imports: [
2204
+ /**
2205
+ * Angular's CommonModule is imported to access common directives like `ngIf` and `ngFor`.
2206
+ */
2207
+ CommonModule,
2208
+ /**
2209
+ * PrimeNG AccordionModule is used for creating collapsible sections in the UI.
2210
+ */
2211
+ AccordionModule,
2212
+ /**
2213
+ * HttpClienModule for the http calls
2214
+ */
2215
+ HttpClientModule,
2216
+ /**
2217
+ * PrimeNG ButtonModule is used for creating buttons in the UI.
2218
+ */
2219
+ ButtonModule,
2220
+ /**
2221
+ * PrimeNG SidebarModule is used for creating sidebar in the UI.
2222
+ */
2223
+ SidebarModule,
2224
+ /**
2225
+ * PrimeNG FileUploadModule is used for uploading file.
2226
+ */
2227
+ FileUploadModule,
2228
+ /**
2229
+ * PrimeNG ProgressBarModule is used for showing progress.
2230
+ */
2231
+ ProgressBarModule,
2232
+ /**
2233
+ * PrimeNG BadgeModule is used for showing badge value.
2234
+ */
2235
+ BadgeModule,
2236
+ /**
2237
+ * PrimeNG ListboxModule is used for showing listbox value.
2238
+ */
2239
+ ListboxModule,
2240
+ /**
2241
+ * PrimeNG CheckboxModule is used for showing checkbox value.
2242
+ */
2243
+ CheckboxModule,
2244
+ /**
2245
+ * PrimeNG TimelineModule is used for showing timeline value.
2246
+ */
2247
+ TimelineModule,
2248
+ /**
2249
+ * PrimeNG InputTextareaModule is used for showing textarea value.
2250
+ */
2251
+ InputTextareaModule,
2252
+ /**
2253
+ * FormsModule to handle the forms.
2254
+ */
2255
+ FormsModule,
2256
+ /**
2257
+ * PdfViewerModule to handle and make visible the pdf.
2258
+ */
2259
+ PdfViewerModule,
2260
+ /**
2261
+ * PrimeNG DialogModule is used for showing dialog.
2262
+ */
2263
+ DialogModule,
2264
+ /**
2265
+ * PrimeNG DropdownModule is used for creating dropdown menus, allowing users to select options from a list.
2266
+ */
2267
+ DropdownModule,
2268
+ /**
2269
+ * PrimeNG InputTextModule is used for creating InputTextFeilds, allowing users to enter name for a document.
2270
+ */
2271
+ InputTextModule] });
2272
+ }
2273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentModule, decorators: [{
2274
+ type: NgModule,
2275
+ args: [{
2276
+ declarations: [
2277
+ /**
2278
+ * The main container for managing documents.
2279
+ * DocumentContainerComponent
2280
+ */
2281
+ DocumentContainerComponent,
2282
+ /**
2283
+ * A container component to manage folders.
2284
+ * FolderContainerComponent
2285
+ */
2286
+ FolderContainerComponent,
2287
+ /**
2288
+ * A block component that represents an individual folder.
2289
+ * FolderBlockComponent
2290
+ */
2291
+ FolderBlockComponent,
2292
+ /**
2293
+ * A component to display a list of documents.
2294
+ * DocumentListComponent
2295
+ */
2296
+ DocumentListComponent,
2297
+ /**
2298
+ * A component representing an individual item in the document list.
2299
+ * DocumentListItemComponent
2300
+ */
2301
+ DocumentListItemComponent,
2302
+ /**
2303
+ * A component representing to upload a file.
2304
+ */
2305
+ DocumentUploadComponent,
2306
+ /**
2307
+ * A component representing and allow you to view the document.
2308
+ */
2309
+ DocumentViewerComponent,
2310
+ /**
2311
+ * A directive to show the document.
2312
+ */
2313
+ DocumentDirective,
2314
+ /**
2315
+ * A directive to give permission.
2316
+ */
2317
+ HasPermissionDirective,
2318
+ /**
2319
+ * A component which have linked documents.
2320
+ */
2321
+ LinkedDocumentComponent,
2322
+ ],
2323
+ imports: [
2324
+ /**
2325
+ * Angular's CommonModule is imported to access common directives like `ngIf` and `ngFor`.
2326
+ */
2327
+ CommonModule,
2328
+ /**
2329
+ * PrimeNG AccordionModule is used for creating collapsible sections in the UI.
2330
+ */
2331
+ AccordionModule,
2332
+ /**
2333
+ * HttpClienModule for the http calls
2334
+ */
2335
+ HttpClientModule,
2336
+ /**
2337
+ * PrimeNG ButtonModule is used for creating buttons in the UI.
2338
+ */
2339
+ ButtonModule,
2340
+ /**
2341
+ * PrimeNG SidebarModule is used for creating sidebar in the UI.
2342
+ */
2343
+ SidebarModule,
2344
+ /**
2345
+ * PrimeNG FileUploadModule is used for uploading file.
2346
+ */
2347
+ FileUploadModule,
2348
+ /**
2349
+ * PrimeNG ProgressBarModule is used for showing progress.
2350
+ */
2351
+ ProgressBarModule,
2352
+ /**
2353
+ * PrimeNG BadgeModule is used for showing badge value.
2354
+ */
2355
+ BadgeModule,
2356
+ /**
2357
+ * PrimeNG ListboxModule is used for showing listbox value.
2358
+ */
2359
+ ListboxModule,
2360
+ /**
2361
+ * PrimeNG CheckboxModule is used for showing checkbox value.
2362
+ */
2363
+ CheckboxModule,
2364
+ /**
2365
+ * PrimeNG TimelineModule is used for showing timeline value.
2366
+ */
2367
+ TimelineModule,
2368
+ /**
2369
+ * PrimeNG InputTextareaModule is used for showing textarea value.
2370
+ */
2371
+ InputTextareaModule,
2372
+ /**
2373
+ * FormsModule to handle the forms.
2374
+ */
2375
+ FormsModule,
2376
+ /**
2377
+ * PdfViewerModule to handle and make visible the pdf.
2378
+ */
2379
+ PdfViewerModule,
2380
+ /**
2381
+ * PrimeNG DialogModule is used for showing dialog.
2382
+ */
2383
+ DialogModule,
2384
+ /**
2385
+ * PrimeNG DropdownModule is used for creating dropdown menus, allowing users to select options from a list.
2386
+ */
2387
+ DropdownModule,
2388
+ /**
2389
+ * PrimeNG InputTextModule is used for creating InputTextFeilds, allowing users to enter name for a document.
2390
+ */
2391
+ InputTextModule
2392
+ ],
2393
+ exports: [
2394
+ /**
2395
+ * A directive to give permission.
2396
+ */
2397
+ HasPermissionDirective,
2398
+ /**
2399
+ * Exports the `DocumentContainerComponent` to be used in other modules.
2400
+ */
2401
+ DocumentContainerComponent,
2402
+ /**
2403
+ * Exports the `DocumentViewerComponent` to be used in other modules.
2404
+ */
2405
+ DocumentViewerComponent,
2406
+ /**
2407
+ * A component to display a list of documents.
2408
+ * DocumentListComponent
2409
+ */
2410
+ DocumentListComponent,
2411
+ /**
2412
+ * A directive to show the document.
2413
+ */
2414
+ DocumentDirective,
2415
+ ],
2416
+ providers: [
2417
+ /**
2418
+ * Provide the messageservice to be used in other components.
2419
+ */
2420
+ MessageService,
2421
+ /**
2422
+ * Provide the messageservice to be used in other components.
2423
+ */
2424
+ { provide: GlobalErrorHandler, useClass: GlobalErrorHandler },
2425
+ /**
2426
+ * Initializes the application configuration by loading it from the AppConfigService
2427
+ * before the application starts.
2428
+ * This ensures that the configuration is available for the rest of the app when needed.
2429
+ * The configuration is loaded asynchronously using the APP_INITIALIZER.
2430
+ * @returns {Function} - A function that loads the configuration from the AppConfigService.
2431
+ */
2432
+ {
2433
+ provide: APP_INITIALIZER,
2434
+ /**
2435
+ * This useFactory is executed when the app initializes.
2436
+ * It calls the AppConfigService to load the configuration.
2437
+ * If an error occurs, it throws an error.
2438
+ * @param {AppConfigService} configService - The service responsible for loading the application configuration.
2439
+ * @returns {Function} - A function that loads the configuration from the AppConfigService.
2440
+ */
2441
+ useFactory: (configService) => () => configService.loadAppConfig().catch((error) => {
2442
+ throw new Error(error);
2443
+ }),
2444
+ deps: [AppConfigService],
2445
+ multi: true,
2446
+ },
2447
+ ]
2448
+ }]
2449
+ }] });
2450
+
2451
+ /*
2452
+ * Public API Surface of cat-document-lib
2453
+ */
2454
+
2455
+ /**
2456
+ * Generated bundle index. Do not edit.
2457
+ */
2458
+
2459
+ export { DocumentContainerComponent, DocumentDirective, DocumentListComponent, DocumentModule, DocumentViewerComponent, HasPermissionDirective };
2460
+ //# sourceMappingURL=cat-documents-ng.mjs.map