cat-documents-ng 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Shared/constant/ERROR.d.ts +36 -0
- package/Shared/constant/SHARED.d.ts +44 -0
- package/Shared/constant/URLS.d.ts +31 -0
- package/fesm2022/cat-documents-ng.mjs +720 -144
- package/fesm2022/cat-documents-ng.mjs.map +1 -1
- package/lib/document/components/document-container/document-container.component.d.ts +27 -4
- package/lib/document/components/document-list/document-list.component.d.ts +72 -10
- package/lib/document/components/document-upload/document-upload.component.d.ts +22 -15
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +15 -39
- package/lib/document/components/folder-block/folder-block.component.d.ts +2 -2
- package/lib/document/components/folder-container/folder-container.component.d.ts +10 -9
- package/lib/document/document.module.d.ts +3 -1
- package/lib/document/models/document-alert.model.d.ts +38 -0
- package/lib/document/models/document-type.model.d.ts +37 -0
- package/lib/document/models/document.model.d.ts +5 -0
- package/lib/document/models/folder.model.d.ts +3 -3
- package/lib/document/services/document-http.service.d.ts +60 -0
- package/lib/document/services/document-upload.service.d.ts +67 -0
- package/lib/document/state/document.query.d.ts +28 -0
- package/lib/document/state/document.state.d.ts +9 -6
- package/lib/document/state/document.store.d.ts +6 -3
- package/package.json +1 -1
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, Component, Input, EventEmitter, Output, ViewEncapsulation, ViewChild, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
3
|
-
import * as
|
|
3
|
+
import * as i2$1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { firstValueFrom, tap, Subscription } from 'rxjs';
|
|
5
|
+
import { firstValueFrom, tap, catchError, throwError, Subscription } from 'rxjs';
|
|
6
6
|
import { __decorate } from 'tslib';
|
|
7
|
-
import { EntityStore, StoreConfig } from '@datorama/akita';
|
|
8
|
-
import * as
|
|
7
|
+
import { EntityStore, StoreConfig, QueryEntity } from '@datorama/akita';
|
|
8
|
+
import * as i2 from '@angular/common/http';
|
|
9
9
|
import { HttpClientModule } from '@angular/common/http';
|
|
10
|
-
import * as
|
|
11
|
-
import { AccordionModule } from 'primeng/accordion';
|
|
12
|
-
import * as i2 from 'primeng/api';
|
|
10
|
+
import * as i3 from 'primeng/api';
|
|
13
11
|
import { MessageService } from 'primeng/api';
|
|
14
|
-
import * as i3 from 'primeng/
|
|
12
|
+
import * as i3$1 from 'primeng/accordion';
|
|
13
|
+
import { AccordionModule } from 'primeng/accordion';
|
|
14
|
+
import * as i5 from 'primeng/button';
|
|
15
15
|
import { ButtonModule } from 'primeng/button';
|
|
16
|
-
import * as
|
|
16
|
+
import * as i6$1 from 'primeng/sidebar';
|
|
17
17
|
import { SidebarModule } from 'primeng/sidebar';
|
|
18
|
-
import * as
|
|
18
|
+
import * as i7$2 from 'primeng/messages';
|
|
19
|
+
import * as i7$1 from '@angular/forms';
|
|
20
|
+
import { FormsModule } from '@angular/forms';
|
|
21
|
+
import * as i9 from 'primeng/dialog';
|
|
19
22
|
import { DialogModule } from 'primeng/dialog';
|
|
20
|
-
import * as
|
|
23
|
+
import * as i10 from 'primeng/dropdown';
|
|
24
|
+
import { DropdownModule } from 'primeng/dropdown';
|
|
25
|
+
import * as i11 from 'primeng/inputtext';
|
|
26
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
27
|
+
import * as i7 from 'primeng/fileupload';
|
|
21
28
|
import { FileUploadModule } from 'primeng/fileupload';
|
|
22
|
-
import * as
|
|
29
|
+
import * as i8 from 'primeng/progressbar';
|
|
23
30
|
import { ProgressBarModule } from 'primeng/progressbar';
|
|
24
|
-
import * as
|
|
25
|
-
import { ListboxModule } from 'primeng/listbox';
|
|
26
|
-
import * as i5 from 'primeng/checkbox';
|
|
27
|
-
import { CheckboxModule } from 'primeng/checkbox';
|
|
28
|
-
import * as i6$1 from 'primeng/timeline';
|
|
31
|
+
import * as i5$1 from 'primeng/timeline';
|
|
29
32
|
import { TimelineModule } from 'primeng/timeline';
|
|
30
|
-
import * as
|
|
33
|
+
import * as i6 from 'primeng/inputtextarea';
|
|
31
34
|
import { InputTextareaModule } from 'primeng/inputtextarea';
|
|
32
|
-
import * as i8 from '
|
|
33
|
-
import { FormsModule } from '@angular/forms';
|
|
34
|
-
import * as i9 from 'ng2-pdf-viewer';
|
|
35
|
+
import * as i8$1 from 'ng2-pdf-viewer';
|
|
35
36
|
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
|
36
37
|
import { BadgeModule } from 'primeng/badge';
|
|
38
|
+
import { ListboxModule } from 'primeng/listbox';
|
|
39
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
|
37
40
|
|
|
38
41
|
/**
|
|
39
42
|
* The `SHARED` class contains shared constants used across the application.
|
|
@@ -108,12 +111,24 @@ class SHARED {
|
|
|
108
111
|
* @type {'error'}
|
|
109
112
|
*/
|
|
110
113
|
static SEVERITY = 'error';
|
|
114
|
+
/**
|
|
115
|
+
* Show SEVERITY value.
|
|
116
|
+
* @static
|
|
117
|
+
* @type {'error'}
|
|
118
|
+
*/
|
|
119
|
+
static SUCCESS_SEVERITY = 'success';
|
|
111
120
|
/**
|
|
112
121
|
* Show upload summery if it's failed.
|
|
113
122
|
* @static
|
|
114
123
|
* @type {'Upload Failed'}
|
|
115
124
|
*/
|
|
116
125
|
static UPLOAD_SUMMERY = 'Upload Failed';
|
|
126
|
+
/**
|
|
127
|
+
* Show upload summery if it's success.
|
|
128
|
+
* @static
|
|
129
|
+
* @type {'Document uploaded successfully.'}
|
|
130
|
+
*/
|
|
131
|
+
static UPLOAD_SUCCESS = 'Document uploaded successfully.';
|
|
117
132
|
/**
|
|
118
133
|
* Represent empty array.
|
|
119
134
|
* @static
|
|
@@ -132,6 +147,30 @@ class SHARED {
|
|
|
132
147
|
* @type {string}
|
|
133
148
|
*/
|
|
134
149
|
static FILE_SIZE = 'fileSize';
|
|
150
|
+
/**
|
|
151
|
+
* Represent documentName.
|
|
152
|
+
* @static
|
|
153
|
+
* @type {string}
|
|
154
|
+
*/
|
|
155
|
+
static DOCUMENT_NAME = 'documentName';
|
|
156
|
+
/**
|
|
157
|
+
* Represent documentTypeId.
|
|
158
|
+
* @static
|
|
159
|
+
* @type {string}
|
|
160
|
+
*/
|
|
161
|
+
static DOCUMENT_TYPE_ID = 'documentTypeId';
|
|
162
|
+
/**
|
|
163
|
+
* Represent upload summery.
|
|
164
|
+
* @static
|
|
165
|
+
* @type {string}
|
|
166
|
+
*/
|
|
167
|
+
static UPLOAD_ERROR_SUMMERY = 'Form Data Missing';
|
|
168
|
+
/**
|
|
169
|
+
* Represent upload error details.
|
|
170
|
+
* @static
|
|
171
|
+
* @type {string}
|
|
172
|
+
*/
|
|
173
|
+
static UPLOAD_ERROR_DETAILS = 'Required form data is missing. Please ensure the document and all required fields are provided.';
|
|
135
174
|
}
|
|
136
175
|
/**
|
|
137
176
|
* `DUMMYDOCUMENTLIST` is a mock list of document objects used for testing and development purposes.
|
|
@@ -246,6 +285,65 @@ const COUNTRIES = [
|
|
|
246
285
|
const SUPPORTED_IMAGE_TYPES = [
|
|
247
286
|
'image/png'
|
|
248
287
|
];
|
|
288
|
+
/**
|
|
289
|
+
* @constant {Array<{label: string, value: string, files: string[]}>} DOCUMENTTYPES
|
|
290
|
+
* An array of document type objects containing labels, values, and associated files.
|
|
291
|
+
*/
|
|
292
|
+
const DOCUMENTTYPES = [
|
|
293
|
+
{
|
|
294
|
+
label: "BankStatement",
|
|
295
|
+
value: "bank_statement",
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
label: "Payslip",
|
|
299
|
+
value: "payslip",
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
label: "Selfie",
|
|
303
|
+
value: "selfie",
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
label: "Other",
|
|
307
|
+
value: "other",
|
|
308
|
+
}
|
|
309
|
+
];
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* A utility class containing common error messages.
|
|
313
|
+
* @class ERRORS
|
|
314
|
+
*/
|
|
315
|
+
class ERRORS {
|
|
316
|
+
/**
|
|
317
|
+
* Error message for invalid recipient.
|
|
318
|
+
* @static
|
|
319
|
+
* @type {string}
|
|
320
|
+
*/
|
|
321
|
+
static INVALID_RECIPIENT = "Invalid recipient: The recipient cannot be empty.";
|
|
322
|
+
/**
|
|
323
|
+
* Error message for invalid document.
|
|
324
|
+
* @static
|
|
325
|
+
* @type {string}
|
|
326
|
+
*/
|
|
327
|
+
static ERROR_FETCHING_DOCUMENTS = "Error fetching documents:";
|
|
328
|
+
/**
|
|
329
|
+
* Error message for invalid document.
|
|
330
|
+
* @static
|
|
331
|
+
* @type {string}
|
|
332
|
+
*/
|
|
333
|
+
static ERROR_FETCHING_FOLDERS = "Error fetching folders:";
|
|
334
|
+
/**
|
|
335
|
+
* Error message for invalid document.
|
|
336
|
+
* @static
|
|
337
|
+
* @type {string}
|
|
338
|
+
*/
|
|
339
|
+
static ERROR_ALLDOCUMENT_MISSING = "allDocumentTypes is missing in the response:";
|
|
340
|
+
/**
|
|
341
|
+
* Error message for invalid document.
|
|
342
|
+
* @static
|
|
343
|
+
* @type {string}
|
|
344
|
+
*/
|
|
345
|
+
static ERROR_DOCUMENT_TYPES = "Error fetching document types:";
|
|
346
|
+
}
|
|
249
347
|
|
|
250
348
|
/**
|
|
251
349
|
* Class that holds the URLs used throughout the application.
|
|
@@ -275,14 +373,43 @@ class URLS {
|
|
|
275
373
|
* @type {string}
|
|
276
374
|
*/
|
|
277
375
|
static CONTEXT = "?contextId=";
|
|
376
|
+
/**
|
|
377
|
+
* The query parameter to pass a document ID in API requests.
|
|
378
|
+
* @static
|
|
379
|
+
* @type {string}
|
|
380
|
+
*/
|
|
381
|
+
static DOCUMENT_TYPES = "documentTypes";
|
|
382
|
+
/**
|
|
383
|
+
* The query parameter to pass a context ID in API requests.
|
|
384
|
+
* @static
|
|
385
|
+
* @type {string}
|
|
386
|
+
*/
|
|
387
|
+
static FOLDERS = "/folders?contextId=";
|
|
388
|
+
/**
|
|
389
|
+
* The query parameter to pass a document ID in API requests.
|
|
390
|
+
* @static
|
|
391
|
+
* @type {string}
|
|
392
|
+
*/
|
|
393
|
+
static ALERT_BY_DOCUMENT_ID = "alerts?documentId=";
|
|
394
|
+
/**
|
|
395
|
+
* The query parameter to pass a document ID in API requests.
|
|
396
|
+
* @static
|
|
397
|
+
* @type {string}
|
|
398
|
+
*/
|
|
399
|
+
static PARENT_DOCUMENT_TYPE_ID = "parentDocumentType?parentDocumentTypeId=";
|
|
400
|
+
/**
|
|
401
|
+
* The query parameter to pass a context ID in API requests.
|
|
402
|
+
* Used to specify the context for certain API calls, such as filtering or scoping the request.
|
|
403
|
+
* @static
|
|
404
|
+
* @type {string}
|
|
405
|
+
*/
|
|
406
|
+
static CONTEXT_ID = "&contextId=";
|
|
278
407
|
}
|
|
279
408
|
|
|
280
409
|
/**
|
|
281
410
|
* Creates the initial state for the `DocumentState` store.
|
|
282
|
-
*
|
|
283
411
|
* This function provides default values for all properties in the `DocumentState` interface,
|
|
284
412
|
* ensuring the store starts with a consistent initial structure.
|
|
285
|
-
*
|
|
286
413
|
* @returns {DocumentState} The initial state of the document store.
|
|
287
414
|
*/
|
|
288
415
|
function createInitialState() {
|
|
@@ -291,17 +418,20 @@ function createInitialState() {
|
|
|
291
418
|
filteredRecords: [],
|
|
292
419
|
folderId: null,
|
|
293
420
|
isDialogOpen: false,
|
|
421
|
+
dropdownOptions: [],
|
|
422
|
+
uploadedDocumentFiles: [],
|
|
423
|
+
parentDocumentTypeId: null,
|
|
424
|
+
documentAlert: { _id: '' },
|
|
425
|
+
folders: []
|
|
294
426
|
};
|
|
295
427
|
}
|
|
296
428
|
|
|
297
429
|
/**
|
|
298
430
|
* Store that manages the state of documents in the application.
|
|
299
|
-
*
|
|
300
431
|
* The `DocumentStore` class extends Akita's `EntityStore` to manage the entity state for documents.
|
|
301
432
|
* It uses the `createInitialState` function to initialize the store with default values and
|
|
302
433
|
* is configured with the name `'documents'`.
|
|
303
|
-
*
|
|
304
|
-
* @extends EntityStore<DocumentState>
|
|
434
|
+
* @augments EntityStore<DocumentState>
|
|
305
435
|
*/
|
|
306
436
|
let DocumentStore = class DocumentStore extends EntityStore {
|
|
307
437
|
/**
|
|
@@ -310,6 +440,21 @@ let DocumentStore = class DocumentStore extends EntityStore {
|
|
|
310
440
|
constructor() {
|
|
311
441
|
super(createInitialState());
|
|
312
442
|
}
|
|
443
|
+
setUploadedDocumentFiles(files) {
|
|
444
|
+
this.update({ uploadedDocumentFiles: files });
|
|
445
|
+
}
|
|
446
|
+
setFolders(folders) {
|
|
447
|
+
this.update({ folders: folders });
|
|
448
|
+
}
|
|
449
|
+
setDocumentTypes(documentType) {
|
|
450
|
+
this.update({ uploadedDocumentFiles: documentType });
|
|
451
|
+
}
|
|
452
|
+
setDocumentAlert(documentAlert) {
|
|
453
|
+
this.update({ documentAlert: documentAlert });
|
|
454
|
+
}
|
|
455
|
+
setParentDocumentTypeId(parentDocumentTypeId) {
|
|
456
|
+
this.update({ parentDocumentTypeId });
|
|
457
|
+
}
|
|
313
458
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentStore, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
314
459
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentStore, providedIn: 'root' });
|
|
315
460
|
};
|
|
@@ -364,7 +509,7 @@ class AppConfigService {
|
|
|
364
509
|
* @type {*}
|
|
365
510
|
*/
|
|
366
511
|
get apiBaseUrl() {
|
|
367
|
-
return this.appConfig?.
|
|
512
|
+
return this.appConfig?.documentApiUrl;
|
|
368
513
|
}
|
|
369
514
|
/**
|
|
370
515
|
* Returns the local server API URL from the loaded configuration.
|
|
@@ -382,7 +527,7 @@ class AppConfigService {
|
|
|
382
527
|
get visibilityOptions() {
|
|
383
528
|
return this.appConfig?.visibilityOption;
|
|
384
529
|
}
|
|
385
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AppConfigService, deps: [{ token:
|
|
530
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AppConfigService, deps: [{ token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
386
531
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AppConfigService, providedIn: 'root' });
|
|
387
532
|
}
|
|
388
533
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: AppConfigService, decorators: [{
|
|
@@ -390,7 +535,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
390
535
|
args: [{
|
|
391
536
|
providedIn: 'root'
|
|
392
537
|
}]
|
|
393
|
-
}], ctorParameters: () => [{ type:
|
|
538
|
+
}], ctorParameters: () => [{ type: i2.HttpClient }] });
|
|
394
539
|
|
|
395
540
|
/**
|
|
396
541
|
* Service for managing document-related operations.
|
|
@@ -463,13 +608,136 @@ class DocumentService {
|
|
|
463
608
|
delete(id) {
|
|
464
609
|
return this.http.delete(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`).pipe(tap(() => this.documentStore.remove(id)));
|
|
465
610
|
}
|
|
466
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService, deps: [{ token: DocumentStore }, { token:
|
|
611
|
+
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 });
|
|
467
612
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService, providedIn: 'root' });
|
|
468
613
|
}
|
|
469
614
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentService, decorators: [{
|
|
470
615
|
type: Injectable,
|
|
471
616
|
args: [{ providedIn: 'root' }]
|
|
472
|
-
}], ctorParameters: () => [{ type: DocumentStore }, { type:
|
|
617
|
+
}], ctorParameters: () => [{ type: DocumentStore }, { type: i2.HttpClient }, { type: AppConfigService }] });
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Query service for managing document state.
|
|
621
|
+
* This class extends Akita's `QueryEntity` to provide additional functionality for querying document data.
|
|
622
|
+
* @class DocumentQuery
|
|
623
|
+
* @typedef {DocumentQuery}
|
|
624
|
+
* @extends {QueryEntity<DocumentState>}
|
|
625
|
+
*/
|
|
626
|
+
class DocumentQuery extends QueryEntity {
|
|
627
|
+
store;
|
|
628
|
+
constructor(store) {
|
|
629
|
+
super(store);
|
|
630
|
+
this.store = store;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Selects the currently selected folder ID from the document state.
|
|
634
|
+
* @returns {Observable<string | null>} Observable that emits the currently selected folder ID.
|
|
635
|
+
*/
|
|
636
|
+
getParentDocumentTypeId() {
|
|
637
|
+
return this.getValue()['parentDocumentTypeId'];
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Selects the currently selected folder ID from the document state.
|
|
641
|
+
* @returns {Observable<string | null>} Observable that emits the currently selected folder ID.
|
|
642
|
+
*/
|
|
643
|
+
selectParentDocumentTypeId() {
|
|
644
|
+
return this.select((state) => state['parentDocumentTypeId']);
|
|
645
|
+
}
|
|
646
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentQuery, deps: [{ token: DocumentStore }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
647
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentQuery, providedIn: 'root' });
|
|
648
|
+
}
|
|
649
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentQuery, decorators: [{
|
|
650
|
+
type: Injectable,
|
|
651
|
+
args: [{ providedIn: 'root' }]
|
|
652
|
+
}], ctorParameters: () => [{ type: DocumentStore }] });
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Service for making HTTP requests related to documents.
|
|
656
|
+
* @class DocumentHttpService
|
|
657
|
+
* @typedef {DocumentHttpService}
|
|
658
|
+
*/
|
|
659
|
+
class DocumentHttpService {
|
|
660
|
+
documentStore;
|
|
661
|
+
http;
|
|
662
|
+
appConfigService;
|
|
663
|
+
/**
|
|
664
|
+
* Creates an instance of DocumentService.
|
|
665
|
+
* @param {DocumentStore} documentStore - Store managing the state of documents.
|
|
666
|
+
* @param {HttpClient} http - Angular HTTP client for making API requests.
|
|
667
|
+
* @param {AppConfigService} appConfigService - Service for retrieving application configuration, such as API base URL.
|
|
668
|
+
*/
|
|
669
|
+
constructor(documentStore, http, appConfigService) {
|
|
670
|
+
this.documentStore = documentStore;
|
|
671
|
+
this.http = http;
|
|
672
|
+
this.appConfigService = appConfigService;
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Get api url from appConfigService.
|
|
676
|
+
* @readonly
|
|
677
|
+
* @type {string}
|
|
678
|
+
*/
|
|
679
|
+
get apiUrl() {
|
|
680
|
+
return this.appConfigService.apiBaseUrl;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Fetches a document by its path name and transforms the response for dropdown options.
|
|
684
|
+
* Includes error handling for failed API requests.
|
|
685
|
+
* @param {string} contextId - The context ID to fetch the document.
|
|
686
|
+
* @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
|
|
687
|
+
*/
|
|
688
|
+
getFoldersData(contextId) {
|
|
689
|
+
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}${URLS.FOLDERS}${contextId}`).pipe(tap((folders) => {
|
|
690
|
+
this.documentStore.setFolders(folders);
|
|
691
|
+
}), catchError((error) => {
|
|
692
|
+
return throwError(() => new Error(error));
|
|
693
|
+
}));
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Fetches a document by its path name and transforms the response for dropdown options.
|
|
697
|
+
* Includes error handling for failed API requests.
|
|
698
|
+
* @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
|
|
699
|
+
*/
|
|
700
|
+
getDocumentTypes() {
|
|
701
|
+
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${URLS.DOCUMENT_TYPES}`).pipe(tap((documentTypes) => {
|
|
702
|
+
this.documentStore.setDocumentTypes(documentTypes);
|
|
703
|
+
}), catchError((error) => {
|
|
704
|
+
return throwError(() => new Error(error));
|
|
705
|
+
}));
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Fetches a document by its path name and transforms the response for dropdown options.
|
|
709
|
+
* @param {string} documentId - The document ID to fetch the document.
|
|
710
|
+
* @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
|
|
711
|
+
*/
|
|
712
|
+
getAlertsByDocumentID(documentId) {
|
|
713
|
+
return this.http.get(`${this.apiUrl}${URLS.ALERT_BY_DOCUMENT_ID}${documentId}`).pipe(tap((documentAlert) => {
|
|
714
|
+
this.documentStore.setDocumentAlert(documentAlert);
|
|
715
|
+
}), catchError((error) => {
|
|
716
|
+
return throwError(() => new Error(error));
|
|
717
|
+
}));
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Fetches a document by its folder ID and transforms the response for dropdown options.
|
|
721
|
+
* @param {string} folderId - The folder ID to fetch the document.
|
|
722
|
+
* @param {string} contextId - The context ID to fetch the document.
|
|
723
|
+
* @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
|
|
724
|
+
*/
|
|
725
|
+
getDocumentByFolderID(folderId, contextId) {
|
|
726
|
+
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${URLS.PARENT_DOCUMENT_TYPE_ID}${folderId}${URLS.CONTEXT_ID}${contextId}`).pipe(tap((records) => {
|
|
727
|
+
this.documentStore.set(records);
|
|
728
|
+
}), catchError((error) => {
|
|
729
|
+
return throwError(() => new Error(error));
|
|
730
|
+
}));
|
|
731
|
+
}
|
|
732
|
+
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 });
|
|
733
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentHttpService, providedIn: 'root' });
|
|
734
|
+
}
|
|
735
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentHttpService, decorators: [{
|
|
736
|
+
type: Injectable,
|
|
737
|
+
args: [{
|
|
738
|
+
providedIn: 'root'
|
|
739
|
+
}]
|
|
740
|
+
}], ctorParameters: () => [{ type: DocumentStore }, { type: i2.HttpClient }, { type: AppConfigService }] });
|
|
473
741
|
|
|
474
742
|
/**
|
|
475
743
|
* The `FolderBlockComponent` is responsible for displaying a block of folders and
|
|
@@ -484,7 +752,7 @@ class FolderBlockComponent {
|
|
|
484
752
|
* Array of folder blocks data to display.
|
|
485
753
|
* Each folder is represented as a `FolderBlockModel`.
|
|
486
754
|
*/
|
|
487
|
-
|
|
755
|
+
folderList = SHARED.EMPTY_ARRAY;
|
|
488
756
|
/** Number of missing files, sourced from the `SHARED` constants. */
|
|
489
757
|
missingFileCount = SHARED.MISSINGCOUNT;
|
|
490
758
|
/** Number of pending files, sourced from the `SHARED` constants. */
|
|
@@ -507,15 +775,16 @@ class FolderBlockComponent {
|
|
|
507
775
|
if (!folderBlockId) {
|
|
508
776
|
return SHARED.EMPTY;
|
|
509
777
|
}
|
|
778
|
+
this.documentStore.setParentDocumentTypeId(folderBlockId);
|
|
510
779
|
return folderBlockId;
|
|
511
780
|
}
|
|
512
781
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FolderBlockComponent, deps: [{ token: DocumentStore }], target: i0.ɵɵFactoryTarget.Component });
|
|
513
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: FolderBlockComponent, isStandalone: false, selector: "lib-folder-block", inputs: {
|
|
782
|
+
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 folder-info my-4\">\r\n <div class=\"text-900 text-xl font-semibold mb-3\">Folders</div>\r\n <div class=\"grid\">\r\n <div *ngFor=\"let folder of folderList\" class=\"col-12 md:col-6 xl:col-4\">\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: [""], dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
|
|
514
783
|
}
|
|
515
784
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FolderBlockComponent, decorators: [{
|
|
516
785
|
type: Component,
|
|
517
|
-
args: [{ selector: 'lib-folder-block', standalone: false, template: "<div class=\"card folder-info my-4\">\r\n <div class=\"text-900 text-xl font-semibold mb-3\">Folders</div>\r\n <div class=\"grid\">\r\n <div *ngFor=\"let folder of
|
|
518
|
-
}], ctorParameters: () => [{ type: DocumentStore }], propDecorators: {
|
|
786
|
+
args: [{ selector: 'lib-folder-block', standalone: false, template: "<div class=\"card folder-info my-4\">\r\n <div class=\"text-900 text-xl font-semibold mb-3\">Folders</div>\r\n <div class=\"grid\">\r\n <div *ngFor=\"let folder of folderList\" class=\"col-12 md:col-6 xl:col-4\">\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" }]
|
|
787
|
+
}], ctorParameters: () => [{ type: DocumentStore }], propDecorators: { folderList: [{
|
|
519
788
|
type: Input
|
|
520
789
|
}] } });
|
|
521
790
|
|
|
@@ -533,19 +802,154 @@ class FolderContainerComponent {
|
|
|
533
802
|
*/
|
|
534
803
|
documentList;
|
|
535
804
|
/**
|
|
536
|
-
*
|
|
805
|
+
* A list of documents passed as input to the component.
|
|
806
|
+
* Represents the document data to be displayed in the folder container.
|
|
537
807
|
*/
|
|
538
|
-
|
|
808
|
+
folderList = SHARED.EMPTY_ARRAY;
|
|
809
|
+
/**
|
|
810
|
+
* The context ID for the folder container.
|
|
811
|
+
* @type {string}
|
|
812
|
+
*/
|
|
813
|
+
contextId = SHARED.EMPTY;
|
|
539
814
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FolderContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
540
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: FolderContainerComponent, isStandalone: false, selector: "lib-folder-container", inputs: { documentList: "documentList" }, ngImport: i0, template: "\r\n<lib-folder-block [
|
|
815
|
+
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"] }] });
|
|
541
816
|
}
|
|
542
817
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: FolderContainerComponent, decorators: [{
|
|
543
818
|
type: Component,
|
|
544
|
-
args: [{ selector: 'lib-folder-container', standalone: false, template: "\r\n<lib-folder-block [
|
|
819
|
+
args: [{ selector: 'lib-folder-container', standalone: false, template: "\r\n<lib-folder-block [folderList]=\"folderList\"></lib-folder-block>" }]
|
|
545
820
|
}], propDecorators: { documentList: [{
|
|
546
821
|
type: Input
|
|
822
|
+
}], folderList: [{
|
|
823
|
+
type: Input
|
|
824
|
+
}], contextId: [{
|
|
825
|
+
type: Input
|
|
547
826
|
}] } });
|
|
548
827
|
|
|
828
|
+
/**
|
|
829
|
+
* Service for handling document uploads.
|
|
830
|
+
* @class DocumentUploadService
|
|
831
|
+
* @typedef {DocumentUploadService}
|
|
832
|
+
*/
|
|
833
|
+
class DocumentUploadService {
|
|
834
|
+
documentService;
|
|
835
|
+
documentUploadStore;
|
|
836
|
+
messageService;
|
|
837
|
+
/**
|
|
838
|
+
* The file to upload.
|
|
839
|
+
* @type {*}
|
|
840
|
+
*/
|
|
841
|
+
uploadedFile;
|
|
842
|
+
/**
|
|
843
|
+
* Represent contextId
|
|
844
|
+
* @type {string}
|
|
845
|
+
*/
|
|
846
|
+
contextId = SHARED.EMPTY;
|
|
847
|
+
/**
|
|
848
|
+
* Represent document name
|
|
849
|
+
* @type {string}
|
|
850
|
+
*/
|
|
851
|
+
docName = SHARED.EMPTY;
|
|
852
|
+
/**
|
|
853
|
+
* Represent document id
|
|
854
|
+
* @type {string}
|
|
855
|
+
*/
|
|
856
|
+
docTypeId = SHARED.EMPTY;
|
|
857
|
+
/**
|
|
858
|
+
* Creates an instance of DocumentUploadService.
|
|
859
|
+
* @param {DocumentService} documentService - Service for handling document uploads.
|
|
860
|
+
* @param {DocumentStore} documentUploadStore - Store for managing uploaded documents.
|
|
861
|
+
* @param {MessageService} messageService - Service for displaying messages.
|
|
862
|
+
* @returns {void}
|
|
863
|
+
*/
|
|
864
|
+
constructor(documentService, documentUploadStore, messageService) {
|
|
865
|
+
this.documentService = documentService;
|
|
866
|
+
this.documentUploadStore = documentUploadStore;
|
|
867
|
+
this.messageService = messageService;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Prepares the files for upload by creating a FormData object.
|
|
871
|
+
* This method appends each file to the FormData for submission.
|
|
872
|
+
* @returns {void}
|
|
873
|
+
*/
|
|
874
|
+
handleTemplatedUpload() {
|
|
875
|
+
let formsData = this.handleCreateFormData();
|
|
876
|
+
if (!formsData) {
|
|
877
|
+
this.messageService.add({ severity: SHARED.SEVERITY, summary: SHARED.UPLOAD_ERROR_SUMMERY, detail: SHARED.UPLOAD_ERROR_DETAILS });
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
this.documentService.create(formsData)
|
|
881
|
+
.subscribe({
|
|
882
|
+
/**
|
|
883
|
+
* Handles the successful upload event.
|
|
884
|
+
* Updates the list of uploaded files and emits the file ID.
|
|
885
|
+
* @param {any} event - The event emitted by the upload service on success.
|
|
886
|
+
*/
|
|
887
|
+
next: (event) => {
|
|
888
|
+
this.documentUploadStore.setUploadedDocumentFiles(event);
|
|
889
|
+
this.messageService.add({
|
|
890
|
+
severity: SHARED.SUCCESS_SEVERITY,
|
|
891
|
+
detail: SHARED.UPLOAD_SUCCESS
|
|
892
|
+
});
|
|
893
|
+
},
|
|
894
|
+
/**
|
|
895
|
+
* Handles the error event during file upload.
|
|
896
|
+
* Updates the progress of the file to indicate failure.
|
|
897
|
+
* @param {any} error - The error object returned by the upload service.
|
|
898
|
+
*/
|
|
899
|
+
error: (error) => {
|
|
900
|
+
this.messageService.add({ severity: SHARED.SEVERITY, summary: SHARED.UPLOAD_SUMMERY, detail: error?.message, });
|
|
901
|
+
},
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Get the file and contextId
|
|
906
|
+
* @param file - The file to upload.
|
|
907
|
+
* @param contextId - The contextId to upload.
|
|
908
|
+
*/
|
|
909
|
+
getUploadFileData(file, contextId) {
|
|
910
|
+
if (file && contextId) {
|
|
911
|
+
this.uploadedFile = file;
|
|
912
|
+
this.contextId = contextId;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Get the document name and document type id
|
|
917
|
+
* @param documentName - The document name to upload.
|
|
918
|
+
* @param documentTypeId - The document type id to upload.
|
|
919
|
+
*/
|
|
920
|
+
getDocumentNameAndType(documentName, documentTypeId) {
|
|
921
|
+
if (documentName && documentTypeId) {
|
|
922
|
+
this.docName = documentName;
|
|
923
|
+
this.docTypeId = documentTypeId;
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Handle the creation of formdata.
|
|
928
|
+
* @returns {*} - The formdata object.
|
|
929
|
+
*/
|
|
930
|
+
handleCreateFormData() {
|
|
931
|
+
if (this.uploadedFile && this.contextId && this.docName && this.docTypeId) {
|
|
932
|
+
let formData = new FormData();
|
|
933
|
+
formData.append(SHARED.FILE, this.uploadedFile, this.uploadedFile.name);
|
|
934
|
+
formData.append(SHARED.CONTEXT_ID, this.contextId);
|
|
935
|
+
formData.append(SHARED.DOCUMENT_NAME, this.docName);
|
|
936
|
+
formData.append(SHARED.DOCUMENT_TYPE_ID, this.docTypeId);
|
|
937
|
+
return formData;
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
return null;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadService, deps: [{ token: DocumentService }, { token: DocumentStore }, { token: i3.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
944
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadService, providedIn: 'root' });
|
|
945
|
+
}
|
|
946
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadService, decorators: [{
|
|
947
|
+
type: Injectable,
|
|
948
|
+
args: [{
|
|
949
|
+
providedIn: 'root'
|
|
950
|
+
}]
|
|
951
|
+
}], ctorParameters: () => [{ type: DocumentService }, { type: DocumentStore }, { type: i3.MessageService }] });
|
|
952
|
+
|
|
549
953
|
/**
|
|
550
954
|
* DocumentListItemComponent
|
|
551
955
|
*
|
|
@@ -575,11 +979,11 @@ class DocumentListItemComponent {
|
|
|
575
979
|
this.documentClick.emit(document);
|
|
576
980
|
}
|
|
577
981
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentListItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
578
|
-
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\">\r\n <div\r\n class=\"col-12 flex align-items-center justify-content-between md:col-6 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\">{{ 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() === '
|
|
982
|
+
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\">\r\n <div\r\n class=\"col-12 flex align-items-center justify-content-between md:col-6 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\">{{ document.fileName }}</span>\r\n </div>\r\n <div class=\"document-type\">\r\n {{document.documentTypeName}}\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>\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}\n"], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
579
983
|
}
|
|
580
984
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentListItemComponent, decorators: [{
|
|
581
985
|
type: Component,
|
|
582
|
-
args: [{ selector: 'lib-document-list-item', standalone: false, template: "<div class=\"grid\">\r\n <div\r\n class=\"col-12 flex align-items-center justify-content-between md:col-6 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\">{{ 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() === '
|
|
986
|
+
args: [{ selector: 'lib-document-list-item', standalone: false, template: "<div class=\"grid\">\r\n <div\r\n class=\"col-12 flex align-items-center justify-content-between md:col-6 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\">{{ document.fileName }}</span>\r\n </div>\r\n <div class=\"document-type\">\r\n {{document.documentTypeName}}\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>\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}\n"] }]
|
|
583
987
|
}], propDecorators: { documentClick: [{
|
|
584
988
|
type: Output
|
|
585
989
|
}], document: [{
|
|
@@ -634,21 +1038,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
634
1038
|
* @class DocumentUploadComponent
|
|
635
1039
|
*/
|
|
636
1040
|
class DocumentUploadComponent {
|
|
1041
|
+
documentUpload;
|
|
637
1042
|
uploadService;
|
|
638
1043
|
config;
|
|
639
1044
|
fileFormatService;
|
|
640
1045
|
messageService;
|
|
641
1046
|
cdr;
|
|
1047
|
+
/**
|
|
1048
|
+
* Represents the file size.
|
|
1049
|
+
* @type {number}
|
|
1050
|
+
*/
|
|
1051
|
+
fileSize = SHARED.EMPTY;
|
|
642
1052
|
/**
|
|
643
1053
|
* Represent contextId
|
|
644
1054
|
* @type {string}
|
|
645
1055
|
*/
|
|
646
1056
|
contextId = SHARED.EMPTY;
|
|
647
|
-
/**
|
|
648
|
-
* Provide id of file after upload.
|
|
649
|
-
* @type {*}
|
|
650
|
-
*/
|
|
651
|
-
onInput = new EventEmitter();
|
|
652
1057
|
/**
|
|
653
1058
|
* To make file explorer visible.
|
|
654
1059
|
* @type {!FileUpload}
|
|
@@ -673,13 +1078,15 @@ class DocumentUploadComponent {
|
|
|
673
1078
|
/**
|
|
674
1079
|
* Creates an instance of DocumentUploadComponent.
|
|
675
1080
|
* @class
|
|
1081
|
+
* @param {DocumentUploadService} documentUpload - Service for handling document upload.
|
|
676
1082
|
* @param {DocumentService} uploadService - Service for handling document upload.
|
|
677
1083
|
* @param {PrimeNGConfig} config - PrimeNG configuration.
|
|
678
1084
|
* @param {FileFormatService} fileFormatService - Service for formatting file sizes.
|
|
679
1085
|
* @param {MessageService} messageService - Service for displaying messages.
|
|
680
1086
|
* @param {ChangeDetectorRef} cdr - Service for detecting changes.
|
|
681
1087
|
*/
|
|
682
|
-
constructor(uploadService, config, fileFormatService, messageService, cdr) {
|
|
1088
|
+
constructor(documentUpload, uploadService, config, fileFormatService, messageService, cdr) {
|
|
1089
|
+
this.documentUpload = documentUpload;
|
|
683
1090
|
this.uploadService = uploadService;
|
|
684
1091
|
this.config = config;
|
|
685
1092
|
this.fileFormatService = fileFormatService;
|
|
@@ -702,39 +1109,17 @@ class DocumentUploadComponent {
|
|
|
702
1109
|
* @returns {void}
|
|
703
1110
|
*/
|
|
704
1111
|
handleTemplatedUpload(file) {
|
|
705
|
-
|
|
706
|
-
this.
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
* @param {any} event - The event emitted by the upload service on success.
|
|
712
|
-
*/
|
|
713
|
-
next: (event) => {
|
|
714
|
-
this.uploadedFiles.push(event);
|
|
715
|
-
this.fileProgress.set(event, 100);
|
|
716
|
-
this.onInput.emit(event._id);
|
|
717
|
-
this.totalSizePercent = 100;
|
|
718
|
-
},
|
|
719
|
-
/**
|
|
720
|
-
* Handles the error event during file upload.
|
|
721
|
-
* Updates the progress of the file to indicate failure.
|
|
722
|
-
* @param {any} error - The error object returned by the upload service.
|
|
723
|
-
*/
|
|
724
|
-
error: (error) => {
|
|
725
|
-
this.fileProgress.set(file, SHARED.INITIAL_COUNT);
|
|
726
|
-
this.messageService.add({
|
|
727
|
-
severity: SHARED.SEVERITY,
|
|
728
|
-
summary: SHARED.UPLOAD_SUMMERY,
|
|
729
|
-
detail: error?.message,
|
|
730
|
-
});
|
|
731
|
-
},
|
|
732
|
-
});
|
|
1112
|
+
this.documentUpload.getUploadFileData(file, this.contextId);
|
|
1113
|
+
const formattedSize = this.fileFormatService.formatFileSize(file.size, this.config);
|
|
1114
|
+
const progress = 100;
|
|
1115
|
+
this.uploadedFiles.push({ file, formattedSize, progress });
|
|
1116
|
+
this.fileProgress.set(file, progress);
|
|
1117
|
+
this.totalSizePercent = 100;
|
|
733
1118
|
}
|
|
734
1119
|
/**
|
|
735
1120
|
* Handle the creation of formdata.
|
|
736
1121
|
* @param {File} file - The file to append in formdata.
|
|
737
|
-
* @returns {*}
|
|
1122
|
+
* @returns {*} - The formdata object.
|
|
738
1123
|
*/
|
|
739
1124
|
handleCreateFormData(file) {
|
|
740
1125
|
const formData = new FormData();
|
|
@@ -743,10 +1128,10 @@ class DocumentUploadComponent {
|
|
|
743
1128
|
return formData;
|
|
744
1129
|
}
|
|
745
1130
|
/**
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
1131
|
+
* Handles the event when new files are selected.
|
|
1132
|
+
* @param { { currentFiles: File[] } } event - The event containing the newly selected files.
|
|
1133
|
+
* @returns {void} - No return value.
|
|
1134
|
+
*/
|
|
750
1135
|
onSelectedFiles(event) {
|
|
751
1136
|
event.currentFiles.forEach((file) => {
|
|
752
1137
|
this.handleTemplatedUpload(file);
|
|
@@ -759,7 +1144,7 @@ class DocumentUploadComponent {
|
|
|
759
1144
|
* @returns {string} The formatted file size (e.g., '1.2 KB', '2.3 MB').
|
|
760
1145
|
*/
|
|
761
1146
|
formatSize(bytes) {
|
|
762
|
-
|
|
1147
|
+
this.fileSize = this.fileFormatService.formatFileSize(bytes, this.config);
|
|
763
1148
|
}
|
|
764
1149
|
/**
|
|
765
1150
|
* Handles the removal of a file from the uploaded files list.
|
|
@@ -787,16 +1172,14 @@ class DocumentUploadComponent {
|
|
|
787
1172
|
triggerFileUpload() {
|
|
788
1173
|
this.fileUploader.choose();
|
|
789
1174
|
}
|
|
790
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadComponent, deps: [{ token: DocumentService }, { token:
|
|
791
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DocumentUploadComponent, isStandalone: false, selector: "lib-document-upload", inputs: { contextId: "contextId" },
|
|
1175
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadComponent, deps: [{ token: DocumentUploadService }, { token: DocumentService }, { token: i3.PrimeNGConfig }, { token: FileFormatService }, { token: i3.MessageService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1176
|
+
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=\"1000000\"\r\n (onSelect)=\"onSelectedFiles($event)\">\r\n <ng-template pTemplate=\"header\" let-chooseCallback=\"chooseCallback\" let-clearCallback=\"clearCallback\">\r\n <div class=\"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}\n"], dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i5.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.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 });
|
|
792
1177
|
}
|
|
793
1178
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentUploadComponent, decorators: [{
|
|
794
1179
|
type: Component,
|
|
795
|
-
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=\"1000000\"\r\n (onSelect)=\"onSelectedFiles($event)\">\r\n <ng-template pTemplate=\"header\" let-chooseCallback=\"chooseCallback\" let-clearCallback=\"clearCallback\">\r\n <div class=\"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
|
|
796
|
-
}], ctorParameters: () => [{ type: DocumentService }, { type:
|
|
1180
|
+
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=\"1000000\"\r\n (onSelect)=\"onSelectedFiles($event)\">\r\n <ng-template pTemplate=\"header\" let-chooseCallback=\"chooseCallback\" let-clearCallback=\"clearCallback\">\r\n <div class=\"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}\n"] }]
|
|
1181
|
+
}], ctorParameters: () => [{ type: DocumentUploadService }, { type: DocumentService }, { type: i3.PrimeNGConfig }, { type: FileFormatService }, { type: i3.MessageService }, { type: i0.ChangeDetectorRef }], propDecorators: { contextId: [{
|
|
797
1182
|
type: Input
|
|
798
|
-
}], onInput: [{
|
|
799
|
-
type: Output
|
|
800
1183
|
}], fileUploader: [{
|
|
801
1184
|
type: ViewChild,
|
|
802
1185
|
args: ['fileUploader']
|
|
@@ -809,6 +1192,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
809
1192
|
* @implements {OnInit}
|
|
810
1193
|
*/
|
|
811
1194
|
class DocumentViewerComponent {
|
|
1195
|
+
documentHttpService;
|
|
812
1196
|
/**
|
|
813
1197
|
* Get the selected document by user.
|
|
814
1198
|
* @type {*}
|
|
@@ -819,21 +1203,11 @@ class DocumentViewerComponent {
|
|
|
819
1203
|
* @type {!string}
|
|
820
1204
|
*/
|
|
821
1205
|
notes;
|
|
822
|
-
/**
|
|
823
|
-
* Country data according to Country model.
|
|
824
|
-
* @type {!Country[]}
|
|
825
|
-
*/
|
|
826
|
-
countries;
|
|
827
1206
|
/**
|
|
828
1207
|
* Indicates whether a checkbox is selected.
|
|
829
1208
|
* @type {boolean}
|
|
830
1209
|
*/
|
|
831
1210
|
checked = false;
|
|
832
|
-
/**
|
|
833
|
-
* The currently selected country.
|
|
834
|
-
* @type {Country}
|
|
835
|
-
*/
|
|
836
|
-
selectedCountry;
|
|
837
1211
|
/**
|
|
838
1212
|
* Reference to the dynamic dialog used for displaying additional details.
|
|
839
1213
|
* @type {(DynamicDialogRef | undefined)}
|
|
@@ -859,16 +1233,29 @@ class DocumentViewerComponent {
|
|
|
859
1233
|
* @type {any}
|
|
860
1234
|
*/
|
|
861
1235
|
alertData;
|
|
1236
|
+
/**
|
|
1237
|
+
* Holds the subscription to manage observable cleanup.
|
|
1238
|
+
* @private
|
|
1239
|
+
* @type {Subscription}
|
|
1240
|
+
*/
|
|
1241
|
+
subscription = new Subscription();
|
|
862
1242
|
/**
|
|
863
1243
|
* Initializes a new instance of the DocumentViewerComponent.
|
|
864
1244
|
*/
|
|
865
|
-
constructor() {
|
|
1245
|
+
constructor(documentHttpService) {
|
|
1246
|
+
this.documentHttpService = documentHttpService;
|
|
1247
|
+
}
|
|
866
1248
|
/**
|
|
867
|
-
*
|
|
868
|
-
*
|
|
1249
|
+
* Fetches the alerts for the selected document.
|
|
1250
|
+
* @returns {void}
|
|
869
1251
|
*/
|
|
870
|
-
|
|
871
|
-
this.
|
|
1252
|
+
ngOnChanges() {
|
|
1253
|
+
if (this.selectedDocument) {
|
|
1254
|
+
const documentSubscription = this.documentHttpService.getAlertsByDocumentID(this.selectedDocument._id).subscribe((data) => {
|
|
1255
|
+
this.alertData = data;
|
|
1256
|
+
});
|
|
1257
|
+
this.subscription.add(documentSubscription);
|
|
1258
|
+
}
|
|
872
1259
|
}
|
|
873
1260
|
/**
|
|
874
1261
|
* Determines if the given content type is an image.
|
|
@@ -878,74 +1265,174 @@ class DocumentViewerComponent {
|
|
|
878
1265
|
isImage(contentType) {
|
|
879
1266
|
return SUPPORTED_IMAGE_TYPES.includes(contentType);
|
|
880
1267
|
}
|
|
881
|
-
|
|
882
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DocumentViewerComponent, isStandalone: false, selector: "document-viewer", inputs: { selectedDocument: "selectedDocument" }, 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-between\">\r\n <div class=\"action col-12 p-0 md:col-2 no-grow-no-shrink\">\r\n <p-listbox\r\n [options]=\"countries\"\r\n [filter]=\"true\"\r\n [(ngModel)]=\"selectedCountry\"\r\n optionLabel=\"name\"\r\n [style]=\"{ width: '15rem' }\"\r\n [listStyle]=\"{ 'max-height': '250px' }\"\r\n >\r\n <ng-template let-country pTemplate=\"item\">\r\n <div class=\"flex align-items-center gap-2\">\r\n <p-checkbox\r\n [(ngModel)]=\"country.checked\"\r\n [binary]=\"true\"\r\n [inputId]=\"country.code\"\r\n ></p-checkbox>\r\n <div>{{ country.name }}</div>\r\n </div>\r\n </ng-template>\r\n </p-listbox>\r\n </div>\r\n @if(selectedDocument){\r\n\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 width=\"500\"\r\n height=\"500\"\r\n alt=\"Document Image\"\r\n />\r\n </div>\r\n @if(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: 55vw; height: 100vh\"\r\n ></pdf-viewer>\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\" >\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 <div class=\"summery mb-4 pb-1\">\r\n <div class=\"card p-0 mb-0\" style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\">\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; \">Summary</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 <p-timeline [value]=\"events\">\r\n <ng-template pTemplate=\"content\" let-event>\r\n {{ event.status }}\r\n </ng-template>\r\n </p-timeline>\r\n </div>\r\n </div>\r\n <div *ngIf=\"propertyDetails\" class=\"property-details mb-4 pb-1\">\r\n <div class=\"card mb-0\">\r\n <h4 class=\"bold\" style=\"font-size: 21px; font-weight: bold;\">Property Details</h4>\r\n <hr />\r\n <div class=\"grid\">\r\n <div class=\"col-12 md:col-12\">\r\n <div class=\"feild flex\">\r\n <div class=\"col-12 flex md:col-7\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\" style=\"font-size: 21px; font-weight: bold;\">Detached House</div>\r\n <div class=\"decription\">\r\n {{ propertyDetails?.PropertyType }}\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex md:col-5\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Floors }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Floors</div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"feild flex\">\r\n <div class=\"col-12 flex md:col-7\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/badroom.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Bedrooms }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Bedrooms</div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex md:col-5\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Kitchen }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Kitchen</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex ml-2 md:col-12\">\r\n <div class=\"img mr-2\">\r\n <img src=\"../../../../assets/icons/location.png\" alt=\"\" />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Address }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Address</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"notes card pl-0 pr-0 pt-0\">\r\n <div class=\"card p-0\" style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\">\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; \">Notes</h4>\r\n </div>\r\n </div>\r\n <div class=\"card mb-0 pt-0\">\r\n <div class=\"textAreaControl mt-3\">\r\n <textarea\r\n rows=\"5\"\r\n cols=\"30\"\r\n pInputTextarea\r\n #textArea\r\n [(ngModel)]=\"notes\"\r\n >\r\n </textarea>\r\n </div>\r\n <div class=\"buttons document-btn-wrapper flex mt-2\">\r\n <button\r\n pButton\r\n pRipple\r\n type=\"button\"\r\n label=\"Resubmission\"\r\n class=\"p-button-outlined mr-2\"\r\n ></button>\r\n <button\r\n pButton\r\n pRipple\r\n type=\"button\"\r\n label=\"Accept\"\r\n ></button>\r\n </div>\r\n </div>\r\n </div>\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-header,.document-viewer .p-dialog-content{background-color:#ececf9}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i4.Listbox, selector: "p-listbox", inputs: ["id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "ariaLabel", "selectOnFocus", "searchLocale", "focusOnHover", "filterMessage", "filterFields", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "scrollHeight", "tabindex", "multiple", "style", "styleClass", "listStyle", "listStyleClass", "readonly", "disabled", "checkbox", "filter", "filterBy", "filterMatchMode", "filterLocale", "metaKeySelection", "dataKey", "showToggleAll", "optionLabel", "optionValue", "optionGroupChildren", "optionGroupLabel", "optionDisabled", "ariaFilterLabel", "filterPlaceHolder", "emptyFilterMessage", "emptyMessage", "group", "options", "filterValue", "selectAll"], outputs: ["onChange", "onClick", "onDblClick", "onFilter", "onFocus", "onBlur", "onSelectAllChange"] }, { kind: "component", type: i5.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "component", type: i6$1.Timeline, selector: "p-timeline", inputs: ["value", "style", "styleClass", "align", "layout"] }, { kind: "directive", type: i7$1.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize", "variant"], outputs: ["onResize"] }, { kind: "directive", type: i8.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: i8.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i8.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i9.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"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
1268
|
+
ngOnDestroy() {
|
|
1269
|
+
this.subscription.unsubscribe();
|
|
1270
|
+
}
|
|
1271
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentViewerComponent, deps: [{ token: DocumentHttpService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1272
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DocumentViewerComponent, isStandalone: false, selector: "document-viewer", inputs: { selectedDocument: "selectedDocument" }, 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 width=\"500\"\r\n height=\"500\"\r\n alt=\"Document Image\"\r\n />\r\n </div>\r\n @if(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: 55vw; height: 100vh\"\r\n ></pdf-viewer>\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\" >\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 <div class=\"summery mb-4 pb-1\">\r\n <div class=\"card p-0 mb-0\" style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\">\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; \">Summary</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 <p-timeline [value]=\"events\">\r\n <ng-template pTemplate=\"content\" let-event>\r\n {{ event.status }}\r\n </ng-template>\r\n </p-timeline>\r\n </div>\r\n </div>\r\n <div *ngIf=\"propertyDetails\" class=\"property-details mb-4 pb-1\">\r\n <div class=\"card mb-0\">\r\n <h4 class=\"bold\" style=\"font-size: 21px; font-weight: bold;\">Property Details</h4>\r\n <hr />\r\n <div class=\"grid\">\r\n <div class=\"col-12 md:col-12\">\r\n <div class=\"feild flex\">\r\n <div class=\"col-12 flex md:col-7\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\" style=\"font-size: 21px; font-weight: bold;\">Detached House</div>\r\n <div class=\"decription\">\r\n {{ propertyDetails?.PropertyType }}\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex md:col-5\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Floors }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Floors</div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"feild flex\">\r\n <div class=\"col-12 flex md:col-7\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/badroom.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Bedrooms }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Bedrooms</div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex md:col-5\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Kitchen }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Kitchen</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex ml-2 md:col-12\">\r\n <div class=\"img mr-2\">\r\n <img src=\"../../../../assets/icons/location.png\" alt=\"\" />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Address }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Address</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"notes card pl-0 pr-0 pt-0\">\r\n <div class=\"card p-0\" style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\">\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; \">Notes</h4>\r\n </div>\r\n </div>\r\n <div class=\"card mb-0 pt-0\">\r\n <div class=\"textAreaControl mt-3\">\r\n <textarea\r\n rows=\"5\"\r\n cols=\"30\"\r\n pInputTextarea\r\n #textArea\r\n [(ngModel)]=\"notes\"\r\n >\r\n </textarea>\r\n </div>\r\n <div class=\"buttons document-btn-wrapper flex mt-2\">\r\n <button\r\n pButton\r\n pRipple\r\n type=\"button\"\r\n label=\"Resubmission\"\r\n class=\"p-button-outlined mr-2\"\r\n ></button>\r\n <button\r\n pButton\r\n pRipple\r\n type=\"button\"\r\n label=\"Accept\"\r\n ></button>\r\n </div>\r\n </div>\r\n </div>\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-header,.document-viewer .p-dialog-content{background-color:#ececf9}\n"], dependencies: [{ kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i5.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i5$1.Timeline, selector: "p-timeline", inputs: ["value", "style", "styleClass", "align", "layout"] }, { kind: "directive", type: i6.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize", "variant"], outputs: ["onResize"] }, { kind: "directive", type: i7$1.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: i7$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i8$1.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"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
883
1273
|
}
|
|
884
1274
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentViewerComponent, decorators: [{
|
|
885
1275
|
type: Component,
|
|
886
|
-
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-between\">\r\n <div class=\"action col-12 p-0 md:col-2 no-grow-no-shrink\">\r\n <p-listbox\r\n [options]=\"countries\"\r\n [filter]=\"true\"\r\n [(ngModel)]=\"selectedCountry\"\r\n optionLabel=\"name\"\r\n [style]=\"{ width: '15rem' }\"\r\n [listStyle]=\"{ 'max-height': '250px' }\"\r\n >\r\n <ng-template let-country pTemplate=\"item\">\r\n <div class=\"flex align-items-center gap-2\">\r\n <p-checkbox\r\n [(ngModel)]=\"country.checked\"\r\n [binary]=\"true\"\r\n [inputId]=\"country.code\"\r\n ></p-checkbox>\r\n <div>{{ country.name }}</div>\r\n </div>\r\n </ng-template>\r\n </p-listbox>\r\n </div>\r\n @if(selectedDocument){\r\n\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 width=\"500\"\r\n height=\"500\"\r\n alt=\"Document Image\"\r\n />\r\n </div>\r\n @if(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: 55vw; height: 100vh\"\r\n ></pdf-viewer>\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\" >\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 <div class=\"summery mb-4 pb-1\">\r\n <div class=\"card p-0 mb-0\" style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\">\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; \">Summary</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 <p-timeline [value]=\"events\">\r\n <ng-template pTemplate=\"content\" let-event>\r\n {{ event.status }}\r\n </ng-template>\r\n </p-timeline>\r\n </div>\r\n </div>\r\n <div *ngIf=\"propertyDetails\" class=\"property-details mb-4 pb-1\">\r\n <div class=\"card mb-0\">\r\n <h4 class=\"bold\" style=\"font-size: 21px; font-weight: bold;\">Property Details</h4>\r\n <hr />\r\n <div class=\"grid\">\r\n <div class=\"col-12 md:col-12\">\r\n <div class=\"feild flex\">\r\n <div class=\"col-12 flex md:col-7\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\" style=\"font-size: 21px; font-weight: bold;\">Detached House</div>\r\n <div class=\"decription\">\r\n {{ propertyDetails?.PropertyType }}\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex md:col-5\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Floors }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Floors</div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"feild flex\">\r\n <div class=\"col-12 flex md:col-7\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/badroom.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Bedrooms }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Bedrooms</div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex md:col-5\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Kitchen }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Kitchen</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex ml-2 md:col-12\">\r\n <div class=\"img mr-2\">\r\n <img src=\"../../../../assets/icons/location.png\" alt=\"\" />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Address }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Address</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"notes card pl-0 pr-0 pt-0\">\r\n <div class=\"card p-0\" style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\">\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; \">Notes</h4>\r\n </div>\r\n </div>\r\n <div class=\"card mb-0 pt-0\">\r\n <div class=\"textAreaControl mt-3\">\r\n <textarea\r\n rows=\"5\"\r\n cols=\"30\"\r\n pInputTextarea\r\n #textArea\r\n [(ngModel)]=\"notes\"\r\n >\r\n </textarea>\r\n </div>\r\n <div class=\"buttons document-btn-wrapper flex mt-2\">\r\n <button\r\n pButton\r\n pRipple\r\n type=\"button\"\r\n label=\"Resubmission\"\r\n class=\"p-button-outlined mr-2\"\r\n ></button>\r\n <button\r\n pButton\r\n pRipple\r\n type=\"button\"\r\n label=\"Accept\"\r\n ></button>\r\n </div>\r\n </div>\r\n </div>\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-header,.document-viewer .p-dialog-content{background-color:#ececf9}\n"] }]
|
|
887
|
-
}], ctorParameters: () => [], propDecorators: { selectedDocument: [{
|
|
1276
|
+
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 width=\"500\"\r\n height=\"500\"\r\n alt=\"Document Image\"\r\n />\r\n </div>\r\n @if(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: 55vw; height: 100vh\"\r\n ></pdf-viewer>\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\" >\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 <div class=\"summery mb-4 pb-1\">\r\n <div class=\"card p-0 mb-0\" style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\">\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; \">Summary</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 <p-timeline [value]=\"events\">\r\n <ng-template pTemplate=\"content\" let-event>\r\n {{ event.status }}\r\n </ng-template>\r\n </p-timeline>\r\n </div>\r\n </div>\r\n <div *ngIf=\"propertyDetails\" class=\"property-details mb-4 pb-1\">\r\n <div class=\"card mb-0\">\r\n <h4 class=\"bold\" style=\"font-size: 21px; font-weight: bold;\">Property Details</h4>\r\n <hr />\r\n <div class=\"grid\">\r\n <div class=\"col-12 md:col-12\">\r\n <div class=\"feild flex\">\r\n <div class=\"col-12 flex md:col-7\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\" style=\"font-size: 21px; font-weight: bold;\">Detached House</div>\r\n <div class=\"decription\">\r\n {{ propertyDetails?.PropertyType }}\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex md:col-5\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Floors }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Floors</div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"feild flex\">\r\n <div class=\"col-12 flex md:col-7\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/badroom.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Bedrooms }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Bedrooms</div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex md:col-5\">\r\n <div class=\"img mr-2\">\r\n <img\r\n src=\"../../../../assets/icons/building-icon.png\"\r\n alt=\"\"\r\n />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Kitchen }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Kitchen</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col-12 flex ml-2 md:col-12\">\r\n <div class=\"img mr-2\">\r\n <img src=\"../../../../assets/icons/location.png\" alt=\"\" />\r\n </div>\r\n <div class=\"title\">\r\n <div class=\"title font-bold\">\r\n {{ propertyDetails?.Address }}\r\n </div>\r\n <div class=\"decription\" style=\"font-size: 21px; font-weight: bold;\">Address</div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"notes card pl-0 pr-0 pt-0\">\r\n <div class=\"card p-0\" style=\"border-bottom: 1px solid;border-color: rgba(68, 72, 109, 0.2); border-bottom-right-radius: 0px;border-bottom-left-radius: 0px;\">\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; \">Notes</h4>\r\n </div>\r\n </div>\r\n <div class=\"card mb-0 pt-0\">\r\n <div class=\"textAreaControl mt-3\">\r\n <textarea\r\n rows=\"5\"\r\n cols=\"30\"\r\n pInputTextarea\r\n #textArea\r\n [(ngModel)]=\"notes\"\r\n >\r\n </textarea>\r\n </div>\r\n <div class=\"buttons document-btn-wrapper flex mt-2\">\r\n <button\r\n pButton\r\n pRipple\r\n type=\"button\"\r\n label=\"Resubmission\"\r\n class=\"p-button-outlined mr-2\"\r\n ></button>\r\n <button\r\n pButton\r\n pRipple\r\n type=\"button\"\r\n label=\"Accept\"\r\n ></button>\r\n </div>\r\n </div>\r\n </div>\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-header,.document-viewer .p-dialog-content{background-color:#ececf9}\n"] }]
|
|
1277
|
+
}], ctorParameters: () => [{ type: DocumentHttpService }], propDecorators: { selectedDocument: [{
|
|
888
1278
|
type: Input
|
|
889
1279
|
}] } });
|
|
890
1280
|
|
|
891
1281
|
/**
|
|
892
|
-
* This component is responsible for displaying a list of documents.
|
|
1282
|
+
* This component is responsible for displaying and managing a list of documents.
|
|
1283
|
+
* Provides functionality for file upload, document selection, and dialog management.
|
|
893
1284
|
* @class DocumentListComponent
|
|
894
|
-
* @typedef {DocumentListComponent}
|
|
895
1285
|
*/
|
|
896
1286
|
class DocumentListComponent {
|
|
1287
|
+
documentUploadService;
|
|
1288
|
+
documentHttpService;
|
|
897
1289
|
/**
|
|
898
|
-
*
|
|
1290
|
+
* Represents the context ID for the document list.
|
|
1291
|
+
* This value is passed from the parent component.
|
|
899
1292
|
* @type {string}
|
|
1293
|
+
* @memberof DocumentListComponent
|
|
900
1294
|
*/
|
|
901
1295
|
contextId = SHARED.EMPTY;
|
|
1296
|
+
/**
|
|
1297
|
+
* The currently selected document.
|
|
1298
|
+
* @type {DocumentModel}
|
|
1299
|
+
* @memberof DocumentListComponent
|
|
1300
|
+
*/
|
|
902
1301
|
selectedDocument;
|
|
903
1302
|
/**
|
|
904
|
-
* Default
|
|
1303
|
+
* Default visibility of the sidebar.
|
|
905
1304
|
* @type {boolean}
|
|
1305
|
+
* @memberof DocumentListComponent
|
|
906
1306
|
*/
|
|
907
1307
|
isSidebarVisible = SHARED.FALSE;
|
|
908
1308
|
/**
|
|
909
|
-
* Default
|
|
1309
|
+
* Default visibility of the dialog.
|
|
910
1310
|
* @type {boolean}
|
|
1311
|
+
* @memberof DocumentListComponent
|
|
911
1312
|
*/
|
|
912
1313
|
isdialogVisible = SHARED.FALSE;
|
|
913
1314
|
/**
|
|
914
1315
|
* The list of documents to display.
|
|
1316
|
+
* This value is passed from the parent component.
|
|
915
1317
|
* @type {DocumentModel[]}
|
|
1318
|
+
* @memberof DocumentListComponent
|
|
916
1319
|
*/
|
|
917
|
-
documentList =
|
|
1320
|
+
documentList = SHARED.EMPTY_ARRAY;
|
|
1321
|
+
/**
|
|
1322
|
+
* The name of the document being uploaded or managed.
|
|
1323
|
+
* @type {string}
|
|
1324
|
+
* @memberof DocumentListComponent
|
|
1325
|
+
*/
|
|
1326
|
+
documentName = SHARED.EMPTY;
|
|
1327
|
+
/**
|
|
1328
|
+
* Available document types for selection.
|
|
1329
|
+
* @type {string[]}
|
|
1330
|
+
* @memberof DocumentListComponent
|
|
1331
|
+
*/
|
|
1332
|
+
options = SHARED.EMPTY_ARRAY;
|
|
1333
|
+
/**
|
|
1334
|
+
* The selected option for the document type.
|
|
1335
|
+
* @type {(string | null)}
|
|
1336
|
+
* @memberof DocumentListComponent
|
|
1337
|
+
*/
|
|
1338
|
+
selectedOption = null;
|
|
1339
|
+
/**
|
|
1340
|
+
* Creates an instance of DocumentListComponent.
|
|
1341
|
+
* @class
|
|
1342
|
+
* @param {DocumentUploadService} documentUploadService - The service responsible for uploading documents.
|
|
1343
|
+
* @param {DocumentHttpService} documentHttpService - The service responsible for fetching documents from the server.
|
|
1344
|
+
*/
|
|
1345
|
+
constructor(documentUploadService, documentHttpService) {
|
|
1346
|
+
this.documentUploadService = documentUploadService;
|
|
1347
|
+
this.documentHttpService = documentHttpService;
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* Initializes the component by fetching the document type list.
|
|
1351
|
+
*/
|
|
1352
|
+
ngOnInit() {
|
|
1353
|
+
this.getDocumentTypeList();
|
|
1354
|
+
}
|
|
918
1355
|
/**
|
|
919
1356
|
* Handles the click event for file upload.
|
|
920
1357
|
* Prevents event propagation and displays the sidebar.
|
|
921
1358
|
* @param {MouseEvent} event - The click event triggered by the user.
|
|
1359
|
+
* @memberof DocumentListComponent
|
|
922
1360
|
*/
|
|
923
1361
|
handleFileUploadClick(event) {
|
|
924
1362
|
event.stopPropagation();
|
|
925
1363
|
this.isSidebarVisible = SHARED.TRUE;
|
|
926
1364
|
}
|
|
927
1365
|
/**
|
|
928
|
-
*
|
|
929
|
-
*
|
|
1366
|
+
* Handles the selection of an individual document.
|
|
1367
|
+
* Opens a dialog to display or manage the selected document.
|
|
1368
|
+
* @param {DocumentModel} document - The document that was clicked by the user.
|
|
1369
|
+
* @memberof DocumentListComponent
|
|
930
1370
|
*/
|
|
931
|
-
handleClickForDocument(
|
|
1371
|
+
handleClickForDocument(document) {
|
|
932
1372
|
this.isdialogVisible = SHARED.TRUE;
|
|
933
|
-
this.selectedDocument =
|
|
1373
|
+
this.selectedDocument = document;
|
|
934
1374
|
}
|
|
935
1375
|
/**
|
|
936
|
-
*
|
|
1376
|
+
* Closes the dialog and resets the selected document.
|
|
1377
|
+
* @memberof DocumentListComponent
|
|
937
1378
|
*/
|
|
938
1379
|
handleCloseModel() {
|
|
939
1380
|
this.selectedDocument = { _id: SHARED.INITIAL_VALUE };
|
|
940
1381
|
this.isdialogVisible = SHARED.FALSE;
|
|
941
1382
|
}
|
|
942
|
-
|
|
943
|
-
|
|
1383
|
+
/**
|
|
1384
|
+
* Handles the upload action for a document.
|
|
1385
|
+
* Validates if a document type is selected and logs the result.
|
|
1386
|
+
* @memberof DocumentListComponent
|
|
1387
|
+
*/
|
|
1388
|
+
handleUploadDocument() {
|
|
1389
|
+
if (this.selectedOption) {
|
|
1390
|
+
this.documentUploadService.getDocumentNameAndType(this.documentName, this.selectedOption);
|
|
1391
|
+
this.documentUploadService.handleTemplatedUpload();
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1394
|
+
console.error(ERRORS.INVALID_RECIPIENT);
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Fetches the list of document types from the server.
|
|
1399
|
+
* Updates the options array with the available document types.
|
|
1400
|
+
* @memberof DocumentListComponent
|
|
1401
|
+
* @returns {void}
|
|
1402
|
+
*/
|
|
1403
|
+
getDocumentTypeList() {
|
|
1404
|
+
this.documentHttpService.getDocumentTypes().subscribe({
|
|
1405
|
+
/**
|
|
1406
|
+
* Handles the successful API response.
|
|
1407
|
+
* @param {DocumentTypeModel[]} documentTypes - The list of document types returned by the API.
|
|
1408
|
+
*/
|
|
1409
|
+
next: (documentTypes) => {
|
|
1410
|
+
if (documentTypes) {
|
|
1411
|
+
this.options = documentTypes.map((doc) => ({
|
|
1412
|
+
label: doc.label,
|
|
1413
|
+
value: doc._id
|
|
1414
|
+
}));
|
|
1415
|
+
}
|
|
1416
|
+
else {
|
|
1417
|
+
console.error(ERRORS.ERROR_ALLDOCUMENT_MISSING, documentTypes);
|
|
1418
|
+
}
|
|
1419
|
+
},
|
|
1420
|
+
/**
|
|
1421
|
+
* Handles errors if the request fails.
|
|
1422
|
+
* @param {any} err - The error object returned by the server.
|
|
1423
|
+
*/
|
|
1424
|
+
error: (err) => {
|
|
1425
|
+
console.error(ERRORS.ERROR_DOCUMENT_TYPES, err);
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentListComponent, deps: [{ token: DocumentUploadService }, { token: DocumentHttpService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1430
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: DocumentListComponent, isStandalone: false, selector: "lib-document-list", inputs: { contextId: "contextId", documentList: "documentList" }, ngImport: i0, template: "<div class=\"document-viewer\">\r\n <p-dialog [(visible)]=\"isdialogVisible\" [modal]=\"true\" (onHide)=\"handleCloseModel()\" [style]=\"{ width: '100vw' }\"\r\n [draggable]=\"false\" [closable]=\"true\">\r\n <document-viewer [selectedDocument]=\"selectedDocument\"></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 document-list-wrapper\">\r\n <p-accordion>\r\n <p-accordionTab [selected]=\"true\" 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\">\r\n Documents\r\n </span>\r\n <button pButton pRipple class=\"p-button-raised\" type=\"button\" label=\"Upload File\"\r\n style=\"border-radius: 10px;\" (click)=\"handleFileUploadClick($event)\"></button>\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\">\r\n <div class=\"col-12\">\r\n <p-sidebar [(visible)]=\"isSidebarVisible\" position=\"right\" [styleClass]=\"'right-sidebar'\" class=\"relative sidebar-panel-wrapper\">\r\n <ng-template pTemplate=\"header\">\r\n <p-messages />\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=\"username\">Document Name</label>\r\n <input type=\"text\" pInputText [(ngModel)]=\"documentName\" placeholder=\"Proof of Identity\" />\r\n </div>\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-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 .p-button{height:45px!important;width:140px;border-radius:10px}.p-sidebar-footer{padding:0}::ng-deep .custom-sidebar-overlay{z-index:0!important}::ng-deep .sidebar-panel-wrapper .p-sidebar-header{padding:1.4rem 1rem}::ng-deep .sidebar-panel-wrapper .p-sidebar-content{padding:0}::ng-deep .sidebar-panel-wrapper .p-sidebar-right{width:35%!important}::ng-deep .sidebar-devider .p-divider{margin:0}::ng-deep .p-component-overlay{background-color:#f4f4f7!important}\n"], dependencies: [{ kind: "component", type: i3$1.Accordion, selector: "p-accordion", inputs: ["multiple", "style", "styleClass", "expandIcon", "collapseIcon", "activeIndex", "selectOnFocus", "headerAriaLevel"], outputs: ["onClose", "onOpen", "activeIndexChange"] }, { kind: "component", type: i3$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: i5.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain"] }, { kind: "component", type: i5.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: i6$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: i7$2.Messages, selector: "p-messages", inputs: ["value", "closable", "style", "styleClass", "enableService", "key", "escape", "severity", "showTransitionOptions", "hideTransitionOptions"], outputs: ["valueChange", "onClose"] }, { kind: "directive", type: i7$1.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: i7$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i9.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: i10.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: i11.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"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
944
1431
|
}
|
|
945
1432
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentListComponent, decorators: [{
|
|
946
1433
|
type: Component,
|
|
947
|
-
args: [{ selector: 'lib-document-list', standalone: false, encapsulation: ViewEncapsulation.None, template: "<div class=\"document-viewer\">\r\n <p-dialog [(visible)]=\"isdialogVisible\" [modal]=\"true\" (onHide)=\"handleCloseModel()\" [style]=\"{ width: '100vw' }\"\r\n [draggable]=\"false\" [closable]=\"true\">\r\n <document-viewer [selectedDocument]=\"selectedDocument\"></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 document-list-wrapper\">\r\n <p-accordion>\r\n <p-accordionTab [selected]=\"true\" 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\">\r\n Documents\r\n </span>\r\n <button pButton pRipple class=\"p-button-raised\" type=\"button\" label=\"Upload File\"\r\n style=\"border-radius: 10px;\" (click)=\"handleFileUploadClick($event)\"></button>\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\">\r\n <div class=\"col-12\">\r\n <p-sidebar
|
|
948
|
-
}], propDecorators: { contextId: [{
|
|
1434
|
+
args: [{ selector: 'lib-document-list', standalone: false, encapsulation: ViewEncapsulation.None, template: "<div class=\"document-viewer\">\r\n <p-dialog [(visible)]=\"isdialogVisible\" [modal]=\"true\" (onHide)=\"handleCloseModel()\" [style]=\"{ width: '100vw' }\"\r\n [draggable]=\"false\" [closable]=\"true\">\r\n <document-viewer [selectedDocument]=\"selectedDocument\"></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 document-list-wrapper\">\r\n <p-accordion>\r\n <p-accordionTab [selected]=\"true\" 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\">\r\n Documents\r\n </span>\r\n <button pButton pRipple class=\"p-button-raised\" type=\"button\" label=\"Upload File\"\r\n style=\"border-radius: 10px;\" (click)=\"handleFileUploadClick($event)\"></button>\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\">\r\n <div class=\"col-12\">\r\n <p-sidebar [(visible)]=\"isSidebarVisible\" position=\"right\" [styleClass]=\"'right-sidebar'\" class=\"relative sidebar-panel-wrapper\">\r\n <ng-template pTemplate=\"header\">\r\n <p-messages />\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=\"username\">Document Name</label>\r\n <input type=\"text\" pInputText [(ngModel)]=\"documentName\" placeholder=\"Proof of Identity\" />\r\n </div>\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-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 .p-button{height:45px!important;width:140px;border-radius:10px}.p-sidebar-footer{padding:0}::ng-deep .custom-sidebar-overlay{z-index:0!important}::ng-deep .sidebar-panel-wrapper .p-sidebar-header{padding:1.4rem 1rem}::ng-deep .sidebar-panel-wrapper .p-sidebar-content{padding:0}::ng-deep .sidebar-panel-wrapper .p-sidebar-right{width:35%!important}::ng-deep .sidebar-devider .p-divider{margin:0}::ng-deep .p-component-overlay{background-color:#f4f4f7!important}\n"] }]
|
|
1435
|
+
}], ctorParameters: () => [{ type: DocumentUploadService }, { type: DocumentHttpService }], propDecorators: { contextId: [{
|
|
949
1436
|
type: Input
|
|
950
1437
|
}], documentList: [{
|
|
951
1438
|
type: Input
|
|
@@ -958,24 +1445,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
958
1445
|
*/
|
|
959
1446
|
class DocumentContainerComponent {
|
|
960
1447
|
documentService;
|
|
1448
|
+
documentQuery;
|
|
1449
|
+
documentHttpService;
|
|
961
1450
|
/**
|
|
962
1451
|
* Creates an instance of DocumentContainerComponent.
|
|
963
|
-
* @class
|
|
964
1452
|
* @param {DocumentService} documentService - Service to manage document-related operations.
|
|
1453
|
+
* @param {DocumentQuery} documentQuery - Query service to manage document-related state.
|
|
1454
|
+
* @param {DocumentHttpService} documentHttpService - Service to make HTTP requests related to documents.
|
|
965
1455
|
*/
|
|
966
|
-
constructor(documentService) {
|
|
1456
|
+
constructor(documentService, documentQuery, documentHttpService) {
|
|
967
1457
|
this.documentService = documentService;
|
|
1458
|
+
this.documentQuery = documentQuery;
|
|
1459
|
+
this.documentHttpService = documentHttpService;
|
|
968
1460
|
}
|
|
969
1461
|
/**
|
|
970
1462
|
* Get contextId in input.
|
|
971
1463
|
* @type {string}
|
|
972
1464
|
*/
|
|
973
|
-
contextId =
|
|
1465
|
+
contextId = '786756';
|
|
974
1466
|
/**
|
|
975
|
-
* The list of
|
|
1467
|
+
* The list of documents.
|
|
976
1468
|
* @type {Array}
|
|
977
1469
|
*/
|
|
978
1470
|
documentList = [];
|
|
1471
|
+
/**
|
|
1472
|
+
* The list of folders.
|
|
1473
|
+
* @type {Array}
|
|
1474
|
+
*/
|
|
1475
|
+
folderList = SHARED.EMPTY_ARRAY;
|
|
979
1476
|
/**
|
|
980
1477
|
* Holds the subscription to manage observable cleanup.
|
|
981
1478
|
* @private
|
|
@@ -983,28 +1480,75 @@ class DocumentContainerComponent {
|
|
|
983
1480
|
*/
|
|
984
1481
|
subscription = new Subscription();
|
|
985
1482
|
/**
|
|
986
|
-
*
|
|
1483
|
+
* Fetches the folder and document data on initialization.
|
|
1484
|
+
* @returns {void}
|
|
987
1485
|
*/
|
|
988
1486
|
ngOnInit() {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
.
|
|
1487
|
+
this.fetchFolder();
|
|
1488
|
+
const folderSubscription = this.documentQuery
|
|
1489
|
+
.selectParentDocumentTypeId()
|
|
1490
|
+
.subscribe((folderBlockId) => {
|
|
1491
|
+
const idToFetch = folderBlockId ?? this.folderList[0]?._id;
|
|
1492
|
+
if (idToFetch) {
|
|
1493
|
+
this.fetchDocuments(idToFetch);
|
|
1494
|
+
}
|
|
1495
|
+
});
|
|
1496
|
+
this.subscription.add(folderSubscription);
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Fetches the folder data from the API.
|
|
1500
|
+
* @returns {void}
|
|
1501
|
+
*/
|
|
1502
|
+
fetchFolder() {
|
|
1503
|
+
const folderSubscription = this.documentHttpService.getFoldersData(this.contextId).subscribe({
|
|
1504
|
+
/**
|
|
1505
|
+
* Handles the successful API response.
|
|
1506
|
+
* @param {FolderBlockModel[]} folder - The list of folders returned by the API.
|
|
1507
|
+
*/
|
|
1508
|
+
next: (folder) => {
|
|
1509
|
+
if (folder && folder.length > 0) {
|
|
1510
|
+
this.folderList = folder;
|
|
1511
|
+
this.fetchDocuments(this.folderList[0]._id);
|
|
1512
|
+
}
|
|
1513
|
+
else {
|
|
1514
|
+
console.error(ERRORS.ERROR_ALLDOCUMENT_MISSING);
|
|
1515
|
+
}
|
|
1516
|
+
},
|
|
1517
|
+
/**
|
|
1518
|
+
* Handles errors if the request fails.
|
|
1519
|
+
* @param {any} err - The error object returned by the server.
|
|
1520
|
+
*/
|
|
1521
|
+
error: (err) => {
|
|
1522
|
+
console.error(ERRORS.ERROR_DOCUMENT_TYPES, err);
|
|
1523
|
+
}
|
|
1524
|
+
});
|
|
1525
|
+
this.subscription.add(folderSubscription);
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* Fetches the document data from the API.
|
|
1529
|
+
* @param {string} folderBlockId - The folder ID to fetch the document.
|
|
1530
|
+
* @returns {void}
|
|
1531
|
+
*/
|
|
1532
|
+
fetchDocuments(folderBlockId) {
|
|
1533
|
+
const documentSubscription = this.documentHttpService.getDocumentByFolderID(folderBlockId, this.contextId).subscribe({
|
|
992
1534
|
/**
|
|
993
1535
|
* Handles the successful API response.
|
|
994
|
-
* @param {DocumentModel[]}
|
|
1536
|
+
* @param {DocumentModel[]} documentList - The list of documents returned by the API.
|
|
995
1537
|
*/
|
|
996
|
-
next: (
|
|
997
|
-
if (
|
|
998
|
-
this.documentList =
|
|
1538
|
+
next: (documentList) => {
|
|
1539
|
+
if (documentList) {
|
|
1540
|
+
this.documentList = documentList;
|
|
1541
|
+
}
|
|
1542
|
+
else {
|
|
1543
|
+
console.error(ERRORS.ERROR_FETCHING_DOCUMENTS);
|
|
999
1544
|
}
|
|
1000
1545
|
},
|
|
1001
1546
|
/**
|
|
1002
|
-
* Handles errors
|
|
1003
|
-
*
|
|
1004
|
-
* @param {any} err - The error object returned from the API.
|
|
1547
|
+
* Handles errors if the request fails.
|
|
1548
|
+
* @param {any} err - The error object returned by the server.
|
|
1005
1549
|
*/
|
|
1006
1550
|
error: (err) => {
|
|
1007
|
-
|
|
1551
|
+
console.error(ERRORS.ERROR_FETCHING_DOCUMENTS, err);
|
|
1008
1552
|
}
|
|
1009
1553
|
});
|
|
1010
1554
|
this.subscription.add(documentSubscription);
|
|
@@ -1015,13 +1559,13 @@ class DocumentContainerComponent {
|
|
|
1015
1559
|
ngOnDestroy() {
|
|
1016
1560
|
this.subscription.unsubscribe();
|
|
1017
1561
|
}
|
|
1018
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentContainerComponent, deps: [{ token: DocumentService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1019
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DocumentContainerComponent, isStandalone: false, selector: "lib-document-container", inputs: { contextId: "contextId" }, ngImport: i0, template: "<div class=\"grid m-0\">\r\n <div class=\"col-12 md:col-12 lg:col-12
|
|
1562
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentContainerComponent, deps: [{ token: DocumentService }, { token: DocumentQuery }, { token: DocumentHttpService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1563
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: DocumentContainerComponent, isStandalone: false, selector: "lib-document-container", inputs: { contextId: "contextId" }, ngImport: i0, template: "<div class=\"grid m-0\">\r\n <div class=\"col-12 md:col-12 lg:col-12 py-0 pl-0\" >\r\n <lib-folder-container [documentList]=\"documentList\" [folderList]=\"folderList\" [contextId]=\"contextId\"></lib-folder-container>\r\n <lib-document-list [documentList]=\"documentList\" [contextId]=\"contextId\"></lib-document-list>\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "component", type: FolderContainerComponent, selector: "lib-folder-container", inputs: ["documentList", "folderList", "contextId"] }, { kind: "component", type: DocumentListComponent, selector: "lib-document-list", inputs: ["contextId", "documentList"] }] });
|
|
1020
1564
|
}
|
|
1021
1565
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentContainerComponent, decorators: [{
|
|
1022
1566
|
type: Component,
|
|
1023
|
-
args: [{ selector: 'lib-document-container', standalone: false, template: "<div class=\"grid m-0\">\r\n <div class=\"col-12 md:col-12 lg:col-12
|
|
1024
|
-
}], ctorParameters: () => [{ type: DocumentService }], propDecorators: { contextId: [{
|
|
1567
|
+
args: [{ selector: 'lib-document-container', standalone: false, template: "<div class=\"grid m-0\">\r\n <div class=\"col-12 md:col-12 lg:col-12 py-0 pl-0\" >\r\n <lib-folder-container [documentList]=\"documentList\" [folderList]=\"folderList\" [contextId]=\"contextId\"></lib-folder-container>\r\n <lib-document-list [documentList]=\"documentList\" [contextId]=\"contextId\"></lib-document-list>\r\n </div>\r\n</div>" }]
|
|
1568
|
+
}], ctorParameters: () => [{ type: DocumentService }, { type: DocumentQuery }, { type: DocumentHttpService }], propDecorators: { contextId: [{
|
|
1025
1569
|
type: Input
|
|
1026
1570
|
}] } });
|
|
1027
1571
|
|
|
@@ -1160,7 +1704,15 @@ class DocumentModule {
|
|
|
1160
1704
|
/**
|
|
1161
1705
|
* PrimeNG DialogModule is used for showing dialog.
|
|
1162
1706
|
*/
|
|
1163
|
-
DialogModule
|
|
1707
|
+
DialogModule,
|
|
1708
|
+
/**
|
|
1709
|
+
* PrimeNG DropdownModule is used for creating dropdown menus, allowing users to select options from a list.
|
|
1710
|
+
*/
|
|
1711
|
+
DropdownModule,
|
|
1712
|
+
/**
|
|
1713
|
+
* PrimeNG InputTextModule is used for creating InputTextFeilds, allowing users to enter name for a document.
|
|
1714
|
+
*/
|
|
1715
|
+
InputTextModule], exports: [
|
|
1164
1716
|
/**
|
|
1165
1717
|
* Exports the `DocumentContainerComponent` to be used in other modules.
|
|
1166
1718
|
*/
|
|
@@ -1189,6 +1741,10 @@ class DocumentModule {
|
|
|
1189
1741
|
provide: APP_INITIALIZER,
|
|
1190
1742
|
/**
|
|
1191
1743
|
* This useFactory is executed when the app initializes.
|
|
1744
|
+
* It calls the AppConfigService to load the configuration.
|
|
1745
|
+
* If an error occurs, it throws an error.
|
|
1746
|
+
* @param {AppConfigService} configService - The service responsible for loading the application configuration.
|
|
1747
|
+
* @returns {Function} - A function that loads the configuration from the AppConfigService.
|
|
1192
1748
|
*/
|
|
1193
1749
|
useFactory: (configService) => () => configService.loadAppConfig().catch((error) => {
|
|
1194
1750
|
throw new Error(error);
|
|
@@ -1256,7 +1812,15 @@ class DocumentModule {
|
|
|
1256
1812
|
/**
|
|
1257
1813
|
* PrimeNG DialogModule is used for showing dialog.
|
|
1258
1814
|
*/
|
|
1259
|
-
DialogModule
|
|
1815
|
+
DialogModule,
|
|
1816
|
+
/**
|
|
1817
|
+
* PrimeNG DropdownModule is used for creating dropdown menus, allowing users to select options from a list.
|
|
1818
|
+
*/
|
|
1819
|
+
DropdownModule,
|
|
1820
|
+
/**
|
|
1821
|
+
* PrimeNG InputTextModule is used for creating InputTextFeilds, allowing users to enter name for a document.
|
|
1822
|
+
*/
|
|
1823
|
+
InputTextModule] });
|
|
1260
1824
|
}
|
|
1261
1825
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: DocumentModule, decorators: [{
|
|
1262
1826
|
type: NgModule,
|
|
@@ -1356,7 +1920,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1356
1920
|
/**
|
|
1357
1921
|
* PrimeNG DialogModule is used for showing dialog.
|
|
1358
1922
|
*/
|
|
1359
|
-
DialogModule
|
|
1923
|
+
DialogModule,
|
|
1924
|
+
/**
|
|
1925
|
+
* PrimeNG DropdownModule is used for creating dropdown menus, allowing users to select options from a list.
|
|
1926
|
+
*/
|
|
1927
|
+
DropdownModule,
|
|
1928
|
+
/**
|
|
1929
|
+
* PrimeNG InputTextModule is used for creating InputTextFeilds, allowing users to enter name for a document.
|
|
1930
|
+
*/
|
|
1931
|
+
InputTextModule
|
|
1360
1932
|
],
|
|
1361
1933
|
exports: [
|
|
1362
1934
|
/**
|
|
@@ -1388,6 +1960,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
1388
1960
|
provide: APP_INITIALIZER,
|
|
1389
1961
|
/**
|
|
1390
1962
|
* This useFactory is executed when the app initializes.
|
|
1963
|
+
* It calls the AppConfigService to load the configuration.
|
|
1964
|
+
* If an error occurs, it throws an error.
|
|
1965
|
+
* @param {AppConfigService} configService - The service responsible for loading the application configuration.
|
|
1966
|
+
* @returns {Function} - A function that loads the configuration from the AppConfigService.
|
|
1391
1967
|
*/
|
|
1392
1968
|
useFactory: (configService) => () => configService.loadAppConfig().catch((error) => {
|
|
1393
1969
|
throw new Error(error);
|