ui-soxo-bootstrap-core 2.6.40-dev.0 → 2.6.40-dev.11

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 (417) hide show
  1. package/.babelrc +8 -8
  2. package/.github/workflows/npm-publish.yml +41 -33
  3. package/.husky/pre-commit +11 -11
  4. package/.prettierrc.json +10 -10
  5. package/DEVELOPER_GUIDE.md +323 -294
  6. package/babel.config.js +2 -2
  7. package/core/components/component-loader/component-loader.js +125 -125
  8. package/core/components/component-wrapper/component-wrapper.js +121 -121
  9. package/core/components/external-window/DEVELOPER_GUIDE.md +705 -705
  10. package/core/components/external-window/external-window.js +236 -236
  11. package/core/components/external-window/external-window.test.js +80 -80
  12. package/core/components/extra-info/extra-info-details.js +155 -155
  13. package/core/components/extra-info/extra-info-details.scss +26 -26
  14. package/core/components/extra-info/extra-info.js +134 -134
  15. package/core/components/index.js +12 -21
  16. package/core/components/landing-api/landing-api.js +707 -547
  17. package/core/components/landing-api/landing-api.scss +41 -41
  18. package/core/components/license-management/license-alert.js +97 -0
  19. package/core/components/menu-template-api/menu-template-api.js +321 -321
  20. package/core/components/root-application-api/root-application-api.js +174 -174
  21. package/core/index.js +13 -13
  22. package/core/lib/Store.js +369 -369
  23. package/core/lib/components/application-bootstrap/application-bootstrap.js +115 -115
  24. package/core/lib/components/approval-form/approval-form.js +280 -280
  25. package/core/lib/components/approval-form/approval-form.scss +183 -183
  26. package/core/lib/components/approval-list/approval-list.js +143 -143
  27. package/core/lib/components/approval-list/approval-list.scss +2 -2
  28. package/core/lib/components/approval-list/components/request-card/request-card.js +42 -42
  29. package/core/lib/components/approval-list/components/request-card/request-card.scss +30 -30
  30. package/core/lib/components/camera/camera.js +230 -230
  31. package/core/lib/components/camera/camera.scss +86 -86
  32. package/core/lib/components/comment-block/comment-block.js +138 -138
  33. package/core/lib/components/comment-block/comment-block.scss +3 -3
  34. package/core/lib/components/confirm-modal/confirm-modal.js +82 -82
  35. package/core/lib/components/confirm-modal/confirm-modal.scss +2 -2
  36. package/core/lib/components/consent/consent.js +67 -67
  37. package/core/lib/components/consent/pdf-signature.js +299 -299
  38. package/core/lib/components/consent/signature-pad.js +90 -90
  39. package/core/lib/components/consent/signature-pad.scss +14 -14
  40. package/core/lib/components/file-upload/file-upload.js +133 -133
  41. package/core/lib/components/finger-print-reader/finger-print-reader.js +295 -295
  42. package/core/lib/components/finger-print-reader/finger-print-reader.scss +47 -47
  43. package/core/lib/components/finger-print-search/finger-print-search.js +200 -200
  44. package/core/lib/components/finger-print-search/finger-print-search.scss +47 -47
  45. package/core/lib/components/global-header/animations.js +18 -18
  46. package/core/lib/components/global-header/global-header.js +287 -344
  47. package/core/lib/components/global-header/global-header.scss +397 -397
  48. package/core/lib/components/header/generic-header.js +76 -76
  49. package/core/lib/components/header/generic-header.scss +99 -99
  50. package/core/lib/components/image-preview/image-preview.js +33 -33
  51. package/core/lib/components/image-wrapper/image-wrapper.js +108 -108
  52. package/core/lib/components/image-wrapper/image-wrapper.scss +12 -12
  53. package/core/lib/components/index.js +206 -206
  54. package/core/lib/components/landing/landing.js +403 -403
  55. package/core/lib/components/language-switcher/language-switcher.js +49 -49
  56. package/core/lib/components/menu-context/menu-context.js +69 -69
  57. package/core/lib/components/menu-template/menu-template.js +249 -249
  58. package/core/lib/components/menu-template/menu-template.scss +9 -9
  59. package/core/lib/components/modal-search/modal-search.js +153 -153
  60. package/core/lib/components/modal-search/modal-search.scss +78 -78
  61. package/core/lib/components/modal-wrapper/modal-manager.js +15 -15
  62. package/core/lib/components/modal-wrapper/modal-wrapper.js +108 -108
  63. package/core/lib/components/modal-wrapper/modal-wrapper.scss +13 -13
  64. package/core/lib/components/notice-board/notice-board.js +132 -132
  65. package/core/lib/components/notice-board/notice-board.scss +65 -65
  66. package/core/lib/components/page-container/page-container.js +55 -55
  67. package/core/lib/components/page-container/page-container.scss +8 -8
  68. package/core/lib/components/page-header/page-header.js +23 -23
  69. package/core/lib/components/page-header/page-header.scss +17 -17
  70. package/core/lib/components/pdf-viewer/pdf-viewer.js +56 -56
  71. package/core/lib/components/portlet-table/components/table-actions/table-actions.js +58 -58
  72. package/core/lib/components/portlet-table/components/table-actions/table-actions.scss +1 -1
  73. package/core/lib/components/portlet-table/components/table-data/table-data.js +106 -106
  74. package/core/lib/components/portlet-table/portlet-table.js +63 -63
  75. package/core/lib/components/portlet-table/portlet-table.scss +90 -90
  76. package/core/lib/components/progress-bar/progress-bar.js +58 -58
  77. package/core/lib/components/progress-bar/progress-bar.scss +15 -15
  78. package/core/lib/components/request-form/request-form.js +110 -110
  79. package/core/lib/components/root-application/root-application.js +70 -70
  80. package/core/lib/components/rupee/rupee.js +14 -14
  81. package/core/lib/components/script-input/script-input.js +169 -169
  82. package/core/lib/components/script-input/script-input.scss +8 -8
  83. package/core/lib/components/sidemenu/animations.js +51 -51
  84. package/core/lib/components/sidemenu/sidemenu.js +713 -713
  85. package/core/lib/components/sidemenu/sidemenu.scss +314 -314
  86. package/core/lib/components/spotlight-search/spotlight-search.component.js +635 -635
  87. package/core/lib/components/spotlight-search/spotlight-search.component.scss +78 -78
  88. package/core/lib/components/table-wrapper/table-wrapper.js +135 -135
  89. package/core/lib/components/table-wrapper/table-wrapper.scss +72 -72
  90. package/core/lib/components/ui_elements/Loader.js +12 -12
  91. package/core/lib/components/ui_elements/Notify.js +12 -12
  92. package/core/lib/components/ui_elements/PlaceHolder.js +33 -33
  93. package/core/lib/components/web-camera/web-camera.js +161 -161
  94. package/core/lib/components/web-camera/web-camera.scss +28 -28
  95. package/core/lib/core.md +9 -9
  96. package/core/lib/elements/Elements.md +2 -2
  97. package/core/lib/elements/basic/LoggedUserRedirect.js +21 -21
  98. package/core/lib/elements/basic/PrivateRoute.js +16 -16
  99. package/core/lib/elements/basic/button/Button.md +43 -43
  100. package/core/lib/elements/basic/button/button.js +170 -170
  101. package/core/lib/elements/basic/card/Card.md +15 -15
  102. package/core/lib/elements/basic/card/card.js +40 -40
  103. package/core/lib/elements/basic/card/card.scss +13 -13
  104. package/core/lib/elements/basic/checkbox/checkbox.js +23 -23
  105. package/core/lib/elements/basic/col/col.js +15 -15
  106. package/core/lib/elements/basic/copy-to-clipboard/Readme.md +40 -40
  107. package/core/lib/elements/basic/copy-to-clipboard/copy-to-clipboard.js +61 -61
  108. package/core/lib/elements/basic/country-phone-input/Readme.md +98 -98
  109. package/core/lib/elements/basic/country-phone-input/country-phone-input.js +81 -81
  110. package/core/lib/elements/basic/country-phone-input/phone-input.scss +75 -75
  111. package/core/lib/elements/basic/datepicker/datepicker.js +33 -33
  112. package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +203 -203
  113. package/core/lib/elements/basic/empty/empty.js +14 -14
  114. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.js +118 -118
  115. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.scss +10 -10
  116. package/core/lib/elements/basic/form/form.js +70 -70
  117. package/core/lib/elements/basic/form/form.scss +3 -3
  118. package/core/lib/elements/basic/image/image.js +45 -45
  119. package/core/lib/elements/basic/image/image.scss +17 -17
  120. package/core/lib/elements/basic/image/readme.md +26 -26
  121. package/core/lib/elements/basic/image-viewer/image-viewer.js +108 -108
  122. package/core/lib/elements/basic/image-viewer/image-viewer.scss +7 -7
  123. package/core/lib/elements/basic/input/input.js +81 -81
  124. package/core/lib/elements/basic/input/readme.md +77 -77
  125. package/core/lib/elements/basic/json-input/json-input.js +51 -51
  126. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.js +216 -216
  127. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.scss +28 -28
  128. package/core/lib/elements/basic/menu-tree/menu-tree.js +127 -127
  129. package/core/lib/elements/basic/modal/modal.js +64 -64
  130. package/core/lib/elements/basic/modal/readme.md +62 -62
  131. package/core/lib/elements/basic/popconfirm/popconfirm.js +17 -17
  132. package/core/lib/elements/basic/popover/popover.js +12 -12
  133. package/core/lib/elements/basic/radio/radio.js +18 -18
  134. package/core/lib/elements/basic/rangepicker/rangepicker.js +141 -141
  135. package/core/lib/elements/basic/rangepicker/rangepicker.scss +24 -24
  136. package/core/lib/elements/basic/rangepicker/readme.md +81 -81
  137. package/core/lib/elements/basic/reference-select/readme.md +18 -18
  138. package/core/lib/elements/basic/reference-select/reference-select.js +337 -337
  139. package/core/lib/elements/basic/row/row.js +15 -15
  140. package/core/lib/elements/basic/select/select.js +46 -46
  141. package/core/lib/elements/basic/select-box/readme.md +52 -52
  142. package/core/lib/elements/basic/select-box/select-box.js +63 -63
  143. package/core/lib/elements/basic/skeleton/readme.md +35 -35
  144. package/core/lib/elements/basic/skeleton/skeleton.js +35 -35
  145. package/core/lib/elements/basic/skeleton/skeleton.scss +53 -53
  146. package/core/lib/elements/basic/space/space.js +12 -12
  147. package/core/lib/elements/basic/switch/readme.md +29 -29
  148. package/core/lib/elements/basic/switch/switch.js +67 -67
  149. package/core/lib/elements/basic/tab/tab.js +14 -14
  150. package/core/lib/elements/basic/table/readme.md +8 -8
  151. package/core/lib/elements/basic/table/table.js +95 -95
  152. package/core/lib/elements/basic/tag/tag.js +63 -63
  153. package/core/lib/elements/basic/tag/tag.scss +2 -2
  154. package/core/lib/elements/basic/timeline/timeline.js +13 -13
  155. package/core/lib/elements/basic/title/readme.md +20 -20
  156. package/core/lib/elements/basic/title/title.js +37 -37
  157. package/core/lib/elements/basic/user-search/user-search.js +192 -192
  158. package/core/lib/elements/complex/barcode/barcode.js +27 -27
  159. package/core/lib/elements/complex/bargraph/bar-graph.js +262 -262
  160. package/core/lib/elements/complex/basic-table/basic-table.js +110 -110
  161. package/core/lib/elements/complex/basic-table/basic-table.scss +4 -4
  162. package/core/lib/elements/complex/date-display/date-display.js +37 -37
  163. package/core/lib/elements/complex/error-boundary/error-boundary.js +29 -29
  164. package/core/lib/elements/complex/google-location-input/map-container-library-load.js +92 -92
  165. package/core/lib/elements/complex/google-map/google-map.js +230 -230
  166. package/core/lib/elements/complex/google-map/google-map.scss +13 -13
  167. package/core/lib/elements/complex/line-graph/line-graph.js +108 -108
  168. package/core/lib/elements/complex/location-search-input/location-search-input.js +100 -100
  169. package/core/lib/elements/complex/pie-chart/pie-chart.js +202 -202
  170. package/core/lib/elements/complex/qr-code/qr-code.js +27 -27
  171. package/core/lib/elements/complex/qrscanner/qrscanner.js +57 -57
  172. package/core/lib/elements/complex/search-debounce/search-debounce.js +37 -37
  173. package/core/lib/elements/complex/statistic-card/dashboard-statistic-card.js +75 -75
  174. package/core/lib/elements/complex/statistic-card/statistic-card.js +28 -28
  175. package/core/lib/elements/index.js +226 -226
  176. package/core/lib/hooks/device-detect.js +25 -25
  177. package/core/lib/hooks/index.js +9 -9
  178. package/core/lib/hooks/use-location.js +33 -33
  179. package/core/lib/hooks/use-otp-timer.js +80 -80
  180. package/core/lib/hooks/use-window-size.js +34 -34
  181. package/core/lib/i18n.js +69 -69
  182. package/core/lib/index.js +106 -106
  183. package/core/lib/introduction.md +73 -73
  184. package/core/lib/js-styleguide.md +4112 -4112
  185. package/core/lib/models/actions/actions.js +127 -127
  186. package/core/lib/models/actions/components/action-detail/action-detail.js +190 -190
  187. package/core/lib/models/actions/components/custom-actions/custom-actions.js +185 -185
  188. package/core/lib/models/attachments/attachments.js +231 -231
  189. package/core/lib/models/base-loader.js +99 -99
  190. package/core/lib/models/base.js +716 -716
  191. package/core/lib/models/branches/branches.js +125 -125
  192. package/core/lib/models/checklists/checklists.js +114 -114
  193. package/core/lib/models/columns/columns.js +169 -169
  194. package/core/lib/models/columns/components/columns-add/columns-add.js +171 -171
  195. package/core/lib/models/comments/comments.js +213 -213
  196. package/core/lib/models/departments/departments.js +107 -107
  197. package/core/lib/models/financial-years/financial_years.js +127 -127
  198. package/core/lib/models/forms/components/form-creator/form-creator.js +665 -665
  199. package/core/lib/models/forms/components/form-creator/form-creator.scss +39 -39
  200. package/core/lib/models/forms/components/form-detail/form-detail.js +224 -224
  201. package/core/lib/models/forms/forms.js +121 -121
  202. package/core/lib/models/index.js +203 -203
  203. package/core/lib/models/invoice-numbers/invoice_numbers.js +204 -204
  204. package/core/lib/models/lookup-types/components/lookup-detail/lookup-detail.js +145 -145
  205. package/core/lib/models/lookup-types/lookup-types.js +113 -113
  206. package/core/lib/models/lookup-values/components/lookup-values-add/lookup-values-add.js +126 -126
  207. package/core/lib/models/lookup-values/lookup-values.js +107 -107
  208. package/core/lib/models/menu-roles/menu-roles.js +127 -127
  209. package/core/lib/models/menus/components/menu-add/menu-add.js +228 -228
  210. package/core/lib/models/menus/components/menu-detail/menu-detail.js +170 -170
  211. package/core/lib/models/menus/components/menu-list/menu-list.js +550 -550
  212. package/core/lib/models/menus/components/menu-list/menu-list.scss +5 -5
  213. package/core/lib/models/menus/components/menu-roles-add/menu-roles-add.js +183 -183
  214. package/core/lib/models/menus/menus.js +499 -499
  215. package/core/lib/models/models/components/model-detail/model-detail.js +137 -137
  216. package/core/lib/models/models/components/models.js +128 -128
  217. package/core/lib/models/modules/modules.js +204 -204
  218. package/core/lib/models/outbox/outbox.js +73 -73
  219. package/core/lib/models/pages/pages.js +107 -107
  220. package/core/lib/models/permissions/permissions.js +71 -71
  221. package/core/lib/models/process/components/process-add/process-add.js +181 -181
  222. package/core/lib/models/process/components/process-dashboard/process-dashboard.js +1068 -1068
  223. package/core/lib/models/process/components/process-dashboard/process-dashboard.scss +66 -66
  224. package/core/lib/models/process/components/process-detail/process-detail.js +140 -140
  225. package/core/lib/models/process/components/process-timeline/process-timeline.js +139 -139
  226. package/core/lib/models/process/components/task-detail/task-detail.js +240 -240
  227. package/core/lib/models/process/components/task-detail/task-detail.scss +27 -27
  228. package/core/lib/models/process/components/task-form/task-form.js +528 -528
  229. package/core/lib/models/process/components/task-form/task-form.scss +7 -7
  230. package/core/lib/models/process/components/task-list/task-list.js +221 -221
  231. package/core/lib/models/process/components/task-list/task-list.scss +14 -14
  232. package/core/lib/models/process/components/task-overview/task-overview.js +299 -299
  233. package/core/lib/models/process/components/task-overview-legacy/task-overview-legacy.js +192 -192
  234. package/core/lib/models/process/components/task-routes/task-routes.js +45 -45
  235. package/core/lib/models/process/components/task-status/task-status.js +175 -175
  236. package/core/lib/models/process/components/task-status/task-status.scss +11 -11
  237. package/core/lib/models/process/process.js +780 -780
  238. package/core/lib/models/process-transactions/process-transactions.js +123 -123
  239. package/core/lib/models/roles/roles.js +106 -106
  240. package/core/lib/models/scripts/scripts.js +111 -111
  241. package/core/lib/models/step-transactions/step-transcations.js +147 -147
  242. package/core/lib/models/steps/components/step-add/step-add.js +261 -261
  243. package/core/lib/models/steps/components/step-detail/step-detail.js +157 -157
  244. package/core/lib/models/steps/steps.js +356 -356
  245. package/core/lib/models/user-preferences/user-preferences.js +83 -83
  246. package/core/lib/models/users/components/user-add/user-add.js +226 -226
  247. package/core/lib/models/users/users.js +119 -119
  248. package/core/lib/modules/business/launch-page/launch-page.js +29 -29
  249. package/core/lib/modules/business/launch-page/launch-page.scss +5 -5
  250. package/core/lib/modules/business/slots/slots.js +231 -231
  251. package/core/lib/modules/business/slots/slots.scss +108 -108
  252. package/core/lib/modules/forms/components/field-customizer/field-customizer.js +138 -138
  253. package/core/lib/modules/forms/components/field-selector/field-selector.js +157 -157
  254. package/core/lib/modules/forms/components/field-selector/field-selector.scss +25 -25
  255. package/core/lib/modules/forms/components/form-display/form-display.js +203 -203
  256. package/core/lib/modules/forms/components/form-display/form-display.scss +9 -9
  257. package/core/lib/modules/forms/components/tab-customizer/tab-customizer.js +124 -124
  258. package/core/lib/modules/generic/generic-add/generic-add.js +213 -213
  259. package/core/lib/modules/generic/generic-detail/generic-detail.js +199 -199
  260. package/core/lib/modules/generic/generic-edit/generic-edit.js +120 -120
  261. package/core/lib/modules/generic/generic-list/ExportReactCSV.js +414 -88
  262. package/core/lib/modules/generic/generic-list/generic-list.js +705 -705
  263. package/core/lib/modules/generic/generic-list/generic-list.scss +68 -34
  264. package/core/lib/modules/generic/generic-upload/generic-upload.js +483 -483
  265. package/core/lib/modules/generic/table-settings/table-settings.js +226 -226
  266. package/core/lib/modules/generic/table-settings/table-settings.scss +37 -37
  267. package/core/lib/modules/index.js +52 -52
  268. package/core/lib/modules/modules-routes/module-routes.js +35 -35
  269. package/core/lib/pages/change-password/change-password.js +204 -204
  270. package/core/lib/pages/change-password/change-password.scss +73 -73
  271. package/core/lib/pages/homepage/homepage.js +53 -53
  272. package/core/lib/pages/index.js +19 -19
  273. package/core/lib/pages/login/commnication-mode-selection.js +46 -46
  274. package/core/lib/pages/login/communication-mode-selection.scss +60 -60
  275. package/core/lib/pages/login/login.js +872 -872
  276. package/core/lib/pages/login/login.scss +353 -353
  277. package/core/lib/pages/login/reset-password.js +124 -124
  278. package/core/lib/pages/login/reset-password.scss +31 -31
  279. package/core/lib/pages/manage-users/manage-users.js +429 -429
  280. package/core/lib/pages/manage-users/manage-users.scss +25 -25
  281. package/core/lib/pages/profile/profile.js +247 -247
  282. package/core/lib/pages/profile/profile.scss +107 -107
  283. package/core/lib/pages/profile/theme-config.js +18 -18
  284. package/core/lib/pages/profile/themes-backup.json +310 -310
  285. package/core/lib/pages/profile/themes.json +254 -254
  286. package/core/lib/pages/register/register.js +176 -176
  287. package/core/lib/pages/register/register.scss +128 -128
  288. package/core/lib/react-styleguide.md +756 -756
  289. package/core/lib/utils/api/api.utils.js +207 -207
  290. package/core/lib/utils/api/readme.md +426 -426
  291. package/core/lib/utils/async.js +35 -35
  292. package/core/lib/utils/common/common.utils.js +237 -237
  293. package/core/lib/utils/common/readme.md +30 -30
  294. package/core/lib/utils/date/date.utils.js +295 -295
  295. package/core/lib/utils/date/readme.md +2 -2
  296. package/core/lib/utils/firebase.support.utils.js +98 -98
  297. package/core/lib/utils/firebase.utils.js +808 -808
  298. package/core/lib/utils/font-awesome.utils.js +168 -168
  299. package/core/lib/utils/form/form.utils.js +255 -255
  300. package/core/lib/utils/generic/generic.utils.js +70 -70
  301. package/core/lib/utils/http/auth.helper.js +95 -95
  302. package/core/lib/utils/http/http.utils.js +186 -186
  303. package/core/lib/utils/http/readme.md +14 -14
  304. package/core/lib/utils/index.js +43 -43
  305. package/core/lib/utils/location/location.utils.js +137 -137
  306. package/core/lib/utils/location/readme.md +18 -18
  307. package/core/lib/utils/modal.utils.js +15 -15
  308. package/core/lib/utils/notification.utils.js +34 -34
  309. package/core/lib/utils/pwa/pwa.utils.js +88 -88
  310. package/core/lib/utils/script.utils.js +235 -235
  311. package/core/lib/utils/setting.utils.js +68 -68
  312. package/core/lib/utils/upload.utils.js +29 -29
  313. package/core/models/Preference/Preferences.js +46 -46
  314. package/core/models/base/base.js +403 -403
  315. package/core/models/base-clone-loader.js +107 -107
  316. package/core/models/base-clone.js +187 -187
  317. package/core/models/base-loader.js +97 -97
  318. package/core/models/core-scripts/core-scripts.js +179 -158
  319. package/core/models/dashboard/dashboard.js +201 -201
  320. package/core/models/detail-loader.js +88 -88
  321. package/core/models/doctor/components/doctor-add/doctor-add.js +432 -432
  322. package/core/models/doctor/components/doctor-add/doctor-add.scss +32 -32
  323. package/core/models/groups.js +82 -82
  324. package/core/models/index.js +100 -100
  325. package/core/models/lookup-types/components/lookup-detail/lookup-detail.js +129 -129
  326. package/core/models/lookup-types/lookup-types.js +96 -96
  327. package/core/models/lookup-values/components/lookup-values-modal/lookup-values-modal.js +95 -95
  328. package/core/models/lookup-values/lookup-values.js +92 -92
  329. package/core/models/menu-roles/components/menu-roles-add/menu-roles-add.js +153 -153
  330. package/core/models/menu-roles/menu-roles.js +158 -158
  331. package/core/models/menus/components/menu-add/menu-add.js +288 -288
  332. package/core/models/menus/components/menu-add/menu-add.scss +31 -31
  333. package/core/models/menus/components/menu-detail/menu-detail.js +263 -263
  334. package/core/models/menus/components/menu-list/menu-list.js +392 -392
  335. package/core/models/menus/components/menu-lists/menu-lists.js +584 -584
  336. package/core/models/menus/components/menu-lists/menu-lists.scss +46 -46
  337. package/core/models/menus/menus.js +338 -310
  338. package/core/models/model-columns.js +121 -121
  339. package/core/models/models/components/model-detail/model-add.js +120 -120
  340. package/core/models/models/components/model-detail/model-detail.js +133 -133
  341. package/core/models/models/models.js +154 -154
  342. package/core/models/pages/components/page-add/page-add.js +163 -163
  343. package/core/models/pages/components/page-add/page-add.scss +30 -30
  344. package/core/models/pages/components/page-details/page-details.js +209 -209
  345. package/core/models/pages/components/page-list/page-list.js +248 -248
  346. package/core/models/pages/pages.js +142 -142
  347. package/core/models/pages.js +142 -142
  348. package/core/models/roles/components/role-add/role-add.js +222 -222
  349. package/core/models/roles/components/role-add/role-add.scss +4 -4
  350. package/core/models/roles/components/role-list/role-list.js +406 -406
  351. package/core/models/roles/roles.js +196 -196
  352. package/core/models/staff/components/staff-add/staff-add.js +455 -455
  353. package/core/models/user-roles/components/user-roles-add/user-roles-add.js +149 -149
  354. package/core/models/user-roles/user-roles.js +113 -113
  355. package/core/models/users/components/assign-role/assign-role.js +428 -428
  356. package/core/models/users/components/assign-role/assign-role.scss +281 -281
  357. package/core/models/users/components/assign-role/avatar-props.js +45 -45
  358. package/core/models/users/components/user-add/user-add.js +847 -847
  359. package/core/models/users/components/user-add/user-edit.js +110 -110
  360. package/core/models/users/components/user-detail/user-detail.js +236 -236
  361. package/core/models/users/components/user-list/user-list.js +397 -397
  362. package/core/models/users/users.js +379 -379
  363. package/core/modules/Informations/change-info/change-info.js +618 -618
  364. package/core/modules/Informations/change-info/change-info.scss +134 -134
  365. package/core/modules/dashboard/components/dashboard-card/animations.js +64 -64
  366. package/core/modules/dashboard/components/dashboard-card/dashboard-card.js +197 -197
  367. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +430 -430
  368. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.scss +59 -59
  369. package/core/modules/dashboard/components/pop-query-dashboard/pop-query-dashboard.js +66 -66
  370. package/core/modules/generic/components/generic-add/generic-add.js +121 -121
  371. package/core/modules/generic/components/generic-add/generic-add.scss +13 -13
  372. package/core/modules/generic/components/generic-add-modal/generic-add-modal.js +125 -125
  373. package/core/modules/generic/components/generic-add-modal/generic-add-modal.scss +13 -13
  374. package/core/modules/generic/components/generic-detail/generic-detail.js +184 -184
  375. package/core/modules/generic/components/generic-detail/generic-detail.scss +25 -25
  376. package/core/modules/generic/components/generic-edit/generic-edit.js +123 -123
  377. package/core/modules/generic/components/generic-list/generic-list.js +335 -335
  378. package/core/modules/generic/components/generic-list/generic-list.scss +35 -35
  379. package/core/modules/index.js +42 -42
  380. package/core/modules/module-routes/module-routes.js +37 -37
  381. package/core/modules/reporting/components/index.js +6 -6
  382. package/core/modules/reporting/components/reporting-dashboard/README.md +316 -316
  383. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.js +271 -271
  384. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.scss +76 -76
  385. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +90 -90
  386. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -74
  387. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +449 -252
  388. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +199 -126
  389. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +1116 -1096
  390. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.scss +215 -214
  391. package/core/modules/reporting/components/reporting-dashboard/reporting-table.js +519 -0
  392. package/core/modules/steps/action-buttons.js +92 -92
  393. package/core/modules/steps/action-buttons.scss +62 -62
  394. package/core/modules/steps/chat-assistant.js +141 -141
  395. package/core/modules/steps/narration.js +192 -192
  396. package/core/modules/steps/openai-realtime.js +275 -275
  397. package/core/modules/steps/progress-storage.js +140 -140
  398. package/core/modules/steps/readme.md +167 -167
  399. package/core/modules/steps/steps.js +1567 -1567
  400. package/core/modules/steps/steps.scss +907 -907
  401. package/core/modules/steps/timeline.js +56 -56
  402. package/core/modules/steps/voice-navigation.js +709 -709
  403. package/core/pages/homepage-api/homepage-api.js +106 -106
  404. package/core/pages/homepage-api/homepage-api.scss +233 -233
  405. package/core/pages/homepage-api/menu-dashboard.js +169 -169
  406. package/core/pages/homepage-api/menu-dashboard.scss +11 -11
  407. package/core/translation.json +53 -53
  408. package/core/translations.json +19 -19
  409. package/core/utils/script.utils.js +129 -129
  410. package/core/utils/settings.utils.js +25 -25
  411. package/eslint.config.mjs +79 -79
  412. package/index.js +35 -35
  413. package/jest.config.js +7 -7
  414. package/jest.setup.js +1 -1
  415. package/package.json +124 -124
  416. package/tsconfig.json +26 -26
  417. package/webpack.config.js +173 -173
@@ -1,781 +1,781 @@
1
- /**
2
- * Schema required for implementing process
3
- */
4
-
5
- import React from "react";
6
-
7
- import Base from './../base';
8
-
9
- import { Link } from 'react-router-dom'
10
-
11
- import { Tag } from 'antd'
12
-
13
- import ProcessDetail from './components/process-detail/process-detail';
14
-
15
- import { Steps, ProcessTransactions, StepTransactions, Roles, Checklists } from './../';
16
-
17
- import DateUtils from '../../utils/date/date.utils';
18
-
19
- import ProcessDashboard from './components/process-dashboard/process-dashboard';
20
-
21
-
22
- class Process extends Base {
23
-
24
- constructor() {
25
-
26
- super()
27
-
28
- this.fields = [{
29
- field: 'name',
30
- caption: 'Name'
31
- }, {
32
- field: 'description',
33
- caption: 'Description'
34
- }, {
35
- field: 'identifier',
36
- caption: 'Identifier'
37
- }, {
38
- field: 'active',
39
- type: 'radio',
40
- options: [true, false],
41
- caption: 'Active'
42
- }, {
43
- field: 'order',
44
- type: 'number',
45
- caption: 'Order'
46
- }
47
- ]
48
-
49
- // this.columns = [];
50
- }
51
-
52
- get getEndpoint() {
53
- return 'process'
54
- }
55
-
56
- get path() {
57
- return `process`
58
- }
59
-
60
- get getName() {
61
- return `process`
62
- }
63
-
64
-
65
- /**
66
- * Overriding get to stress for orderBy
67
- */
68
- async get(queries) {
69
-
70
- return this.getMethod(queries, { orderBy: 'order' })
71
-
72
- }
73
-
74
- /**
75
- * Start the process with a batch
76
- */
77
- startProcessBatch(batch, identifier, body) {
78
-
79
- // Starting a process is creating a process transaction record
80
- // and starting the first step of that process
81
- // This involves first completing any sub step
82
- // it might have (any level of) and
83
-
84
- var queries = [{
85
- field: 'identifier',
86
- value: identifier
87
- }]
88
-
89
- return this.get(queries).then(async (result) => {
90
-
91
- var process = result.process[0];
92
-
93
- // Trigger the process and its first sub process
94
- return await this.triggerProcessBatch(batch, process.id, body);
95
-
96
- })
97
- }
98
-
99
- /**
100
- * Move the process transaction to the next step
101
- *
102
- * @param {*} process_transaction_id
103
- */
104
- async proceedNextStep({ id, process_transaction_id }) {
105
-
106
- // Get the firestore app
107
- const app = this.getFireStoreApp();
108
-
109
- // Starting a batched write
110
- let batch = app.batch();
111
-
112
- const transactions = await ProcessTransactions.getRecord(process_transaction_id)
113
-
114
- // console.log(transactions);
115
-
116
- const step = await Steps.getRecord(transactions.step_id);
117
-
118
- // const steps = await this.prepareStepData(id, step, transactions)
119
-
120
- // console.log(step, steps);
121
-
122
- return await this.onStepCompletion({ batch, step, process_transaction_id, record_id: id });
123
-
124
- }
125
-
126
- /**
127
- * Actions to be taken care on completion of a step
128
- */
129
- async onStepCompletion({ batch, step, process_transaction_id, record_id, callback }) {
130
-
131
- if (step.trigger_sub_process_ids === null) {
132
- step.trigger_sub_process_ids = []
133
- }
134
-
135
- if (step.trigger_process_ids === null) {
136
- step.trigger_process_ids = []
137
- }
138
-
139
- // The first Step transaction
140
- let step_transaction = step.step_transactions[0];
141
-
142
- // We have to forward the process transaction to the next sub process
143
- //
144
- // await triggerSubProcess(step, process_transaction_id)
145
-
146
- console.log("Triggering Subprocesses", step.trigger_sub_process_ids.map((record) => record.id));
147
-
148
- // Trigger the sub process
149
- await Promise.all(step.trigger_sub_process_ids.map(async (step_id) => {
150
-
151
- let params = {
152
- step_id: step_id
153
- }
154
-
155
- console.log("Updating Process Transaction started");
156
-
157
- // Reference for process transaction
158
- var processTransactionReference = ProcessTransactions.getRecordReference(process_transaction_id)
159
-
160
- // Move the process transaction to next step
161
- await batch.update(processTransactionReference, this.appendDefaultValues(params));
162
-
163
- console.log("Updating Process Transaction ended");
164
-
165
- // If there is a step transaction record ,
166
- // We have to update that its completed
167
-
168
- // We have to record a step transaction record for every event
169
- let body = {
170
- step_id: step_id,
171
- process_id: step.process_id,
172
- process_transaction_id: process_transaction_id,
173
- record_id: record_id
174
- }
175
-
176
- // Record the Step Transaction
177
- var stepTransactionReference = StepTransactions.getRecordReference()
178
-
179
- console.log("Step Transaction Add started");
180
-
181
- return await batch.set(stepTransactionReference, this.appendDefaultValues(body));
182
-
183
- console.log("Step Transaction Add Completed");
184
-
185
- }));
186
-
187
- console.log("Triggering Process started", step.trigger_process_ids && step.trigger_process_ids.map((record) => record.id));
188
-
189
- // We also have to trigger any process that this step would trigger
190
- await Promise.all(step.trigger_process_ids && step.trigger_process_ids.map((process_id) => {
191
-
192
- let body = {
193
- record_id: record_id,
194
- model_identifier: 'Candidates'
195
- }
196
-
197
- console.log("Trigger Process Started");
198
-
199
- return this.triggerProcessBatch(batch, process_id, body, process_transaction_id).catch((error) => {
200
-
201
- console.log(error, "Trigger process failed");
202
- })
203
-
204
- }));
205
-
206
- console.log("Step Transaction Update Started");
207
-
208
- if (step_transaction) {
209
-
210
- console.log("Found Step Transaction to Update");
211
-
212
- // We have to record a step transaction record for every event
213
- let body = {
214
- end_time: DateUtils.getTime(),
215
- completed: true,
216
- }
217
-
218
- // Record the Step Transaction
219
- let stepTransactionReference = StepTransactions.getRecordReference(step_transaction.id);
220
-
221
- await batch.update(stepTransactionReference, this.appendDefaultValues(body));
222
-
223
- // Commit the batch
224
- return batch.commit();
225
-
226
- } else {
227
-
228
- // Commit the batch
229
- return batch.commit();
230
-
231
- }
232
- }
233
-
234
-
235
- /**
236
- *
237
- * Start the step
238
- * After identifying the step , we have
239
- * to check if this step has any sub steps
240
- * If present we have to start the first step of that step
241
- *
242
- * @param {*} param0
243
- * @returns
244
- */
245
- async startStepBatch({ batch, step, body }) {
246
-
247
- // Find all the steps in the process
248
- // After finding the steps we have to find all
249
- // the sub steps of the step , use a recursive apporach to make
250
- // sure
251
- let stepParams = {
252
- ...body,
253
-
254
- step_id: step.id,
255
- process_id: step.process_id,
256
-
257
- start_time: new Date(),
258
- end_time: null,
259
- completed: false
260
- }
261
-
262
- const stepTransactionReference = StepTransactions.getRecordReference();
263
-
264
- console.log(stepTransactionReference.id);
265
-
266
- // Find the sub steps and start the loop
267
- var queries = [{
268
- field: 'header_id',
269
- value: step.id
270
- }, {
271
- field: 'active',
272
- value: true
273
- }]
274
-
275
- // Find the first step of child
276
- const { steps } = await Steps.get(queries, {
277
- orderBy: 'order'
278
- });
279
-
280
- if (steps.length) {
281
-
282
- await batch.set(stepTransactionReference, StepTransactions.appendDefaultValues(stepParams))
283
-
284
- // Start the step
285
- await this.startStepBatch({ batch, step: steps[0], body });
286
-
287
- } else {
288
-
289
- stepParams = {
290
- ...stepParams,
291
- end_time: new Date(),
292
- completed: true
293
- }
294
-
295
- return await batch.set(stepTransactionReference, StepTransactions.appendDefaultValues(stepParams))
296
-
297
- }
298
- }
299
-
300
- /**
301
- * Stop the step
302
- */
303
- async stopStepBatch({ batch, step }) {
304
-
305
- // Complete the step
306
- // If another step needs to be started , start that step
307
- // Else thats it
308
- console.log(step);
309
-
310
- if (step.step_transactions.length) {
311
-
312
- // Get the reference
313
- let stepTransactionReference = StepTransactions.getRecordReference(step.step_transactions[0].id)
314
-
315
- await batch.update(stepTransactionReference, {
316
- end_time: new Date(),
317
- completed: true
318
- })
319
-
320
- // Further triggering of other steps
321
- return await batch.commit()
322
- }
323
- }
324
-
325
- /**
326
- * To Start the process
327
- *
328
- * @param {*} batch
329
- * @param {*} process_id
330
- * @param {*} body
331
- * @param {*} process_transaction_id
332
- * @returns
333
- */
334
- async triggerProcessBatch(batch, process_id, body, process_transaction_id) {
335
-
336
- var queries = [{
337
- field: 'process_id',
338
- value: process_id
339
- }, {
340
- field: 'active',
341
- value: true
342
- }]
343
- // Find all the steps in the process
344
- // After finding the steps we have to find all
345
- // the sub steps of the step , use a recursive apporach to make
346
- // sure each of the first step is started
347
-
348
- // When the process starts the first step every nested steps is also started
349
- const { steps = [] } = await Steps.get(queries);
350
-
351
- // From the ordered data ,
352
- var step = this.orderArray(steps, 'order')[0];
353
-
354
- // Create the step transactions record for each step
355
- // and its sub steps
356
- await this.startStepBatch({ batch, step, body });
357
-
358
- // body = {
359
- // ...body,
360
- // step_id: step.id,
361
- // process_id: process_id,
362
- // start_time: DateUtils.getTime(),
363
- // end_time: null
364
- // }
365
-
366
- // if (body.duration === 0) {
367
-
368
- // body = {
369
- // ...body,
370
- // duration: 0,
371
- // end_time: DateUtils.getTime(),
372
- // }
373
- // }
374
-
375
- // If there is already an existing process transaction
376
- // We have to move it to a new step according to the master
377
- if (process_transaction_id) {
378
-
379
- let params = {
380
- ...body,
381
- end_time: new Date(),
382
-
383
- // Other fields required for duration
384
- }
385
-
386
- // Get the reference to update
387
- const processTransactionReference = ProcessTransactions.getRecordReference(process_transaction_id);
388
-
389
- await batch.update(processTransactionReference, this.appendDefaultValues(params));
390
-
391
- return {
392
- process_transaction_id,
393
-
394
- }
395
-
396
- } else {
397
-
398
- // Get the reference to update
399
- const processTransactionReference = ProcessTransactions.getRecordReference();
400
-
401
- // Process transaction would record the start of the
402
- // process and other fields releated to record ,
403
- // we can keep
404
- let processTransactionParams = {
405
- start_time: new Date(),
406
- end_time: null,
407
- ...body
408
- }
409
-
410
- // Note : Have to recheck how the data
411
- // is flow
412
- // Should we also consider
413
- //
414
- if (body.completed) {
415
- processTransactionParams.end_time = new Date();
416
- }
417
-
418
- // #Note Below looks buggy
419
- await batch.set(processTransactionReference, this.appendDefaultValues(processTransactionParams));
420
-
421
- return {
422
- process_transaction_id: processTransactionReference.id,
423
- }
424
-
425
- }
426
- }
427
-
428
-
429
- // pre_requisites = [{
430
- // type: 'process/step',
431
- // // Process/ Step
432
- // type_id: '',
433
- // // model: 'process/step',
434
- // condition: 'start||end',
435
- // hirarchy:''
436
- // // Operators has to be considered
437
- // //
438
- // }, {
439
- // condition: 'end',
440
- // step_id: '2',
441
- // process_id: ''
442
- // }]
443
-
444
-
445
- // pre_requisites = [{
446
- // type: 'process/step',
447
- // // Process/ Step
448
- // type_id: '',
449
- // // model: 'process/step',
450
- // condition: 'start||end',
451
- // hirarchy:''
452
- // // Operators has to be considered
453
- // //
454
- // }, {
455
- // condition: 'end',
456
- // step_id: '2',
457
- // process_id: ''
458
- // }]
459
-
460
- // var pre_requisites = "(type=process&type_id=1&condition=start)&&(type=process&type_id=1&condition=start)"
461
-
462
-
463
- /**
464
- * Get Config data for the timeline
465
- */
466
- getProcessTimeline({ identifier, id }) {
467
-
468
- var processQueries = [{
469
- field: 'identifier',
470
- value: identifier
471
- }]
472
-
473
- // Note , The process transaction cannot be linked with a record
474
- var queries = [{ field: 'record_id', value: id }];
475
-
476
- return ProcessTransactions.get(queries).then(({ process_transactions }) => {
477
-
478
- console.log(process_transactions);
479
-
480
- // We load the process by the identifier in a sorted manner
481
- return this.get(processQueries, {
482
- orderBy: 'order'
483
- }).then((result) => {
484
-
485
- // For each of the process , we have to load the steps
486
- return Promise.all(this.orderArray(result.process, 'order').map((process) => this.getSteps(process, process_transactions, id)));
487
- })
488
- })
489
- }
490
-
491
-
492
- /**
493
- * Get the process timeline for step
494
- *
495
- */
496
- getProcessTimelineForStep = async (id, step_id, process_transaction_id) => {
497
-
498
- const process_trnsaction = await ProcessTransactions.getRecord(process_transaction_id);
499
-
500
- const step = await Steps.getDetail(step_id);
501
-
502
- // const finalData = await this.loadStepDetail(step, id, process_trnsaction);
503
-
504
- return await this.loadStepDetail(step, id, process_trnsaction);
505
-
506
- // return await this.prepareStepData(id, finalData, [process_trnsaction])
507
-
508
- }
509
-
510
-
511
- /**
512
- * Get all the steps of that process
513
- */
514
- getSteps(process, process_transactions = [], id) {
515
-
516
- var queries = [{
517
- field: 'process_id',
518
- value: process.id
519
- }, {
520
- field: 'active',
521
- value: true
522
- }]
523
-
524
- return Steps.get(queries, [], {
525
- orderBy: 'order'
526
- }).then((result) => {
527
-
528
- // We have to consider the transaction and step transaction for the process dashboard
529
- // #todo roles should be considered to decide
530
- // What needs to be shown
531
- return Promise.all(this.orderArray(result.steps, 'order').map(async (step) => {
532
-
533
- // We have to load the details of the step
534
- return await this.loadStepDetail(step, id, process_transactions);
535
-
536
- // return await this.prepareStepData(id, finalData, process_transactions);
537
-
538
- })).then((steps) => {
539
-
540
- return {
541
- ...process,
542
- process_transactions,
543
- steps: steps
544
- }
545
- })
546
- })
547
- }
548
-
549
-
550
- /**
551
- * Load the all details of the step
552
- *
553
- * Who it is assigned to
554
- */
555
- async loadStepDetail(step, id, process_transactions) {
556
-
557
- // Load Sub Steps
558
- var queries = [{
559
- field: 'header_id',
560
- value: step.id
561
- }, {
562
- field: 'active',
563
- value: true
564
- }]
565
-
566
- // We Check if there are any sub steps under
567
- // the steps .
568
- const { steps = [] } = await Steps.get(queries, { orderBy: 'order' })
569
-
570
- if (steps.length) {
571
-
572
- // For the step we have to prepare the step data which incldues the form /page
573
- const final = await this.prepareStepData(id, step, process_transactions)
574
-
575
- // For all the sub steps , we have to load the details of it
576
- const modifiedSteps = await Promise.all(steps.map((innerStep) => this.loadStepDetail(innerStep, id, process_transactions)))
577
-
578
- return {
579
- ...final,
580
- sub_steps: modifiedSteps
581
- }
582
-
583
- } else {
584
-
585
- // If there is no sub steps , we have to still load the steps information
586
- const final = await this.prepareStepData(id, step, process_transactions)
587
-
588
- return {
589
- // ...step,
590
- ...final,
591
- sub_steps: []
592
- }
593
- }
594
-
595
- // if (step.role_id && step.role_id.length) {
596
-
597
- // var queries = [{
598
- // field: firebase.firestore.FieldPath.documentId(),
599
- // operator: 'in',
600
- // value: step.role_id
601
- // }]
602
-
603
- // const { roles } = await Roles.get(queries)
604
-
605
- // return {
606
- // ...step,
607
- // roles
608
- // }
609
-
610
-
611
- // } else {
612
-
613
- // return {
614
- // ...step,
615
- // }
616
- // }
617
- }
618
-
619
-
620
- async getStepRole() {
621
-
622
-
623
- }
624
-
625
-
626
-
627
- /**
628
- * Prepare the step data to be shown in the timeline
629
- * We load the step transaction and use process transaction
630
- * to enable the form
631
- */
632
- prepareStepData(id, step, transactions) {
633
-
634
- let user = this.getUser();
635
-
636
- var queries = [{
637
- field: 'record_id',
638
- value: id
639
- }, {
640
- field: 'step_id',
641
- value: step.id
642
- }]
643
-
644
- // For the particular step id we have to check if there are any transactions active.
645
- return StepTransactions.get(queries).then(({ step_transactions }) => {
646
-
647
- // Considering the process trnsaction current stage , we have to enable the form
648
- // Also we consider the role
649
- if (transactions.length && transactions[0].step_id === step.id) {
650
-
651
- // Decide who should see the form
652
- if (step.role_id && step.role_id.indexOf(user.role_id) !== -1) {
653
-
654
- // if (user.role_id === step.role_id) {
655
-
656
- step.formEnabled = true;
657
-
658
- }
659
-
660
- step.process_transaction = transactions[0]
661
-
662
- step.current_state = 'ongoing';
663
-
664
- } else {
665
-
666
- step.pending = true;
667
-
668
- step.current_state = 'pending';
669
-
670
- }
671
-
672
- step.step_transactions = [];
673
-
674
- // Below applicable cases
675
- // Its pending
676
- // Its done
677
- // Its in process
678
- if (step_transactions.length) {
679
-
680
- if (step_transactions[0].completed) {
681
-
682
- step.current_state = 'completed';
683
-
684
- } else {
685
-
686
- step.current_state = 'ongoing';
687
-
688
- // If there is a form or page linked to the step ,
689
- // we have to activate the task form ,
690
- // which would take care of the redirection to the page
691
- // or load the form to complete the step
692
- if (step.form_id || step.page_id) {
693
-
694
- step.formEnabled = true;
695
- }
696
-
697
-
698
-
699
- }
700
-
701
- step.step_transactions = step_transactions;
702
-
703
- }
704
-
705
- return step
706
-
707
- })
708
- }
709
-
710
-
711
- get columns() {
712
- return [
713
-
714
- {
715
- caption: 'Name',
716
- render: (record) => {
717
-
718
- return <Link className="booking-card" to={`/process/${record['id']}`}>
719
- {record.name}
720
- </Link>
721
-
722
-
723
- },
724
- key: 'created_at',
725
- },
726
-
727
-
728
- {
729
- caption: 'Description',
730
- field: 'description',
731
- key: 'description',
732
- },
733
-
734
- {
735
- caption: 'Identier',
736
- field: 'identier',
737
- key: 'identier',
738
- },
739
-
740
- ];
741
- }
742
-
743
- Card = (record) => {
744
-
745
- return (<Link className="booking-card" to={`process/${record['id']}`}>
746
- <div className="card">
747
- <h2 className="">
748
-
749
- {record['amount']}
750
-
751
- </h2>
752
- <h3 className="head">
753
-
754
- {record['name']}
755
-
756
- </h3>
757
-
758
- <h3 className="title">
759
-
760
- {record['title']}
761
-
762
- </h3>
763
-
764
- <p className="address">
765
- Booked on {record['Booking Date']}
766
- <Tag color="magenta">{record['Consultant Name']}</Tag>
767
- </p>
768
-
769
- </div>
770
- </Link>)
771
- }
772
-
773
- DetailComponent = ({ model }) => <ProcessDetail model={model} />
774
-
775
- // AddComponent = ({ model }) => <ProcessAdd model={model} />
776
-
777
- }
778
-
779
- export default Process;
780
-
1
+ /**
2
+ * Schema required for implementing process
3
+ */
4
+
5
+ import React from "react";
6
+
7
+ import Base from './../base';
8
+
9
+ import { Link } from 'react-router-dom'
10
+
11
+ import { Tag } from 'antd'
12
+
13
+ import ProcessDetail from './components/process-detail/process-detail';
14
+
15
+ import { Steps, ProcessTransactions, StepTransactions, Roles, Checklists } from './../';
16
+
17
+ import DateUtils from '../../utils/date/date.utils';
18
+
19
+ import ProcessDashboard from './components/process-dashboard/process-dashboard';
20
+
21
+
22
+ class Process extends Base {
23
+
24
+ constructor() {
25
+
26
+ super()
27
+
28
+ this.fields = [{
29
+ field: 'name',
30
+ caption: 'Name'
31
+ }, {
32
+ field: 'description',
33
+ caption: 'Description'
34
+ }, {
35
+ field: 'identifier',
36
+ caption: 'Identifier'
37
+ }, {
38
+ field: 'active',
39
+ type: 'radio',
40
+ options: [true, false],
41
+ caption: 'Active'
42
+ }, {
43
+ field: 'order',
44
+ type: 'number',
45
+ caption: 'Order'
46
+ }
47
+ ]
48
+
49
+ // this.columns = [];
50
+ }
51
+
52
+ get getEndpoint() {
53
+ return 'process'
54
+ }
55
+
56
+ get path() {
57
+ return `process`
58
+ }
59
+
60
+ get getName() {
61
+ return `process`
62
+ }
63
+
64
+
65
+ /**
66
+ * Overriding get to stress for orderBy
67
+ */
68
+ async get(queries) {
69
+
70
+ return this.getMethod(queries, { orderBy: 'order' })
71
+
72
+ }
73
+
74
+ /**
75
+ * Start the process with a batch
76
+ */
77
+ startProcessBatch(batch, identifier, body) {
78
+
79
+ // Starting a process is creating a process transaction record
80
+ // and starting the first step of that process
81
+ // This involves first completing any sub step
82
+ // it might have (any level of) and
83
+
84
+ var queries = [{
85
+ field: 'identifier',
86
+ value: identifier
87
+ }]
88
+
89
+ return this.get(queries).then(async (result) => {
90
+
91
+ var process = result.process[0];
92
+
93
+ // Trigger the process and its first sub process
94
+ return await this.triggerProcessBatch(batch, process.id, body);
95
+
96
+ })
97
+ }
98
+
99
+ /**
100
+ * Move the process transaction to the next step
101
+ *
102
+ * @param {*} process_transaction_id
103
+ */
104
+ async proceedNextStep({ id, process_transaction_id }) {
105
+
106
+ // Get the firestore app
107
+ const app = this.getFireStoreApp();
108
+
109
+ // Starting a batched write
110
+ let batch = app.batch();
111
+
112
+ const transactions = await ProcessTransactions.getRecord(process_transaction_id)
113
+
114
+ // console.log(transactions);
115
+
116
+ const step = await Steps.getRecord(transactions.step_id);
117
+
118
+ // const steps = await this.prepareStepData(id, step, transactions)
119
+
120
+ // console.log(step, steps);
121
+
122
+ return await this.onStepCompletion({ batch, step, process_transaction_id, record_id: id });
123
+
124
+ }
125
+
126
+ /**
127
+ * Actions to be taken care on completion of a step
128
+ */
129
+ async onStepCompletion({ batch, step, process_transaction_id, record_id, callback }) {
130
+
131
+ if (step.trigger_sub_process_ids === null) {
132
+ step.trigger_sub_process_ids = []
133
+ }
134
+
135
+ if (step.trigger_process_ids === null) {
136
+ step.trigger_process_ids = []
137
+ }
138
+
139
+ // The first Step transaction
140
+ let step_transaction = step.step_transactions[0];
141
+
142
+ // We have to forward the process transaction to the next sub process
143
+ //
144
+ // await triggerSubProcess(step, process_transaction_id)
145
+
146
+ console.log("Triggering Subprocesses", step.trigger_sub_process_ids.map((record) => record.id));
147
+
148
+ // Trigger the sub process
149
+ await Promise.all(step.trigger_sub_process_ids.map(async (step_id) => {
150
+
151
+ let params = {
152
+ step_id: step_id
153
+ }
154
+
155
+ console.log("Updating Process Transaction started");
156
+
157
+ // Reference for process transaction
158
+ var processTransactionReference = ProcessTransactions.getRecordReference(process_transaction_id)
159
+
160
+ // Move the process transaction to next step
161
+ await batch.update(processTransactionReference, this.appendDefaultValues(params));
162
+
163
+ console.log("Updating Process Transaction ended");
164
+
165
+ // If there is a step transaction record ,
166
+ // We have to update that its completed
167
+
168
+ // We have to record a step transaction record for every event
169
+ let body = {
170
+ step_id: step_id,
171
+ process_id: step.process_id,
172
+ process_transaction_id: process_transaction_id,
173
+ record_id: record_id
174
+ }
175
+
176
+ // Record the Step Transaction
177
+ var stepTransactionReference = StepTransactions.getRecordReference()
178
+
179
+ console.log("Step Transaction Add started");
180
+
181
+ return await batch.set(stepTransactionReference, this.appendDefaultValues(body));
182
+
183
+ console.log("Step Transaction Add Completed");
184
+
185
+ }));
186
+
187
+ console.log("Triggering Process started", step.trigger_process_ids && step.trigger_process_ids.map((record) => record.id));
188
+
189
+ // We also have to trigger any process that this step would trigger
190
+ await Promise.all(step.trigger_process_ids && step.trigger_process_ids.map((process_id) => {
191
+
192
+ let body = {
193
+ record_id: record_id,
194
+ model_identifier: 'Candidates'
195
+ }
196
+
197
+ console.log("Trigger Process Started");
198
+
199
+ return this.triggerProcessBatch(batch, process_id, body, process_transaction_id).catch((error) => {
200
+
201
+ console.log(error, "Trigger process failed");
202
+ })
203
+
204
+ }));
205
+
206
+ console.log("Step Transaction Update Started");
207
+
208
+ if (step_transaction) {
209
+
210
+ console.log("Found Step Transaction to Update");
211
+
212
+ // We have to record a step transaction record for every event
213
+ let body = {
214
+ end_time: DateUtils.getTime(),
215
+ completed: true,
216
+ }
217
+
218
+ // Record the Step Transaction
219
+ let stepTransactionReference = StepTransactions.getRecordReference(step_transaction.id);
220
+
221
+ await batch.update(stepTransactionReference, this.appendDefaultValues(body));
222
+
223
+ // Commit the batch
224
+ return batch.commit();
225
+
226
+ } else {
227
+
228
+ // Commit the batch
229
+ return batch.commit();
230
+
231
+ }
232
+ }
233
+
234
+
235
+ /**
236
+ *
237
+ * Start the step
238
+ * After identifying the step , we have
239
+ * to check if this step has any sub steps
240
+ * If present we have to start the first step of that step
241
+ *
242
+ * @param {*} param0
243
+ * @returns
244
+ */
245
+ async startStepBatch({ batch, step, body }) {
246
+
247
+ // Find all the steps in the process
248
+ // After finding the steps we have to find all
249
+ // the sub steps of the step , use a recursive apporach to make
250
+ // sure
251
+ let stepParams = {
252
+ ...body,
253
+
254
+ step_id: step.id,
255
+ process_id: step.process_id,
256
+
257
+ start_time: new Date(),
258
+ end_time: null,
259
+ completed: false
260
+ }
261
+
262
+ const stepTransactionReference = StepTransactions.getRecordReference();
263
+
264
+ console.log(stepTransactionReference.id);
265
+
266
+ // Find the sub steps and start the loop
267
+ var queries = [{
268
+ field: 'header_id',
269
+ value: step.id
270
+ }, {
271
+ field: 'active',
272
+ value: true
273
+ }]
274
+
275
+ // Find the first step of child
276
+ const { steps } = await Steps.get(queries, {
277
+ orderBy: 'order'
278
+ });
279
+
280
+ if (steps.length) {
281
+
282
+ await batch.set(stepTransactionReference, StepTransactions.appendDefaultValues(stepParams))
283
+
284
+ // Start the step
285
+ await this.startStepBatch({ batch, step: steps[0], body });
286
+
287
+ } else {
288
+
289
+ stepParams = {
290
+ ...stepParams,
291
+ end_time: new Date(),
292
+ completed: true
293
+ }
294
+
295
+ return await batch.set(stepTransactionReference, StepTransactions.appendDefaultValues(stepParams))
296
+
297
+ }
298
+ }
299
+
300
+ /**
301
+ * Stop the step
302
+ */
303
+ async stopStepBatch({ batch, step }) {
304
+
305
+ // Complete the step
306
+ // If another step needs to be started , start that step
307
+ // Else thats it
308
+ console.log(step);
309
+
310
+ if (step.step_transactions.length) {
311
+
312
+ // Get the reference
313
+ let stepTransactionReference = StepTransactions.getRecordReference(step.step_transactions[0].id)
314
+
315
+ await batch.update(stepTransactionReference, {
316
+ end_time: new Date(),
317
+ completed: true
318
+ })
319
+
320
+ // Further triggering of other steps
321
+ return await batch.commit()
322
+ }
323
+ }
324
+
325
+ /**
326
+ * To Start the process
327
+ *
328
+ * @param {*} batch
329
+ * @param {*} process_id
330
+ * @param {*} body
331
+ * @param {*} process_transaction_id
332
+ * @returns
333
+ */
334
+ async triggerProcessBatch(batch, process_id, body, process_transaction_id) {
335
+
336
+ var queries = [{
337
+ field: 'process_id',
338
+ value: process_id
339
+ }, {
340
+ field: 'active',
341
+ value: true
342
+ }]
343
+ // Find all the steps in the process
344
+ // After finding the steps we have to find all
345
+ // the sub steps of the step , use a recursive apporach to make
346
+ // sure each of the first step is started
347
+
348
+ // When the process starts the first step every nested steps is also started
349
+ const { steps = [] } = await Steps.get(queries);
350
+
351
+ // From the ordered data ,
352
+ var step = this.orderArray(steps, 'order')[0];
353
+
354
+ // Create the step transactions record for each step
355
+ // and its sub steps
356
+ await this.startStepBatch({ batch, step, body });
357
+
358
+ // body = {
359
+ // ...body,
360
+ // step_id: step.id,
361
+ // process_id: process_id,
362
+ // start_time: DateUtils.getTime(),
363
+ // end_time: null
364
+ // }
365
+
366
+ // if (body.duration === 0) {
367
+
368
+ // body = {
369
+ // ...body,
370
+ // duration: 0,
371
+ // end_time: DateUtils.getTime(),
372
+ // }
373
+ // }
374
+
375
+ // If there is already an existing process transaction
376
+ // We have to move it to a new step according to the master
377
+ if (process_transaction_id) {
378
+
379
+ let params = {
380
+ ...body,
381
+ end_time: new Date(),
382
+
383
+ // Other fields required for duration
384
+ }
385
+
386
+ // Get the reference to update
387
+ const processTransactionReference = ProcessTransactions.getRecordReference(process_transaction_id);
388
+
389
+ await batch.update(processTransactionReference, this.appendDefaultValues(params));
390
+
391
+ return {
392
+ process_transaction_id,
393
+
394
+ }
395
+
396
+ } else {
397
+
398
+ // Get the reference to update
399
+ const processTransactionReference = ProcessTransactions.getRecordReference();
400
+
401
+ // Process transaction would record the start of the
402
+ // process and other fields releated to record ,
403
+ // we can keep
404
+ let processTransactionParams = {
405
+ start_time: new Date(),
406
+ end_time: null,
407
+ ...body
408
+ }
409
+
410
+ // Note : Have to recheck how the data
411
+ // is flow
412
+ // Should we also consider
413
+ //
414
+ if (body.completed) {
415
+ processTransactionParams.end_time = new Date();
416
+ }
417
+
418
+ // #Note Below looks buggy
419
+ await batch.set(processTransactionReference, this.appendDefaultValues(processTransactionParams));
420
+
421
+ return {
422
+ process_transaction_id: processTransactionReference.id,
423
+ }
424
+
425
+ }
426
+ }
427
+
428
+
429
+ // pre_requisites = [{
430
+ // type: 'process/step',
431
+ // // Process/ Step
432
+ // type_id: '',
433
+ // // model: 'process/step',
434
+ // condition: 'start||end',
435
+ // hirarchy:''
436
+ // // Operators has to be considered
437
+ // //
438
+ // }, {
439
+ // condition: 'end',
440
+ // step_id: '2',
441
+ // process_id: ''
442
+ // }]
443
+
444
+
445
+ // pre_requisites = [{
446
+ // type: 'process/step',
447
+ // // Process/ Step
448
+ // type_id: '',
449
+ // // model: 'process/step',
450
+ // condition: 'start||end',
451
+ // hirarchy:''
452
+ // // Operators has to be considered
453
+ // //
454
+ // }, {
455
+ // condition: 'end',
456
+ // step_id: '2',
457
+ // process_id: ''
458
+ // }]
459
+
460
+ // var pre_requisites = "(type=process&type_id=1&condition=start)&&(type=process&type_id=1&condition=start)"
461
+
462
+
463
+ /**
464
+ * Get Config data for the timeline
465
+ */
466
+ getProcessTimeline({ identifier, id }) {
467
+
468
+ var processQueries = [{
469
+ field: 'identifier',
470
+ value: identifier
471
+ }]
472
+
473
+ // Note , The process transaction cannot be linked with a record
474
+ var queries = [{ field: 'record_id', value: id }];
475
+
476
+ return ProcessTransactions.get(queries).then(({ process_transactions }) => {
477
+
478
+ console.log(process_transactions);
479
+
480
+ // We load the process by the identifier in a sorted manner
481
+ return this.get(processQueries, {
482
+ orderBy: 'order'
483
+ }).then((result) => {
484
+
485
+ // For each of the process , we have to load the steps
486
+ return Promise.all(this.orderArray(result.process, 'order').map((process) => this.getSteps(process, process_transactions, id)));
487
+ })
488
+ })
489
+ }
490
+
491
+
492
+ /**
493
+ * Get the process timeline for step
494
+ *
495
+ */
496
+ getProcessTimelineForStep = async (id, step_id, process_transaction_id) => {
497
+
498
+ const process_trnsaction = await ProcessTransactions.getRecord(process_transaction_id);
499
+
500
+ const step = await Steps.getDetail(step_id);
501
+
502
+ // const finalData = await this.loadStepDetail(step, id, process_trnsaction);
503
+
504
+ return await this.loadStepDetail(step, id, process_trnsaction);
505
+
506
+ // return await this.prepareStepData(id, finalData, [process_trnsaction])
507
+
508
+ }
509
+
510
+
511
+ /**
512
+ * Get all the steps of that process
513
+ */
514
+ getSteps(process, process_transactions = [], id) {
515
+
516
+ var queries = [{
517
+ field: 'process_id',
518
+ value: process.id
519
+ }, {
520
+ field: 'active',
521
+ value: true
522
+ }]
523
+
524
+ return Steps.get(queries, [], {
525
+ orderBy: 'order'
526
+ }).then((result) => {
527
+
528
+ // We have to consider the transaction and step transaction for the process dashboard
529
+ // #todo roles should be considered to decide
530
+ // What needs to be shown
531
+ return Promise.all(this.orderArray(result.steps, 'order').map(async (step) => {
532
+
533
+ // We have to load the details of the step
534
+ return await this.loadStepDetail(step, id, process_transactions);
535
+
536
+ // return await this.prepareStepData(id, finalData, process_transactions);
537
+
538
+ })).then((steps) => {
539
+
540
+ return {
541
+ ...process,
542
+ process_transactions,
543
+ steps: steps
544
+ }
545
+ })
546
+ })
547
+ }
548
+
549
+
550
+ /**
551
+ * Load the all details of the step
552
+ *
553
+ * Who it is assigned to
554
+ */
555
+ async loadStepDetail(step, id, process_transactions) {
556
+
557
+ // Load Sub Steps
558
+ var queries = [{
559
+ field: 'header_id',
560
+ value: step.id
561
+ }, {
562
+ field: 'active',
563
+ value: true
564
+ }]
565
+
566
+ // We Check if there are any sub steps under
567
+ // the steps .
568
+ const { steps = [] } = await Steps.get(queries, { orderBy: 'order' })
569
+
570
+ if (steps.length) {
571
+
572
+ // For the step we have to prepare the step data which incldues the form /page
573
+ const final = await this.prepareStepData(id, step, process_transactions)
574
+
575
+ // For all the sub steps , we have to load the details of it
576
+ const modifiedSteps = await Promise.all(steps.map((innerStep) => this.loadStepDetail(innerStep, id, process_transactions)))
577
+
578
+ return {
579
+ ...final,
580
+ sub_steps: modifiedSteps
581
+ }
582
+
583
+ } else {
584
+
585
+ // If there is no sub steps , we have to still load the steps information
586
+ const final = await this.prepareStepData(id, step, process_transactions)
587
+
588
+ return {
589
+ // ...step,
590
+ ...final,
591
+ sub_steps: []
592
+ }
593
+ }
594
+
595
+ // if (step.role_id && step.role_id.length) {
596
+
597
+ // var queries = [{
598
+ // field: firebase.firestore.FieldPath.documentId(),
599
+ // operator: 'in',
600
+ // value: step.role_id
601
+ // }]
602
+
603
+ // const { roles } = await Roles.get(queries)
604
+
605
+ // return {
606
+ // ...step,
607
+ // roles
608
+ // }
609
+
610
+
611
+ // } else {
612
+
613
+ // return {
614
+ // ...step,
615
+ // }
616
+ // }
617
+ }
618
+
619
+
620
+ async getStepRole() {
621
+
622
+
623
+ }
624
+
625
+
626
+
627
+ /**
628
+ * Prepare the step data to be shown in the timeline
629
+ * We load the step transaction and use process transaction
630
+ * to enable the form
631
+ */
632
+ prepareStepData(id, step, transactions) {
633
+
634
+ let user = this.getUser();
635
+
636
+ var queries = [{
637
+ field: 'record_id',
638
+ value: id
639
+ }, {
640
+ field: 'step_id',
641
+ value: step.id
642
+ }]
643
+
644
+ // For the particular step id we have to check if there are any transactions active.
645
+ return StepTransactions.get(queries).then(({ step_transactions }) => {
646
+
647
+ // Considering the process trnsaction current stage , we have to enable the form
648
+ // Also we consider the role
649
+ if (transactions.length && transactions[0].step_id === step.id) {
650
+
651
+ // Decide who should see the form
652
+ if (step.role_id && step.role_id.indexOf(user.role_id) !== -1) {
653
+
654
+ // if (user.role_id === step.role_id) {
655
+
656
+ step.formEnabled = true;
657
+
658
+ }
659
+
660
+ step.process_transaction = transactions[0]
661
+
662
+ step.current_state = 'ongoing';
663
+
664
+ } else {
665
+
666
+ step.pending = true;
667
+
668
+ step.current_state = 'pending';
669
+
670
+ }
671
+
672
+ step.step_transactions = [];
673
+
674
+ // Below applicable cases
675
+ // Its pending
676
+ // Its done
677
+ // Its in process
678
+ if (step_transactions.length) {
679
+
680
+ if (step_transactions[0].completed) {
681
+
682
+ step.current_state = 'completed';
683
+
684
+ } else {
685
+
686
+ step.current_state = 'ongoing';
687
+
688
+ // If there is a form or page linked to the step ,
689
+ // we have to activate the task form ,
690
+ // which would take care of the redirection to the page
691
+ // or load the form to complete the step
692
+ if (step.form_id || step.page_id) {
693
+
694
+ step.formEnabled = true;
695
+ }
696
+
697
+
698
+
699
+ }
700
+
701
+ step.step_transactions = step_transactions;
702
+
703
+ }
704
+
705
+ return step
706
+
707
+ })
708
+ }
709
+
710
+
711
+ get columns() {
712
+ return [
713
+
714
+ {
715
+ caption: 'Name',
716
+ render: (record) => {
717
+
718
+ return <Link className="booking-card" to={`/process/${record['id']}`}>
719
+ {record.name}
720
+ </Link>
721
+
722
+
723
+ },
724
+ key: 'created_at',
725
+ },
726
+
727
+
728
+ {
729
+ caption: 'Description',
730
+ field: 'description',
731
+ key: 'description',
732
+ },
733
+
734
+ {
735
+ caption: 'Identier',
736
+ field: 'identier',
737
+ key: 'identier',
738
+ },
739
+
740
+ ];
741
+ }
742
+
743
+ Card = (record) => {
744
+
745
+ return (<Link className="booking-card" to={`process/${record['id']}`}>
746
+ <div className="card">
747
+ <h2 className="">
748
+
749
+ {record['amount']}
750
+
751
+ </h2>
752
+ <h3 className="head">
753
+
754
+ {record['name']}
755
+
756
+ </h3>
757
+
758
+ <h3 className="title">
759
+
760
+ {record['title']}
761
+
762
+ </h3>
763
+
764
+ <p className="address">
765
+ Booked on {record['Booking Date']}
766
+ <Tag color="magenta">{record['Consultant Name']}</Tag>
767
+ </p>
768
+
769
+ </div>
770
+ </Link>)
771
+ }
772
+
773
+ DetailComponent = ({ model }) => <ProcessDetail model={model} />
774
+
775
+ // AddComponent = ({ model }) => <ProcessAdd model={model} />
776
+
777
+ }
778
+
779
+ export default Process;
780
+
781
781
  export { ProcessDashboard }