cat-documents-ng 1.0.4 → 1.0.6
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/ng-package.json +10 -0
- package/package.json +5 -11
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.html +3 -0
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.scss +13 -0
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.spec.ts +70 -0
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.ts +133 -0
- package/src/Shared/components/table-primary/table-primary.component.html +66 -0
- package/src/Shared/components/table-primary/table-primary.component.scss +227 -0
- package/src/Shared/components/table-primary/table-primary.component.spec.ts +23 -0
- package/src/Shared/components/table-primary/table-primary.component.ts +143 -0
- package/src/Shared/components/table-primary/table-primary.model.ts +21 -0
- package/src/Shared/constant/ERROR.ts +55 -0
- package/src/Shared/constant/PERMISSIONS.ts +17 -0
- package/src/Shared/constant/SHARED.ts +936 -0
- package/{Shared/constant/URLS.d.ts → src/Shared/constant/URLS.ts} +31 -25
- package/src/Shared/services/app-config.service.spec.ts +19 -0
- package/src/Shared/services/app-config.service.ts +73 -0
- package/{Shared/services/global-error.handler.d.ts → src/Shared/services/global-error.handler.ts} +11 -9
- package/src/Shared/services/session.service.spec.ts +16 -0
- package/src/Shared/services/session.service.ts +76 -0
- package/src/Shared/shared.module.ts +25 -0
- package/src/lib/document/components/csv-viewer/csv-viewer.component.ts +1 -0
- package/src/lib/document/components/document-actions/document-actions.component.html +59 -0
- package/src/lib/document/components/document-actions/document-actions.component.scss +362 -0
- package/src/lib/document/components/document-actions/document-actions.component.spec.ts +297 -0
- package/src/lib/document/components/document-actions/document-actions.component.ts +163 -0
- package/src/lib/document/components/document-container/document-container.component.html +36 -0
- package/src/lib/document/components/document-container/document-container.component.scss +144 -0
- package/src/lib/document/components/document-container/document-container.component.spec.ts +110 -0
- package/src/lib/document/components/document-container/document-container.component.ts +363 -0
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.html +332 -0
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.scss +1877 -0
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.spec.ts +258 -0
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.ts +664 -0
- package/src/lib/document/components/document-history/document-history.component.html +96 -0
- package/src/lib/document/components/document-history/document-history.component.scss +392 -0
- package/src/lib/document/components/document-history/document-history.component.spec.ts +93 -0
- package/src/lib/document/components/document-history/document-history.component.ts +373 -0
- package/src/lib/document/components/document-list/document-list.component.html +46 -0
- package/src/lib/document/components/document-list/document-list.component.scss +513 -0
- package/src/lib/document/components/document-list/document-list.component.spec.ts +486 -0
- package/src/lib/document/components/document-list/document-list.component.ts +682 -0
- package/src/lib/document/components/document-list-item/document-list-item.component.html +36 -0
- package/src/lib/document/components/document-list-item/document-list-item.component.scss +34 -0
- package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +75 -0
- package/src/lib/document/components/document-list-item/document-list-item.component.ts +40 -0
- package/src/lib/document/components/document-search/document-search.component.html +64 -0
- package/src/lib/document/components/document-search/document-search.component.scss +206 -0
- package/src/lib/document/components/document-search/document-search.component.spec.ts +82 -0
- package/src/lib/document/components/document-search/document-search.component.ts +163 -0
- package/src/lib/document/components/document-status/document-status.component.html +31 -0
- package/src/lib/document/components/document-status/document-status.component.scss +192 -0
- package/src/lib/document/components/document-status/document-status.component.spec.ts +23 -0
- package/src/lib/document/components/document-status/document-status.component.ts +87 -0
- package/src/lib/document/components/document-upload/document-upload.component.html +160 -0
- package/src/lib/document/components/document-upload/document-upload.component.scss +235 -0
- package/src/lib/document/components/document-upload/document-upload.component.spec.ts +95 -0
- package/src/lib/document/components/document-upload/document-upload.component.ts +668 -0
- package/src/lib/document/components/document-viewer/document-viewer.component.html +50 -0
- package/src/lib/document/components/document-viewer/document-viewer.component.scss +187 -0
- package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +79 -0
- package/src/lib/document/components/document-viewer/document-viewer.component.ts +261 -0
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.html +48 -0
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.scss +320 -0
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.spec.ts +59 -0
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.ts +150 -0
- package/src/lib/document/components/documents-menu/documents-menu.component.html +44 -0
- package/src/lib/document/components/documents-menu/documents-menu.component.scss +363 -0
- package/src/lib/document/components/documents-menu/documents-menu.component.spec.ts +23 -0
- package/src/lib/document/components/documents-menu/documents-menu.component.ts +316 -0
- package/src/lib/document/components/folder-block/folder-block.component.html +46 -0
- package/src/lib/document/components/folder-block/folder-block.component.scss +9 -0
- package/src/lib/document/components/folder-block/folder-block.component.spec.ts +70 -0
- package/{lib/document/components/folder-block/folder-block.component.d.ts → src/lib/document/components/folder-block/folder-block.component.ts} +28 -12
- package/src/lib/document/components/folder-container/folder-container.component.html +56 -0
- package/src/lib/document/components/folder-container/folder-container.component.scss +20 -0
- package/src/lib/document/components/folder-container/folder-container.component.spec.ts +27 -0
- package/src/lib/document/components/folder-container/folder-container.component.ts +328 -0
- package/src/lib/document/components/linked-document/linked-document.component.html +23 -0
- package/src/lib/document/components/linked-document/linked-document.component.scss +10 -0
- package/src/lib/document/components/linked-document/linked-document.component.spec.ts +61 -0
- package/src/lib/document/components/linked-document/linked-document.component.ts +49 -0
- package/src/lib/document/components/request-document/request-document.component.html +86 -0
- package/src/lib/document/components/request-document/request-document.component.scss +16 -0
- package/src/lib/document/components/request-document/request-document.component.ts +278 -0
- package/src/lib/document/components/sidebar/sidebar.component.html +75 -0
- package/src/lib/document/components/sidebar/sidebar.component.scss +157 -0
- package/src/lib/document/components/sidebar/sidebar.component.spec.ts +114 -0
- package/src/lib/document/components/sidebar/sidebar.component.ts +223 -0
- package/src/lib/document/components/user-list/user-list.component.html +33 -0
- package/src/lib/document/components/user-list/user-list.component.scss +118 -0
- package/src/lib/document/components/user-list/user-list.component.spec.ts +23 -0
- package/src/lib/document/components/user-list/user-list.component.ts +181 -0
- package/src/lib/document/constant/DOCUMENT_HISTORY.ts +52 -0
- package/src/lib/document/directives/document.directive.ts +32 -0
- package/src/lib/document/directives/permission.directive.spec.ts +0 -0
- package/src/lib/document/directives/permission.directive.ts +72 -0
- package/src/lib/document/document.module.ts +351 -0
- package/{lib/document/models/document-alert.model.d.ts → src/lib/document/models/document-alert.model.ts} +11 -4
- package/src/lib/document/models/document-category.model.ts +30 -0
- package/src/lib/document/models/document-history.model.ts +109 -0
- package/src/lib/document/models/document-list-response.model.ts +37 -0
- package/src/lib/document/models/document-type.model.ts +44 -0
- package/src/lib/document/models/document.model.ts +53 -0
- package/{lib/document/models/folder.model.d.ts → src/lib/document/models/folder.model.ts} +10 -4
- package/src/lib/document/models/status-data.model.ts +31 -0
- package/src/lib/document/models/uploaded-file-response.model.ts +7 -0
- package/src/lib/document/models/user-list.model.ts +10 -0
- package/src/lib/document/services/csv-parser.service.spec.ts +97 -0
- package/src/lib/document/services/csv-parser.service.ts +303 -0
- package/src/lib/document/services/document-actions.service.ts +125 -0
- package/src/lib/document/services/document-content-type.service.ts +193 -0
- package/src/lib/document/services/document-history-style.service.ts +138 -0
- package/src/lib/document/services/document-history.service.ts +129 -0
- package/src/lib/document/services/document-http.service.spec.ts +119 -0
- package/src/lib/document/services/document-http.service.ts +497 -0
- package/src/lib/document/services/document-list.service.ts +195 -0
- package/src/lib/document/services/document-menu.service.ts +277 -0
- package/src/lib/document/services/document-scroll.service.ts +138 -0
- package/src/lib/document/services/document-severity.service.ts +98 -0
- package/src/lib/document/services/document-table-builder.service.ts +82 -0
- package/src/lib/document/services/document-upload-business.service.ts +326 -0
- package/src/lib/document/services/document-upload-data.service.ts +82 -0
- package/src/lib/document/services/document-upload-form.service.ts +149 -0
- package/src/lib/document/services/document-upload.service.spec.ts +99 -0
- package/src/lib/document/services/document-upload.service.ts +209 -0
- package/src/lib/document/services/document-viewer.service.ts +279 -0
- package/src/lib/document/services/document-zoom.service.spec.ts +56 -0
- package/src/lib/document/services/document-zoom.service.ts +164 -0
- package/src/lib/document/services/document.service.ts +356 -0
- package/src/lib/document/services/eml-parser.service.ts +444 -0
- package/src/lib/document/services/excel-parser.service.spec.ts +66 -0
- package/src/lib/document/services/excel-parser.service.ts +483 -0
- package/src/lib/document/services/file-format.service.spec.ts +16 -0
- package/src/lib/document/services/file-format.service.ts +63 -0
- package/src/lib/document/services/status-calculator.service.ts +44 -0
- package/src/lib/document/services/user-list.service.ts +77 -0
- package/src/lib/document/state/document.query.ts +378 -0
- package/{lib/document/state/document.service.d.ts → src/lib/document/state/document.service.ts} +46 -15
- package/src/lib/document/state/document.state.ts +100 -0
- package/src/lib/document/state/document.store.ts +200 -0
- package/{public-api.d.ts → src/public-api.ts} +4 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/Shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +0 -44
- package/Shared/components/table-primary/table-primary.component.d.ts +0 -31
- package/Shared/components/table-primary/table-primary.model.d.ts +0 -19
- package/Shared/constant/ERROR.d.ts +0 -52
- package/Shared/constant/SHARED.d.ts +0 -546
- package/Shared/services/app-config.service.d.ts +0 -51
- package/Shared/services/session.service.d.ts +0 -46
- package/Shared/shared.module.d.ts +0 -14
- package/fesm2022/cat-documents-ng.mjs +0 -11392
- package/fesm2022/cat-documents-ng.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/document/components/document-actions/document-actions.component.d.ts +0 -78
- package/lib/document/components/document-container/document-container.component.d.ts +0 -162
- package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +0 -291
- package/lib/document/components/document-history/document-history.component.d.ts +0 -160
- package/lib/document/components/document-list/document-list.component.d.ts +0 -299
- package/lib/document/components/document-list-item/document-list-item.component.d.ts +0 -28
- package/lib/document/components/document-search/document-search.component.d.ts +0 -77
- package/lib/document/components/document-status/document-status.component.d.ts +0 -24
- package/lib/document/components/document-upload/document-upload.component.d.ts +0 -321
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +0 -137
- package/lib/document/components/document-zoom-controls/document-zoom-controls.component.d.ts +0 -33
- package/lib/document/components/documents-menu/documents-menu.component.d.ts +0 -110
- package/lib/document/components/folder-container/folder-container.component.d.ts +0 -162
- package/lib/document/components/linked-document/linked-document.component.d.ts +0 -39
- package/lib/document/components/request-document/request-document.component.d.ts +0 -69
- package/lib/document/components/sidebar/sidebar.component.d.ts +0 -109
- package/lib/document/components/user-list/user-list.component.d.ts +0 -34
- package/lib/document/constant/DOCUMENT_HISTORY.d.ts +0 -41
- package/lib/document/directives/document.directive.d.ts +0 -20
- package/lib/document/directives/permission.directive.d.ts +0 -38
- package/lib/document/document.module.d.ts +0 -60
- package/lib/document/models/document-category.model.d.ts +0 -24
- package/lib/document/models/document-history.model.d.ts +0 -94
- package/lib/document/models/document-list-response.model.d.ts +0 -33
- package/lib/document/models/document-type.model.d.ts +0 -37
- package/lib/document/models/document.model.d.ts +0 -44
- package/lib/document/models/status-data.model.d.ts +0 -27
- package/lib/document/models/uploaded-file-response.model.d.ts +0 -7
- package/lib/document/models/user-list.model.d.ts +0 -8
- package/lib/document/services/csv-parser.service.d.ts +0 -88
- package/lib/document/services/document-actions.service.d.ts +0 -48
- package/lib/document/services/document-content-type.service.d.ts +0 -85
- package/lib/document/services/document-history-style.service.d.ts +0 -34
- package/lib/document/services/document-history.service.d.ts +0 -42
- package/lib/document/services/document-http.service.d.ts +0 -179
- package/lib/document/services/document-list.service.d.ts +0 -74
- package/lib/document/services/document-menu.service.d.ts +0 -122
- package/lib/document/services/document-scroll.service.d.ts +0 -55
- package/lib/document/services/document-table-builder.service.d.ts +0 -38
- package/lib/document/services/document-upload-business.service.d.ts +0 -107
- package/lib/document/services/document-upload-data.service.d.ts +0 -40
- package/lib/document/services/document-upload-form.service.d.ts +0 -41
- package/lib/document/services/document-upload.service.d.ts +0 -99
- package/lib/document/services/document-viewer.service.d.ts +0 -97
- package/lib/document/services/document-zoom.service.d.ts +0 -81
- package/lib/document/services/document.service.d.ts +0 -161
- package/lib/document/services/eml-parser.service.d.ts +0 -116
- package/lib/document/services/excel-parser.service.d.ts +0 -169
- package/lib/document/services/file-format.service.d.ts +0 -34
- package/lib/document/services/status-calculator.service.d.ts +0 -20
- package/lib/document/services/user-list.service.d.ts +0 -29
- package/lib/document/state/document.query.d.ts +0 -243
- package/lib/document/state/document.state.d.ts +0 -61
- package/lib/document/state/document.store.d.ts +0 -56
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
3
|
+
import { DocumentActionsService, DocumentAction } from '../../services/document-actions.service';
|
|
4
|
+
import { SessionService } from '../../../../Shared/services/session.service';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'document-actions',
|
|
8
|
+
templateUrl: './document-actions.component.html',
|
|
9
|
+
styleUrls: ['./document-actions.component.scss'],
|
|
10
|
+
standalone: false
|
|
11
|
+
})
|
|
12
|
+
export class DocumentActionsComponent implements OnChanges {
|
|
13
|
+
readonly SHARED = SHARED;
|
|
14
|
+
|
|
15
|
+
@Input() document?: any;
|
|
16
|
+
@Input() documentId?: string;
|
|
17
|
+
@Input() currentStatus?: string;
|
|
18
|
+
@Input() isLoading?: boolean = false;
|
|
19
|
+
@Input() isUploaded?: boolean = false;
|
|
20
|
+
@Input() statusId?: string;
|
|
21
|
+
@Output() actionPerformed = new EventEmitter<DocumentAction>();
|
|
22
|
+
|
|
23
|
+
showAcceptDialog = false;
|
|
24
|
+
showRejectDialog = false;
|
|
25
|
+
acceptNote = SHARED.EMPTY;
|
|
26
|
+
private _rejectNote = SHARED.EMPTY;
|
|
27
|
+
userRole: any = SHARED.EMPTY;
|
|
28
|
+
// Action processing flags
|
|
29
|
+
isAccepting = false;
|
|
30
|
+
isRejecting = false;
|
|
31
|
+
|
|
32
|
+
// Computed properties for template
|
|
33
|
+
cardClass: string = SHARED.CARD_PENDING;
|
|
34
|
+
rejectButtonClass: string = SHARED.BUTTON_DEFAULT_REJECT;
|
|
35
|
+
acceptButtonClass: string = SHARED.BUTTON_DEFAULT_ACCEPT;
|
|
36
|
+
isRejectNoteEmpty: boolean = true;
|
|
37
|
+
|
|
38
|
+
// Action visibility computed properties
|
|
39
|
+
showApproveRejectActions: boolean = false;
|
|
40
|
+
showNoActions: boolean = false;
|
|
41
|
+
|
|
42
|
+
constructor(
|
|
43
|
+
private documentActionsService: DocumentActionsService,
|
|
44
|
+
private sessionService: SessionService
|
|
45
|
+
) {}
|
|
46
|
+
|
|
47
|
+
get rejectNote(): string {
|
|
48
|
+
return this._rejectNote;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
set rejectNote(value: string) {
|
|
52
|
+
this._rejectNote = value;
|
|
53
|
+
this.updateRejectNoteEmpty();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Checks if both action buttons should be disabled
|
|
58
|
+
* @returns {boolean} True if both buttons should be disabled
|
|
59
|
+
*/
|
|
60
|
+
get areButtonsDisabled(): boolean {
|
|
61
|
+
return this.isDocumentApproved || this.isDocumentRejected;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Checks if the document is approved (case-insensitive)
|
|
66
|
+
* @returns {boolean} True if document is approved
|
|
67
|
+
*/
|
|
68
|
+
get isDocumentApproved(): boolean {
|
|
69
|
+
return this.currentStatus?.toLowerCase() === SHARED.STATUS_ACCEPTED.toLowerCase() ||
|
|
70
|
+
this.currentStatus?.toLowerCase() === SHARED.STATUS_APPROVED.toLowerCase();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Checks if the document is rejected (case-insensitive)
|
|
75
|
+
* @returns {boolean} True if document is rejected
|
|
76
|
+
*/
|
|
77
|
+
get isDocumentRejected(): boolean {
|
|
78
|
+
return this.currentStatus?.toLowerCase() === SHARED.STATUS_REJECTED_LOWERCASE.toLowerCase() ||
|
|
79
|
+
this.currentStatus?.toLowerCase() === SHARED.STATUS_REJECTED.toLowerCase();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
83
|
+
this.updateComputedProperties();
|
|
84
|
+
if (changes['isLoading'] && !this.isLoading) {
|
|
85
|
+
this.resetActionFlags();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Updates computed properties based on currentStatus and statusId
|
|
91
|
+
*/
|
|
92
|
+
private updateComputedProperties(): void {
|
|
93
|
+
this.cardClass = this.documentActionsService.calculateCardClass(this.currentStatus, this.statusId);
|
|
94
|
+
this.rejectButtonClass = this.documentActionsService.calculateRejectButtonClass(this.currentStatus, this.statusId);
|
|
95
|
+
this.acceptButtonClass = this.documentActionsService.calculateAcceptButtonClass(this.currentStatus, this.statusId);
|
|
96
|
+
this.updateRejectNoteEmpty();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Checks if the current user is a Team Leader
|
|
101
|
+
* @returns {boolean} True if user is Team Leader
|
|
102
|
+
*/
|
|
103
|
+
isUserTeamLeader(): boolean {
|
|
104
|
+
this.userRole = this.sessionService.getUserRole();
|
|
105
|
+
return this.userRole === SHARED.TEAM_LEADER;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Checks if the current user is an Underwriter
|
|
110
|
+
* @returns {boolean} True if user is Underwriter
|
|
111
|
+
*/
|
|
112
|
+
isUserUnderwriter(): boolean {
|
|
113
|
+
this.userRole = this.sessionService.getUserRole();
|
|
114
|
+
return this.userRole === SHARED.UNDERWRITER_USER;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Updates the isRejectNoteEmpty property based on current rejectNote value
|
|
119
|
+
*/
|
|
120
|
+
updateRejectNoteEmpty(): void {
|
|
121
|
+
this.isRejectNoteEmpty = !this.rejectNote || this.rejectNote.trim() === SHARED.EMPTY;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Resets the action processing flags
|
|
126
|
+
*/
|
|
127
|
+
private resetActionFlags(): void {
|
|
128
|
+
this.isAccepting = false;
|
|
129
|
+
this.isRejecting = false;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
onAcceptClick(): void {
|
|
133
|
+
this.showAcceptDialog = true;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
onRejectClick(): void {
|
|
137
|
+
this.showRejectDialog = true;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
onAcceptConfirm(): void {
|
|
143
|
+
this.isAccepting = true;
|
|
144
|
+
this.actionPerformed.emit(this.documentActionsService.createAcceptAction(this.acceptNote));
|
|
145
|
+
this.acceptNote = SHARED.EMPTY;
|
|
146
|
+
this.showAcceptDialog = false;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
onRejectConfirm(): void {
|
|
150
|
+
this.isRejecting = true;
|
|
151
|
+
this.actionPerformed.emit(this.documentActionsService.createRejectAction(this.rejectNote));
|
|
152
|
+
this.rejectNote = SHARED.EMPTY;
|
|
153
|
+
this.showRejectDialog = false;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
onCancel(): void {
|
|
157
|
+
this.showAcceptDialog = false;
|
|
158
|
+
this.showRejectDialog = false;
|
|
159
|
+
this.acceptNote = SHARED.EMPTY;
|
|
160
|
+
this.rejectNote = SHARED.EMPTY;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<div class="grid m-0 flex document-container-layout">
|
|
2
|
+
<div class="menu-panel col-12 md:col-2">
|
|
3
|
+
<lib-documents-menu
|
|
4
|
+
[catagories]="catagories"
|
|
5
|
+
[applicationNumber]="applicationNumber"
|
|
6
|
+
[contextId]="contextId"
|
|
7
|
+
(menuItemSelected)="onMenuItemSelected($event)">
|
|
8
|
+
</lib-documents-menu>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="content-panel col-12 md:col-10" #contentScrollContainer>
|
|
12
|
+
<div class="content-card">
|
|
13
|
+
<lib-folder-container [contextId]="contextId" [userList]="userList" [statusData]="statusData" [categories]="catagories"></lib-folder-container>
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<lib-document-list
|
|
17
|
+
[contextId]="contextId"
|
|
18
|
+
[documentListResponse]="documentListResponse"
|
|
19
|
+
[selectedMenuItemId]="selectedMenuItemId"
|
|
20
|
+
[navigationInfo]="navigationInfo"
|
|
21
|
+
(handleSelectedDocumentInNewTab)="onDocumentSelectedInNewTab($event)"
|
|
22
|
+
(handleSelectedDocument)="onDocumentSelected($event)"
|
|
23
|
+
>
|
|
24
|
+
<ng-content></ng-content>
|
|
25
|
+
</lib-document-list>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<p-confirmDialog
|
|
29
|
+
[style]="{width: '25vw'}"
|
|
30
|
+
acceptLabel="Yes"
|
|
31
|
+
rejectLabel="No"
|
|
32
|
+
appendTo="body"
|
|
33
|
+
acceptIcon="pi pi-check"
|
|
34
|
+
rejectIcon="pi pi-times">
|
|
35
|
+
</p-confirmDialog>
|
|
36
|
+
</div>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Grid Layout Styles
|
|
2
|
+
.document-container-layout {
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-columns: 1fr;
|
|
5
|
+
height: 98vh;
|
|
6
|
+
overflow: auto;
|
|
7
|
+
position: relative;
|
|
8
|
+
|
|
9
|
+
@media (min-width: 768px) {
|
|
10
|
+
grid-template-columns: 16.6667% 1fr;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.menu-panel {
|
|
15
|
+
background-color: #ffffff;
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
overflow-x: hidden;
|
|
18
|
+
|
|
19
|
+
@media (min-width: 768px) {
|
|
20
|
+
position: fixed;
|
|
21
|
+
left: 0;
|
|
22
|
+
top: 0;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
width: 16.6667%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Hide scrollbar but maintain scroll functionality
|
|
28
|
+
scrollbar-width: none; /* Firefox */
|
|
29
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
30
|
+
|
|
31
|
+
&::-webkit-scrollbar {
|
|
32
|
+
display: none; /* Chrome, Safari and Opera */
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.content-panel {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
height: 98vh;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
overflow-x: hidden;
|
|
42
|
+
padding: 0;
|
|
43
|
+
|
|
44
|
+
@media (min-width: 768px) {
|
|
45
|
+
margin-left: 16.6667%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Ensure this is the only scrollable container
|
|
49
|
+
position: relative;
|
|
50
|
+
z-index: 10; // Higher z-index for content
|
|
51
|
+
|
|
52
|
+
// Hide scrollbar but maintain scroll functionality
|
|
53
|
+
scrollbar-width: none; /* Firefox */
|
|
54
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
55
|
+
|
|
56
|
+
&::-webkit-scrollbar {
|
|
57
|
+
display: none; /* Chrome, Safari and Opera */
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Responsive design
|
|
62
|
+
@media (max-width: 1024px) {
|
|
63
|
+
.menu-panel {
|
|
64
|
+
width: 240px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.content-panel {
|
|
68
|
+
margin-left: 240px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media (max-width: 768px) {
|
|
73
|
+
.document-container-layout {
|
|
74
|
+
grid-template-columns: 1fr;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.menu-panel {
|
|
78
|
+
position: relative;
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 200px;
|
|
81
|
+
border-right: none;
|
|
82
|
+
border-bottom: 1px solid #e5e7eb;
|
|
83
|
+
z-index: auto; // Reset z-index on mobile
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.content-panel {
|
|
87
|
+
margin-left: 0;
|
|
88
|
+
flex: 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Legacy scroll styles (keeping for backward compatibility)
|
|
93
|
+
.custom-scroll{
|
|
94
|
+
overflow-y: hidden;
|
|
95
|
+
scrollbar-gutter: stable;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.custom-scroll:hover {
|
|
99
|
+
overflow-y: auto;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Ensure no double scrollbars
|
|
103
|
+
* {
|
|
104
|
+
scrollbar-width: thin;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Remove problematic body overflow restrictions that break dialogs
|
|
108
|
+
// body, html {
|
|
109
|
+
// overflow: hidden;
|
|
110
|
+
// height: 100%;
|
|
111
|
+
// }
|
|
112
|
+
|
|
113
|
+
// Override any conflicting scroll styles
|
|
114
|
+
body, html {
|
|
115
|
+
height: 100%;
|
|
116
|
+
// Don't force overflow hidden as it breaks dialog positioning
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Override PrimeNG card styles that might cause scroll issues
|
|
120
|
+
::ng-deep .p-card {
|
|
121
|
+
overflow: visible !important;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
::ng-deep .p-card-body {
|
|
125
|
+
overflow: visible !important;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Ensure dialogs appear above everything
|
|
129
|
+
::ng-deep .p-dialog {
|
|
130
|
+
z-index: 9999 !important;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
::ng-deep .p-dialog-mask {
|
|
134
|
+
z-index: 9998 !important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Ensure no nested scroll containers
|
|
138
|
+
// ::ng-deep .content-panel * {
|
|
139
|
+
// overflow: visible !important;
|
|
140
|
+
// }
|
|
141
|
+
|
|
142
|
+
::ng-deep .content-panel .p-card {
|
|
143
|
+
overflow: visible !important;
|
|
144
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { DocumentContainerComponent } from './document-container.component';
|
|
3
|
+
import { of, throwError } from 'rxjs';
|
|
4
|
+
import { DocumentHttpService } from '../../services/document-http.service';
|
|
5
|
+
import { DocumentStore } from '../../state/document.store';
|
|
6
|
+
import { DocumentQuery } from '../../state/document.query';
|
|
7
|
+
import { DocumentService } from '../../state/document.service';
|
|
8
|
+
import { CommonModule } from '@angular/common';
|
|
9
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
10
|
+
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
11
|
+
import { DocumentListComponent } from '../document-list/document-list.component';
|
|
12
|
+
import { MessageService } from 'primeng/api';
|
|
13
|
+
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
14
|
+
import { DialogModule } from 'primeng/dialog';
|
|
15
|
+
|
|
16
|
+
describe('DocumentContainerComponent', () => {
|
|
17
|
+
let component: DocumentContainerComponent;
|
|
18
|
+
let fixture: ComponentFixture<DocumentContainerComponent>;
|
|
19
|
+
let mockDocumentHttpService: jasmine.SpyObj<DocumentHttpService>;
|
|
20
|
+
let mockDocumentStore: jasmine.SpyObj<DocumentStore>;
|
|
21
|
+
let mockDocumentQuery: jasmine.SpyObj<DocumentQuery>;
|
|
22
|
+
let mockDocumentService: jasmine.SpyObj<DocumentService>;
|
|
23
|
+
|
|
24
|
+
const dummyFolders = [
|
|
25
|
+
{ _id: '1', name: 'Folder A', documentCount: 2 },
|
|
26
|
+
{ _id: '2', name: 'Folder B', documentCount: 0 }
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const dummyDocuments = [
|
|
30
|
+
{ _id: 'doc1', name: 'Document 1' },
|
|
31
|
+
{ _id: 'doc2', name: 'Document 2' }
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
beforeEach(async () => {
|
|
35
|
+
mockDocumentHttpService = jasmine.createSpyObj('DocumentHttpService', [
|
|
36
|
+
'getFoldersData',
|
|
37
|
+
'getDocumentByFolderID',
|
|
38
|
+
'getDocumentTypes' // ✅ Fix added here
|
|
39
|
+
]);
|
|
40
|
+
mockDocumentHttpService.getDocumentTypes.and.returnValue(of([])); // ✅ Return dummy value
|
|
41
|
+
|
|
42
|
+
mockDocumentStore = jasmine.createSpyObj('DocumentStore', ['setDocumentList']);
|
|
43
|
+
mockDocumentQuery = jasmine.createSpyObj('DocumentQuery', ['selectParentDocumentTypeId']);
|
|
44
|
+
mockDocumentService = jasmine.createSpyObj('DocumentService', ['dummy']);
|
|
45
|
+
|
|
46
|
+
await TestBed.configureTestingModule({
|
|
47
|
+
declarations: [DocumentContainerComponent, DocumentListComponent],
|
|
48
|
+
imports: [CommonModule, HttpClientModule, DialogModule],
|
|
49
|
+
providers: [
|
|
50
|
+
{ provide: DocumentHttpService, useValue: mockDocumentHttpService },
|
|
51
|
+
{ provide: DocumentStore, useValue: mockDocumentStore },
|
|
52
|
+
{ provide: DocumentQuery, useValue: mockDocumentQuery },
|
|
53
|
+
{ provide: DocumentService, useValue: mockDocumentService },
|
|
54
|
+
MessageService
|
|
55
|
+
],
|
|
56
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
|
57
|
+
}).compileComponents();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
fixture = TestBed.createComponent(DocumentContainerComponent);
|
|
62
|
+
component = fixture.componentInstance;
|
|
63
|
+
component.contextId = 'abc123';
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should create', () => {
|
|
67
|
+
expect(component).toBeTruthy();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should fetch folders and documents on ngOnInit', () => {
|
|
71
|
+
mockDocumentHttpService.getFoldersData.and.returnValue(of(dummyFolders));
|
|
72
|
+
mockDocumentQuery.selectParentDocumentTypeId.and.returnValue(of(null));
|
|
73
|
+
mockDocumentHttpService.getDocumentByFolderID.and.returnValue(of(dummyDocuments));
|
|
74
|
+
|
|
75
|
+
fixture.detectChanges(); // triggers ngOnInit
|
|
76
|
+
|
|
77
|
+
expect(mockDocumentHttpService.getFoldersData).toHaveBeenCalledWith('abc123');
|
|
78
|
+
expect(mockDocumentHttpService.getDocumentByFolderID).toHaveBeenCalledWith('1', 'abc123');
|
|
79
|
+
expect(mockDocumentStore.setDocumentList).toHaveBeenCalledWith(dummyDocuments);
|
|
80
|
+
expect(component.folderList.length).toBe(1); // Only folder with doc count > 0
|
|
81
|
+
expect(component.documentList.length).toBe(2);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should handle folder fetch error', () => {
|
|
85
|
+
const consoleSpy = spyOn(console, 'error');
|
|
86
|
+
mockDocumentHttpService.getFoldersData.and.returnValue(throwError(() => new Error('Error fetching folders')));
|
|
87
|
+
mockDocumentQuery.selectParentDocumentTypeId.and.returnValue(of(null));
|
|
88
|
+
|
|
89
|
+
fixture.detectChanges();
|
|
90
|
+
|
|
91
|
+
expect(consoleSpy).toHaveBeenCalled();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should handle document fetch error', () => {
|
|
95
|
+
const consoleSpy = spyOn(console, 'error');
|
|
96
|
+
mockDocumentHttpService.getFoldersData.and.returnValue(of(dummyFolders));
|
|
97
|
+
mockDocumentQuery.selectParentDocumentTypeId.and.returnValue(of(null));
|
|
98
|
+
mockDocumentHttpService.getDocumentByFolderID.and.returnValue(throwError(() => new Error('Error fetching docs')));
|
|
99
|
+
|
|
100
|
+
fixture.detectChanges();
|
|
101
|
+
|
|
102
|
+
expect(consoleSpy).toHaveBeenCalled();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('should unsubscribe on destroy', () => {
|
|
106
|
+
spyOn(component['subscription'], 'unsubscribe');
|
|
107
|
+
component.ngOnDestroy();
|
|
108
|
+
expect(component['subscription'].unsubscribe).toHaveBeenCalled();
|
|
109
|
+
});
|
|
110
|
+
});
|