vc-create-dashboard 3.0.6 → 3.0.62

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 (372) hide show
  1. package/karma.conf.js +44 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +3 -17
  4. package/src/lib/categoryList.ts +23 -0
  5. package/src/lib/configurations.ts +8 -0
  6. package/src/lib/create-dashboard-container/categories/categories-config.ts +18 -0
  7. package/src/lib/create-dashboard-container/categories/categories.component.html +150 -0
  8. package/src/lib/create-dashboard-container/categories/categories.component.less +252 -0
  9. package/src/lib/create-dashboard-container/categories/categories.component.spec.ts +43 -0
  10. package/src/lib/create-dashboard-container/categories/categories.component.ts +220 -0
  11. package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.html +141 -0
  12. package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.less +381 -0
  13. package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.spec.ts +48 -0
  14. package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.ts +589 -0
  15. package/src/lib/create-dashboard-container/configure-widgets/configure-widgets/widget.interface.ts +9 -0
  16. package/src/lib/create-dashboard-container/configure-widgets/configure-widgets.module.ts +30 -0
  17. package/src/lib/create-dashboard-container/constants/assets.constant.ts +36 -0
  18. package/src/lib/create-dashboard-container/create-dashboard-config.ts +24 -0
  19. package/src/lib/create-dashboard-container/create-dashboard-mockData.ts +341 -0
  20. package/src/lib/create-dashboard-container/create-dashboard.component.html +1276 -0
  21. package/src/lib/create-dashboard-container/create-dashboard.component.less +1453 -0
  22. package/src/lib/create-dashboard-container/create-dashboard.component.ts +1333 -0
  23. package/src/lib/create-dashboard-container/create-dashboard.module.ts +75 -0
  24. package/src/lib/create-dashboard-container/directives/directives.module.ts +18 -0
  25. package/src/lib/create-dashboard-container/directives/scroll-in-view.directive.ts +28 -0
  26. package/src/lib/create-dashboard-container/form-group/form-group.component.html +288 -0
  27. package/src/lib/create-dashboard-container/form-group/form-group.component.less +450 -0
  28. package/src/lib/create-dashboard-container/form-group/form-group.component.spec.ts +90 -0
  29. package/src/lib/create-dashboard-container/form-group/form-group.component.ts +163 -0
  30. package/src/lib/create-dashboard-container/frequency/frequency.component.html +61 -0
  31. package/src/lib/create-dashboard-container/frequency/frequency.component.less +183 -0
  32. package/src/lib/create-dashboard-container/frequency/frequency.component.spec.ts +120 -0
  33. package/src/lib/create-dashboard-container/frequency/frequency.component.ts +303 -0
  34. package/{lib/create-dashboard-container/interfaces/widget-data-model.d.ts → src/lib/create-dashboard-container/interfaces/widget-data-model.ts} +1 -1
  35. package/src/lib/create-dashboard-container/pipes/filter.pipe.ts +25 -0
  36. package/src/lib/create-dashboard-container/pipes/search.pipe.ts +23 -0
  37. package/src/lib/create-dashboard-container/pipes/text-count.pipe.spec.ts +8 -0
  38. package/src/lib/create-dashboard-container/pipes/text-count.pipe.ts +15 -0
  39. package/src/lib/create-dashboard-container/responsibility-center/responsibility-center.component.html +70 -0
  40. package/src/lib/create-dashboard-container/responsibility-center/responsibility-center.component.less +181 -0
  41. package/src/lib/create-dashboard-container/responsibility-center/responsibility-center.component.spec.ts +41 -0
  42. package/src/lib/create-dashboard-container/responsibility-center/responsibility-center.component.ts +154 -0
  43. package/src/lib/create-dashboard-container/risk-categories/risk-categories-config.ts +18 -0
  44. package/src/lib/create-dashboard-container/risk-categories/risk-categories.component.html +152 -0
  45. package/src/lib/create-dashboard-container/risk-categories/risk-categories.component.less +230 -0
  46. package/src/lib/create-dashboard-container/risk-categories/risk-categories.component.spec.ts +39 -0
  47. package/src/lib/create-dashboard-container/risk-categories/risk-categories.component.ts +209 -0
  48. package/src/lib/create-dashboard-container/services/auth.service.ts +27 -0
  49. package/src/lib/create-dashboard-container/services/configure-widgets.service.spec.ts +19 -0
  50. package/src/lib/create-dashboard-container/services/configure-widgets.service.ts +245 -0
  51. package/src/lib/create-dashboard-container/services/create-dashboard.service.spec.ts +19 -0
  52. package/src/lib/create-dashboard-container/services/create-dashboard.service.ts +220 -0
  53. package/src/lib/create-dashboard-container/services/pagination.service.spec.ts +16 -0
  54. package/src/lib/create-dashboard-container/services/pagination.service.ts +25 -0
  55. package/src/lib/create-dashboard-container/services/urlConfig.service.ts +21 -0
  56. package/src/lib/create-dashboard-container/user-list/user-list.component.html +357 -0
  57. package/src/lib/create-dashboard-container/user-list/user-list.component.less +451 -0
  58. package/src/lib/create-dashboard-container/user-list/user-list.component.spec.ts +153 -0
  59. package/src/lib/create-dashboard-container/user-list/user-list.component.ts +472 -0
  60. package/{lib/create-dashboard-container/user-list/user-list.config.d.ts → src/lib/create-dashboard-container/user-list/user-list.config.ts} +6 -6
  61. package/src/lib/create-dashboard.service.ts +8 -0
  62. package/src/lib/ui-kit/action-dialog/access-capability/access-capability.component.html +22 -0
  63. package/src/lib/ui-kit/action-dialog/access-capability/access-capability.component.less +218 -0
  64. package/src/lib/ui-kit/action-dialog/access-capability/access-capability.component.ts +30 -0
  65. package/src/lib/ui-kit/action-dialog/action-dialog.module.ts +53 -0
  66. package/src/lib/ui-kit/action-dialog/active/active.component.html +1 -0
  67. package/src/lib/ui-kit/action-dialog/active/active.component.less +0 -0
  68. package/src/lib/ui-kit/action-dialog/active/active.component.ts +12 -0
  69. package/src/lib/ui-kit/action-dialog/assesment-confirmation/assesment-confirmation.component.html +18 -0
  70. package/src/lib/ui-kit/action-dialog/assesment-confirmation/assesment-confirmation.component.less +98 -0
  71. package/src/lib/ui-kit/action-dialog/assesment-confirmation/assesment-confirmation.component.ts +18 -0
  72. package/src/lib/ui-kit/action-dialog/confirmation/confirmation.component.html +20 -0
  73. package/src/lib/ui-kit/action-dialog/confirmation/confirmation.component.less +325 -0
  74. package/src/lib/ui-kit/action-dialog/confirmation/confirmation.component.ts +26 -0
  75. package/src/lib/ui-kit/action-dialog/delete/delete.component.html +24 -0
  76. package/src/lib/ui-kit/action-dialog/delete/delete.component.less +240 -0
  77. package/src/lib/ui-kit/action-dialog/delete/delete.component.ts +22 -0
  78. package/src/lib/ui-kit/action-dialog/error/error.component.html +20 -0
  79. package/src/lib/ui-kit/action-dialog/error/error.component.less +103 -0
  80. package/src/lib/ui-kit/action-dialog/error/error.component.ts +18 -0
  81. package/src/lib/ui-kit/action-dialog/inactive/inactive.component.html +23 -0
  82. package/src/lib/ui-kit/action-dialog/inactive/inactive.component.less +167 -0
  83. package/src/lib/ui-kit/action-dialog/inactive/inactive.component.ts +12 -0
  84. package/src/lib/ui-kit/action-dialog/link/link.component.html +57 -0
  85. package/src/lib/ui-kit/action-dialog/link/link.component.less +222 -0
  86. package/src/lib/ui-kit/action-dialog/link/link.component.ts +18 -0
  87. package/src/lib/ui-kit/action-dialog/move/move.component.html +43 -0
  88. package/src/lib/ui-kit/action-dialog/move/move.component.less +157 -0
  89. package/src/lib/ui-kit/action-dialog/move/move.component.ts +25 -0
  90. package/src/lib/ui-kit/action-dialog/my-rating/my-rating.component.html +19 -0
  91. package/src/lib/ui-kit/action-dialog/my-rating/my-rating.component.less +97 -0
  92. package/src/lib/ui-kit/action-dialog/my-rating/my-rating.component.ts +18 -0
  93. package/src/lib/ui-kit/action-dialog/upload/upload.component.html +19 -0
  94. package/src/lib/ui-kit/action-dialog/upload/upload.component.less +97 -0
  95. package/src/lib/ui-kit/action-dialog/upload/upload.component.ts +12 -0
  96. package/src/lib/ui-kit/chart/bar/bar.component.html +28 -0
  97. package/src/lib/ui-kit/chart/bar/bar.component.less +13 -0
  98. package/src/lib/ui-kit/chart/bar/bar.component.ts +44 -0
  99. package/src/lib/ui-kit/chart/chart.module.ts +12 -0
  100. package/src/lib/ui-kit/chart/pipes/segmenter.pipe.ts +28 -0
  101. package/src/lib/ui-kit/chart/pipes/x-calculator.pipe.ts +22 -0
  102. package/src/lib/ui-kit/circle-progresss/circle/circle.component.html +37 -0
  103. package/src/lib/ui-kit/circle-progresss/circle/circle.component.less +1448 -0
  104. package/src/lib/ui-kit/circle-progresss/circle/circle.component.ts +19 -0
  105. package/src/lib/ui-kit/circle-progresss/circle-progresss.module.ts +10 -0
  106. package/src/lib/ui-kit/click-outside/click-outside.directive.ts +16 -0
  107. package/src/lib/ui-kit/click-outside/click-outside.module.ts +16 -0
  108. package/src/lib/ui-kit/color-palette/color-palette.component.html +110 -0
  109. package/src/lib/ui-kit/color-palette/color-palette.component.less +54 -0
  110. package/src/lib/ui-kit/color-palette/color-palette.component.ts +28 -0
  111. package/src/lib/ui-kit/color-palette/color-palette.module.ts +10 -0
  112. package/src/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.html +37 -0
  113. package/src/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.less +335 -0
  114. package/src/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.spec.ts +25 -0
  115. package/src/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.ts +44 -0
  116. package/src/lib/ui-kit/dashboard-footer/dashboard-footer-config.ts +11 -0
  117. package/src/lib/ui-kit/dashboard-footer/dashboard-footer.module.ts +22 -0
  118. package/src/lib/ui-kit/dialog/dialog-config.ts +6 -0
  119. package/src/lib/ui-kit/dialog/dialog-injector.ts +18 -0
  120. package/src/lib/ui-kit/dialog/dialog-ref.ts +12 -0
  121. package/src/lib/ui-kit/dialog/dialog.component.css +89 -0
  122. package/src/lib/ui-kit/dialog/dialog.component.html +27 -0
  123. package/src/lib/ui-kit/dialog/dialog.component.ts +114 -0
  124. package/src/lib/ui-kit/dialog/dialog.module.ts +11 -0
  125. package/src/lib/ui-kit/dialog/dialog.service.ts +57 -0
  126. package/src/lib/ui-kit/dialog/insertion.directive.ts +8 -0
  127. package/src/lib/ui-kit/floating-bar/floating-bar.component.html +42 -0
  128. package/src/lib/ui-kit/floating-bar/floating-bar.component.less +355 -0
  129. package/src/lib/ui-kit/floating-bar/floating-bar.component.spec.ts +25 -0
  130. package/src/lib/ui-kit/floating-bar/floating-bar.component.ts +40 -0
  131. package/src/lib/ui-kit/floating-bar/floating-bar.module.ts +22 -0
  132. package/src/lib/ui-kit/formgroup/click-outside.directive.ts +16 -0
  133. package/src/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.html +11 -0
  134. package/src/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.less +102 -0
  135. package/src/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.ts +19 -0
  136. package/src/lib/ui-kit/formgroup/cs-radio/cs-radio.component.html +11 -0
  137. package/src/lib/ui-kit/formgroup/cs-radio/cs-radio.component.less +125 -0
  138. package/src/lib/ui-kit/formgroup/cs-radio/cs-radio.component.ts +21 -0
  139. package/src/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.html +4 -0
  140. package/src/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.less +0 -0
  141. package/src/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.ts +12 -0
  142. package/src/lib/ui-kit/formgroup/cs-select/cs-select.component.html +78 -0
  143. package/src/lib/ui-kit/formgroup/cs-select/cs-select.component.less +259 -0
  144. package/src/lib/ui-kit/formgroup/cs-select/cs-select.component.ts +92 -0
  145. package/src/lib/ui-kit/formgroup/cs-switch/cs-switch.component.html +30 -0
  146. package/src/lib/ui-kit/formgroup/cs-switch/cs-switch.component.less +103 -0
  147. package/src/lib/ui-kit/formgroup/cs-switch/cs-switch.component.ts +23 -0
  148. package/src/lib/ui-kit/formgroup/formgroup.module.ts +35 -0
  149. package/src/lib/ui-kit/formgroup/pipes/pascal.pipe.ts +13 -0
  150. package/src/lib/ui-kit/formgroup/pipes/searchMultiSelect.pipe.ts +18 -0
  151. package/src/lib/ui-kit/line-loader/line-loader.component.html +3 -0
  152. package/src/lib/ui-kit/line-loader/line-loader.component.less +34 -0
  153. package/src/lib/ui-kit/line-loader/line-loader.component.ts +14 -0
  154. package/src/lib/ui-kit/line-loader/line-loader.module.ts +10 -0
  155. package/src/lib/ui-kit/longpress/longpress.directive.ts +28 -0
  156. package/src/lib/ui-kit/longpress/longpress.module.ts +10 -0
  157. package/src/lib/ui-kit/multi-select/cs-multiselect/cs-multiselect.component.html +51 -0
  158. package/src/lib/ui-kit/multi-select/cs-multiselect/cs-multiselect.component.less +367 -0
  159. package/src/lib/ui-kit/multi-select/cs-multiselect/cs-multiselect.component.spec.ts +24 -0
  160. package/src/lib/ui-kit/multi-select/cs-multiselect/cs-multiselect.component.ts +141 -0
  161. package/src/lib/ui-kit/multi-select/cs-multiselect-option/cs-multiselect-option.component.html +9 -0
  162. package/src/lib/ui-kit/multi-select/cs-multiselect-option/cs-multiselect-option.component.less +105 -0
  163. package/src/lib/ui-kit/multi-select/cs-multiselect-option/cs-multiselect-option.component.spec.ts +27 -0
  164. package/src/lib/ui-kit/multi-select/cs-multiselect-option/cs-multiselect-option.component.ts +24 -0
  165. package/src/lib/ui-kit/multi-select/multi-select.module.ts +24 -0
  166. package/src/lib/ui-kit/multi-select/multi-select.service.ts +10 -0
  167. package/src/lib/ui-kit/no-data/no-data.component.html +14 -0
  168. package/src/lib/ui-kit/no-data/no-data.component.less +86 -0
  169. package/src/lib/ui-kit/no-data/no-data.component.ts +26 -0
  170. package/src/lib/ui-kit/no-data/no-data.module.ts +10 -0
  171. package/src/lib/ui-kit/pagination/pagination.component.html +11 -0
  172. package/src/lib/ui-kit/pagination/pagination.component.less +72 -0
  173. package/src/lib/ui-kit/pagination/pagination.component.spec.ts +25 -0
  174. package/src/lib/ui-kit/pagination/pagination.component.ts +138 -0
  175. package/src/lib/ui-kit/pagination/pagination.module.ts +10 -0
  176. package/src/lib/ui-kit/pipes/pipes.module.ts +10 -0
  177. package/src/lib/ui-kit/pipes/safeHTML.pipe.ts +12 -0
  178. package/src/lib/ui-kit/pipes/trim.pipe.ts +10 -0
  179. package/src/lib/ui-kit/popover/popover.component.html +6 -0
  180. package/src/lib/ui-kit/popover/popover.component.less +20 -0
  181. package/src/lib/ui-kit/popover/popover.component.ts +124 -0
  182. package/src/lib/ui-kit/popover/popover.directive.ts +72 -0
  183. package/src/lib/ui-kit/popover/popover.module.ts +13 -0
  184. package/src/lib/ui-kit/popover/popover.service.ts +17 -0
  185. package/src/lib/ui-kit/ripple/ripple.directive.ts +33 -0
  186. package/src/lib/ui-kit/ripple/ripple.module.ts +10 -0
  187. package/src/lib/ui-kit/select/cs-option/cs-option.component.html +8 -0
  188. package/src/lib/ui-kit/select/cs-option/cs-option.component.less +49 -0
  189. package/src/lib/ui-kit/select/cs-option/cs-option.component.ts +31 -0
  190. package/src/lib/ui-kit/select/cs-select/cs-select.component.html +16 -0
  191. package/src/lib/ui-kit/select/cs-select/cs-select.component.less +142 -0
  192. package/src/lib/ui-kit/select/cs-select/cs-select.component.ts +98 -0
  193. package/src/lib/ui-kit/select/safe-html.pipe.ts +13 -0
  194. package/src/lib/ui-kit/select/select.module.ts +13 -0
  195. package/src/lib/ui-kit/services/cs-select.service.ts +10 -0
  196. package/src/lib/ui-kit/smiley-dialog/smiley-dialog.component.html +30 -0
  197. package/src/lib/ui-kit/smiley-dialog/smiley-dialog.component.less +442 -0
  198. package/src/lib/ui-kit/smiley-dialog/smiley-dialog.component.ts +40 -0
  199. package/src/lib/ui-kit/smiley-dialog/smiley-dialog.module.ts +11 -0
  200. package/src/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.html +10 -0
  201. package/src/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.less +110 -0
  202. package/src/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.ts +42 -0
  203. package/src/lib/ui-kit/snack-bar/snack-bar.module.ts +10 -0
  204. package/src/lib/ui-kit/snack-bar/snack-bar.service.ts +18 -0
  205. package/src/lib/ui-kit/time-filter/time-filter.component.html +126 -0
  206. package/src/lib/ui-kit/time-filter/time-filter.component.less +482 -0
  207. package/src/lib/ui-kit/time-filter/time-filter.component.ts +284 -0
  208. package/src/lib/ui-kit/time-filter/time-filter.module.ts +10 -0
  209. package/src/lib/ui-kit/tooltip/tooltip.directive.ts +150 -0
  210. package/src/lib/ui-kit/tooltip/tooltip.module.ts +10 -0
  211. package/src/lib/ui-kit/v-loader/loader/loader.component.html +6 -0
  212. package/src/lib/ui-kit/v-loader/loader/loader.component.less +52 -0
  213. package/src/lib/ui-kit/v-loader/loader/loader.component.ts +22 -0
  214. package/src/lib/ui-kit/v-loader/loader-inline/loader-inline.component.html +6 -0
  215. package/src/lib/ui-kit/v-loader/loader-inline/loader-inline.component.less +52 -0
  216. package/src/lib/ui-kit/v-loader/loader-inline/loader-inline.component.ts +22 -0
  217. package/src/lib/ui-kit/v-loader/v-loader.module.ts +11 -0
  218. package/src/public-api.ts +11 -0
  219. package/src/test.ts +28 -0
  220. package/tsconfig.lib.json +20 -0
  221. package/tsconfig.lib.prod.json +10 -0
  222. package/tsconfig.spec.json +17 -0
  223. package/esm2022/lib/configurations.mjs +0 -7
  224. package/esm2022/lib/create-dashboard-container/categories/categories-config.mjs +0 -2
  225. package/esm2022/lib/create-dashboard-container/categories/categories.component.mjs +0 -212
  226. package/esm2022/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.mjs +0 -551
  227. package/esm2022/lib/create-dashboard-container/configure-widgets/configure-widgets/widget.interface.mjs +0 -2
  228. package/esm2022/lib/create-dashboard-container/configure-widgets/configure-widgets.module.mjs +0 -47
  229. package/esm2022/lib/create-dashboard-container/constants/assets.constant.mjs +0 -35
  230. package/esm2022/lib/create-dashboard-container/create-dashboard-config.mjs +0 -2
  231. package/esm2022/lib/create-dashboard-container/create-dashboard.component.mjs +0 -1119
  232. package/esm2022/lib/create-dashboard-container/create-dashboard.module.mjs +0 -132
  233. package/esm2022/lib/create-dashboard-container/directives/directives.module.mjs +0 -24
  234. package/esm2022/lib/create-dashboard-container/directives/scroll-in-view.directive.mjs +0 -36
  235. package/esm2022/lib/create-dashboard-container/form-group/form-group.component.mjs +0 -153
  236. package/esm2022/lib/create-dashboard-container/frequency/frequency.component.mjs +0 -309
  237. package/esm2022/lib/create-dashboard-container/interfaces/widget-data-model.mjs +0 -2
  238. package/esm2022/lib/create-dashboard-container/pipes/filter.pipe.mjs +0 -30
  239. package/esm2022/lib/create-dashboard-container/pipes/search.pipe.mjs +0 -25
  240. package/esm2022/lib/create-dashboard-container/pipes/text-count.pipe.mjs +0 -19
  241. package/esm2022/lib/create-dashboard-container/responsibility-center/responsibility-center.component.mjs +0 -149
  242. package/esm2022/lib/create-dashboard-container/risk-categories/risk-categories-config.mjs +0 -2
  243. package/esm2022/lib/create-dashboard-container/risk-categories/risk-categories.component.mjs +0 -206
  244. package/esm2022/lib/create-dashboard-container/services/auth.service.mjs +0 -31
  245. package/esm2022/lib/create-dashboard-container/services/configure-widgets.service.mjs +0 -230
  246. package/esm2022/lib/create-dashboard-container/services/create-dashboard.service.mjs +0 -160
  247. package/esm2022/lib/create-dashboard-container/services/pagination.service.mjs +0 -28
  248. package/esm2022/lib/create-dashboard-container/services/urlConfig.service.mjs +0 -29
  249. package/esm2022/lib/create-dashboard-container/user-list/user-list.component.mjs +0 -440
  250. package/esm2022/lib/create-dashboard-container/user-list/user-list.config.mjs +0 -2
  251. package/esm2022/lib/create-dashboard.service.mjs +0 -14
  252. package/esm2022/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.mjs +0 -52
  253. package/esm2022/lib/ui-kit/dashboard-footer/dashboard-footer-config.mjs +0 -2
  254. package/esm2022/lib/ui-kit/dashboard-footer/dashboard-footer.module.mjs +0 -32
  255. package/esm2022/lib/ui-kit/dialog/dialog-config.mjs +0 -7
  256. package/esm2022/lib/ui-kit/dialog/dialog-injector.mjs +0 -17
  257. package/esm2022/lib/ui-kit/dialog/dialog-ref.mjs +0 -11
  258. package/esm2022/lib/ui-kit/dialog/dialog.component.mjs +0 -99
  259. package/esm2022/lib/ui-kit/dialog/dialog.module.mjs +0 -20
  260. package/esm2022/lib/ui-kit/dialog/dialog.service.mjs +0 -56
  261. package/esm2022/lib/ui-kit/dialog/insertion.directive.mjs +0 -17
  262. package/esm2022/lib/ui-kit/floating-bar/floating-bar.component.mjs +0 -57
  263. package/esm2022/lib/ui-kit/floating-bar/floating-bar.module.mjs +0 -32
  264. package/esm2022/lib/ui-kit/formgroup/click-outside.directive.mjs +0 -30
  265. package/esm2022/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.mjs +0 -29
  266. package/esm2022/lib/ui-kit/formgroup/cs-radio/cs-radio.component.mjs +0 -34
  267. package/esm2022/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.mjs +0 -14
  268. package/esm2022/lib/ui-kit/formgroup/cs-select/cs-select.component.mjs +0 -119
  269. package/esm2022/lib/ui-kit/formgroup/cs-switch/cs-switch.component.mjs +0 -39
  270. package/esm2022/lib/ui-kit/formgroup/formgroup.module.mjs +0 -55
  271. package/esm2022/lib/ui-kit/formgroup/pipes/pascal.pipe.mjs +0 -19
  272. package/esm2022/lib/ui-kit/formgroup/pipes/searchMultiSelect.pipe.mjs +0 -24
  273. package/esm2022/lib/ui-kit/no-data/no-data.component.mjs +0 -47
  274. package/esm2022/lib/ui-kit/no-data/no-data.module.mjs +0 -18
  275. package/esm2022/lib/ui-kit/pagination/pagination.component.mjs +0 -130
  276. package/esm2022/lib/ui-kit/pagination/pagination.module.mjs +0 -18
  277. package/esm2022/lib/ui-kit/popover/popover.component.mjs +0 -142
  278. package/esm2022/lib/ui-kit/popover/popover.directive.mjs +0 -93
  279. package/esm2022/lib/ui-kit/popover/popover.module.mjs +0 -21
  280. package/esm2022/lib/ui-kit/popover/popover.service.mjs +0 -23
  281. package/esm2022/lib/ui-kit/select/cs-option/cs-option.component.mjs +0 -41
  282. package/esm2022/lib/ui-kit/select/cs-select/cs-select.component.mjs +0 -107
  283. package/esm2022/lib/ui-kit/select/safe-html.pipe.mjs +0 -21
  284. package/esm2022/lib/ui-kit/select/select.module.mjs +0 -21
  285. package/esm2022/lib/ui-kit/services/cs-select.service.mjs +0 -16
  286. package/esm2022/lib/ui-kit/smiley-dialog/smiley-dialog.component.mjs +0 -52
  287. package/esm2022/lib/ui-kit/smiley-dialog/smiley-dialog.module.mjs +0 -18
  288. package/esm2022/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.mjs +0 -46
  289. package/esm2022/lib/ui-kit/snack-bar/snack-bar.module.mjs +0 -18
  290. package/esm2022/lib/ui-kit/snack-bar/snack-bar.service.mjs +0 -23
  291. package/esm2022/lib/ui-kit/tooltip/tooltip.directive.mjs +0 -168
  292. package/esm2022/lib/ui-kit/tooltip/tooltip.module.mjs +0 -18
  293. package/esm2022/lib/ui-kit/v-loader/loader/loader.component.mjs +0 -24
  294. package/esm2022/lib/ui-kit/v-loader/loader-inline/loader-inline.component.mjs +0 -24
  295. package/esm2022/lib/ui-kit/v-loader/v-loader.module.mjs +0 -19
  296. package/esm2022/public-api.mjs +0 -10
  297. package/esm2022/vc-create-dashboard.mjs +0 -5
  298. package/fesm2022/vc-create-dashboard.mjs +0 -5526
  299. package/fesm2022/vc-create-dashboard.mjs.map +0 -1
  300. package/index.d.ts +0 -5
  301. package/lib/configurations.d.ts +0 -4
  302. package/lib/create-dashboard-container/categories/categories-config.d.ts +0 -18
  303. package/lib/create-dashboard-container/categories/categories.component.d.ts +0 -65
  304. package/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.d.ts +0 -122
  305. package/lib/create-dashboard-container/configure-widgets/configure-widgets/widget.interface.d.ts +0 -9
  306. package/lib/create-dashboard-container/configure-widgets/configure-widgets.module.d.ts +0 -14
  307. package/lib/create-dashboard-container/constants/assets.constant.d.ts +0 -34
  308. package/lib/create-dashboard-container/create-dashboard-config.d.ts +0 -18
  309. package/lib/create-dashboard-container/create-dashboard.component.d.ts +0 -178
  310. package/lib/create-dashboard-container/create-dashboard.module.d.ts +0 -40
  311. package/lib/create-dashboard-container/directives/directives.module.d.ts +0 -8
  312. package/lib/create-dashboard-container/directives/scroll-in-view.directive.d.ts +0 -12
  313. package/lib/create-dashboard-container/form-group/form-group.component.d.ts +0 -48
  314. package/lib/create-dashboard-container/frequency/frequency.component.d.ts +0 -39
  315. package/lib/create-dashboard-container/pipes/filter.pipe.d.ts +0 -7
  316. package/lib/create-dashboard-container/pipes/search.pipe.d.ts +0 -7
  317. package/lib/create-dashboard-container/pipes/text-count.pipe.d.ts +0 -7
  318. package/lib/create-dashboard-container/responsibility-center/responsibility-center.component.d.ts +0 -61
  319. package/lib/create-dashboard-container/risk-categories/risk-categories-config.d.ts +0 -18
  320. package/lib/create-dashboard-container/risk-categories/risk-categories.component.d.ts +0 -65
  321. package/lib/create-dashboard-container/services/auth.service.d.ts +0 -11
  322. package/lib/create-dashboard-container/services/configure-widgets.service.d.ts +0 -38
  323. package/lib/create-dashboard-container/services/create-dashboard.service.d.ts +0 -45
  324. package/lib/create-dashboard-container/services/pagination.service.d.ts +0 -12
  325. package/lib/create-dashboard-container/services/urlConfig.service.d.ts +0 -10
  326. package/lib/create-dashboard-container/user-list/user-list.component.d.ts +0 -122
  327. package/lib/create-dashboard.service.d.ts +0 -6
  328. package/lib/ui-kit/dashboard-footer/dashboard-footer/dashboard-footer.component.d.ts +0 -17
  329. package/lib/ui-kit/dashboard-footer/dashboard-footer-config.d.ts +0 -11
  330. package/lib/ui-kit/dashboard-footer/dashboard-footer.module.d.ts +0 -10
  331. package/lib/ui-kit/dialog/dialog-config.d.ts +0 -6
  332. package/lib/ui-kit/dialog/dialog-injector.d.ts +0 -7
  333. package/lib/ui-kit/dialog/dialog-ref.d.ts +0 -7
  334. package/lib/ui-kit/dialog/dialog.component.d.ts +0 -33
  335. package/lib/ui-kit/dialog/dialog.module.d.ts +0 -9
  336. package/lib/ui-kit/dialog/dialog.service.d.ts +0 -17
  337. package/lib/ui-kit/dialog/insertion.directive.d.ts +0 -8
  338. package/lib/ui-kit/floating-bar/floating-bar.component.d.ts +0 -20
  339. package/lib/ui-kit/floating-bar/floating-bar.module.d.ts +0 -10
  340. package/lib/ui-kit/formgroup/click-outside.directive.d.ts +0 -10
  341. package/lib/ui-kit/formgroup/cs-checkbox/cs-checkbox.component.d.ts +0 -13
  342. package/lib/ui-kit/formgroup/cs-radio/cs-radio.component.d.ts +0 -15
  343. package/lib/ui-kit/formgroup/cs-radio-group/cs-radio-group.component.d.ts +0 -8
  344. package/lib/ui-kit/formgroup/cs-select/cs-select.component.d.ts +0 -36
  345. package/lib/ui-kit/formgroup/cs-switch/cs-switch.component.d.ts +0 -15
  346. package/lib/ui-kit/formgroup/formgroup.module.d.ts +0 -17
  347. package/lib/ui-kit/formgroup/pipes/pascal.pipe.d.ts +0 -7
  348. package/lib/ui-kit/formgroup/pipes/searchMultiSelect.pipe.d.ts +0 -7
  349. package/lib/ui-kit/no-data/no-data.component.d.ts +0 -19
  350. package/lib/ui-kit/no-data/no-data.module.d.ts +0 -8
  351. package/lib/ui-kit/pagination/pagination.component.d.ts +0 -21
  352. package/lib/ui-kit/pagination/pagination.module.d.ts +0 -8
  353. package/lib/ui-kit/popover/popover.component.d.ts +0 -28
  354. package/lib/ui-kit/popover/popover.directive.d.ts +0 -17
  355. package/lib/ui-kit/popover/popover.module.d.ts +0 -9
  356. package/lib/ui-kit/popover/popover.service.d.ts +0 -13
  357. package/lib/ui-kit/select/cs-option/cs-option.component.d.ts +0 -16
  358. package/lib/ui-kit/select/cs-select/cs-select.component.d.ts +0 -32
  359. package/lib/ui-kit/select/safe-html.pipe.d.ts +0 -10
  360. package/lib/ui-kit/select/select.module.d.ts +0 -11
  361. package/lib/ui-kit/services/cs-select.service.d.ts +0 -7
  362. package/lib/ui-kit/smiley-dialog/smiley-dialog.component.d.ts +0 -17
  363. package/lib/ui-kit/smiley-dialog/smiley-dialog.module.d.ts +0 -8
  364. package/lib/ui-kit/snack-bar/snack-bar/snack-bar.component.d.ts +0 -17
  365. package/lib/ui-kit/snack-bar/snack-bar.module.d.ts +0 -8
  366. package/lib/ui-kit/snack-bar/snack-bar.service.d.ts +0 -9
  367. package/lib/ui-kit/tooltip/tooltip.directive.d.ts +0 -28
  368. package/lib/ui-kit/tooltip/tooltip.module.d.ts +0 -8
  369. package/lib/ui-kit/v-loader/loader/loader.component.d.ts +0 -11
  370. package/lib/ui-kit/v-loader/loader-inline/loader-inline.component.d.ts +0 -11
  371. package/lib/ui-kit/v-loader/v-loader.module.d.ts +0 -9
  372. package/public-api.d.ts +0 -3
@@ -0,0 +1,1333 @@
1
+ import {
2
+ ChangeDetectorRef,
3
+ Component,
4
+ ElementRef,
5
+ EventEmitter,
6
+ HostListener,
7
+ Input,
8
+ OnChanges,
9
+ OnInit,
10
+ Output,
11
+ ViewChild,
12
+ } from '@angular/core';
13
+ import { EditorConfig } from '@vcomply/editor';
14
+ import { DatePickerComponent, IDatePickerConfig } from 'ng2-date-picker';
15
+ import { CreateDashboardService } from './services/create-dashboard.service';
16
+ import { PaginationService } from './services/pagination.service';
17
+ import { UserListConfiguration } from './user-list/user-list.config';
18
+ import { CreateDashboardForm } from './create-dashboard-config';
19
+ import { SnackBarService } from '../ui-kit/snack-bar/snack-bar.service';
20
+ import { ConfigureWidgetsService } from './services/configure-widgets.service';
21
+
22
+ import dayjs from 'dayjs';
23
+ import { PopoverService } from '../ui-kit/popover/popover.service';
24
+ import { TextCountPipe } from './pipes/text-count.pipe';
25
+ import { ASSETS } from './constants/assets.constant';
26
+
27
+ @Component({
28
+ selector: 'app-create-dashboard',
29
+ templateUrl: './create-dashboard.component.html',
30
+ styleUrls: ['./create-dashboard.component.less'],
31
+ providers: [TextCountPipe],
32
+ })
33
+ export class CreateDashboardComponent implements OnInit, OnChanges {
34
+ @Input() feature: any;
35
+ activeSelector = '';
36
+ disabled = false;
37
+ @Input() mode = 'CREATE';
38
+ @Input() dashboardId = '';
39
+ @Output() close = new EventEmitter();
40
+ @Input() createdBy = 0;
41
+ @ViewChild('fromDatePicker') fromDatePicker!: DatePickerComponent;
42
+ @ViewChild('toDatePicker') toDatePicker!: DatePickerComponent;
43
+ animation = true;
44
+ @Input() configureWidget = false;
45
+ ASSETS: any = ASSETS;
46
+
47
+ totalPages = 1;
48
+ totalList = 1;
49
+ usersList: any[] = [];
50
+ vLoader = true;
51
+ userListLoaded = false;
52
+ rcListLoaded = false;
53
+ complianceCategoriesListLoaded = false;
54
+ riskCategoryListLoaded = false;
55
+ hideToDate = false;
56
+ listDetails: UserListConfiguration = {
57
+ selectedUsersList: [],
58
+ selectedGroupList: [],
59
+ nonRemovableUsersList: [],
60
+ displayElementKey: 'member_name',
61
+ displayGroupKey: 'group_name',
62
+ groupIdkey: 'group_id',
63
+ elementIdKey: 'member_id',
64
+ tooltipKey: 'member_email',
65
+ };
66
+ dashboardDescription: EditorConfig = {
67
+ placeholder: 'Description (Max limit: 250 characters)',
68
+ mode: 'prime',
69
+ id: 'description',
70
+ };
71
+ responsibilityCategoriesTree: any = {
72
+ regulations: {
73
+ list: [],
74
+ selectedList: [],
75
+ },
76
+ standards: {
77
+ list: [],
78
+ selectedList: [],
79
+ },
80
+ internalControls: {
81
+ list: [],
82
+ selectedList: [],
83
+ },
84
+ others: {
85
+ list: [],
86
+ selectedList: [],
87
+ },
88
+ };
89
+ allComplianceCategories: any[] = [];
90
+ allRiskCategories: any[] = [];
91
+ showRiskCategory = false;
92
+ showCriteria = true;
93
+
94
+ dashboardForm: CreateDashboardForm = {
95
+ dashboardName: '',
96
+ dashboardDescriptionText: '',
97
+ selectedViewers: [],
98
+ selectedGroup: [],
99
+ selectedFromDate: undefined,
100
+ selectedToDate: undefined,
101
+ selectedResponsibilityCenters: [],
102
+ selectedResponsibilityCategories: [],
103
+ selectedRiskCategories: [],
104
+ displayCriteria: 'or',
105
+ configureWidget: [],
106
+ frequencyDetails: '',
107
+ selectedFrequencyType: '',
108
+ selectedFrequencies: [0],
109
+ frequencyMessage: '',
110
+ frequencyDate: 1,
111
+ };
112
+
113
+ openConfigureWidgets = false;
114
+ selectedWidgets: any = [];
115
+ displayedWidgets: any = [];
116
+
117
+ responsibilityCentersList = [];
118
+ datePickerOverlay = false;
119
+ dayNames = [
120
+ 'Monday',
121
+ 'Tuesday',
122
+ 'Wednesday',
123
+ 'Thursday',
124
+ 'Friday',
125
+ 'Saturday',
126
+ 'Sunday',
127
+ ];
128
+ monthNames = [
129
+ 'January',
130
+ 'February',
131
+ 'March',
132
+ 'April',
133
+ 'May',
134
+ 'June',
135
+ 'July',
136
+ 'August',
137
+ 'September',
138
+ 'October',
139
+ 'November',
140
+ 'December',
141
+ ];
142
+ quarters = [
143
+ 'January, April, July, October',
144
+ 'February, May, August, November',
145
+ 'March, June, September, December',
146
+ ];
147
+
148
+ categoryListLoaded = false;
149
+ showRiskWidgets = false;
150
+ showComplianceWidgets = false;
151
+ isManageRisk: boolean = false;
152
+
153
+ riskCategoryList = {
154
+ strategic: {
155
+ list: [],
156
+ selectedList: [],
157
+ },
158
+ operational: {
159
+ list: [],
160
+ selectedList: [],
161
+ },
162
+ compliance: {
163
+ list: [],
164
+ selectedList: [],
165
+ },
166
+ others: {
167
+ list: [],
168
+ selectedList: [],
169
+ },
170
+ };
171
+
172
+ fromDatePickerConfig: IDatePickerConfig = {
173
+ min: this.getCurrentDate(),
174
+ };
175
+
176
+ toDatePickerConfig: IDatePickerConfig = {};
177
+
178
+ isSmiley!: boolean;
179
+ smileyMessage: string = '';
180
+ groupList: any;
181
+ groupsEnabled: boolean = false;
182
+ totalgroups: any;
183
+ @ViewChild('fromDatePicker', { read: ElementRef, static: false })
184
+ fromDatePickerPopup!: ElementRef;
185
+ @ViewChild('toDatePicker', { read: ElementRef, static: false })
186
+ toDatePickerPopup!: ElementRef;
187
+ openedDatePicker: string = '';
188
+
189
+ constructor(
190
+ private createDashboardService: CreateDashboardService,
191
+ private paginationService: PaginationService,
192
+ private cdr: ChangeDetectorRef,
193
+ private snackBar: SnackBarService,
194
+ public popoverService: PopoverService,
195
+ private configureWidgetsService: ConfigureWidgetsService,
196
+ private textCount: TextCountPipe,
197
+ ) {}
198
+
199
+ ngOnChanges() {
200
+ if (this.createdBy) {
201
+ this.listDetails.nonRemovableUsersList.push(this.createdBy);
202
+ }
203
+ }
204
+
205
+ @HostListener('document:keydown.escape', ['$event']) onKeydownHandler(
206
+ event: KeyboardEvent
207
+ ) {
208
+ this.close.emit({ mode: 'discard' });
209
+ this.isSmiley = false;
210
+ }
211
+
212
+ ngOnInit(): void {
213
+ this.groupsEnabled = true;
214
+ this.animation = true;
215
+ setTimeout(() => {
216
+ this.animation = false;
217
+ }, 300);
218
+ // this.getOrganizationUsersCount('');
219
+ this.getCategoryList();
220
+ this.getRCList();
221
+ this.getComplianceCategoryList();
222
+ this.setFrequency('2~1~0~0', 'import');
223
+ this.checkWhetherAllListsLoaded();
224
+ this.getUsersList('');
225
+ this.getGroupList();
226
+ this.createDashboardService.getUserInformation().subscribe(
227
+ (res: any) => {
228
+ this.setPermission(res?.roleActions);
229
+ const quickLink = res.quick_link;
230
+ if (quickLink.risk) {
231
+ this.showRiskCategory = true;
232
+ } else {
233
+ this.showRiskCategory = false;
234
+ }
235
+ },
236
+ (error) => {
237
+ console.error(error);
238
+ }
239
+ );
240
+ }
241
+
242
+ /**
243
+ * Displays the listing pages the left side of policy form to set and edit the dropdown fields values
244
+ * @param type holds name of particular list is to be displayed
245
+ * @param event contains boolean value to display the list or not
246
+ */
247
+ activateSelector(type: any, event: boolean) {
248
+ if (type == 'frequency' || this.activeSelector == 'frequency') {
249
+ this.showCriteria = false;
250
+ setTimeout(() => {
251
+ this.showCriteria = true;
252
+ }, 1);
253
+ }
254
+ this.activeSelector = event ? type : '';
255
+ }
256
+
257
+ openFromDatePicker() {
258
+ this.openedDatePicker = 'FROM_DATE';
259
+
260
+ this.fromDatePicker?.api?.open();
261
+ this.datePickerOverlay = true;
262
+ }
263
+
264
+ openToDatePicker() {
265
+ this.openedDatePicker = 'TO_DATE';
266
+
267
+ this.toDatePicker?.api?.open();
268
+
269
+ this.datePickerOverlay = true;
270
+ }
271
+ closeFromDatePicker() {
272
+ this.fromDatePicker?.api?.close();
273
+ if (!this.dashboardForm.selectedFromDate) {
274
+ this.dashboardForm.selectedToDate = undefined;
275
+ this.hideToDate = true;
276
+ setTimeout(() => {
277
+ this.hideToDate = false;
278
+ }, 20);
279
+ this.fromDatePicker.api.close();
280
+ this.datePickerOverlay = false;
281
+ return;
282
+ }
283
+ let minToDate = this.setToDate(this.dashboardForm.selectedFromDate);
284
+ this.toDatePickerConfig = { min: minToDate };
285
+
286
+ const fromDate = new Date(minToDate.split('-').reverse().join('-'));
287
+ const toDate = new Date(this.dashboardForm.selectedToDate);
288
+ const inValidDate = fromDate >= toDate ? true : false;
289
+ if (inValidDate) {
290
+ this.dashboardForm.selectedToDate = undefined;
291
+ this.hideToDate = true;
292
+ setTimeout(() => {
293
+ this.hideToDate = false;
294
+ }, 20);
295
+ }
296
+
297
+ this.datePickerOverlay = false;
298
+ }
299
+
300
+ closeToDatePicker() {
301
+ this.toDatePicker?.api?.close();
302
+ this.datePickerOverlay = false;
303
+ }
304
+
305
+ animateImage() {
306
+ const circleImage = document.getElementsByClassName('image');
307
+ }
308
+
309
+ saveFrequency(eventValues: any) {
310
+ this.dashboardForm.selectedFrequencyType = eventValues.frequencyType;
311
+ this.dashboardForm.selectedFrequencies = eventValues.frequencies;
312
+ this.dashboardForm.frequencyMessage = eventValues.frequencyString;
313
+ this.dashboardForm.frequencyDate = eventValues.selectedDate;
314
+ this.activateSelector('', false);
315
+ }
316
+
317
+ getCurrentDate() {
318
+ let today = new Date();
319
+ return dayjs(today).format('DD-MM-YYYY');
320
+ }
321
+ setToDate(data: string) {
322
+ let today = new Date(data);
323
+ return dayjs(today).format('DD-MM-YYYY');
324
+ }
325
+ getFromDate(data: string) {
326
+ let today = new Date(data);
327
+ return (
328
+ today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear()
329
+ );
330
+ }
331
+
332
+ /**
333
+ * It takes a string, converts it to a date, then returns a string in the format of YYYY-MM-DD.
334
+ * @param {string} data - the date you want to format
335
+ * @returns A string in the format of YYYY-MM-DD
336
+ */
337
+ getDateFormate(data: string) {
338
+ let today = new Date(data);
339
+ return (
340
+ today.getFullYear() +
341
+ '-' +
342
+ String(today.getMonth() + 1).padStart(2, '0') +
343
+ '-' +
344
+ String(today.getDate()).padStart(2, '0')
345
+ );
346
+ }
347
+
348
+ configureDashboard() {
349
+ let fieldsStatus = this.validateDashboard();
350
+ if (fieldsStatus) {
351
+ if (this.mode == 'CREATE') {
352
+ this.vLoader = true;
353
+ const payload = {
354
+ dashboard_name: this.dashboardForm.dashboardName,
355
+ dashboard_id: '',
356
+ };
357
+ this.createDashboardService
358
+ .checkDuplicateDashboardName(payload)
359
+ .subscribe(
360
+ (res) => {
361
+ if (!res) {
362
+ this.vLoader = false;
363
+ this.showRiskWidgets =
364
+ this.isManageRisk &&
365
+ this.showRiskCategory &&
366
+ (this.dashboardForm.selectedRiskCategories.length > 0 ||
367
+ this.dashboardForm.selectedResponsibilityCenters.length > 0)
368
+ ? true
369
+ : false;
370
+ this.showComplianceWidgets =
371
+ this.dashboardForm.selectedResponsibilityCategories.length >
372
+ 0 ||
373
+ this.dashboardForm.selectedResponsibilityCenters.length > 0
374
+ ? true
375
+ : false;
376
+ this.openConfigureWidgets = true;
377
+ } else {
378
+ this.vLoader = false;
379
+ this.snackBar.show(
380
+ 'A dashboard with this name already exists. Specify a different name for the dashboard.',
381
+ 'alert'
382
+ );
383
+ return;
384
+ }
385
+ },
386
+ (error) => {
387
+ console.error(error);
388
+ this.vLoader = false;
389
+ }
390
+ );
391
+ } else if (this.mode == 'EDIT') {
392
+ this.vLoader = true;
393
+ const payload = {
394
+ dashboard_name: this.dashboardForm.dashboardName,
395
+ dashboard_id: this.dashboardId,
396
+ };
397
+ this.createDashboardService
398
+ .checkDuplicateDashboardName(payload)
399
+ .subscribe(
400
+ (res) => {
401
+ if (!res) {
402
+ this.vLoader = false;
403
+ this.showRiskWidgets =
404
+ this.isManageRisk &&
405
+ this.showRiskCategory &&
406
+ (this.dashboardForm.selectedRiskCategories.length > 0 ||
407
+ this.dashboardForm.selectedResponsibilityCenters.length > 0)
408
+ ? true
409
+ : false;
410
+ this.showComplianceWidgets =
411
+ this.dashboardForm.selectedResponsibilityCategories.length >
412
+ 0 ||
413
+ this.dashboardForm.selectedResponsibilityCenters.length > 0
414
+ ? true
415
+ : false;
416
+ this.openConfigureWidgets = true;
417
+ } else {
418
+ this.vLoader = false;
419
+ this.snackBar.show(
420
+ 'A dashboard with this name already exists. Specify a different name for the dashboard.',
421
+ 'alert'
422
+ );
423
+ return;
424
+ }
425
+ },
426
+ (error) => {
427
+ this.vLoader = false;
428
+ console.error(error);
429
+ }
430
+ );
431
+ }
432
+ }
433
+ }
434
+
435
+ /**
436
+ * Fetches organization users count api to get total number of pages
437
+ * @param Url contains prams
438
+ */
439
+ getOrganizationUsersCount(Url: any) {
440
+ this.createDashboardService
441
+ .getOrganizationUsersCount(Url)
442
+ .subscribe((res) => {
443
+ this.totalList = res.total_members;
444
+ if (res.total_members && res.limit_per_page > 1) {
445
+ this.totalPages = res.create_page;
446
+ } else {
447
+ this.totalPages = 1;
448
+ }
449
+ });
450
+ }
451
+
452
+ /**
453
+ * Get users list by making api call and pre selects all admins by adding to viewers
454
+ * @param url contains query params for organization users api
455
+ */
456
+ getUsersList(url: any) {
457
+ this.createDashboardService.getAllUsers().subscribe((res: any) => {
458
+ this.usersList = res;
459
+ this.userListLoaded = true;
460
+
461
+ if (this.mode === 'EDIT') {
462
+ this.vLoader = true;
463
+ } else {
464
+ this.dashboardForm.selectedViewers = this.setList(
465
+ this.usersList,
466
+ [this.createdBy],
467
+ 'member_id'
468
+ );
469
+ this.listDetails.selectedUsersList = this.dashboardForm.selectedViewers;
470
+ this.vLoader = false;
471
+ }
472
+ });
473
+ }
474
+
475
+ getGroupList() {
476
+ this.createDashboardService.getAllGroups().subscribe((res: any) => {
477
+ this.totalgroups = res.total_items;
478
+ this.groupList = res.data;
479
+ this.userListLoaded = true;
480
+ if (this.mode === 'EDIT') {
481
+ this.vLoader = true;
482
+ } else {
483
+ this.dashboardForm.selectedGroup = this.setList(
484
+ this.groupList,
485
+ [this.createdBy],
486
+ 'group_id'
487
+ );
488
+ this.listDetails.selectedGroupList = this.dashboardForm.selectedGroup;
489
+ this.vLoader = false;
490
+ }
491
+ });
492
+ }
493
+
494
+ getComplianceCategoryList() {
495
+ this.createDashboardService
496
+ .getComplianceCategoriesListFromGlobal()
497
+ .subscribe(
498
+ (res: any) => {
499
+ const data = res;
500
+ this.allComplianceCategories = Object.assign(res);
501
+ // cloneDeep(res);
502
+ data.forEach((element: any) => {
503
+ if (element && element.compliance_type == 0) {
504
+ this.responsibilityCategoriesTree.others.list.push(element);
505
+ }
506
+ if (element && element.compliance_type == 1) {
507
+ this.responsibilityCategoriesTree.regulations.list.push(element);
508
+ }
509
+ if (element && element.compliance_type == 2) {
510
+ this.responsibilityCategoriesTree.standards.list.push(element);
511
+ }
512
+ if (element && element.compliance_type == 3) {
513
+ this.responsibilityCategoriesTree.internalControls.list.push(
514
+ element
515
+ );
516
+ }
517
+ });
518
+ this.complianceCategoriesListLoaded = true;
519
+ },
520
+ (err: any) => {
521
+ console.error(err);
522
+ this.complianceCategoriesListLoaded = true;
523
+ }
524
+ );
525
+ }
526
+
527
+ getCategoryList() {
528
+ this.createDashboardService.getCategoryList().subscribe(
529
+ (res: any) => {
530
+ this.riskCategoryList.strategic.list = res.strategic_arr;
531
+ this.riskCategoryList.operational.list = res.operational_arr;
532
+ this.riskCategoryList.compliance.list = res.compliance_arr;
533
+ this.riskCategoryList.others.list = res.others_arr;
534
+ this.riskCategoryListLoaded = true;
535
+ this.allRiskCategories = [
536
+ ...new Set(
537
+ this.allRiskCategories.concat(
538
+ res.strategic_arr,
539
+ res.operational_arr,
540
+ res.compliance_arr,
541
+ res.others_arr
542
+ )
543
+ ),
544
+ ];
545
+ },
546
+ (err) => {
547
+ console.error(err);
548
+ this.riskCategoryListLoaded = true;
549
+ }
550
+ );
551
+ }
552
+
553
+ /**
554
+ * It is to ensure whether all required lists on Policy from is loaded from the api call or not
555
+ */
556
+ checkWhetherAllListsLoaded() {
557
+ if (
558
+ this.rcListLoaded &&
559
+ this.complianceCategoriesListLoaded &&
560
+ this.riskCategoryListLoaded &&
561
+ this.userListLoaded
562
+ ) {
563
+ if (this.mode === 'EDIT') {
564
+ this.editDashboard();
565
+ } else {
566
+ this.vLoader = false;
567
+ }
568
+ } else {
569
+ setTimeout(() => {
570
+ this.checkWhetherAllListsLoaded();
571
+ }, 300);
572
+ }
573
+ }
574
+
575
+ setSelectedWidgets(data: any) {
576
+ if (this.mode === 'CREATE') {
577
+ const widgetsArray: any = [];
578
+ data.forEach((element: any) => {
579
+ let obj: any = {};
580
+ obj.module_name = element.module;
581
+ obj._id = '';
582
+ obj.widget_name = element.title;
583
+ obj.widget_code = element.id;
584
+ obj.sub_widgets = [];
585
+ obj.state = 'ACTIVE';
586
+ if (element.subWidgets.length > 0) {
587
+ element.subWidgets.forEach((subWidget: any) => {
588
+ let subWidgetObject: any = {};
589
+ subWidgetObject._id = '';
590
+ subWidgetObject.widget_name = subWidget.title;
591
+ subWidgetObject.widget_code = subWidget.id;
592
+ subWidgetObject.state = subWidget.value ? 'ACTIVE' : 'INACTIVE';
593
+ obj.sub_widgets.push(Object.assign(subWidgetObject));
594
+ });
595
+ }
596
+ widgetsArray.push(obj);
597
+ });
598
+
599
+ this.dashboardForm.configureWidget = widgetsArray;
600
+ } else if (this.mode === 'EDIT') {
601
+ const widgetsArray: any = [];
602
+
603
+ data.forEach((element: any) => {
604
+ if (
605
+ !JSON.stringify(this.dashboardForm.configureWidget).includes(
606
+ element.id
607
+ )
608
+ ) {
609
+ let obj: any = {};
610
+ obj.module_name = element.module;
611
+ obj._id = '';
612
+ obj.widget_name = element.title;
613
+ obj.widget_code = element.id;
614
+ obj.sub_widgets = [];
615
+ obj.state = 'ACTIVE';
616
+ if (element.subWidgets.length > 0) {
617
+ element.subWidgets.forEach((subWidget: any) => {
618
+ let subWidgetObject: any = {};
619
+ subWidgetObject._id = '';
620
+ subWidgetObject.widget_name = subWidget.title;
621
+ subWidgetObject.widget_code = subWidget.id;
622
+ subWidgetObject.state = subWidget.value ? 'ACTIVE' : 'INACTIVE';
623
+ obj.sub_widgets.push(subWidgetObject);
624
+ });
625
+ }
626
+ this.dashboardForm.configureWidget.push(obj);
627
+ } else {
628
+ const index = this.selectedWidgets.findIndex(
629
+ (ele: any) => ele.widget_code == element.id
630
+ );
631
+ if (index != -1) {
632
+ this.selectedWidgets[index].state = 'ACTIVE';
633
+ if (this.selectedWidgets[index].sub_widgets.length > 0) {
634
+ this.selectedWidgets[index].sub_widgets.forEach(
635
+ (subWidgetData: any) => {
636
+ const elementIndex = element.subWidgets.findIndex(
637
+ (ele: any) => ele.id == subWidgetData.widget_code
638
+ );
639
+ if (elementIndex != -1) {
640
+ subWidgetData.state = element.subWidgets[elementIndex].value
641
+ ? 'ACTIVE'
642
+ : 'INACTIVE';
643
+ }
644
+ }
645
+ );
646
+ }
647
+ }
648
+ }
649
+ });
650
+ this.dashboardForm.configureWidget.forEach((savedWidget: any) => {
651
+ const index = data.findIndex(
652
+ (dataElement: any) => dataElement.id == savedWidget.widget_code
653
+ );
654
+ if (index == -1) {
655
+ savedWidget.state = 'INACTIVE';
656
+ if (savedWidget.sub_widgets.length > 0) {
657
+ savedWidget.sub_widgets.forEach((saveSubWidget: any) => {
658
+ saveSubWidget.state = 'INACTIVE';
659
+ });
660
+ }
661
+ }
662
+ });
663
+ }
664
+ this.selectedWidgets = data;
665
+ this.openConfigureWidgets = false;
666
+ this.submitDashboard();
667
+ }
668
+
669
+ closeConfigureWidgets(event: boolean) {
670
+ this.openConfigureWidgets = event;
671
+ }
672
+
673
+ /**
674
+ * Filter list user's list based on pagination by making api call
675
+ * @param event specifies a boolean value to call api
676
+ */
677
+ paginationFilter(event: any) {
678
+ if (event) {
679
+ this.getUsersList({
680
+ p:
681
+ this.paginationService.currentPage === 1
682
+ ? ''
683
+ : this.paginationService.currentPage,
684
+ type: 'all_except_executive',
685
+ q: !this.paginationService.searchValue
686
+ ? ''
687
+ : this.paginationService.searchValue,
688
+ });
689
+ }
690
+ }
691
+
692
+ getRCList() {
693
+ this.createDashboardService.getResponsibilityCenterList().subscribe(
694
+ (res: any) => {
695
+ this.responsibilityCentersList = res;
696
+ this.rcListLoaded = true;
697
+ },
698
+ (err: any) => {
699
+ console.error(err);
700
+ this.rcListLoaded = true;
701
+ }
702
+ );
703
+ }
704
+ /**
705
+ * #### Description
706
+ *
707
+ * Returns the unique array of object based on unique key
708
+ * @param array
709
+ * @param key
710
+ * @returns
711
+ */
712
+ uniqueByProp(array: any, key: string) {
713
+ return Array.from(
714
+ array
715
+ .reduce(
716
+ (acc: any, item: any) => (
717
+ item && item[key] && acc.set(item[key], item), acc
718
+ ),
719
+ new Map()
720
+ )
721
+ .values()
722
+ );
723
+ }
724
+
725
+ saveSelectedList(type: string, selectedItems: any) {
726
+ switch (type) {
727
+ case 'rc':
728
+ this.dashboardForm.selectedResponsibilityCenters = this.setList(
729
+ this.responsibilityCentersList,
730
+ selectedItems,
731
+ 'item_id'
732
+ );
733
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
734
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
735
+ this.selectedWidgets = this.selectedWidgets.filter(
736
+ (element: any) => element.module_name != 'COMPLIANCE'
737
+ );
738
+ } else if (this.dashboardForm.selectedRiskCategories.length == 0) {
739
+ this.selectedWidgets = this.selectedWidgets.filter(
740
+ (element: any) => element.module_name != 'RISK'
741
+ );
742
+ }
743
+ }
744
+ break;
745
+ case 'whoCanView':
746
+ this.dashboardForm.selectedViewers = this.uniqueByProp(
747
+ selectedItems?.users,
748
+ 'member_id'
749
+ );
750
+ this.listDetails.selectedUsersList = this.dashboardForm.selectedViewers;
751
+ this.dashboardForm.selectedGroup = this.uniqueByProp(
752
+ selectedItems?.groups,
753
+ 'group_id'
754
+ );
755
+ this.listDetails.selectedGroupList = this.dashboardForm.selectedGroup;
756
+ break;
757
+ case 'responsibilityCategories':
758
+ this.dashboardForm.selectedResponsibilityCategories = selectedItems;
759
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
760
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
761
+ this.selectedWidgets = this.selectedWidgets.filter(
762
+ (element: any) => element.module_name != 'COMPLIANCE'
763
+ );
764
+ } else if (this.dashboardForm.selectedRiskCategories.length == 0) {
765
+ this.selectedWidgets = this.selectedWidgets.filter(
766
+ (element: any) => element.module_name != 'RISK'
767
+ );
768
+ }
769
+ }
770
+ break;
771
+ case 'riskCategory':
772
+ this.dashboardForm.selectedRiskCategories = selectedItems;
773
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
774
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
775
+ this.selectedWidgets = this.selectedWidgets.filter(
776
+ (element: any) => element.module_name != 'COMPLIANCE'
777
+ );
778
+ } else if (this.dashboardForm.selectedRiskCategories.length == 0) {
779
+ this.selectedWidgets = this.selectedWidgets.filter(
780
+ (element: any) => element.module_name != 'RISK'
781
+ );
782
+ }
783
+ }
784
+ break;
785
+ }
786
+ this.activateSelector('', false);
787
+ }
788
+
789
+ remove(type: any, event: any, removeIndex?: any) {
790
+ switch (type) {
791
+ case 'rc':
792
+ const rcIndex =
793
+ this.dashboardForm.selectedResponsibilityCenters.findIndex(
794
+ (rc: any) => rc.rc_id == event.rc_id
795
+ );
796
+ if (rcIndex !== -1) {
797
+ const parentRc: any =
798
+ this.dashboardForm.selectedResponsibilityCenters[rcIndex];
799
+ this.dashboardForm.selectedResponsibilityCenters.splice(rcIndex, 1);
800
+
801
+ if (parentRc?.item_child_ids?.length > 0) {
802
+ parentRc.item_child_ids.forEach((childElement: any) => {
803
+ const removeIndex =
804
+ this.dashboardForm.selectedResponsibilityCenters.findIndex(
805
+ (removeElement: any) => removeElement.rc_id == childElement
806
+ );
807
+ this.dashboardForm.selectedResponsibilityCenters.splice(
808
+ removeIndex,
809
+ 1
810
+ );
811
+ });
812
+ }
813
+ }
814
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
815
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
816
+ this.selectedWidgets = this.selectedWidgets.filter(
817
+ (element: any) => element.module_name != 'COMPLIANCE'
818
+ );
819
+ } else if (this.dashboardForm.selectedRiskCategories.length == 0) {
820
+ this.selectedWidgets = this.selectedWidgets.filter(
821
+ (element: any) => element.module_name != 'RISK'
822
+ );
823
+ }
824
+ }
825
+ break;
826
+
827
+ case 'whoCanView':
828
+ const reviewerIndex = this.dashboardForm.selectedViewers.findIndex(
829
+ (viewer: any) => viewer.member_id == event.member_id
830
+ );
831
+ this.dashboardForm.selectedViewers.splice(reviewerIndex, 1);
832
+ break;
833
+ case 'whoCanViewGroup':
834
+ const groups = this.dashboardForm.selectedGroup.findIndex(
835
+ (ele: any) => ele?.group_id == event?.group_id
836
+ );
837
+ this.dashboardForm.selectedGroup.splice(groups, 1);
838
+ break;
839
+ case 'responsibilityCategories':
840
+ const CCcategoryIndex =
841
+ this.dashboardForm.selectedResponsibilityCategories.findIndex(
842
+ (CCcategory: any) => CCcategory.category_id == event.category_id
843
+ );
844
+ this.dashboardForm.selectedResponsibilityCategories.splice(
845
+ CCcategoryIndex,
846
+ 1
847
+ );
848
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
849
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
850
+ this.selectedWidgets = this.selectedWidgets.filter(
851
+ (element: any) => element.module_name != 'COMPLIANCE'
852
+ );
853
+ } else if (this.dashboardForm.selectedRiskCategories.length == 0) {
854
+ this.selectedWidgets = this.selectedWidgets.filter(
855
+ (element: any) => element.module_name != 'RISK'
856
+ );
857
+ }
858
+ }
859
+ break;
860
+
861
+ case 'riskCategory':
862
+ const riskCategoryIndex =
863
+ this.dashboardForm.selectedRiskCategories.findIndex(
864
+ (riskCategory: any) => riskCategory.category_id == event.category_id
865
+ );
866
+ if (riskCategoryIndex !== -1) {
867
+ const parent: any =
868
+ this.dashboardForm.selectedRiskCategories[riskCategoryIndex];
869
+ this.dashboardForm.selectedRiskCategories.splice(
870
+ riskCategoryIndex,
871
+ 1
872
+ );
873
+ if (parent?.child_cat_ids?.length > 0) {
874
+ parent.child_cat_ids.forEach((childElement: any) => {
875
+ const removeIndex =
876
+ this.dashboardForm.selectedRiskCategories.findIndex(
877
+ (removeElement: any) =>
878
+ removeElement.category_id == childElement
879
+ );
880
+ this.dashboardForm.selectedRiskCategories.splice(removeIndex, 1);
881
+ });
882
+ }
883
+ }
884
+ this.dashboardForm.selectedRiskCategories.splice(riskCategoryIndex, 1);
885
+ if (this.dashboardForm.selectedResponsibilityCenters.length == 0) {
886
+ if (this.dashboardForm.selectedResponsibilityCategories.length == 0) {
887
+ this.selectedWidgets = this.selectedWidgets.filter(
888
+ (element: any) => element.module_name != 'COMPLIANCE'
889
+ );
890
+ } else if (this.dashboardForm.selectedRiskCategories.length == 0) {
891
+ this.selectedWidgets = this.selectedWidgets.filter(
892
+ (element: any) => element.module_name != 'RISK'
893
+ );
894
+ }
895
+ }
896
+ break;
897
+ }
898
+ }
899
+
900
+ setList(list: any[], ids: any[], key: string) {
901
+ const data: any = [];
902
+
903
+ ids.forEach((element: any) => {
904
+ const index = list.findIndex(
905
+ (listElement: any) => listElement[key] == element
906
+ );
907
+ if (index !== -1) {
908
+ data.push(list[index]);
909
+ }
910
+ });
911
+ return data;
912
+ }
913
+ submitted = false;
914
+
915
+ /**
916
+ * Returns id's from a particular list elements
917
+ * @param list actual selected list
918
+ * @param key contains key to extract id from the list
919
+ */
920
+ returnIds(list: any[], key: string) {
921
+ return list?.map((ele) => {
922
+ if (ele[key]) {
923
+ return ele[key];
924
+ }
925
+ });
926
+ }
927
+
928
+ /**
929
+ * Validates the data submitted on create dashboard form
930
+ */
931
+ validateDashboard() {
932
+ setTimeout(() => {
933
+ this.submitted = true;
934
+ }, 100);
935
+ const event = this.dashboardForm.dashboardName;
936
+ const re = /&nbsp;|<br>/g;
937
+ this.dashboardForm.dashboardName = event.replace(re, '').trim();
938
+ const description = this.dashboardForm.dashboardDescriptionText;
939
+ this.dashboardForm.dashboardDescriptionText = description
940
+ .replace(re, '')
941
+ .trim();
942
+ if (
943
+ !this.dashboardForm.dashboardName ||
944
+ this.dashboardForm.dashboardName.trim() == '' ||
945
+ this.dashboardForm.dashboardName.length > 30 ||
946
+ this.textCount.transform(this.dashboardForm?.dashboardDescriptionText) >
947
+ 250 ||
948
+ (this.dashboardForm?.selectedFromDate &&
949
+ !this.dashboardForm?.selectedToDate) ||
950
+ (this.dashboardForm.selectedResponsibilityCenters.length == 0 &&
951
+ this.dashboardForm.selectedResponsibilityCategories.length == 0 &&
952
+ this.dashboardForm.selectedRiskCategories.length == 0)
953
+ ) {
954
+ return false;
955
+ } else {
956
+ return true;
957
+ }
958
+ }
959
+
960
+ /**
961
+ * Makes an api call to create a policy
962
+ * @param dashboard contains dashboardForm data
963
+ */
964
+ submitDashboard() {
965
+ this.submitted = false;
966
+ const valid = this.validateDashboard();
967
+ if (!valid) {
968
+ return false;
969
+ }
970
+ this.vLoader = true;
971
+ const dashboard = this.dashboardForm;
972
+ const payload: any = {
973
+ dashboard_name: dashboard.dashboardName,
974
+ description: [
975
+ {
976
+ content: dashboard.dashboardDescriptionText,
977
+ attachments: [],
978
+ },
979
+ ],
980
+ visible_to_users: this.returnIds(dashboard.selectedViewers, 'member_id'),
981
+ visible_to_groups: this.returnIds(dashboard.selectedGroup, 'group_id'),
982
+ responsibility_center: this.returnIds(
983
+ dashboard.selectedResponsibilityCenters,
984
+ 'item_id'
985
+ ),
986
+ responsibility_category: this.returnIds(
987
+ dashboard.selectedResponsibilityCategories,
988
+ 'category_id'
989
+ ),
990
+ risk_category: this.returnIds(
991
+ dashboard.selectedRiskCategories,
992
+ 'category_id'
993
+ ),
994
+ display_criteria:
995
+ dashboard.displayCriteria === 'and'
996
+ ? 'BOTH_RC_AND_CATEGORY'
997
+ : 'RC_OR_CATEGORY',
998
+ timeframe: {
999
+ start_date: dashboard.selectedFromDate
1000
+ ? this.getDateFormate(dashboard?.selectedFromDate)
1001
+ : '',
1002
+ end_date: dashboard.selectedToDate
1003
+ ? this.getDateFormate(dashboard?.selectedToDate)
1004
+ : '',
1005
+ },
1006
+ email_summary: this.setFrequency('', 'export'), //setFormat
1007
+ widget_details: dashboard.configureWidget,
1008
+ };
1009
+ if (this.mode == 'CREATE') {
1010
+ this.createDashboardService.submitDashboard(payload).subscribe(
1011
+ (res: any) => {
1012
+ this.vLoader = false;
1013
+ // this.snackBar.show('The dashboard has been created.','info');
1014
+ this.isSmiley = true;
1015
+ this.smileyMessage = 'The dashboard has been created.';
1016
+ setTimeout(() => {
1017
+ this.isSmiley = false;
1018
+ this.close.emit({ mode: 'created', id: res._id });
1019
+ }, 3000);
1020
+ },
1021
+ (err) => {
1022
+ if (err.status === 409) {
1023
+ this.snackBar.show(
1024
+ 'A dashboard with this name already exists. Specify a different name for the dashboard.',
1025
+ 'alert'
1026
+ );
1027
+ this.vLoader = false;
1028
+ } else {
1029
+ console.error(err);
1030
+ this.vLoader = false;
1031
+ this.snackBar.show(
1032
+ 'OOPS! Something went wrong and the page could not be loaded. Could you please try one more time?',
1033
+ 'alert'
1034
+ );
1035
+ }
1036
+ }
1037
+ );
1038
+ }
1039
+ if (this.mode === 'EDIT') {
1040
+ payload.widget_update_flag = true;
1041
+ this.createDashboardService
1042
+ .updateDashboard(this.dashboardId, payload)
1043
+ .subscribe({
1044
+ next: (res: any) => {
1045
+ this.vLoader = false;
1046
+ // this.snackBar.show('The dashboard has been updated','info');
1047
+ this.isSmiley = true;
1048
+ this.smileyMessage = 'The dashboard has been updated';
1049
+ setTimeout(() => {
1050
+ this.isSmiley = false;
1051
+ this.close.emit({ mode: 'updated' });
1052
+ }, 3000);
1053
+ },
1054
+ error: (error: any) => {
1055
+ console.error(error);
1056
+ this.vLoader = false;
1057
+ this.snackBar.show(
1058
+ 'OOPS! Something went wrong and the page could not be loaded. Could you please try one more time?',
1059
+ 'alert'
1060
+ );
1061
+ },
1062
+ });
1063
+ }
1064
+ }
1065
+
1066
+ editDashboard() {
1067
+ if (this.dashboardId) {
1068
+ this.createDashboardService.fetchDashboard(this.dashboardId).subscribe(
1069
+ (res: any) => {
1070
+ const data = res;
1071
+ this.listDetails.nonRemovableUsersList = [res.created_by];
1072
+ data.visible_to_groups =
1073
+ data?.visible_to_groups && data.visible_to_groups.length
1074
+ ? data.visible_to_groups
1075
+ : [];
1076
+ this.populateDashboardForm(data);
1077
+ },
1078
+ (error) => {
1079
+ console.error(error);
1080
+ }
1081
+ );
1082
+ }
1083
+ }
1084
+
1085
+ populateDashboardForm(data: any) {
1086
+ try {
1087
+ (this.dashboardForm.dashboardName = data?.dashboard_name),
1088
+ (this.dashboardForm.dashboardDescriptionText =
1089
+ data?.description[0]?.content ?? ''),
1090
+ (this.dashboardForm.selectedViewers = this.setList(
1091
+ this.usersList,
1092
+ data?.visible_to_users,
1093
+ 'member_id'
1094
+ ));
1095
+ this.listDetails.selectedUsersList = this.dashboardForm.selectedViewers;
1096
+ data.visible_to_groups =
1097
+ data?.visible_to_groups && data?.visible_to_groups.length
1098
+ ? data?.visible_to_groups
1099
+ : [];
1100
+ this.dashboardForm.selectedGroup = this.setList(
1101
+ this.groupList,
1102
+ data?.visible_to_groups ?? [],
1103
+ 'group_id'
1104
+ );
1105
+ this.listDetails.selectedGroupList = this.dashboardForm.selectedGroup;
1106
+ this.dashboardForm.selectedResponsibilityCenters = this.setList(
1107
+ this.responsibilityCentersList,
1108
+ data?.responsibility_center,
1109
+ 'item_id'
1110
+ );
1111
+ this.dashboardForm.selectedResponsibilityCategories = this.setList(
1112
+ this.allComplianceCategories,
1113
+ data?.responsibility_category,
1114
+ 'category_id'
1115
+ );
1116
+ this.dashboardForm.selectedRiskCategories = this.setList(
1117
+ this.allRiskCategories,
1118
+ data?.risk_category,
1119
+ 'category_id'
1120
+ );
1121
+ this.dashboardForm.displayCriteria =
1122
+ data?.display_criteria === 'BOTH_RC_AND_CATEGORY' ? 'and' : 'or';
1123
+ this.dashboardForm.selectedFromDate = data?.timeframe?.start_date
1124
+ ? new Date(data?.timeframe?.start_date)
1125
+ : undefined;
1126
+ this.dashboardForm.selectedToDate = data?.timeframe?.end_date
1127
+ ? new Date(data?.timeframe?.end_date)
1128
+ : undefined;
1129
+ this.vLoader = false;
1130
+ this.dashboardForm.configureWidget = data.widget_details;
1131
+ this.selectedWidgets =
1132
+ data.widget_details.length > 0 ? [...new Set(data.widget_details)] : [];
1133
+ this.displayedWidgets =
1134
+ data.all_widgets.length > 0 ? [...new Set(data.all_widgets)] : [];
1135
+ this.setFrequency(data?.email_summary, 'import');
1136
+ let minToDate = this.setToDate(data?.timeframe?.start_date);
1137
+ this.toDatePickerConfig = { min: minToDate };
1138
+ this.hideToDate = true;
1139
+ setTimeout(() => {
1140
+ this.hideToDate = false;
1141
+ }, 20);
1142
+ } catch (error) {
1143
+ console.error('populate dashboard error =>', error);
1144
+ }
1145
+ }
1146
+
1147
+ setFrequency(event: any, mode: any) {
1148
+ if (mode === 'export') {
1149
+ switch (this.dashboardForm.selectedFrequencyType) {
1150
+ case 'weekly':
1151
+ const weeklyValueData = this.dashboardForm?.selectedFrequencies?.map(
1152
+ (ele: any) => Number(ele) + 1
1153
+ );
1154
+ const weeklyValue = weeklyValueData?.join();
1155
+ return '2~' + weeklyValue + '~0~0';
1156
+ case 'monthly':
1157
+ const monthlyValueData = this.dashboardForm?.selectedFrequencies?.map(
1158
+ (ele: any) => Number(ele) + 1
1159
+ );
1160
+ const monthlyValue = monthlyValueData?.join();
1161
+ return (
1162
+ '3~' + this.dashboardForm?.frequencyDate + '~' + monthlyValue + '~0'
1163
+ );
1164
+ case 'quarterly':
1165
+ const quarterlyValueData =
1166
+ Number(this.dashboardForm.selectedFrequencies) + 1;
1167
+ return (
1168
+ '7~' +
1169
+ this.dashboardForm.frequencyDate +
1170
+ '~' +
1171
+ quarterlyValueData +
1172
+ '~0'
1173
+ );
1174
+ }
1175
+ }
1176
+ if (mode === 'import') {
1177
+ const val = event.split('~');
1178
+ switch (val[0]) {
1179
+ case '2':
1180
+ {
1181
+ let stringVal = 'Every ';
1182
+ this.dashboardForm.selectedFrequencyType = 'weekly';
1183
+ this.dashboardForm.selectedFrequencies = val[1]
1184
+ ?.split(',')
1185
+ ?.map((element: any) => Number(element) - 1);
1186
+ this.dashboardForm.selectedFrequencies?.forEach(
1187
+ (dayIndex: any, index: any) => {
1188
+ stringVal +=
1189
+ index === 0
1190
+ ? this.dayNames[dayIndex]
1191
+ : ', ' + this.dayNames[dayIndex];
1192
+ }
1193
+ );
1194
+ this.dashboardForm.frequencyMessage = stringVal;
1195
+ }
1196
+
1197
+ break;
1198
+ case '3':
1199
+ {
1200
+ let stringVal = 'every ';
1201
+ this.dashboardForm.selectedFrequencyType = 'monthly';
1202
+ this.dashboardForm.frequencyDate = val[1];
1203
+ this.dashboardForm.selectedFrequencies = val[2]
1204
+ ?.split(',')
1205
+ ?.map((element: any) => Number(element) - 1);
1206
+ this.dashboardForm.selectedFrequencies.forEach(
1207
+ (monthIndex: any, index: any) => {
1208
+ stringVal +=
1209
+ index === 0
1210
+ ? this.monthNames[monthIndex]
1211
+ : ', ' + this.monthNames[monthIndex];
1212
+ }
1213
+ );
1214
+ let monthDateName;
1215
+ if (this.dashboardForm.frequencyDate == '1') {
1216
+ monthDateName = '1st';
1217
+ } else if (this.dashboardForm.frequencyDate == '2') {
1218
+ monthDateName = '2nd';
1219
+ } else if (this.dashboardForm.frequencyDate == '3') {
1220
+ monthDateName = '3rd';
1221
+ } else {
1222
+ monthDateName = this.dashboardForm.frequencyDate + 'th';
1223
+ }
1224
+ this.dashboardForm.frequencyMessage =
1225
+ monthDateName + ' of ' + stringVal;
1226
+ }
1227
+ break;
1228
+ case '7':
1229
+ {
1230
+ let stringVal = 'every ';
1231
+ this.dashboardForm.selectedFrequencyType = 'quarterly';
1232
+ this.dashboardForm.frequencyDate = val[1];
1233
+ this.dashboardForm.selectedFrequencies =
1234
+ Number(val[2].split(',')[0]) - 1;
1235
+ stringVal += this.quarters[this.dashboardForm.selectedFrequencies];
1236
+ let monthDateName;
1237
+ if (this.dashboardForm.frequencyDate == '1') {
1238
+ monthDateName = '1st';
1239
+ } else if (this.dashboardForm.frequencyDate == '2') {
1240
+ monthDateName = '2nd';
1241
+ } else if (this.dashboardForm.frequencyDate == '3') {
1242
+ monthDateName = '3rd';
1243
+ } else {
1244
+ monthDateName = this.dashboardForm.frequencyDate + 'th';
1245
+ }
1246
+ this.dashboardForm.frequencyMessage =
1247
+ monthDateName + ' of ' + stringVal;
1248
+ }
1249
+ break;
1250
+ }
1251
+ }
1252
+ }
1253
+
1254
+ ngAfterViewChecked() {
1255
+ //your code to update the model
1256
+ this.cdr.detectChanges();
1257
+ }
1258
+
1259
+ setPermission(roleActions: any) {
1260
+ let ifExistRisk = roleActions?.find((el: any) => el.moduleName == 'risk');
1261
+ ifExistRisk?.subModule?.forEach((module: any) => {
1262
+ module?.permissions?.forEach((permission: any) => {
1263
+ switch (permission?.code) {
1264
+ case 'RRMR': {
1265
+ if (permission?.defaultPermission == 1 || permission?.enable == 1) {
1266
+ this.isManageRisk = true;
1267
+ }
1268
+ break;
1269
+ }
1270
+ }
1271
+ });
1272
+ });
1273
+ }
1274
+ @HostListener('document:click', ['$event'])
1275
+ documentClick(event: any): void {
1276
+ const targetElement = event?.target as Element;
1277
+ const fromDateInputElement =
1278
+ document.getElementById(this.openedDatePicker.toLowerCase()) || null;
1279
+ const datePickerCalendarContainer = document.getElementsByClassName(
1280
+ 'dp-day-calendar-container'
1281
+ )[0];
1282
+ const monthYearElement = document.querySelector(
1283
+ '.dp-month-calendar-container'
1284
+ );
1285
+ const isNotMonthYearElement = !monthYearElement?.contains(targetElement);
1286
+
1287
+ const openedElement =
1288
+ this.openedDatePicker === 'FROM_DATE'
1289
+ ? this.fromDatePickerPopup
1290
+ : this.toDatePickerPopup;
1291
+ const isOutsideFromDateInput =
1292
+ !openedElement?.nativeElement?.contains(targetElement);
1293
+ const isNotFromDateElement = event?.target !== fromDateInputElement;
1294
+ const isNotInsideCalendar =
1295
+ !datePickerCalendarContainer?.contains(targetElement);
1296
+ const selectedDatePicker =
1297
+ this.openedDatePicker === 'FROM_DATE'
1298
+ ? this.fromDatePicker
1299
+ : this.toDatePicker;
1300
+
1301
+ const isNotCalendarMonth =
1302
+ !targetElement.className.includes('dp-calendar-month');
1303
+
1304
+ if (
1305
+ isOutsideFromDateInput &&
1306
+ isNotFromDateElement &&
1307
+ isNotInsideCalendar &&
1308
+ isNotCalendarMonth &&
1309
+ isNotMonthYearElement &&
1310
+ datePickerCalendarContainer
1311
+ ) {
1312
+ this.documentClickListener(
1313
+ event.target,
1314
+ openedElement,
1315
+ selectedDatePicker
1316
+ );
1317
+ }
1318
+ }
1319
+
1320
+ documentClickListener(
1321
+ target: any,
1322
+ openedElements: ElementRef,
1323
+ selectedDatePicker: any
1324
+ ): void {
1325
+ if (
1326
+ !openedElements?.nativeElement?.contains(target) &&
1327
+ selectedDatePicker?.areCalendarsShown
1328
+ ) {
1329
+ selectedDatePicker?.api?.close();
1330
+ this.datePickerOverlay = false;
1331
+ }
1332
+ }
1333
+ }