cat-documents-ng 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular.json +2 -2
- package/package.json +3 -1
- package/projects/cat-document-lib/ng-package.json +2 -3
- package/projects/cat-document-lib/src/assets/images/document.png +0 -0
- package/projects/cat-document-lib/src/lib/document/components/document-container/document-container.component.html +6 -1
- package/projects/cat-document-lib/src/lib/document/components/document-container/document-container.component.ts +79 -11
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.html +35 -1
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.scss +12 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.ts +63 -11
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.html +33 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.scss +22 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +23 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.ts +40 -0
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.html +56 -0
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.scss +26 -0
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.spec.ts +24 -0
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.ts +175 -0
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.html +244 -0
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.scss +36 -0
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +21 -0
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.ts +125 -0
- package/projects/cat-document-lib/src/lib/document/document.module.ts +171 -8
- package/projects/cat-document-lib/src/lib/document/models/document.model.ts +39 -3
- package/projects/cat-document-lib/src/lib/document/services/file-format.service.spec.ts +16 -0
- package/projects/cat-document-lib/src/lib/document/services/file-format.service.ts +41 -0
- package/projects/cat-document-lib/src/lib/document/state/document.service.ts +83 -11
- package/projects/cat-document-lib/src/shared/constant/SHARED.ts +125 -0
- package/projects/cat-document-lib/src/shared/constant/URLS.ts +31 -0
- package/projects/cat-document-lib/src/shared/services/app-config.service.spec.ts +16 -0
- package/projects/cat-document-lib/src/shared/services/app-config.service.ts +73 -0
- package/src/app/app.module.ts +4 -3
- package/src/styles.scss +38 -4
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { ChangeDetectorRef, Component, EventEmitter, Output, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { FileUpload } from 'primeng/fileupload';
|
|
3
|
+
import { MessageService } from 'primeng/api';
|
|
4
|
+
import { PrimeNGConfig } from 'primeng/api';
|
|
5
|
+
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
6
|
+
import { FileFormatService } from '../../services/file-format.service';
|
|
7
|
+
import { DocumentService } from '../../state/document.service';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A component for handling document uploads, including file selection, removal, and progress tracking.
|
|
11
|
+
* @class DocumentUploadComponent
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'lib-document-upload',
|
|
15
|
+
templateUrl: './document-upload.component.html',
|
|
16
|
+
styleUrls: ['./document-upload.component.scss'],
|
|
17
|
+
standalone: false,
|
|
18
|
+
encapsulation: ViewEncapsulation.None
|
|
19
|
+
})
|
|
20
|
+
export class DocumentUploadComponent {
|
|
21
|
+
/**
|
|
22
|
+
* Provide id of file after upload.
|
|
23
|
+
* @type {*}
|
|
24
|
+
*/
|
|
25
|
+
@Output() onInput = new EventEmitter();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* To make file explorer visible.
|
|
29
|
+
* @type {!FileUpload}
|
|
30
|
+
*/
|
|
31
|
+
@ViewChild('fileUploader') fileUploader!: FileUpload;
|
|
32
|
+
|
|
33
|
+
fileProgress: Map<File, number> = new Map();
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* List of files selected for upload.
|
|
37
|
+
* @type {File[]}
|
|
38
|
+
*/
|
|
39
|
+
uploadedFiles: any[] = [];
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Total size of the uploaded files in bytes.
|
|
43
|
+
* @type {number}
|
|
44
|
+
*/
|
|
45
|
+
totalSize: number = SHARED.INITIAL_COUNT;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Percentage of the total size calculated for displaying upload progress.
|
|
49
|
+
* @type {number}
|
|
50
|
+
*/
|
|
51
|
+
totalSizePercent: number = SHARED.INITIAL_COUNT;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The current upload progress percentage (SHARED.INITIAL_VALUE-100).
|
|
55
|
+
* @type {number}
|
|
56
|
+
*/
|
|
57
|
+
uploadProgress: number = SHARED.INITIAL_COUNT;
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Creates an instance of DocumentUploadComponent.
|
|
62
|
+
* @class
|
|
63
|
+
* @param {DocumentService} uploadService - Service for handling document upload.
|
|
64
|
+
* @param {PrimeNGConfig} config - PrimeNG configuration.
|
|
65
|
+
* @param {FileFormatService} fileFormatService - Service for formatting file sizes.
|
|
66
|
+
* @param {MessageService} messageService - Service for displaying messages.
|
|
67
|
+
* @param {ChangeDetectorRef} cdr - Service for detecting changes.
|
|
68
|
+
*/
|
|
69
|
+
constructor(public uploadService: DocumentService, private config: PrimeNGConfig, public fileFormatService: FileFormatService, public messageService: MessageService, public cdr: ChangeDetectorRef) { }
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Open the file explorer.
|
|
73
|
+
* @param {*} event - The triggering event.
|
|
74
|
+
* @param {() => void} callback - A callback function to execute.
|
|
75
|
+
* @returns {void} - No return value.
|
|
76
|
+
*/
|
|
77
|
+
choose(event: any, callback: () => void) {
|
|
78
|
+
callback();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Prepares the files for upload by creating a FormData object.
|
|
83
|
+
* This method appends each file to the FormData for submission.
|
|
84
|
+
* @param {File} file - The file to upload.
|
|
85
|
+
* @returns {void}
|
|
86
|
+
*/
|
|
87
|
+
handleTemplatedUpload(file: File) {
|
|
88
|
+
const formData = new FormData();
|
|
89
|
+
formData.append(SHARED.FILE, file, file.name);
|
|
90
|
+
this.uploadService.create(formData)
|
|
91
|
+
.subscribe({
|
|
92
|
+
/**
|
|
93
|
+
* Handles the successful upload event.
|
|
94
|
+
* Updates the list of uploaded files and emits the file ID.
|
|
95
|
+
* @param {any} event - The event emitted by the upload service on success.
|
|
96
|
+
*/
|
|
97
|
+
next: (event) => {
|
|
98
|
+
this.uploadedFiles.push(event)
|
|
99
|
+
this.fileProgress.set(event, 100);
|
|
100
|
+
this.onInput.emit(event._id)
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Handles the error event during file upload.
|
|
104
|
+
* Updates the progress of the file to indicate failure.
|
|
105
|
+
* @param {any} error - The error object returned by the upload service.
|
|
106
|
+
*/
|
|
107
|
+
error: (error) => {
|
|
108
|
+
this.fileProgress.set(file, SHARED.INITIAL_COUNT);
|
|
109
|
+
this.messageService.add({
|
|
110
|
+
severity: SHARED.SEVERITY,
|
|
111
|
+
summary: SHARED.UPLOAD_SUMMERY,
|
|
112
|
+
detail: error?.message,
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Handles the event when new files are selected.
|
|
120
|
+
* Updates the uploaded files list and calculates the total file size and progress.
|
|
121
|
+
* @param { { currentFiles: File[] } } event - The event containing the newly selected files.
|
|
122
|
+
* @returns {void}
|
|
123
|
+
*/
|
|
124
|
+
onSelectedFiles(event: { currentFiles: File[] }): void {
|
|
125
|
+
event.currentFiles.forEach((file: File) => {
|
|
126
|
+
this.totalSize += file.size;
|
|
127
|
+
this.handleTemplatedUpload(file);
|
|
128
|
+
});
|
|
129
|
+
this.totalSizePercent = this.totalSize / SHARED.TEN;
|
|
130
|
+
this.fileUploader.clear();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Formats the given file size in bytes into a readable format (e.g., KB, MB).
|
|
135
|
+
* @param {number} bytes - The size of the file in bytes.
|
|
136
|
+
* @returns {string} The formatted file size (e.g., '1.2 KB', '2.3 MB').
|
|
137
|
+
*/
|
|
138
|
+
formatSize(bytes: number): string {
|
|
139
|
+
return this.fileFormatService.formatFileSize(bytes, this.config)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Handles the removal of a file from the uploaded files list.
|
|
144
|
+
* Resets the total size and upload progress after removing the file.
|
|
145
|
+
* @param {File} file - The file to be removed.
|
|
146
|
+
* @param {number} index - The index of the file in the uploaded files list.
|
|
147
|
+
*/
|
|
148
|
+
handleDocumentRemove(file: File, index: number): void {
|
|
149
|
+
this.uploadedFiles.splice(index, 1);
|
|
150
|
+
this.fileProgress.delete(file);
|
|
151
|
+
this.totalSize -= file.size;
|
|
152
|
+
this.totalSizePercent = this.totalSize / SHARED.TEN;
|
|
153
|
+
this.cdr.detectChanges();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Major progress for the progress bar.
|
|
158
|
+
* @param {File} file - File to check progress for.
|
|
159
|
+
* @returns {number} - The progress percentage for the file.
|
|
160
|
+
*/
|
|
161
|
+
getProgress(file: File): number {
|
|
162
|
+
return this.fileProgress.get(file) || SHARED.INITIAL_COUNT;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Triggers the file upload dialog.
|
|
167
|
+
* Opens the file explorer for selecting files.
|
|
168
|
+
* @returns {void}
|
|
169
|
+
*/
|
|
170
|
+
triggerFileUpload() {
|
|
171
|
+
this.fileUploader.choose();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<div class="grid">
|
|
2
|
+
<div class="col-12">
|
|
3
|
+
<div class="p-fluid p-formgrid grid m-0">
|
|
4
|
+
<div class="col-12 md:col-12 md:flex justify-content-between">
|
|
5
|
+
<div class="action col-12 p-0 md:col-2 no-grow-no-shrink">
|
|
6
|
+
<p-listbox
|
|
7
|
+
[options]="countries"
|
|
8
|
+
[filter]="true"
|
|
9
|
+
[(ngModel)]="selectedCountry"
|
|
10
|
+
optionLabel="name"
|
|
11
|
+
[style]="{ width: '15rem' }"
|
|
12
|
+
[listStyle]="{ 'max-height': '250px' }"
|
|
13
|
+
>
|
|
14
|
+
<ng-template let-country pTemplate="item">
|
|
15
|
+
<div class="flex align-items-center gap-2">
|
|
16
|
+
<p-checkbox
|
|
17
|
+
[(ngModel)]="country.checked"
|
|
18
|
+
[binary]="true"
|
|
19
|
+
[inputId]="country.code"
|
|
20
|
+
></p-checkbox>
|
|
21
|
+
<div>{{ country.name }}</div>
|
|
22
|
+
</div>
|
|
23
|
+
</ng-template>
|
|
24
|
+
</p-listbox>
|
|
25
|
+
</div>
|
|
26
|
+
@if(selectedDocument){
|
|
27
|
+
|
|
28
|
+
<div id="outerContainer col-12 md:col-7">
|
|
29
|
+
<div
|
|
30
|
+
*ngIf="isImage(selectedDocument.contentType)"
|
|
31
|
+
class="img-container"
|
|
32
|
+
>
|
|
33
|
+
<img
|
|
34
|
+
[src]="selectedDocument.documentUrl"
|
|
35
|
+
width="500"
|
|
36
|
+
height="500"
|
|
37
|
+
alt="Document Image"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
@if(selectedDocument.contentType == "application/pdf"){
|
|
41
|
+
<div class="pdf-container">
|
|
42
|
+
<pdf-viewer
|
|
43
|
+
[src]="selectedDocument.documentUrl"
|
|
44
|
+
[rotation]="0"
|
|
45
|
+
[original-size]="false"
|
|
46
|
+
[show-all]="true"
|
|
47
|
+
[fit-to-page]="false"
|
|
48
|
+
[zoom]="1"
|
|
49
|
+
[zoom-scale]="'page-width'"
|
|
50
|
+
[stick-to-page]="false"
|
|
51
|
+
[render-text]="true"
|
|
52
|
+
[external-link-target]="'blank'"
|
|
53
|
+
[autoresize]="true"
|
|
54
|
+
[show-borders]="false"
|
|
55
|
+
style="width: 55vw; height: 100vh"
|
|
56
|
+
></pdf-viewer>
|
|
57
|
+
</div>
|
|
58
|
+
}
|
|
59
|
+
</div>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
<div class="left-part col-12 md:col-3 pt-0">
|
|
63
|
+
<div class="alerts mb-4 pb-1">
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
*ngIf="
|
|
67
|
+
(alertData?.status !== 'Pending' && !!alertData?.status) ||
|
|
68
|
+
alertData?.isAlert === false
|
|
69
|
+
"
|
|
70
|
+
class="bg-green-500 border-none border-round-md flex align-items-center mb-3 p-2 px-3"
|
|
71
|
+
>
|
|
72
|
+
<i
|
|
73
|
+
class="pi pi-verified mr-2 cursor-pointer"
|
|
74
|
+
[ngStyle]="{
|
|
75
|
+
color:
|
|
76
|
+
alertData?.status === 'Pending' &&
|
|
77
|
+
alertData?.isAlert !== false
|
|
78
|
+
? '#FFFFFF'
|
|
79
|
+
: '#8A8EA6'
|
|
80
|
+
}"
|
|
81
|
+
style="font-size: 20px"
|
|
82
|
+
></i>
|
|
83
|
+
<span class="font-semibold text-white">Verified</span>
|
|
84
|
+
</button>
|
|
85
|
+
<div
|
|
86
|
+
class="card mb-0"
|
|
87
|
+
[ngClass]="
|
|
88
|
+
(alertData?.status === 'Pending' || !alertData?.status) &&
|
|
89
|
+
alertData?.isAlert !== false
|
|
90
|
+
? 'alert-card'
|
|
91
|
+
: 'success-alert'
|
|
92
|
+
"
|
|
93
|
+
>
|
|
94
|
+
<div class="flex align-items-center mb-2 pb-1" >
|
|
95
|
+
<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>
|
|
96
|
+
<i
|
|
97
|
+
class="pi pi-exclamation-triangle"
|
|
98
|
+
style="font-size: 20px"
|
|
99
|
+
[ngStyle]="{
|
|
100
|
+
color:
|
|
101
|
+
(alertData?.status === 'Pending' || !alertData?.status) &&
|
|
102
|
+
alertData?.isAlert !== false
|
|
103
|
+
? '#FB392D'
|
|
104
|
+
: '#8A8EA6'
|
|
105
|
+
}"
|
|
106
|
+
></i>
|
|
107
|
+
</div>
|
|
108
|
+
<p class="text-color mb-0">{{ alertData?.alertMessage }}</p>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div class="summery mb-4 pb-1">
|
|
112
|
+
<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;">
|
|
113
|
+
<div class="p-0" >
|
|
114
|
+
<h4 class="m-0 pt-3 pl-3 mb-3" style="font-size: 21px; font-weight: bold; ">Summary</h4>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="card mb-0" style="border-top-right-radius: 0px;border-top-left-radius: 0px;" >
|
|
118
|
+
<p-timeline [value]="events">
|
|
119
|
+
<ng-template pTemplate="content" let-event>
|
|
120
|
+
{{ event.status }}
|
|
121
|
+
</ng-template>
|
|
122
|
+
</p-timeline>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
<div *ngIf="propertyDetails" class="property-details mb-4 pb-1">
|
|
126
|
+
<div class="card mb-0">
|
|
127
|
+
<h4 class="bold" style="font-size: 21px; font-weight: bold;">Property Details</h4>
|
|
128
|
+
<hr />
|
|
129
|
+
<div class="grid">
|
|
130
|
+
<div class="col-12 md:col-12">
|
|
131
|
+
<div class="feild flex">
|
|
132
|
+
<div class="col-12 flex md:col-7">
|
|
133
|
+
<div class="img mr-2">
|
|
134
|
+
<img
|
|
135
|
+
src="../../../../assets/icons/building-icon.png"
|
|
136
|
+
alt=""
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="title">
|
|
140
|
+
<div class="title font-bold" style="font-size: 21px; font-weight: bold;">Detached House</div>
|
|
141
|
+
<div class="decription">
|
|
142
|
+
{{ propertyDetails?.PropertyType }}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="col-12 flex md:col-5">
|
|
147
|
+
<div class="img mr-2">
|
|
148
|
+
<img
|
|
149
|
+
src="../../../../assets/icons/building-icon.png"
|
|
150
|
+
alt=""
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
<div class="title">
|
|
154
|
+
<div class="title font-bold">
|
|
155
|
+
{{ propertyDetails?.Floors }}
|
|
156
|
+
</div>
|
|
157
|
+
<div class="decription" style="font-size: 21px; font-weight: bold;">Floors</div>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
<div class="feild flex">
|
|
162
|
+
<div class="col-12 flex md:col-7">
|
|
163
|
+
<div class="img mr-2">
|
|
164
|
+
<img
|
|
165
|
+
src="../../../../assets/icons/badroom.png"
|
|
166
|
+
alt=""
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
<div class="title">
|
|
170
|
+
<div class="title font-bold">
|
|
171
|
+
{{ propertyDetails?.Bedrooms }}
|
|
172
|
+
</div>
|
|
173
|
+
<div class="decription" style="font-size: 21px; font-weight: bold;">Bedrooms</div>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="col-12 flex md:col-5">
|
|
177
|
+
<div class="img mr-2">
|
|
178
|
+
<img
|
|
179
|
+
src="../../../../assets/icons/building-icon.png"
|
|
180
|
+
alt=""
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
<div class="title">
|
|
184
|
+
<div class="title font-bold">
|
|
185
|
+
{{ propertyDetails?.Kitchen }}
|
|
186
|
+
</div>
|
|
187
|
+
<div class="decription" style="font-size: 21px; font-weight: bold;">Kitchen</div>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
<div class="col-12 flex ml-2 md:col-12">
|
|
193
|
+
<div class="img mr-2">
|
|
194
|
+
<img src="../../../../assets/icons/location.png" alt="" />
|
|
195
|
+
</div>
|
|
196
|
+
<div class="title">
|
|
197
|
+
<div class="title font-bold">
|
|
198
|
+
{{ propertyDetails?.Address }}
|
|
199
|
+
</div>
|
|
200
|
+
<div class="decription" style="font-size: 21px; font-weight: bold;">Address</div>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
<div class="notes card pl-0 pr-0 pt-0">
|
|
207
|
+
<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;">
|
|
208
|
+
<div class="p-0" >
|
|
209
|
+
<h4 class="m-0 pt-3 pl-3 mb-3" style="font-size: 21px; font-weight: bold; ">Notes</h4>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
<div class="card mb-0 pt-0">
|
|
213
|
+
<div class="textAreaControl mt-3">
|
|
214
|
+
<textarea
|
|
215
|
+
rows="5"
|
|
216
|
+
cols="30"
|
|
217
|
+
pInputTextarea
|
|
218
|
+
#textArea
|
|
219
|
+
[(ngModel)]="notes"
|
|
220
|
+
>
|
|
221
|
+
</textarea>
|
|
222
|
+
</div>
|
|
223
|
+
<div class="buttons document-btn-wrapper flex mt-2">
|
|
224
|
+
<button
|
|
225
|
+
pButton
|
|
226
|
+
pRipple
|
|
227
|
+
type="button"
|
|
228
|
+
label="Resubmission"
|
|
229
|
+
class="p-button-outlined mr-2"
|
|
230
|
+
></button>
|
|
231
|
+
<button
|
|
232
|
+
pButton
|
|
233
|
+
pRipple
|
|
234
|
+
type="button"
|
|
235
|
+
label="Accept"
|
|
236
|
+
></button>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.alert-card {
|
|
2
|
+
background-color: #fb392d1a;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.success-alert {
|
|
6
|
+
border-radius: 10px;
|
|
7
|
+
border: 1px solid rgba(251, 57, 45, 0.1);
|
|
8
|
+
background: linear-gradient(0deg, #dedede 0%, #dedede 100%), #fff;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.p-timeline-event-opposite {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
.decription {
|
|
15
|
+
color: #676b89;
|
|
16
|
+
}
|
|
17
|
+
.textAreaControl textarea {
|
|
18
|
+
width: 100%;
|
|
19
|
+
resize: vertical;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.document-btn-wrapper {
|
|
24
|
+
.p-button-outlined {
|
|
25
|
+
color: #f57c00;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.document-viewer{
|
|
30
|
+
.p-dialog-header{
|
|
31
|
+
background-color:#ececf9;
|
|
32
|
+
}
|
|
33
|
+
.p-dialog-content{
|
|
34
|
+
background-color:#ececf9;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { DocumentViewerComponent } from './document-viewer.component';
|
|
3
|
+
|
|
4
|
+
describe('DocumentViewerComponent', () => {
|
|
5
|
+
let component: DocumentViewerComponent;
|
|
6
|
+
let fixture: ComponentFixture<DocumentViewerComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [DocumentViewerComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(DocumentViewerComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
OnInit,
|
|
5
|
+
ViewEncapsulation,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
8
|
+
import { COUNTRIES, DUMMYSUMMARY, SUPPORTED_IMAGE_TYPES } from '../../../../Shared/constant/SHARED';
|
|
9
|
+
/**
|
|
10
|
+
* For list box data.
|
|
11
|
+
* @interface Country
|
|
12
|
+
* @typedef {Country}
|
|
13
|
+
*/
|
|
14
|
+
interface Country {
|
|
15
|
+
/**
|
|
16
|
+
* For the name of the property.
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
/**
|
|
21
|
+
* For the unique code of country.
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
code: string;
|
|
25
|
+
/**
|
|
26
|
+
* Mark check or unchecked.
|
|
27
|
+
* @type {?boolean}
|
|
28
|
+
*/
|
|
29
|
+
checked?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Component for viewing and managing document details.
|
|
34
|
+
* @class DocumentViewerComponent
|
|
35
|
+
* @typedef {DocumentViewerComponent}
|
|
36
|
+
* @implements {OnInit}
|
|
37
|
+
*/
|
|
38
|
+
@Component({
|
|
39
|
+
selector: 'document-viewer',
|
|
40
|
+
templateUrl: './document-viewer.component.html',
|
|
41
|
+
standalone : false,
|
|
42
|
+
styleUrl: './document-viewer.component.scss',
|
|
43
|
+
encapsulation: ViewEncapsulation.None,
|
|
44
|
+
})
|
|
45
|
+
export class DocumentViewerComponent implements OnInit {
|
|
46
|
+
/**
|
|
47
|
+
* Get the selected document by user.
|
|
48
|
+
* @type {*}
|
|
49
|
+
*/
|
|
50
|
+
@Input() selectedDocument: any;
|
|
51
|
+
/**
|
|
52
|
+
* Handle notes data.
|
|
53
|
+
* @type {!string}
|
|
54
|
+
*/
|
|
55
|
+
notes!: string;
|
|
56
|
+
/**
|
|
57
|
+
* Country data according to Country model.
|
|
58
|
+
* @type {!Country[]}
|
|
59
|
+
*/
|
|
60
|
+
countries!: Country[];
|
|
61
|
+
/**
|
|
62
|
+
* Indicates whether a checkbox is selected.
|
|
63
|
+
* @type {boolean}
|
|
64
|
+
*/
|
|
65
|
+
checked: boolean = false;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The currently selected country.
|
|
69
|
+
* @type {Country}
|
|
70
|
+
*/
|
|
71
|
+
selectedCountry!: Country;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Reference to the dynamic dialog used for displaying additional details.
|
|
75
|
+
* @type {(DynamicDialogRef | undefined)}
|
|
76
|
+
*/
|
|
77
|
+
ref: DynamicDialogRef | undefined;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Indicates whether the document has been verified.
|
|
81
|
+
* @type {boolean}
|
|
82
|
+
*/
|
|
83
|
+
isVerified: boolean = false;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Additional property details related to the document.
|
|
87
|
+
* @type {any}
|
|
88
|
+
*/
|
|
89
|
+
propertyDetails: any;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* List of predefined events used for summaries or alerts.
|
|
93
|
+
* @type {*}
|
|
94
|
+
*/
|
|
95
|
+
events = DUMMYSUMMARY;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Data used for displaying alert messages.
|
|
99
|
+
* @type {any}
|
|
100
|
+
*/
|
|
101
|
+
alertData!: any;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Initializes a new instance of the DocumentViewerComponent.
|
|
105
|
+
*/
|
|
106
|
+
constructor() {}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Lifecycle hook that is called after data-bound properties are initialized.
|
|
110
|
+
* Initializes the list of countries.
|
|
111
|
+
*/
|
|
112
|
+
ngOnInit() {
|
|
113
|
+
this.countries = COUNTRIES;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Determines if the given content type is an image.
|
|
119
|
+
* @param {string} contentType - The MIME type of the content.
|
|
120
|
+
* @returns {boolean} `true` if the content type is an image; otherwise, `false`.
|
|
121
|
+
*/
|
|
122
|
+
isImage(contentType: string): boolean {
|
|
123
|
+
return SUPPORTED_IMAGE_TYPES.includes(contentType);
|
|
124
|
+
}
|
|
125
|
+
}
|