vc-create-dashboard 2.9.5 → 2.9.7

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