cat-documents-ng 0.2.42 → 0.2.43
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/URLS.d.ts +1 -0
- package/fesm2022/cat-documents-ng.mjs +402 -255
- package/fesm2022/cat-documents-ng.mjs.map +1 -1
- package/lib/document/components/document-container/document-container.component.d.ts +5 -5
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +17 -56
- package/lib/document/services/document-viewer.service.d.ts +84 -0
- package/lib/document/services/document.service.d.ts +36 -0
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy {
|
|
|
63
63
|
ngOnInit(): void;
|
|
64
64
|
/**
|
|
65
65
|
* Sets up subscriptions to monitor menu item and user selection changes
|
|
66
|
-
* to trigger status data fetching
|
|
66
|
+
* to trigger status data fetching and user list refreshing
|
|
67
67
|
*/
|
|
68
68
|
private setupStatusDataSubscriptions;
|
|
69
69
|
/**
|
|
@@ -71,13 +71,13 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy {
|
|
|
71
71
|
*/
|
|
72
72
|
private fetchStatusData;
|
|
73
73
|
/**
|
|
74
|
-
* Fetches
|
|
74
|
+
* Fetches userlist data with current filters applied
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
fetchUserListWithFilters(): void;
|
|
77
77
|
/**
|
|
78
|
-
* Fetches
|
|
78
|
+
* Fetches document catagory data.
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
fetchDocumentCatagories(): void;
|
|
81
81
|
/**
|
|
82
82
|
* Sets up subscription to listen for filtered document responses
|
|
83
83
|
*/
|
|
@@ -3,9 +3,9 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
|
3
3
|
import { DocumentHttpService } from '../../services/document-http.service';
|
|
4
4
|
import { DocumentHelperService } from '../../services/document.service';
|
|
5
5
|
import { DocumentListItem } from '../../models/document-list-response.model';
|
|
6
|
-
import { DocumentHistorySection } from '../../models/document-history.model';
|
|
7
6
|
import { DocumentAction } from '../../services/document-actions.service';
|
|
8
7
|
import { MessageService } from 'primeng/api';
|
|
8
|
+
import { DocumentViewerService, DocumentViewerState } from '../../services/document-viewer.service';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
10
|
/**
|
|
11
11
|
* Component for viewing and managing document details.
|
|
@@ -16,6 +16,7 @@ export declare class DocumentViewerComponent implements OnChanges, OnDestroy {
|
|
|
16
16
|
documentHttpService: DocumentHttpService;
|
|
17
17
|
private documentService;
|
|
18
18
|
private messageService;
|
|
19
|
+
private documentViewerService;
|
|
19
20
|
/**
|
|
20
21
|
* Get the selected document by user.
|
|
21
22
|
* @type {*}
|
|
@@ -26,6 +27,11 @@ export declare class DocumentViewerComponent implements OnChanges, OnDestroy {
|
|
|
26
27
|
* @type {*}
|
|
27
28
|
*/
|
|
28
29
|
documentList?: DocumentListItem[];
|
|
30
|
+
/**
|
|
31
|
+
* The context ID for API calls
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
contextId?: string;
|
|
29
35
|
/**
|
|
30
36
|
* Event emitted when document status is updated to refresh the document list
|
|
31
37
|
* @type {EventEmitter<void>}
|
|
@@ -46,41 +52,16 @@ export declare class DocumentViewerComponent implements OnChanges, OnDestroy {
|
|
|
46
52
|
* @type {boolean}
|
|
47
53
|
*/
|
|
48
54
|
isVerified: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Data used for displaying alert messages.
|
|
51
|
-
* @type {any}
|
|
52
|
-
*/
|
|
53
|
-
alertData: any;
|
|
54
|
-
/**
|
|
55
|
-
* Document history data
|
|
56
|
-
* @type {DocumentHistorySection[]}
|
|
57
|
-
*/
|
|
58
|
-
documentHistory: DocumentHistorySection[];
|
|
59
|
-
/**
|
|
60
|
-
* Whether to show document history
|
|
61
|
-
* @type {boolean}
|
|
62
|
-
*/
|
|
63
|
-
showDocumentHistory: boolean;
|
|
64
55
|
/**
|
|
65
56
|
* Messages for user feedback
|
|
66
57
|
* @type {any[]}
|
|
67
58
|
*/
|
|
68
59
|
messages: any[];
|
|
69
60
|
/**
|
|
70
|
-
*
|
|
71
|
-
* @type {
|
|
72
|
-
*/
|
|
73
|
-
isActionLoading: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Computed document status for the actions component
|
|
76
|
-
* @type {'pending' | 'accepted' | 'rejected'}
|
|
77
|
-
*/
|
|
78
|
-
documentStatus: 'pending' | 'accepted' | 'rejected';
|
|
79
|
-
/**
|
|
80
|
-
* Computed flag indicating if document is uploaded
|
|
81
|
-
* @type {boolean}
|
|
61
|
+
* Current state from the service
|
|
62
|
+
* @type {DocumentViewerState}
|
|
82
63
|
*/
|
|
83
|
-
|
|
64
|
+
currentState: DocumentViewerState;
|
|
84
65
|
/**
|
|
85
66
|
* Holds the subscription to manage observable cleanup.
|
|
86
67
|
* @private
|
|
@@ -91,51 +72,31 @@ export declare class DocumentViewerComponent implements OnChanges, OnDestroy {
|
|
|
91
72
|
* Initializes a new instance of the DocumentViewerComponent.
|
|
92
73
|
* @param {DocumentHttpService} documentHttpService - Handle the http service.
|
|
93
74
|
* @param {DocumentService} documentService - Handle the states.
|
|
75
|
+
* @param {DocumentViewerService} documentViewerService - Handle the viewer business logic.
|
|
94
76
|
*/
|
|
95
|
-
constructor(documentHttpService: DocumentHttpService, documentService: DocumentHelperService, messageService: MessageService);
|
|
77
|
+
constructor(documentHttpService: DocumentHttpService, documentService: DocumentHelperService, messageService: MessageService, documentViewerService: DocumentViewerService);
|
|
96
78
|
/**
|
|
97
79
|
* Fetches the alerts for the selected document.
|
|
98
80
|
* @returns {void}
|
|
99
81
|
*/
|
|
100
82
|
ngOnChanges(changes: SimpleChanges): void;
|
|
101
|
-
handleSelectedDocument(document: DocumentListItem): void;
|
|
102
83
|
/**
|
|
103
|
-
*
|
|
104
|
-
* @
|
|
84
|
+
* Handles document selection from template
|
|
85
|
+
* @param document The selected document
|
|
105
86
|
*/
|
|
106
|
-
|
|
87
|
+
handleSelectedDocument(document: DocumentListItem): void;
|
|
107
88
|
/**
|
|
108
89
|
* Determines if the given content type is an image.
|
|
109
90
|
* @param {string | undefined} contentType - The MIME type of the content.
|
|
110
91
|
* @returns {boolean} `true` if the content type is an image; otherwise, `false`.
|
|
111
92
|
*/
|
|
112
93
|
isImage(contentType?: string): boolean;
|
|
113
|
-
ngOnDestroy(): void;
|
|
114
|
-
/**
|
|
115
|
-
* Updates computed properties based on selectedDocument
|
|
116
|
-
*/
|
|
117
|
-
private updateComputedProperties;
|
|
118
|
-
/**
|
|
119
|
-
* Calculates the current status of the document for the actions component
|
|
120
|
-
* @returns {'pending' | 'accepted' | 'rejected'} The current document status
|
|
121
|
-
*/
|
|
122
|
-
private calculateDocumentStatus;
|
|
123
|
-
/**
|
|
124
|
-
* Calculates if the document is uploaded and ready for actions
|
|
125
|
-
* @returns {boolean} True if document is uploaded
|
|
126
|
-
*/
|
|
127
|
-
private calculateIsDocumentUploaded;
|
|
128
94
|
/**
|
|
129
95
|
* Handles document actions from the actions component
|
|
130
96
|
* @param {DocumentAction} action - The action performed
|
|
131
97
|
*/
|
|
132
98
|
handleDocumentAction(action: DocumentAction): void;
|
|
133
|
-
|
|
134
|
-
* Updates the document status via API call
|
|
135
|
-
* @param {string} status - The new status (Approved, Rejected)
|
|
136
|
-
* @param {string} description - The status update description
|
|
137
|
-
*/
|
|
138
|
-
private updateDocumentStatus;
|
|
99
|
+
ngOnDestroy(): void;
|
|
139
100
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentViewerComponent, never>;
|
|
140
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentViewerComponent, "document-viewer", never, { "selectedDocument": { "alias": "selectedDocument"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; }, { "documentStatusUpdated": "documentStatusUpdated"; }, never, ["*"], false, never>;
|
|
101
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentViewerComponent, "document-viewer", never, { "selectedDocument": { "alias": "selectedDocument"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; "contextId": { "alias": "contextId"; "required": false; }; }, { "documentStatusUpdated": "documentStatusUpdated"; }, never, ["*"], false, never>;
|
|
141
102
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { DocumentHttpService } from './document-http.service';
|
|
3
|
+
import { DocumentHelperService } from './document.service';
|
|
4
|
+
import { DocumentListItem } from '../models/document-list-response.model';
|
|
5
|
+
import { DocumentHistorySection } from '../models/document-history.model';
|
|
6
|
+
import { DocumentAction } from './document-actions.service';
|
|
7
|
+
import { MessageService } from 'primeng/api';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
export interface DocumentViewerState {
|
|
10
|
+
selectedDocument?: DocumentListItem;
|
|
11
|
+
documentHistory: DocumentHistorySection[];
|
|
12
|
+
showDocumentHistory: boolean;
|
|
13
|
+
isActionLoading: boolean;
|
|
14
|
+
documentStatus: 'pending' | 'accepted' | 'rejected';
|
|
15
|
+
documentIsUploaded: boolean;
|
|
16
|
+
alertData: any;
|
|
17
|
+
}
|
|
18
|
+
export declare class DocumentViewerService {
|
|
19
|
+
private documentHttpService;
|
|
20
|
+
private documentService;
|
|
21
|
+
private messageService;
|
|
22
|
+
private stateSubject;
|
|
23
|
+
state$: Observable<DocumentViewerState>;
|
|
24
|
+
constructor(documentHttpService: DocumentHttpService, documentService: DocumentHelperService, messageService: MessageService);
|
|
25
|
+
/**
|
|
26
|
+
* Updates the selected document and recalculates all computed properties
|
|
27
|
+
* @param document The selected document
|
|
28
|
+
*/
|
|
29
|
+
updateSelectedDocument(document: DocumentListItem): void;
|
|
30
|
+
/**
|
|
31
|
+
* Loads document history data
|
|
32
|
+
* @param documentId The document ID
|
|
33
|
+
*/
|
|
34
|
+
loadDocumentHistory(documentId: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Determines if the given content type is an image
|
|
37
|
+
* @param contentType The MIME type of the content
|
|
38
|
+
* @returns True if the content type is an image
|
|
39
|
+
*/
|
|
40
|
+
isImage(contentType?: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Handles document actions and updates status
|
|
43
|
+
* @param action The action performed
|
|
44
|
+
* @param contextId The context ID for API calls
|
|
45
|
+
*/
|
|
46
|
+
handleDocumentAction(action: DocumentAction, contextId?: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Updates the document status via API call and refreshes all related data
|
|
49
|
+
* @param status The new status (Approved, Rejected)
|
|
50
|
+
* @param description The status update description
|
|
51
|
+
* @param contextId The context ID for API calls
|
|
52
|
+
*/
|
|
53
|
+
private updateDocumentStatus;
|
|
54
|
+
/**
|
|
55
|
+
* Refreshes all related data after document status update
|
|
56
|
+
* @param contextId The context ID for API calls
|
|
57
|
+
*/
|
|
58
|
+
private refreshAllData;
|
|
59
|
+
/**
|
|
60
|
+
* Gets alert data for the document
|
|
61
|
+
* @param document The document
|
|
62
|
+
* @returns Alert data
|
|
63
|
+
*/
|
|
64
|
+
private getAlertData;
|
|
65
|
+
/**
|
|
66
|
+
* Calculates the current status of the document for the actions component
|
|
67
|
+
* @param document The document
|
|
68
|
+
* @returns The current document status
|
|
69
|
+
*/
|
|
70
|
+
private calculateDocumentStatus;
|
|
71
|
+
/**
|
|
72
|
+
* Calculates if the document is uploaded and ready for actions
|
|
73
|
+
* @param document The document
|
|
74
|
+
* @returns True if document is uploaded
|
|
75
|
+
*/
|
|
76
|
+
private calculateIsDocumentUploaded;
|
|
77
|
+
/**
|
|
78
|
+
* Gets the current state
|
|
79
|
+
* @returns The current state
|
|
80
|
+
*/
|
|
81
|
+
getCurrentState(): DocumentViewerState;
|
|
82
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentViewerService, never>;
|
|
83
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DocumentViewerService>;
|
|
84
|
+
}
|
|
@@ -83,6 +83,25 @@ export declare class DocumentHelperService {
|
|
|
83
83
|
userId: string | null;
|
|
84
84
|
status: string | null;
|
|
85
85
|
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Get the current selection state value synchronously
|
|
88
|
+
* @returns the current selection state value
|
|
89
|
+
*/
|
|
90
|
+
getSelectionStateValue(): {
|
|
91
|
+
menuItem: string | null;
|
|
92
|
+
userId: string | null;
|
|
93
|
+
status: string | null;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Set status data in the store
|
|
97
|
+
* @param statusData the status data to set
|
|
98
|
+
*/
|
|
99
|
+
setStatusData(statusData: any[]): void;
|
|
100
|
+
/**
|
|
101
|
+
* Set user list in the store
|
|
102
|
+
* @param userList the user list to set
|
|
103
|
+
*/
|
|
104
|
+
setUserList(userList: any[]): void;
|
|
86
105
|
/**
|
|
87
106
|
* Get observable for filtered documents
|
|
88
107
|
* @returns Observable that emits filtered document responses
|
|
@@ -98,6 +117,23 @@ export declare class DocumentHelperService {
|
|
|
98
117
|
* @param contextId - The context ID to use for the API call
|
|
99
118
|
*/
|
|
100
119
|
refreshDocumentsWithoutFilters(contextId: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Refresh all data with current filters after accept/reject operations
|
|
122
|
+
* This includes status data, user list, and document list
|
|
123
|
+
*
|
|
124
|
+
* This method ensures that after a document status change (accept/reject):
|
|
125
|
+
* 1. Status counts are refreshed with current menu item and user filters
|
|
126
|
+
* 2. User list is refreshed with current filters (if applicable)
|
|
127
|
+
* 3. Document list is refreshed with all current filters (menu item, user, status, search)
|
|
128
|
+
*
|
|
129
|
+
* Filter application:
|
|
130
|
+
* - Status data: Uses userId as contextId and menuItem as categoryId
|
|
131
|
+
* - User list: Uses base contextId (can be enhanced with additional filters if API supports)
|
|
132
|
+
* - Document list: Uses all current filters (menuItem, userId, status, searchKey)
|
|
133
|
+
*
|
|
134
|
+
* @param contextId - The context ID to use for the API calls
|
|
135
|
+
*/
|
|
136
|
+
refreshAllDataWithCurrentFilters(contextId: string): void;
|
|
101
137
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentHelperService, never>;
|
|
102
138
|
static ɵprov: i0.ɵɵInjectableDeclaration<DocumentHelperService>;
|
|
103
139
|
}
|