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.
Files changed (210) hide show
  1. package/ng-package.json +10 -0
  2. package/package.json +5 -11
  3. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.html +3 -0
  4. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.scss +13 -0
  5. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.spec.ts +70 -0
  6. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.ts +133 -0
  7. package/src/Shared/components/table-primary/table-primary.component.html +66 -0
  8. package/src/Shared/components/table-primary/table-primary.component.scss +227 -0
  9. package/src/Shared/components/table-primary/table-primary.component.spec.ts +23 -0
  10. package/src/Shared/components/table-primary/table-primary.component.ts +143 -0
  11. package/src/Shared/components/table-primary/table-primary.model.ts +21 -0
  12. package/src/Shared/constant/ERROR.ts +55 -0
  13. package/src/Shared/constant/PERMISSIONS.ts +17 -0
  14. package/src/Shared/constant/SHARED.ts +936 -0
  15. package/{Shared/constant/URLS.d.ts → src/Shared/constant/URLS.ts} +31 -25
  16. package/src/Shared/services/app-config.service.spec.ts +19 -0
  17. package/src/Shared/services/app-config.service.ts +73 -0
  18. package/{Shared/services/global-error.handler.d.ts → src/Shared/services/global-error.handler.ts} +11 -9
  19. package/src/Shared/services/session.service.spec.ts +16 -0
  20. package/src/Shared/services/session.service.ts +76 -0
  21. package/src/Shared/shared.module.ts +25 -0
  22. package/src/lib/document/components/csv-viewer/csv-viewer.component.ts +1 -0
  23. package/src/lib/document/components/document-actions/document-actions.component.html +59 -0
  24. package/src/lib/document/components/document-actions/document-actions.component.scss +362 -0
  25. package/src/lib/document/components/document-actions/document-actions.component.spec.ts +297 -0
  26. package/src/lib/document/components/document-actions/document-actions.component.ts +163 -0
  27. package/src/lib/document/components/document-container/document-container.component.html +36 -0
  28. package/src/lib/document/components/document-container/document-container.component.scss +144 -0
  29. package/src/lib/document/components/document-container/document-container.component.spec.ts +110 -0
  30. package/src/lib/document/components/document-container/document-container.component.ts +363 -0
  31. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.html +332 -0
  32. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.scss +1877 -0
  33. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.spec.ts +258 -0
  34. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.ts +664 -0
  35. package/src/lib/document/components/document-history/document-history.component.html +96 -0
  36. package/src/lib/document/components/document-history/document-history.component.scss +392 -0
  37. package/src/lib/document/components/document-history/document-history.component.spec.ts +93 -0
  38. package/src/lib/document/components/document-history/document-history.component.ts +373 -0
  39. package/src/lib/document/components/document-list/document-list.component.html +46 -0
  40. package/src/lib/document/components/document-list/document-list.component.scss +513 -0
  41. package/src/lib/document/components/document-list/document-list.component.spec.ts +486 -0
  42. package/src/lib/document/components/document-list/document-list.component.ts +682 -0
  43. package/src/lib/document/components/document-list-item/document-list-item.component.html +36 -0
  44. package/src/lib/document/components/document-list-item/document-list-item.component.scss +34 -0
  45. package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +75 -0
  46. package/src/lib/document/components/document-list-item/document-list-item.component.ts +40 -0
  47. package/src/lib/document/components/document-search/document-search.component.html +64 -0
  48. package/src/lib/document/components/document-search/document-search.component.scss +206 -0
  49. package/src/lib/document/components/document-search/document-search.component.spec.ts +82 -0
  50. package/src/lib/document/components/document-search/document-search.component.ts +163 -0
  51. package/src/lib/document/components/document-status/document-status.component.html +31 -0
  52. package/src/lib/document/components/document-status/document-status.component.scss +192 -0
  53. package/src/lib/document/components/document-status/document-status.component.spec.ts +23 -0
  54. package/src/lib/document/components/document-status/document-status.component.ts +87 -0
  55. package/src/lib/document/components/document-upload/document-upload.component.html +160 -0
  56. package/src/lib/document/components/document-upload/document-upload.component.scss +235 -0
  57. package/src/lib/document/components/document-upload/document-upload.component.spec.ts +95 -0
  58. package/src/lib/document/components/document-upload/document-upload.component.ts +668 -0
  59. package/src/lib/document/components/document-viewer/document-viewer.component.html +50 -0
  60. package/src/lib/document/components/document-viewer/document-viewer.component.scss +187 -0
  61. package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +79 -0
  62. package/src/lib/document/components/document-viewer/document-viewer.component.ts +261 -0
  63. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.html +48 -0
  64. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.scss +320 -0
  65. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.spec.ts +59 -0
  66. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.ts +150 -0
  67. package/src/lib/document/components/documents-menu/documents-menu.component.html +44 -0
  68. package/src/lib/document/components/documents-menu/documents-menu.component.scss +363 -0
  69. package/src/lib/document/components/documents-menu/documents-menu.component.spec.ts +23 -0
  70. package/src/lib/document/components/documents-menu/documents-menu.component.ts +316 -0
  71. package/src/lib/document/components/folder-block/folder-block.component.html +46 -0
  72. package/src/lib/document/components/folder-block/folder-block.component.scss +9 -0
  73. package/src/lib/document/components/folder-block/folder-block.component.spec.ts +70 -0
  74. package/{lib/document/components/folder-block/folder-block.component.d.ts → src/lib/document/components/folder-block/folder-block.component.ts} +28 -12
  75. package/src/lib/document/components/folder-container/folder-container.component.html +56 -0
  76. package/src/lib/document/components/folder-container/folder-container.component.scss +20 -0
  77. package/src/lib/document/components/folder-container/folder-container.component.spec.ts +27 -0
  78. package/src/lib/document/components/folder-container/folder-container.component.ts +328 -0
  79. package/src/lib/document/components/linked-document/linked-document.component.html +23 -0
  80. package/src/lib/document/components/linked-document/linked-document.component.scss +10 -0
  81. package/src/lib/document/components/linked-document/linked-document.component.spec.ts +61 -0
  82. package/src/lib/document/components/linked-document/linked-document.component.ts +49 -0
  83. package/src/lib/document/components/request-document/request-document.component.html +86 -0
  84. package/src/lib/document/components/request-document/request-document.component.scss +16 -0
  85. package/src/lib/document/components/request-document/request-document.component.ts +278 -0
  86. package/src/lib/document/components/sidebar/sidebar.component.html +75 -0
  87. package/src/lib/document/components/sidebar/sidebar.component.scss +157 -0
  88. package/src/lib/document/components/sidebar/sidebar.component.spec.ts +114 -0
  89. package/src/lib/document/components/sidebar/sidebar.component.ts +223 -0
  90. package/src/lib/document/components/user-list/user-list.component.html +33 -0
  91. package/src/lib/document/components/user-list/user-list.component.scss +118 -0
  92. package/src/lib/document/components/user-list/user-list.component.spec.ts +23 -0
  93. package/src/lib/document/components/user-list/user-list.component.ts +181 -0
  94. package/src/lib/document/constant/DOCUMENT_HISTORY.ts +52 -0
  95. package/src/lib/document/directives/document.directive.ts +32 -0
  96. package/src/lib/document/directives/permission.directive.spec.ts +0 -0
  97. package/src/lib/document/directives/permission.directive.ts +72 -0
  98. package/src/lib/document/document.module.ts +351 -0
  99. package/{lib/document/models/document-alert.model.d.ts → src/lib/document/models/document-alert.model.ts} +11 -4
  100. package/src/lib/document/models/document-category.model.ts +30 -0
  101. package/src/lib/document/models/document-history.model.ts +109 -0
  102. package/src/lib/document/models/document-list-response.model.ts +37 -0
  103. package/src/lib/document/models/document-type.model.ts +44 -0
  104. package/src/lib/document/models/document.model.ts +53 -0
  105. package/{lib/document/models/folder.model.d.ts → src/lib/document/models/folder.model.ts} +10 -4
  106. package/src/lib/document/models/status-data.model.ts +31 -0
  107. package/src/lib/document/models/uploaded-file-response.model.ts +7 -0
  108. package/src/lib/document/models/user-list.model.ts +10 -0
  109. package/src/lib/document/services/csv-parser.service.spec.ts +97 -0
  110. package/src/lib/document/services/csv-parser.service.ts +303 -0
  111. package/src/lib/document/services/document-actions.service.ts +125 -0
  112. package/src/lib/document/services/document-content-type.service.ts +193 -0
  113. package/src/lib/document/services/document-history-style.service.ts +138 -0
  114. package/src/lib/document/services/document-history.service.ts +129 -0
  115. package/src/lib/document/services/document-http.service.spec.ts +119 -0
  116. package/src/lib/document/services/document-http.service.ts +497 -0
  117. package/src/lib/document/services/document-list.service.ts +195 -0
  118. package/src/lib/document/services/document-menu.service.ts +277 -0
  119. package/src/lib/document/services/document-scroll.service.ts +138 -0
  120. package/src/lib/document/services/document-severity.service.ts +98 -0
  121. package/src/lib/document/services/document-table-builder.service.ts +82 -0
  122. package/src/lib/document/services/document-upload-business.service.ts +326 -0
  123. package/src/lib/document/services/document-upload-data.service.ts +82 -0
  124. package/src/lib/document/services/document-upload-form.service.ts +149 -0
  125. package/src/lib/document/services/document-upload.service.spec.ts +99 -0
  126. package/src/lib/document/services/document-upload.service.ts +209 -0
  127. package/src/lib/document/services/document-viewer.service.ts +279 -0
  128. package/src/lib/document/services/document-zoom.service.spec.ts +56 -0
  129. package/src/lib/document/services/document-zoom.service.ts +164 -0
  130. package/src/lib/document/services/document.service.ts +356 -0
  131. package/src/lib/document/services/eml-parser.service.ts +444 -0
  132. package/src/lib/document/services/excel-parser.service.spec.ts +66 -0
  133. package/src/lib/document/services/excel-parser.service.ts +483 -0
  134. package/src/lib/document/services/file-format.service.spec.ts +16 -0
  135. package/src/lib/document/services/file-format.service.ts +63 -0
  136. package/src/lib/document/services/status-calculator.service.ts +44 -0
  137. package/src/lib/document/services/user-list.service.ts +77 -0
  138. package/src/lib/document/state/document.query.ts +378 -0
  139. package/{lib/document/state/document.service.d.ts → src/lib/document/state/document.service.ts} +46 -15
  140. package/src/lib/document/state/document.state.ts +100 -0
  141. package/src/lib/document/state/document.store.ts +200 -0
  142. package/{public-api.d.ts → src/public-api.ts} +4 -0
  143. package/tsconfig.lib.json +15 -0
  144. package/tsconfig.lib.prod.json +11 -0
  145. package/tsconfig.spec.json +15 -0
  146. package/Shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +0 -44
  147. package/Shared/components/table-primary/table-primary.component.d.ts +0 -31
  148. package/Shared/components/table-primary/table-primary.model.d.ts +0 -19
  149. package/Shared/constant/ERROR.d.ts +0 -52
  150. package/Shared/constant/SHARED.d.ts +0 -546
  151. package/Shared/services/app-config.service.d.ts +0 -51
  152. package/Shared/services/session.service.d.ts +0 -46
  153. package/Shared/shared.module.d.ts +0 -14
  154. package/fesm2022/cat-documents-ng.mjs +0 -11392
  155. package/fesm2022/cat-documents-ng.mjs.map +0 -1
  156. package/index.d.ts +0 -5
  157. package/lib/document/components/document-actions/document-actions.component.d.ts +0 -78
  158. package/lib/document/components/document-container/document-container.component.d.ts +0 -162
  159. package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +0 -291
  160. package/lib/document/components/document-history/document-history.component.d.ts +0 -160
  161. package/lib/document/components/document-list/document-list.component.d.ts +0 -299
  162. package/lib/document/components/document-list-item/document-list-item.component.d.ts +0 -28
  163. package/lib/document/components/document-search/document-search.component.d.ts +0 -77
  164. package/lib/document/components/document-status/document-status.component.d.ts +0 -24
  165. package/lib/document/components/document-upload/document-upload.component.d.ts +0 -321
  166. package/lib/document/components/document-viewer/document-viewer.component.d.ts +0 -137
  167. package/lib/document/components/document-zoom-controls/document-zoom-controls.component.d.ts +0 -33
  168. package/lib/document/components/documents-menu/documents-menu.component.d.ts +0 -110
  169. package/lib/document/components/folder-container/folder-container.component.d.ts +0 -162
  170. package/lib/document/components/linked-document/linked-document.component.d.ts +0 -39
  171. package/lib/document/components/request-document/request-document.component.d.ts +0 -69
  172. package/lib/document/components/sidebar/sidebar.component.d.ts +0 -109
  173. package/lib/document/components/user-list/user-list.component.d.ts +0 -34
  174. package/lib/document/constant/DOCUMENT_HISTORY.d.ts +0 -41
  175. package/lib/document/directives/document.directive.d.ts +0 -20
  176. package/lib/document/directives/permission.directive.d.ts +0 -38
  177. package/lib/document/document.module.d.ts +0 -60
  178. package/lib/document/models/document-category.model.d.ts +0 -24
  179. package/lib/document/models/document-history.model.d.ts +0 -94
  180. package/lib/document/models/document-list-response.model.d.ts +0 -33
  181. package/lib/document/models/document-type.model.d.ts +0 -37
  182. package/lib/document/models/document.model.d.ts +0 -44
  183. package/lib/document/models/status-data.model.d.ts +0 -27
  184. package/lib/document/models/uploaded-file-response.model.d.ts +0 -7
  185. package/lib/document/models/user-list.model.d.ts +0 -8
  186. package/lib/document/services/csv-parser.service.d.ts +0 -88
  187. package/lib/document/services/document-actions.service.d.ts +0 -48
  188. package/lib/document/services/document-content-type.service.d.ts +0 -85
  189. package/lib/document/services/document-history-style.service.d.ts +0 -34
  190. package/lib/document/services/document-history.service.d.ts +0 -42
  191. package/lib/document/services/document-http.service.d.ts +0 -179
  192. package/lib/document/services/document-list.service.d.ts +0 -74
  193. package/lib/document/services/document-menu.service.d.ts +0 -122
  194. package/lib/document/services/document-scroll.service.d.ts +0 -55
  195. package/lib/document/services/document-table-builder.service.d.ts +0 -38
  196. package/lib/document/services/document-upload-business.service.d.ts +0 -107
  197. package/lib/document/services/document-upload-data.service.d.ts +0 -40
  198. package/lib/document/services/document-upload-form.service.d.ts +0 -41
  199. package/lib/document/services/document-upload.service.d.ts +0 -99
  200. package/lib/document/services/document-viewer.service.d.ts +0 -97
  201. package/lib/document/services/document-zoom.service.d.ts +0 -81
  202. package/lib/document/services/document.service.d.ts +0 -161
  203. package/lib/document/services/eml-parser.service.d.ts +0 -116
  204. package/lib/document/services/excel-parser.service.d.ts +0 -169
  205. package/lib/document/services/file-format.service.d.ts +0 -34
  206. package/lib/document/services/status-calculator.service.d.ts +0 -20
  207. package/lib/document/services/user-list.service.d.ts +0 -29
  208. package/lib/document/state/document.query.d.ts +0 -243
  209. package/lib/document/state/document.state.d.ts +0 -61
  210. package/lib/document/state/document.store.d.ts +0 -56
@@ -4,120 +4,126 @@
4
4
  * @class URLS
5
5
  * @typedef {URLS}
6
6
  */
7
- export declare class URLS {
7
+ export class URLS {
8
8
  /**
9
9
  * The URL to fetch the application configuration file.
10
10
  * This JSON file typically contains settings and options for the application.
11
11
  * @static
12
12
  * @type {string}
13
13
  */
14
- static CONFIGFILEURL: string;
14
+ static CONFIGFILEURL = "assets/config/api.config.json";
15
+
15
16
  /**
16
17
  * The URL endpoint for document uploads.
17
18
  * Used to send documents to the server for storage or processing.
18
19
  * @static
19
20
  * @type {string}
20
21
  */
21
- static DOCUMENT_UPLOAD_FILE: string;
22
+ static DOCUMENT_UPLOAD_FILE = "documents/uploadFile";
22
23
  /**
23
24
  * The URL endpoint for document uploads.
24
25
  * Used to send documents to the server for storage or processing.
25
26
  * @static
26
27
  * @type {string}
27
28
  */
28
- static DOCUMENT_UPLOAD: string;
29
+ static DOCUMENT_UPLOAD = "Documents";
29
30
  /**
30
31
  * The URL endpoint for document uploads.
31
32
  * Used to send documents to the server for storage or processing.
32
33
  * @static
33
34
  * @type {string}
34
35
  */
35
- static DOCUMENTS: string;
36
+ static DOCUMENTS = "documents";
36
37
  /**
37
38
  * The URL endpoint for document uploads.
38
39
  * Used to send documents to the server for storage or processing.
39
40
  * @static
40
41
  * @type {string}
41
42
  */
42
- static DOCUMENTS_CATAGORIES: string;
43
+ static DOCUMENTS_CATAGORIES = "documents/getAllCategoriesByApplicationId";
44
+
43
45
  /**
44
46
  * The query parameter to pass a context ID in API requests.
45
47
  * Used to specify the context for certain API calls, such as filtering or scoping the request.
46
48
  * @static
47
49
  * @type {string}
48
50
  */
49
- static CONTEXT: string;
51
+ static CONTEXT = "?contextId=";
52
+
50
53
  /**
51
54
  * The query parameter to pass a document ID in API requests.
52
55
  * @static
53
56
  * @type {string}
54
57
  */
55
- static DOCUMENT_TYPES: string;
56
- static ALIAS_NAME: string;
58
+ static DOCUMENT_TYPES = "documentTypes";
59
+ static ALIAS_NAME = 'documents/updateAliasNameByDocumentId/';
57
60
  /**
58
61
  * The URL endpoint for getting categories by source (Applicant/Application).
59
62
  * Used to fetch document categories based on the selected source.
60
63
  * @static
61
64
  * @type {string}
62
65
  */
63
- static GET_CATEGORIES_BY_SOURCE: string;
66
+ static GET_CATEGORIES_BY_SOURCE = "documentTypes/getAllCategoriesBySource/";
64
67
  /**
65
68
  * The URL endpoint for getting document types by category ID.
66
69
  * Used to fetch document types based on the selected category.
67
70
  * @static
68
71
  * @type {string}
69
72
  */
70
- static GET_DOCUMENT_TYPES_BY_CATEGORY: string;
73
+ static GET_DOCUMENT_TYPES_BY_CATEGORY = "documentTypes/getAllDocumentTypesByCategoryId/";
71
74
  /**
72
75
  * The URL endpoint for saving document upload data.
73
76
  * Used to save the complete document upload information.
74
77
  * @static
75
78
  * @type {string}
76
79
  */
77
- static SAVE_DOCUMENT_UPLOAD: string;
80
+ static SAVE_DOCUMENT_UPLOAD = "documents/create";
78
81
  /**
79
82
  * The query parameter to pass a context ID in API requests.
80
83
  * @static
81
84
  * @type {string}
82
85
  */
83
- static FOLDERS: string;
86
+ static FOLDERS = "/folders?contextId=";
84
87
  /**
85
88
  * The query parameter to pass a document ID in API requests.
86
89
  * @static
87
90
  * @type {string}
88
91
  */
89
- static ALERT_BY_DOCUMENT_ID: string;
92
+ static ALERT_BY_DOCUMENT_ID = "alerts?documentId=";
90
93
  /**
91
94
  * The query parameter to pass a document ID in API requests.
92
95
  * @static
93
96
  * @type {string}
94
97
  */
95
- static PARENT_DOCUMENT_TYPE_ID: string;
98
+ static PARENT_DOCUMENT_TYPE_ID = "parentDocumentType?parentDocumentTypeId=";
96
99
  /**
97
100
  * The query parameter to pass a document ID in API requests.
98
101
  * @static
99
102
  * @type {string}
100
103
  */
101
- static USERLIST: string;
104
+ static USERLIST = "documents/getContextIdListByApplicationId/";
105
+
102
106
  /**
103
107
  * The URL endpoint for getting document status count by context ID.
104
108
  * Used to fetch status data with applicationId, contextId, and category parameters.
105
109
  * @static
106
110
  * @type {string}
107
111
  */
108
- static STATUS_DOCUMENT_COUNT: string;
112
+ static STATUS_DOCUMENT_COUNT = "documents/getStatusDocumentCountByContextId/";
113
+
109
114
  /**
110
115
  * The query parameter to pass a context ID in API requests.
111
116
  * Used to specify the context for certain API calls, such as filtering or scoping the request.
112
117
  * @static
113
118
  * @type {string}
114
119
  */
115
- static CONTEXT_ID: string;
116
- static GETALL: string;
117
- static DOCUMENT_LIST: string;
118
- static DOCUMENT_HISTORY: string;
119
- static DELETE_DOCUMENT: string;
120
- static UPDATE_DOCUMENT_STATUS: string;
121
- static DOCUMENT_REQUEST: string;
122
- static VALUATION_REPORT: string;
120
+
121
+ static CONTEXT_ID = "&contextId=";
122
+ static GETALL = "documents/getAllByContextId";
123
+ static DOCUMENT_LIST = "list";
124
+ static DOCUMENT_HISTORY = "documents/getDocumentHistoryByDocumentId/";
125
+ static DELETE_DOCUMENT = "documents/deleteDocumentByDocumentId/";
126
+ static UPDATE_DOCUMENT_STATUS = "documents/updateDocumentStatusByDocumentId/";
127
+ static DOCUMENT_REQUEST = "documents/requestDocument";
128
+ static VALUATION_REPORT = "valuationReport/";
123
129
  }
@@ -0,0 +1,19 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+
3
+ import { AppConfigService } from './app-config.service';
4
+ import { HttpClientModule } from '@angular/common/http';
5
+
6
+ describe('AppConfigService', () => {
7
+ let service: AppConfigService;
8
+
9
+ beforeEach(() => {
10
+ TestBed.configureTestingModule({
11
+ imports: [HttpClientModule],
12
+ });
13
+ service = TestBed.inject(AppConfigService);
14
+ });
15
+
16
+ it('should be created', () => {
17
+ expect(service).toBeTruthy();
18
+ });
19
+ });
@@ -0,0 +1,73 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Injectable } from '@angular/core';
3
+ import { firstValueFrom } from 'rxjs';
4
+ import { URLS } from '../constant/URLS';
5
+
6
+ /**
7
+ * Service that handles loading and providing configuration settings for the application.
8
+ * It fetches configuration data from a remote server and exposes various configuration options.
9
+ * @class AppConfigService
10
+ * @typedef {AppConfigService}
11
+ */
12
+ @Injectable({
13
+ providedIn: 'root'
14
+ })
15
+ export class AppConfigService {
16
+
17
+ /**
18
+ * Holds the configuration data loaded from the server.
19
+ * @private
20
+ * @type {*}
21
+ */
22
+ private appConfig: any;
23
+
24
+ /**
25
+ * Creates an instance of AppConfigService.
26
+ * Initializes the HttpClient for making HTTP requests.
27
+ * @class
28
+ * @param {HttpClient} http - The HttpClient service used for making HTTP requests.
29
+ */
30
+ constructor(private http: HttpClient) {}
31
+
32
+ /**
33
+ * Loads the application configuration from the server by making an HTTP request to the configuration URL.
34
+ * This method retrieves the configuration data and assigns it to the appConfig property.
35
+ * @async
36
+ * @returns {*}
37
+ */
38
+ async loadAppConfig() {
39
+ try {
40
+ this.appConfig = await firstValueFrom(this.http.get(URLS.CONFIGFILEURL));
41
+ } catch (error) {
42
+ throw new Error("Api url is missing.")
43
+ }
44
+ }
45
+
46
+
47
+ /**
48
+ * Returns the base URL for the API from the loaded configuration.
49
+ * @readonly
50
+ * @type {*}
51
+ */
52
+ get apiBaseUrl() {
53
+ return this.appConfig?.documentApiUrl;
54
+ }
55
+
56
+ /**
57
+ * Returns the local server API URL from the loaded configuration.
58
+ * @readonly
59
+ * @type {*}
60
+ */
61
+ get localServerApi() {
62
+ return this.appConfig?.localServerApi;
63
+ }
64
+
65
+ /**
66
+ * Returns the visibility options from the loaded configuration.
67
+ * @readonly
68
+ * @type {*}
69
+ */
70
+ get visibilityOptions() {
71
+ return this.appConfig?.visibilityOption;
72
+ }
73
+ }
@@ -1,5 +1,6 @@
1
- import { ErrorHandler, Injector } from '@angular/core';
2
- import * as i0 from "@angular/core";
1
+ import { ErrorHandler, Injectable, Injector } from '@angular/core';
2
+ import { HttpErrorResponse } from '@angular/common/http';
3
+
3
4
  /**
4
5
  * GlobalErrorHandler is a custom error handler that implements the ErrorHandler interface.
5
6
  * It is used to handle both HTTP errors and other types of errors globally in the application.
@@ -7,21 +8,22 @@ import * as i0 from "@angular/core";
7
8
  * @implements {ErrorHandler}
8
9
  * @decorator {Injectable}
9
10
  */
10
- export declare class GlobalErrorHandler implements ErrorHandler {
11
- private injector;
11
+ @Injectable()
12
+ export class GlobalErrorHandler implements ErrorHandler {
12
13
  /**
13
14
  * Creates an instance of GlobalErrorHandler.
14
15
  * @constructor
15
16
  * @param {Injector} injector - The Angular injector used to get instances of services.
16
17
  */
17
- constructor(injector: Injector);
18
+ constructor(private injector: Injector) { }
19
+
18
20
  /**
19
21
  * Handles errors globally in the application.
20
- *
22
+ *
21
23
  * @param {any} error - The error object that needs to be handled.
22
24
  * @returns {void}
23
25
  */
24
- handleError(error: any): void;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<GlobalErrorHandler, never>;
26
- static ɵprov: i0.ɵɵInjectableDeclaration<GlobalErrorHandler>;
26
+ handleError(error: any): void {
27
+ console.error('GlobalErrorHandler:', error);
28
+ }
27
29
  }
@@ -0,0 +1,16 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+
3
+ import { SessionService } from './session.service';
4
+
5
+ describe('SessionService', () => {
6
+ let service: SessionService;
7
+
8
+ beforeEach(() => {
9
+ TestBed.configureTestingModule({});
10
+ service = TestBed.inject(SessionService);
11
+ });
12
+
13
+ it('should be created', () => {
14
+ expect(service).toBeTruthy();
15
+ });
16
+ });
@@ -0,0 +1,76 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+ import { SHARED } from '../constant/SHARED';
4
+
5
+ /**
6
+ * Service for managing user session details.
7
+ * @class SessionService
8
+ * @typedef {SessionService}
9
+ */
10
+ @Injectable({
11
+ providedIn: 'root'
12
+ })
13
+ export class SessionService {
14
+
15
+ /**
16
+ * Creates an instance of SessionService.
17
+ * @param {Router} router - Angular Router for navigation.
18
+ */
19
+ constructor(public router: Router) {}
20
+
21
+ /**
22
+ * Retrieves the current user's role from local storage.
23
+ * @returns {string | null} The user's role, or null if not found.
24
+ */
25
+ getUserRole(): string | null {
26
+ return localStorage.getItem('role');
27
+ }
28
+
29
+ /**
30
+ * Stores the user session data in local storage.
31
+ * @param {any} data - The session data to store.
32
+ */
33
+ setUserSession(data: any): void {
34
+ localStorage.setItem(SHARED.SESSIONKEY, JSON.stringify(data));
35
+ }
36
+
37
+ /**
38
+ * Retrieves the stored user session data.
39
+ * @returns {any | null} The parsed session data, or null if not found.
40
+ */
41
+ getUserSession(): any | null {
42
+ const sessionData = localStorage.getItem(SHARED.SESSIONKEY);
43
+ return sessionData ? JSON.parse(sessionData) : null;
44
+ }
45
+
46
+ /**
47
+ * Retrieves the user's permissions from the stored session data.
48
+ * @returns {any | null} The user's permissions, or null if not found.
49
+ */
50
+ getUserPermissions(): any | null {
51
+ const sessionData = localStorage.getItem(SHARED.SESSIONKEY);
52
+ return sessionData ? JSON.parse(sessionData).permissions : null;
53
+ }
54
+
55
+ /**
56
+ * Retrieves the session ID from the stored session data.
57
+ * @returns {any | null} The session ID, or null if not found.
58
+ */
59
+ getSessionID(): any | null {
60
+ const sessionData = localStorage.getItem(SHARED.SESSIONKEY);
61
+ console.log(sessionData);
62
+ if (sessionData) {
63
+ const sessionId = JSON.parse(sessionData);
64
+ console.log(sessionId);
65
+ return sessionId;
66
+ }
67
+ return null;
68
+ }
69
+
70
+ /**
71
+ * Clears all stored session data from local storage.
72
+ */
73
+ clearSession(): void {
74
+ localStorage.clear();
75
+ }
76
+ }
@@ -0,0 +1,25 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { TablePrimaryComponent } from './components/table-primary/table-primary.component';
4
+ import { TableModule } from 'primeng/table';
5
+ import { ButtonModule } from 'primeng/button';
6
+ import { RippleModule } from 'primeng/ripple';
7
+ import { ConfirmDialogModule } from 'primeng/confirmdialog';
8
+ import { HasPermissionDirective } from '../lib/document/directives/permission.directive';
9
+ import { ConfirmationDialogComponent } from './components/confirmation-dialog/confirmation-dialog.component';
10
+ import { ConfirmationService } from 'primeng/api';
11
+
12
+
13
+ @NgModule({
14
+ declarations: [TablePrimaryComponent, HasPermissionDirective, ConfirmationDialogComponent],
15
+ imports: [
16
+ CommonModule,
17
+ TableModule,
18
+ ButtonModule,
19
+ RippleModule,
20
+ ConfirmDialogModule
21
+ ],
22
+ providers: [ConfirmationService],
23
+ exports : [TablePrimaryComponent, HasPermissionDirective, ConfirmationDialogComponent, ConfirmDialogModule]
24
+ })
25
+ export class SharedModule { }
@@ -0,0 +1,59 @@
1
+ <div class="document-actions-container" *ngIf="document?.status !=='Pending' && !document?.isUploaded && document?.status === 'Reviewing'">
2
+ <div class="actions-card" [ngClass]="cardClass">
3
+ <div class="actions-buttons">
4
+ <button *ngIf="!document?.isUploaded" class="action-btn reject-btn" [ngClass]="rejectButtonClass"
5
+ (click)="onRejectClick()" [disabled]="areButtonsDisabled || isRejecting">
6
+ <i class="pi pi-times" *ngIf="isDocumentRejected"></i>
7
+ <i class="pi pi-spin pi-spinner" *ngIf="isRejecting"></i>
8
+ <span>{{ isDocumentRejected ? SHARED.BUTTON_LABEL_REJECTED :
9
+ SHARED.BUTTON_LABEL_REJECT }}</span>
10
+ </button>
11
+ <button *ngIf="!document?.isUploaded" class="action-btn accept-btn" [ngClass]="acceptButtonClass"
12
+ (click)="onAcceptClick()" [disabled]="areButtonsDisabled || isAccepting">
13
+ <i class="pi pi-check" *ngIf="isDocumentApproved"></i>
14
+ <i class="pi pi-spin pi-spinner" *ngIf="isAccepting"></i>
15
+ <span>{{ isDocumentApproved ? SHARED.BUTTON_LABEL_ACCEPTED : SHARED.BUTTON_LABEL_ACCEPT
16
+ }}</span>
17
+ </button>
18
+ </div>
19
+ </div>
20
+ </div>
21
+
22
+
23
+
24
+ <p-dialog [(visible)]="showAcceptDialog" [header]="SHARED.ACCEPT_CONFIRM_HEADER" [modal]="true" [draggable]="false"
25
+ [closable]="true" [style]="{ width: '25rem', height: '25rem' }" styleClass="confirmation-dialog">
26
+ <div class="dialog-content">
27
+ <label for="acceptNote" class="note-label">{{ SHARED.ACCEPT_NOTE_LABEL }}</label>
28
+ <textarea id="acceptNote" pInputTextarea [(ngModel)]="acceptNote" [placeholder]="SHARED.ACCEPT_NOTE_PLACEHOLDER"
29
+ rows="6" class="note-textarea">
30
+ </textarea>
31
+ </div>
32
+ <ng-template pTemplate="footer">
33
+ <div class="dialog-footer">
34
+ <button pButton [label]="SHARED.CANCEL_BUTTON_LABEL" class="p-button-secondary" (click)="onCancel()">
35
+ </button>
36
+ <button pButton [label]="SHARED.ACCEPT_BUTTON_LABEL" class="p-button-success" (click)="onAcceptConfirm()">
37
+ </button>
38
+ </div>
39
+ </ng-template>
40
+ </p-dialog>
41
+
42
+ <p-dialog [(visible)]="showRejectDialog" [header]="SHARED.REJECT_CONFIRM_HEADER" [modal]="true" [draggable]="false"
43
+ [closable]="true" [style]="{ width: '25rem', height: '25rem' }" styleClass="confirmation-dialog">
44
+ <div class="dialog-content">
45
+ <label for="rejectNote" class="note-label">{{ SHARED.REJECT_NOTE_LABEL }}</label>
46
+ <textarea id="rejectNote" pInputTextarea [(ngModel)]="rejectNote" [placeholder]="SHARED.REJECT_NOTE_PLACEHOLDER"
47
+ rows="6" class="note-textarea">
48
+ </textarea>
49
+ </div>
50
+ <ng-template pTemplate="footer">
51
+ <div class="dialog-footer">
52
+ <button pButton [label]="SHARED.CANCEL_BUTTON_LABEL" class="p-button-secondary" (click)="onCancel()">
53
+ </button>
54
+ <button pButton [label]="SHARED.REJECT_BUTTON_LABEL" class="p-button-danger" [disabled]="isRejectNoteEmpty"
55
+ (click)="onRejectConfirm()">
56
+ </button>
57
+ </div>
58
+ </ng-template>
59
+ </p-dialog>