ui-soxo-bootstrap-core 2.6.40-dev.1 → 2.6.40-dev.12

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 (420) hide show
  1. package/.babelrc +8 -8
  2. package/.github/workflows/npm-publish.yml +5 -4
  3. package/.husky/pre-commit +11 -11
  4. package/.prettierrc.json +10 -10
  5. package/DEVELOPER_GUIDE.md +323 -323
  6. package/PUBLISHING.md +333 -0
  7. package/babel.config.js +2 -2
  8. package/core/components/component-loader/component-loader.js +125 -125
  9. package/core/components/component-wrapper/component-wrapper.js +121 -121
  10. package/core/components/external-window/DEVELOPER_GUIDE.md +705 -705
  11. package/core/components/external-window/external-window.js +236 -236
  12. package/core/components/external-window/external-window.test.js +80 -80
  13. package/core/components/extra-info/extra-info-details.js +155 -155
  14. package/core/components/extra-info/extra-info-details.scss +26 -26
  15. package/core/components/extra-info/extra-info.js +134 -134
  16. package/core/components/index.js +12 -12
  17. package/core/components/landing-api/landing-api.js +707 -707
  18. package/core/components/landing-api/landing-api.scss +41 -41
  19. package/core/components/license-management/license-alert.js +97 -97
  20. package/core/components/menu-template-api/menu-template-api.js +321 -321
  21. package/core/components/root-application-api/root-application-api.js +174 -174
  22. package/core/index.js +13 -13
  23. package/core/lib/Store.js +369 -369
  24. package/core/lib/components/application-bootstrap/application-bootstrap.js +115 -115
  25. package/core/lib/components/approval-form/approval-form.js +280 -280
  26. package/core/lib/components/approval-form/approval-form.scss +183 -183
  27. package/core/lib/components/approval-list/approval-list.js +143 -143
  28. package/core/lib/components/approval-list/approval-list.scss +2 -2
  29. package/core/lib/components/approval-list/components/request-card/request-card.js +42 -42
  30. package/core/lib/components/approval-list/components/request-card/request-card.scss +30 -30
  31. package/core/lib/components/camera/camera.js +230 -230
  32. package/core/lib/components/camera/camera.scss +86 -86
  33. package/core/lib/components/comment-block/comment-block.js +138 -138
  34. package/core/lib/components/comment-block/comment-block.scss +3 -3
  35. package/core/lib/components/confirm-modal/confirm-modal.js +82 -82
  36. package/core/lib/components/confirm-modal/confirm-modal.scss +2 -2
  37. package/core/lib/components/consent/consent.js +67 -67
  38. package/core/lib/components/consent/pdf-signature.js +299 -299
  39. package/core/lib/components/consent/signature-pad.js +90 -90
  40. package/core/lib/components/consent/signature-pad.scss +14 -14
  41. package/core/lib/components/file-upload/file-upload.js +133 -133
  42. package/core/lib/components/finger-print-reader/finger-print-reader.js +295 -295
  43. package/core/lib/components/finger-print-reader/finger-print-reader.scss +47 -47
  44. package/core/lib/components/finger-print-search/finger-print-search.js +200 -200
  45. package/core/lib/components/finger-print-search/finger-print-search.scss +47 -47
  46. package/core/lib/components/global-header/animations.js +18 -18
  47. package/core/lib/components/global-header/global-header.js +286 -286
  48. package/core/lib/components/global-header/global-header.scss +397 -397
  49. package/core/lib/components/header/generic-header.js +76 -76
  50. package/core/lib/components/header/generic-header.scss +99 -99
  51. package/core/lib/components/image-preview/image-preview.js +33 -33
  52. package/core/lib/components/image-wrapper/image-wrapper.js +108 -108
  53. package/core/lib/components/image-wrapper/image-wrapper.scss +12 -12
  54. package/core/lib/components/index.js +206 -206
  55. package/core/lib/components/landing/landing.js +403 -403
  56. package/core/lib/components/language-switcher/language-switcher.js +49 -49
  57. package/core/lib/components/menu-context/menu-context.js +69 -69
  58. package/core/lib/components/menu-template/menu-template.js +249 -249
  59. package/core/lib/components/menu-template/menu-template.scss +9 -9
  60. package/core/lib/components/modal-search/modal-search.js +153 -153
  61. package/core/lib/components/modal-search/modal-search.scss +78 -78
  62. package/core/lib/components/modal-wrapper/modal-manager.js +15 -15
  63. package/core/lib/components/modal-wrapper/modal-wrapper.js +108 -108
  64. package/core/lib/components/modal-wrapper/modal-wrapper.scss +13 -13
  65. package/core/lib/components/notice-board/notice-board.js +132 -132
  66. package/core/lib/components/notice-board/notice-board.scss +65 -65
  67. package/core/lib/components/page-container/page-container.js +55 -55
  68. package/core/lib/components/page-container/page-container.scss +8 -8
  69. package/core/lib/components/page-header/page-header.js +23 -23
  70. package/core/lib/components/page-header/page-header.scss +17 -17
  71. package/core/lib/components/pdf-viewer/pdf-viewer.js +56 -56
  72. package/core/lib/components/portlet-table/components/table-actions/table-actions.js +58 -58
  73. package/core/lib/components/portlet-table/components/table-actions/table-actions.scss +1 -1
  74. package/core/lib/components/portlet-table/components/table-data/table-data.js +106 -106
  75. package/core/lib/components/portlet-table/portlet-table.js +63 -63
  76. package/core/lib/components/portlet-table/portlet-table.scss +90 -90
  77. package/core/lib/components/progress-bar/progress-bar.js +58 -58
  78. package/core/lib/components/progress-bar/progress-bar.scss +15 -15
  79. package/core/lib/components/request-form/request-form.js +110 -110
  80. package/core/lib/components/root-application/root-application.js +70 -70
  81. package/core/lib/components/rupee/rupee.js +14 -14
  82. package/core/lib/components/script-input/script-input.js +169 -169
  83. package/core/lib/components/script-input/script-input.scss +8 -8
  84. package/core/lib/components/sidemenu/animations.js +51 -51
  85. package/core/lib/components/sidemenu/sidemenu.js +713 -713
  86. package/core/lib/components/sidemenu/sidemenu.scss +314 -314
  87. package/core/lib/components/spotlight-search/spotlight-search.component.js +635 -635
  88. package/core/lib/components/spotlight-search/spotlight-search.component.scss +78 -78
  89. package/core/lib/components/table-wrapper/table-wrapper.js +135 -135
  90. package/core/lib/components/table-wrapper/table-wrapper.scss +72 -72
  91. package/core/lib/components/ui_elements/Loader.js +12 -12
  92. package/core/lib/components/ui_elements/Notify.js +12 -12
  93. package/core/lib/components/ui_elements/PlaceHolder.js +33 -33
  94. package/core/lib/components/web-camera/web-camera.js +161 -161
  95. package/core/lib/components/web-camera/web-camera.scss +28 -28
  96. package/core/lib/core.md +9 -9
  97. package/core/lib/elements/Elements.md +2 -2
  98. package/core/lib/elements/basic/LoggedUserRedirect.js +21 -21
  99. package/core/lib/elements/basic/PrivateRoute.js +16 -16
  100. package/core/lib/elements/basic/button/Button.md +43 -43
  101. package/core/lib/elements/basic/button/button.js +170 -170
  102. package/core/lib/elements/basic/card/Card.md +15 -15
  103. package/core/lib/elements/basic/card/card.js +40 -40
  104. package/core/lib/elements/basic/card/card.scss +13 -13
  105. package/core/lib/elements/basic/checkbox/checkbox.js +23 -23
  106. package/core/lib/elements/basic/col/col.js +15 -15
  107. package/core/lib/elements/basic/copy-to-clipboard/Readme.md +40 -40
  108. package/core/lib/elements/basic/copy-to-clipboard/copy-to-clipboard.js +61 -61
  109. package/core/lib/elements/basic/country-phone-input/Readme.md +98 -98
  110. package/core/lib/elements/basic/country-phone-input/country-phone-input.js +81 -81
  111. package/core/lib/elements/basic/country-phone-input/phone-input.scss +75 -75
  112. package/core/lib/elements/basic/datepicker/datepicker.js +33 -33
  113. package/core/lib/elements/basic/dragabble-wrapper/draggable-wrapper.js +203 -203
  114. package/core/lib/elements/basic/empty/empty.js +14 -14
  115. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.js +118 -118
  116. package/core/lib/elements/basic/fingerprint-protrected/fingerprint-protected.scss +10 -10
  117. package/core/lib/elements/basic/form/form.js +70 -70
  118. package/core/lib/elements/basic/form/form.scss +3 -3
  119. package/core/lib/elements/basic/image/image.js +45 -45
  120. package/core/lib/elements/basic/image/image.scss +17 -17
  121. package/core/lib/elements/basic/image/readme.md +26 -26
  122. package/core/lib/elements/basic/image-viewer/image-viewer.js +108 -108
  123. package/core/lib/elements/basic/image-viewer/image-viewer.scss +7 -7
  124. package/core/lib/elements/basic/input/input.js +81 -81
  125. package/core/lib/elements/basic/input/readme.md +77 -77
  126. package/core/lib/elements/basic/json-input/json-input.js +51 -51
  127. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.js +216 -216
  128. package/core/lib/elements/basic/menu-dashboard/menu-dashboard.scss +28 -28
  129. package/core/lib/elements/basic/menu-tree/menu-tree.js +127 -127
  130. package/core/lib/elements/basic/modal/modal.js +64 -64
  131. package/core/lib/elements/basic/modal/readme.md +62 -62
  132. package/core/lib/elements/basic/popconfirm/popconfirm.js +17 -17
  133. package/core/lib/elements/basic/popover/popover.js +12 -12
  134. package/core/lib/elements/basic/radio/radio.js +18 -18
  135. package/core/lib/elements/basic/rangepicker/rangepicker.js +141 -141
  136. package/core/lib/elements/basic/rangepicker/rangepicker.scss +24 -24
  137. package/core/lib/elements/basic/rangepicker/readme.md +81 -81
  138. package/core/lib/elements/basic/reference-select/readme.md +18 -18
  139. package/core/lib/elements/basic/reference-select/reference-select.js +337 -337
  140. package/core/lib/elements/basic/row/row.js +15 -15
  141. package/core/lib/elements/basic/select/select.js +46 -46
  142. package/core/lib/elements/basic/select-box/readme.md +52 -52
  143. package/core/lib/elements/basic/select-box/select-box.js +63 -63
  144. package/core/lib/elements/basic/skeleton/readme.md +35 -35
  145. package/core/lib/elements/basic/skeleton/skeleton.js +35 -35
  146. package/core/lib/elements/basic/skeleton/skeleton.scss +53 -53
  147. package/core/lib/elements/basic/space/space.js +12 -12
  148. package/core/lib/elements/basic/switch/readme.md +29 -29
  149. package/core/lib/elements/basic/switch/switch.js +67 -67
  150. package/core/lib/elements/basic/tab/tab.js +14 -14
  151. package/core/lib/elements/basic/table/readme.md +8 -8
  152. package/core/lib/elements/basic/table/table.js +95 -95
  153. package/core/lib/elements/basic/tag/tag.js +63 -63
  154. package/core/lib/elements/basic/tag/tag.scss +2 -2
  155. package/core/lib/elements/basic/timeline/timeline.js +13 -13
  156. package/core/lib/elements/basic/title/readme.md +20 -20
  157. package/core/lib/elements/basic/title/title.js +37 -37
  158. package/core/lib/elements/basic/user-search/user-search.js +192 -192
  159. package/core/lib/elements/complex/barcode/barcode.js +27 -27
  160. package/core/lib/elements/complex/bargraph/bar-graph.js +262 -262
  161. package/core/lib/elements/complex/basic-table/basic-table.js +110 -110
  162. package/core/lib/elements/complex/basic-table/basic-table.scss +4 -4
  163. package/core/lib/elements/complex/date-display/date-display.js +37 -37
  164. package/core/lib/elements/complex/error-boundary/error-boundary.js +29 -29
  165. package/core/lib/elements/complex/google-location-input/map-container-library-load.js +92 -92
  166. package/core/lib/elements/complex/google-map/google-map.js +230 -230
  167. package/core/lib/elements/complex/google-map/google-map.scss +13 -13
  168. package/core/lib/elements/complex/line-graph/line-graph.js +108 -108
  169. package/core/lib/elements/complex/location-search-input/location-search-input.js +100 -100
  170. package/core/lib/elements/complex/pie-chart/pie-chart.js +202 -202
  171. package/core/lib/elements/complex/qr-code/qr-code.js +27 -27
  172. package/core/lib/elements/complex/qrscanner/qrscanner.js +57 -57
  173. package/core/lib/elements/complex/search-debounce/search-debounce.js +37 -37
  174. package/core/lib/elements/complex/statistic-card/dashboard-statistic-card.js +75 -75
  175. package/core/lib/elements/complex/statistic-card/statistic-card.js +28 -28
  176. package/core/lib/elements/index.js +226 -226
  177. package/core/lib/hooks/device-detect.js +25 -25
  178. package/core/lib/hooks/index.js +9 -9
  179. package/core/lib/hooks/use-location.js +33 -33
  180. package/core/lib/hooks/use-otp-timer.js +80 -80
  181. package/core/lib/hooks/use-window-size.js +34 -34
  182. package/core/lib/i18n.js +69 -69
  183. package/core/lib/index.js +106 -106
  184. package/core/lib/introduction.md +73 -73
  185. package/core/lib/js-styleguide.md +4112 -4112
  186. package/core/lib/models/actions/actions.js +127 -127
  187. package/core/lib/models/actions/components/action-detail/action-detail.js +190 -190
  188. package/core/lib/models/actions/components/custom-actions/custom-actions.js +185 -185
  189. package/core/lib/models/attachments/attachments.js +231 -231
  190. package/core/lib/models/base-loader.js +99 -99
  191. package/core/lib/models/base.js +716 -716
  192. package/core/lib/models/branches/branches.js +125 -125
  193. package/core/lib/models/checklists/checklists.js +114 -114
  194. package/core/lib/models/columns/columns.js +169 -169
  195. package/core/lib/models/columns/components/columns-add/columns-add.js +171 -171
  196. package/core/lib/models/comments/comments.js +213 -213
  197. package/core/lib/models/departments/departments.js +107 -107
  198. package/core/lib/models/financial-years/financial_years.js +127 -127
  199. package/core/lib/models/forms/components/form-creator/form-creator.js +665 -665
  200. package/core/lib/models/forms/components/form-creator/form-creator.scss +39 -39
  201. package/core/lib/models/forms/components/form-detail/form-detail.js +224 -224
  202. package/core/lib/models/forms/forms.js +121 -121
  203. package/core/lib/models/index.js +203 -203
  204. package/core/lib/models/invoice-numbers/invoice_numbers.js +204 -204
  205. package/core/lib/models/lookup-types/components/lookup-detail/lookup-detail.js +145 -145
  206. package/core/lib/models/lookup-types/lookup-types.js +113 -113
  207. package/core/lib/models/lookup-values/components/lookup-values-add/lookup-values-add.js +126 -126
  208. package/core/lib/models/lookup-values/lookup-values.js +107 -107
  209. package/core/lib/models/menu-roles/menu-roles.js +127 -127
  210. package/core/lib/models/menus/components/menu-add/menu-add.js +228 -228
  211. package/core/lib/models/menus/components/menu-detail/menu-detail.js +170 -170
  212. package/core/lib/models/menus/components/menu-list/menu-list.js +550 -550
  213. package/core/lib/models/menus/components/menu-list/menu-list.scss +5 -5
  214. package/core/lib/models/menus/components/menu-roles-add/menu-roles-add.js +183 -183
  215. package/core/lib/models/menus/menus.js +499 -499
  216. package/core/lib/models/models/components/model-detail/model-detail.js +137 -137
  217. package/core/lib/models/models/components/models.js +128 -128
  218. package/core/lib/models/modules/modules.js +204 -204
  219. package/core/lib/models/outbox/outbox.js +73 -73
  220. package/core/lib/models/pages/pages.js +107 -107
  221. package/core/lib/models/permissions/permissions.js +71 -71
  222. package/core/lib/models/process/components/process-add/process-add.js +181 -181
  223. package/core/lib/models/process/components/process-dashboard/process-dashboard.js +1068 -1068
  224. package/core/lib/models/process/components/process-dashboard/process-dashboard.scss +66 -66
  225. package/core/lib/models/process/components/process-detail/process-detail.js +140 -140
  226. package/core/lib/models/process/components/process-timeline/process-timeline.js +139 -139
  227. package/core/lib/models/process/components/task-detail/task-detail.js +240 -240
  228. package/core/lib/models/process/components/task-detail/task-detail.scss +27 -27
  229. package/core/lib/models/process/components/task-form/task-form.js +528 -528
  230. package/core/lib/models/process/components/task-form/task-form.scss +7 -7
  231. package/core/lib/models/process/components/task-list/task-list.js +221 -221
  232. package/core/lib/models/process/components/task-list/task-list.scss +14 -14
  233. package/core/lib/models/process/components/task-overview/task-overview.js +299 -299
  234. package/core/lib/models/process/components/task-overview-legacy/task-overview-legacy.js +192 -192
  235. package/core/lib/models/process/components/task-routes/task-routes.js +45 -45
  236. package/core/lib/models/process/components/task-status/task-status.js +175 -175
  237. package/core/lib/models/process/components/task-status/task-status.scss +11 -11
  238. package/core/lib/models/process/process.js +780 -780
  239. package/core/lib/models/process-transactions/process-transactions.js +123 -123
  240. package/core/lib/models/roles/roles.js +106 -106
  241. package/core/lib/models/scripts/scripts.js +111 -111
  242. package/core/lib/models/step-transactions/step-transcations.js +147 -147
  243. package/core/lib/models/steps/components/step-add/step-add.js +261 -261
  244. package/core/lib/models/steps/components/step-detail/step-detail.js +157 -157
  245. package/core/lib/models/steps/steps.js +356 -356
  246. package/core/lib/models/user-preferences/user-preferences.js +83 -83
  247. package/core/lib/models/users/components/user-add/user-add.js +226 -226
  248. package/core/lib/models/users/users.js +119 -119
  249. package/core/lib/modules/business/launch-page/launch-page.js +29 -29
  250. package/core/lib/modules/business/launch-page/launch-page.scss +5 -5
  251. package/core/lib/modules/business/slots/slots.js +231 -231
  252. package/core/lib/modules/business/slots/slots.scss +108 -108
  253. package/core/lib/modules/forms/components/field-customizer/field-customizer.js +138 -138
  254. package/core/lib/modules/forms/components/field-selector/field-selector.js +157 -157
  255. package/core/lib/modules/forms/components/field-selector/field-selector.scss +25 -25
  256. package/core/lib/modules/forms/components/form-display/form-display.js +203 -203
  257. package/core/lib/modules/forms/components/form-display/form-display.scss +9 -9
  258. package/core/lib/modules/forms/components/tab-customizer/tab-customizer.js +124 -124
  259. package/core/lib/modules/generic/generic-add/generic-add.js +213 -213
  260. package/core/lib/modules/generic/generic-detail/generic-detail.js +199 -199
  261. package/core/lib/modules/generic/generic-edit/generic-edit.js +120 -120
  262. package/core/lib/modules/generic/generic-list/ExportReactCSV.js +414 -414
  263. package/core/lib/modules/generic/generic-list/generic-list.js +705 -705
  264. package/core/lib/modules/generic/generic-list/generic-list.scss +68 -68
  265. package/core/lib/modules/generic/generic-upload/generic-upload.js +483 -483
  266. package/core/lib/modules/generic/table-settings/table-settings.js +226 -226
  267. package/core/lib/modules/generic/table-settings/table-settings.scss +37 -37
  268. package/core/lib/modules/index.js +52 -52
  269. package/core/lib/modules/modules-routes/module-routes.js +35 -35
  270. package/core/lib/pages/change-password/change-password.js +204 -204
  271. package/core/lib/pages/change-password/change-password.scss +73 -73
  272. package/core/lib/pages/homepage/homepage.js +53 -53
  273. package/core/lib/pages/index.js +19 -19
  274. package/core/lib/pages/login/commnication-mode-selection.js +46 -46
  275. package/core/lib/pages/login/communication-mode-selection.scss +60 -60
  276. package/core/lib/pages/login/login.js +872 -872
  277. package/core/lib/pages/login/login.scss +353 -353
  278. package/core/lib/pages/login/reset-password.js +124 -124
  279. package/core/lib/pages/login/reset-password.scss +31 -31
  280. package/core/lib/pages/manage-users/manage-users.js +429 -429
  281. package/core/lib/pages/manage-users/manage-users.scss +25 -25
  282. package/core/lib/pages/profile/profile.js +247 -247
  283. package/core/lib/pages/profile/profile.scss +107 -107
  284. package/core/lib/pages/profile/theme-config.js +18 -18
  285. package/core/lib/pages/profile/themes-backup.json +310 -310
  286. package/core/lib/pages/profile/themes.json +254 -254
  287. package/core/lib/pages/register/register.js +176 -176
  288. package/core/lib/pages/register/register.scss +128 -128
  289. package/core/lib/react-styleguide.md +756 -756
  290. package/core/lib/utils/api/api.utils.js +207 -207
  291. package/core/lib/utils/api/readme.md +426 -426
  292. package/core/lib/utils/async.js +35 -35
  293. package/core/lib/utils/common/common.utils.js +237 -237
  294. package/core/lib/utils/common/readme.md +30 -30
  295. package/core/lib/utils/date/date.utils.js +295 -295
  296. package/core/lib/utils/date/readme.md +2 -2
  297. package/core/lib/utils/firebase.support.utils.js +98 -98
  298. package/core/lib/utils/firebase.utils.js +808 -808
  299. package/core/lib/utils/font-awesome.utils.js +168 -168
  300. package/core/lib/utils/form/form.utils.js +255 -255
  301. package/core/lib/utils/generic/generic.utils.js +70 -70
  302. package/core/lib/utils/http/auth.helper.js +95 -95
  303. package/core/lib/utils/http/http.utils.js +186 -186
  304. package/core/lib/utils/http/readme.md +14 -14
  305. package/core/lib/utils/index.js +43 -43
  306. package/core/lib/utils/location/location.utils.js +137 -137
  307. package/core/lib/utils/location/readme.md +18 -18
  308. package/core/lib/utils/modal.utils.js +15 -15
  309. package/core/lib/utils/notification.utils.js +34 -34
  310. package/core/lib/utils/pwa/pwa.utils.js +88 -88
  311. package/core/lib/utils/script.utils.js +235 -235
  312. package/core/lib/utils/setting.utils.js +68 -68
  313. package/core/lib/utils/upload.utils.js +29 -29
  314. package/core/models/Preference/Preferences.js +46 -46
  315. package/core/models/base/base.js +403 -403
  316. package/core/models/base-clone-loader.js +107 -107
  317. package/core/models/base-clone.js +187 -187
  318. package/core/models/base-loader.js +97 -97
  319. package/core/models/core-scripts/core-scripts.js +179 -179
  320. package/core/models/dashboard/dashboard.js +201 -201
  321. package/core/models/detail-loader.js +88 -88
  322. package/core/models/doctor/components/doctor-add/doctor-add.js +432 -432
  323. package/core/models/doctor/components/doctor-add/doctor-add.scss +32 -32
  324. package/core/models/groups.js +82 -82
  325. package/core/models/index.js +100 -100
  326. package/core/models/lookup-types/components/lookup-detail/lookup-detail.js +129 -129
  327. package/core/models/lookup-types/lookup-types.js +96 -96
  328. package/core/models/lookup-values/components/lookup-values-modal/lookup-values-modal.js +95 -95
  329. package/core/models/lookup-values/lookup-values.js +92 -92
  330. package/core/models/menu-roles/components/menu-roles-add/menu-roles-add.js +153 -153
  331. package/core/models/menu-roles/menu-roles.js +158 -158
  332. package/core/models/menus/components/menu-add/menu-add.js +288 -288
  333. package/core/models/menus/components/menu-add/menu-add.scss +31 -31
  334. package/core/models/menus/components/menu-detail/menu-detail.js +263 -263
  335. package/core/models/menus/components/menu-list/menu-list.js +392 -392
  336. package/core/models/menus/components/menu-lists/menu-lists.js +635 -584
  337. package/core/models/menus/components/menu-lists/menu-lists.scss +46 -46
  338. package/core/models/menus/menus.js +338 -338
  339. package/core/models/model-columns.js +121 -121
  340. package/core/models/models/components/model-detail/model-add.js +120 -120
  341. package/core/models/models/components/model-detail/model-detail.js +133 -133
  342. package/core/models/models/models.js +154 -154
  343. package/core/models/pages/components/page-add/page-add.js +163 -163
  344. package/core/models/pages/components/page-add/page-add.scss +30 -30
  345. package/core/models/pages/components/page-details/page-details.js +209 -209
  346. package/core/models/pages/components/page-list/page-list.js +248 -248
  347. package/core/models/pages/pages.js +142 -142
  348. package/core/models/pages.js +142 -142
  349. package/core/models/roles/components/role-add/menu-label.js +14 -14
  350. package/core/models/roles/components/role-add/menu-tree.js +127 -127
  351. package/core/models/roles/components/role-add/role-add.js +222 -222
  352. package/core/models/roles/components/role-add/role-add.scss +4 -4
  353. package/core/models/roles/components/role-list/role-list.js +406 -406
  354. package/core/models/roles/roles.js +196 -196
  355. package/core/models/staff/components/staff-add/staff-add.js +455 -455
  356. package/core/models/user-roles/components/user-roles-add/user-roles-add.js +149 -149
  357. package/core/models/user-roles/user-roles.js +113 -113
  358. package/core/models/users/components/assign-role/assign-role.js +428 -428
  359. package/core/models/users/components/assign-role/assign-role.scss +281 -281
  360. package/core/models/users/components/assign-role/avatar-props.js +45 -45
  361. package/core/models/users/components/user-add/user-add.js +847 -847
  362. package/core/models/users/components/user-add/user-edit.js +110 -110
  363. package/core/models/users/components/user-detail/user-detail.js +236 -236
  364. package/core/models/users/components/user-list/user-list.js +397 -397
  365. package/core/models/users/users.js +379 -379
  366. package/core/modules/Informations/change-info/change-info.js +618 -618
  367. package/core/modules/Informations/change-info/change-info.scss +134 -134
  368. package/core/modules/dashboard/components/dashboard-card/animations.js +64 -64
  369. package/core/modules/dashboard/components/dashboard-card/dashboard-card.js +197 -197
  370. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.js +430 -430
  371. package/core/modules/dashboard/components/dashboard-card/menu-dashboard-card.scss +59 -59
  372. package/core/modules/dashboard/components/pop-query-dashboard/pop-query-dashboard.js +66 -66
  373. package/core/modules/generic/components/generic-add/generic-add.js +121 -121
  374. package/core/modules/generic/components/generic-add/generic-add.scss +13 -13
  375. package/core/modules/generic/components/generic-add-modal/generic-add-modal.js +125 -125
  376. package/core/modules/generic/components/generic-add-modal/generic-add-modal.scss +13 -13
  377. package/core/modules/generic/components/generic-detail/generic-detail.js +184 -184
  378. package/core/modules/generic/components/generic-detail/generic-detail.scss +25 -25
  379. package/core/modules/generic/components/generic-edit/generic-edit.js +123 -123
  380. package/core/modules/generic/components/generic-list/generic-list.js +335 -335
  381. package/core/modules/generic/components/generic-list/generic-list.scss +35 -35
  382. package/core/modules/index.js +42 -42
  383. package/core/modules/module-routes/module-routes.js +37 -37
  384. package/core/modules/reporting/components/index.js +6 -6
  385. package/core/modules/reporting/components/reporting-dashboard/README.md +316 -316
  386. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.js +271 -271
  387. package/core/modules/reporting/components/reporting-dashboard/adavance-search/advance-search.scss +76 -76
  388. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.js +90 -90
  389. package/core/modules/reporting/components/reporting-dashboard/display-columns/build-display-columns.test.js +74 -74
  390. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.js +449 -449
  391. package/core/modules/reporting/components/reporting-dashboard/display-columns/display-cell-renderer.test.js +199 -199
  392. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.js +1116 -1116
  393. package/core/modules/reporting/components/reporting-dashboard/reporting-dashboard.scss +215 -215
  394. package/core/modules/reporting/components/reporting-dashboard/reporting-table.js +519 -519
  395. package/core/modules/steps/action-buttons.js +92 -92
  396. package/core/modules/steps/action-buttons.scss +62 -62
  397. package/core/modules/steps/chat-assistant.js +141 -141
  398. package/core/modules/steps/narration.js +192 -192
  399. package/core/modules/steps/openai-realtime.js +275 -275
  400. package/core/modules/steps/progress-storage.js +140 -140
  401. package/core/modules/steps/readme.md +167 -167
  402. package/core/modules/steps/steps.js +1567 -1567
  403. package/core/modules/steps/steps.scss +907 -907
  404. package/core/modules/steps/timeline.js +56 -56
  405. package/core/modules/steps/voice-navigation.js +709 -709
  406. package/core/pages/homepage-api/homepage-api.js +106 -106
  407. package/core/pages/homepage-api/homepage-api.scss +233 -233
  408. package/core/pages/homepage-api/menu-dashboard.js +169 -169
  409. package/core/pages/homepage-api/menu-dashboard.scss +11 -11
  410. package/core/translation.json +53 -53
  411. package/core/translations.json +19 -19
  412. package/core/utils/script.utils.js +129 -129
  413. package/core/utils/settings.utils.js +25 -25
  414. package/eslint.config.mjs +79 -79
  415. package/index.js +35 -35
  416. package/jest.config.js +7 -7
  417. package/jest.setup.js +1 -1
  418. package/package.json +124 -124
  419. package/tsconfig.json +26 -26
  420. package/webpack.config.js +173 -173
@@ -1,665 +1,665 @@
1
- /**
2
- *
3
- * @author Ashique Mohammed
4
- * @description Generic Form create accepts an array of fields to update any resource
5
- * @version
6
- *
7
- */
8
-
9
- // let forms = [{
10
- // type: 'input'
11
- // }, {
12
- // type: 'tabs',
13
- // tabs: [{}]
14
- // }]
15
-
16
- import React, { useState } from "react"
17
-
18
- import moment from 'moment';
19
-
20
- import Button from "../../../../../lib/elements/basic/button/button";
21
-
22
- import { Form, Input, Radio, InputNumber, DatePicker, TimePicker, Checkbox, Select, Row, Col, Tabs } from 'antd';
23
-
24
- // import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
25
-
26
- import FileUpload from './../../../../components/file-upload/file-upload';
27
-
28
- import Camera from './../../../../components/camera/camera';
29
-
30
- // import { ColumnHeightOutlined } from '@ant-design/icons';
31
-
32
- import { DateUtils } from "../../../../utils";
33
-
34
- import { FieldCustomizer, TabCustomizer } from "./../../../../";
35
-
36
- import { prepareAndExecuteScript } from './../../../../utils/script.utils';
37
-
38
- import AdvancedSearchSelect from "../../../../../modules/reporting/components/reporting-dashboard/adavance-search/advance-search";
39
-
40
- const { TextArea } = Input;
41
-
42
- const { Option } = Select;
43
-
44
- const { TabPane } = Tabs;
45
-
46
- // const grid = 4;
47
-
48
-
49
- import './form-creator.scss'
50
-
51
- /**
52
- * Component accepts fields to render the necessary components and returns the values on submission
53
- *
54
- * @param {*} param0
55
- * @returns
56
- */
57
- function FormCreator({
58
- /**If we want to change the existing information first we need the current information ie, selectedInformation*/
59
- selectedInformation,
60
- model,
61
- formContent = {},
62
- onSubmit,
63
- fields = [],
64
- reportId,
65
- callback,
66
- layout,
67
- onFormValuesChange,
68
- // Below are arguments for use in form display
69
- onFieldUpdate,
70
- // onListUpdate,
71
- onFieldRemove,
72
- }) {
73
- const [form] = Form.useForm();
74
-
75
- let layoutValue;
76
- if (layout) {
77
- layoutValue = layout
78
- } else {
79
- layoutValue = {
80
- labelCol: { span: 12 },
81
- wrapperCol: { span: 12 },
82
- };
83
- }
84
-
85
- // Variable used for loading state
86
- const [loading, setLoading] = useState(false);
87
-
88
- // Variable stores the form body values
89
- const [content, setContent] = useState(() => {
90
-
91
- // Body for the files
92
- let body = formContent || { [model.name]: {} };
93
-
94
- fields.forEach((entry) => {
95
-
96
- if (entry.transform) {
97
-
98
- body[entry.field] = entry.transform(body[entry.field]);
99
- }
100
-
101
- // If its a date
102
- if (['date'].indexOf(entry.type) !== -1 && formContent[entry.field]) {
103
-
104
- body[entry.field] = DateUtils.getMomentObject(formContent[entry.field]);
105
- }
106
-
107
- })
108
-
109
- return body;
110
-
111
- });
112
-
113
- /**
114
- * Function handles trigger of onupload
115
- *
116
- * @param {*} element
117
- * @param {*} attachments
118
- */
119
- function onUpload(element, attachments) {
120
- form.setFieldsValue({ [element.field]: attachments });
121
- }
122
-
123
- /**
124
- * Custom Listener for onchange of input
125
- *
126
- * @param {*} element
127
- * @param {*} attachments
128
- */
129
- function onChange(element, value) {
130
-
131
- // Though we initially gave less respect to this method
132
- // This is the game changer - 29/01/23
133
-
134
- // Being able to listen to script , Bind onChange listeners to each input
135
- // can avoid the need for building custom forms again
136
-
137
- // console.log(element);
138
-
139
- /** */
140
- if (element.field) {
141
-
142
- form.setFieldsValue({ [element.field]: value });
143
- }
144
- }
145
-
146
- // const onDragEnd = (result) => {
147
-
148
- // onListUpdate(result.source, result.destination);
149
- // }
150
-
151
- // const getListStyle = (isDraggingOver) => ({
152
- // // background: isDraggingOver ? 'lightblue' : '',
153
- // boxShadow: isDraggingOver ? '0px 0px 5px 5px #eeeeee' : '',
154
-
155
- // // padding: grid,
156
- // // width: 250
157
- // });
158
-
159
- /**
160
- * Function triggered for any onChange of input
161
- *
162
- * @param {*} formFields
163
- */
164
- const onFieldsChange = (formFields) => {
165
-
166
- formFields.forEach((field) => {
167
- if (field.name[0].includes('date')) {
168
-
169
- // values[field.field] = new Timestamp(moment(field.value).valueOf());
170
-
171
- // content[field.name[0]] = moment(field.value).format('DD/MM/YYYY');
172
- } else {
173
- // content[field.name[0]] = field.value;
174
- }
175
- })
176
- // setContent({ ...content })
177
- }
178
-
179
- /**
180
- * Values Change
181
- *
182
- * @param {*} field
183
- * @param {*} values
184
- */
185
- const onValuesChange = async (field, values) => {
186
-
187
- // Find the input that is changed
188
- let key = Object.keys(field)[0];
189
-
190
- // Configuration
191
- let fieldConfiguration = fields.filter((config) => config.field === key)[0];
192
-
193
- // We have to check if there is an onChange script for the field
194
- if (fieldConfiguration.on_change) {
195
-
196
- // Before Submit of form , execute the script
197
- values = await prepareAndExecuteScript(values, null, fieldConfiguration.on_change);
198
-
199
- }
200
-
201
- if (onFormValuesChange) {
202
- onFormValuesChange(values);
203
- }
204
- }
205
-
206
- const submitFormValues = async (values) => {
207
- setLoading(true);
208
-
209
- const nextValues = { ...values };
210
-
211
- // Keep the same value preparation path for normal submit and search reset.
212
- fields.forEach((field) => {
213
-
214
- if (field.field && field.field.includes('date')) {
215
-
216
- nextValues[field.field] = moment(nextValues[field.field]).valueOf();
217
-
218
- }
219
-
220
- if (field.type === ('time')) {
221
-
222
- nextValues[field.field] = moment(nextValues[field.field]).format('HH:mm A');
223
-
224
- }
225
- })
226
-
227
- try {
228
- if (onSubmit) {
229
- await onSubmit(nextValues);
230
- }
231
- } finally {
232
- setLoading(false);
233
- }
234
- }
235
-
236
- const handleSearchReset = async (fieldName) => {
237
- if (!fieldName) return;
238
-
239
- const values = {
240
- ...form.getFieldsValue(true),
241
- [fieldName]: [],
242
- };
243
-
244
- form.setFieldsValue({ [fieldName]: [] });
245
-
246
- if (onFormValuesChange) {
247
- onFormValuesChange(values);
248
- }
249
-
250
- await submitFormValues(values);
251
- }
252
-
253
- return (
254
- <section className="form-creator">
255
-
256
- {/* <DragDropContext onDragEnd={onDragEnd}>
257
- <Droppable droppableId="droppable">
258
-
259
- {(provided, snapshot) => (
260
- <div
261
- ref={provided.innerRef}
262
- style={getListStyle(snapshot.isDraggingOver)}
263
- {...provided.droppableProps}
264
- > */}
265
-
266
- <Form
267
-
268
- form={form}
269
- // layout="inline"
270
- {...layoutValue}
271
- className="new-record"
272
- name="new-record"
273
- onFinish={submitFormValues}
274
- // layout="inline"
275
-
276
- onFieldsChange={onFieldsChange}
277
-
278
- onValuesChange={onValuesChange}
279
- layout={layoutValue}
280
- // validateMessages={validateMessages}
281
- initialValues={{
282
- ...content,
283
- remarks: ''
284
- }}
285
- >
286
-
287
- {/* Mapper maps each fields to build the form */}
288
- <FieldMapper
289
- fields={fields}
290
- reportId={reportId}
291
- onChange={onChange}
292
- onSearchReset={handleSearchReset}
293
- selectedInformation={selectedInformation}
294
- onUpload={onUpload}
295
- onFieldUpdate={onFieldUpdate}
296
- onFieldRemove={onFieldRemove}
297
- />
298
-
299
- {/* Mapper Ends */}
300
-
301
- <Button loading={loading} type="primary" htmlType="submit" className="submit-button">
302
- SUBMIT
303
- </Button>
304
- </Form>
305
-
306
- {/* </div>)}
307
-
308
- </Droppable>
309
- </DragDropContext> */}
310
-
311
- </section>
312
- );
313
- }
314
-
315
- export default FormCreator;
316
-
317
-
318
- /**
319
- * Field Mapper accepts fields to build the form
320
- *
321
- * @param {*} param0
322
- * @returns
323
- */
324
- function FieldMapper({
325
- fields = [],
326
- reportId,
327
- onChange,
328
- onSearchReset,
329
- selectedInformation,
330
- onUpload,
331
- onFieldUpdate,
332
- onFieldRemove
333
- }) {
334
-
335
- return (<>
336
-
337
- {
338
- fields.map((field, index) => {
339
-
340
- // For Tabs
341
- if (field.type === 'Tabs') {
342
-
343
- return (<Tabs defaultActiveKey="0">
344
-
345
- {
346
- field.tabs.map((tab, tabIndex) => {
347
-
348
- return (
349
- <TabPane tab={`${tab.caption}`} key={tabIndex} >
350
-
351
- {/* Customizes the Tab */}
352
- <TabCustomizer
353
-
354
- tab={tab}
355
- field={field}
356
-
357
- onFieldUpdate={onFieldUpdate}
358
- fieldIndex={tabIndex}
359
- index={index}
360
- onFieldRemove={onFieldRemove} />
361
- {/* Customizes the Tab Ends */}
362
-
363
- {/* Mapper maps each fields to build the form */}
364
- <FieldMapper
365
- fields={tab.fields}
366
- reportId={reportId}
367
- onChange={onChange}
368
- onSearchReset={onSearchReset}
369
- onUpload={onUpload}
370
- onFieldUpdate={onFieldUpdate}
371
- onFieldRemove={onFieldRemove}
372
- />
373
-
374
- </TabPane>
375
- )
376
- })
377
- }
378
-
379
- </Tabs>)
380
-
381
- } else {
382
-
383
- if (field.condition) {
384
-
385
- return field.condition(content)
386
- ?
387
- <UserInput
388
- onChange={onChange}
389
- onSearchReset={onSearchReset}
390
- reportId={reportId}
391
- index={index}
392
- key={index}
393
- onUpload={onUpload}
394
- field={field}
395
- onFieldUpdate={onFieldUpdate}
396
- onFieldRemove={onFieldRemove}
397
- />
398
- :
399
- null
400
-
401
- } else {
402
- return <UserInput
403
- onChange={onChange}
404
- onSearchReset={onSearchReset}
405
- reportId={reportId}
406
- key={index}
407
- selectedInformation={selectedInformation}
408
- index={index}
409
- field={field}
410
- onUpload={onUpload}
411
- onFieldUpdate={onFieldUpdate}
412
-
413
- onFieldRemove={onFieldRemove}
414
-
415
- />;
416
- }
417
- }
418
- })
419
- }
420
-
421
- </>)
422
-
423
- }
424
-
425
-
426
-
427
- /**
428
- * Component accepts user input according to type
429
- *
430
- * @param {*} param0
431
- */
432
- function UserInput({ field, onUpload, selectedInformation, onChange, onSearchReset, onFieldUpdate, onFieldRemove, index, reportId }) {
433
-
434
- let props = {};
435
-
436
- // The extra text
437
- if (field.extra) {
438
- props.extra = field.extra;
439
- }
440
-
441
- const isVisible = field.visible !== undefined ? field.visible : true;
442
-
443
- /**
444
- * According to the type render each element
445
- *
446
- * @param {*} field
447
- */
448
- const inputElement = (field, onChange) => {
449
-
450
- if (field.visible) {
451
-
452
- if (field.visible === false) return null;
453
-
454
- }
455
-
456
- switch (field.type) {
457
-
458
- case 'search':
459
- return <AdvancedSearchSelect {...field} reportId={reportId} style={{ width: '100%' }} onReset={onSearchReset} />
460
-
461
- case 'number':
462
- return <InputNumber required={field.required} />
463
-
464
- case 'input':
465
- return <Input required={field.required} />
466
-
467
- case 'radio':
468
- return (
469
- <Radio.Group>
470
-
471
- {field.options.map((option, key) => <Radio key={key} value={option}>{option ? 'Yes' : 'No'}</Radio>)}
472
-
473
- </Radio.Group>
474
-
475
- );
476
-
477
- case 'checkbox':
478
- return <Checkbox.Group style={{ width: '100%' }}>
479
- <Col>
480
- {
481
- field.options.map((option, key) => {
482
-
483
- let opt = typeof option === 'string' ? option : option.value;
484
-
485
- return <Row><Checkbox key={key} value={opt}>{opt}</Checkbox></Row>
486
- })
487
- }
488
- </Col>
489
- </Checkbox.Group>
490
-
491
- // case 'checkbox':
492
- // return <Checkbox.Group options={field.options}/>
493
- case 'textarea':
494
- return <TextArea rows={4} required={field.required} />
495
-
496
- case 'boolean':
497
- return <Select style={{ width: '120' }} required={field.required}>
498
- {[true, false].map((option, key) => <Option key={key} value={option}>{option ? 'Yes' : 'No'}</Option>)}
499
- </Select>
500
-
501
- case 'select':
502
- // Handle static select options
503
- if (Array.isArray(field.options)) {
504
-
505
- let defaultValue = field.default ? field.default : '';
506
-
507
- /**If there is selected Information ie, for change info if there is selected guest information
508
- * then we will match and set a default value from the guest details
509
- */
510
- if (selectedInformation) {
511
- // Get the field value dynamically from selectedInformation[0] using field.field
512
- const fieldValue = selectedInformation[0] && selectedInformation[0][field.caption];
513
-
514
- // Find the default value based on field value and matching DisplayMember or description
515
- const defaultOption = field.options.find(
516
- (option) =>
517
- option.displayMember?.toLowerCase() === fieldValue?.toLowerCase()
518
- )
519
-
520
- // If a matching option is found, set the default value; otherwise, do not set a default value (i.e., null or undefined)
521
- defaultValue = defaultOption ? defaultOption.valueMember : null;
522
-
523
- }
524
- /**In case of default selection we need to call the onchange manually */
525
- if (defaultValue) {
526
-
527
- onChange(field, defaultValue);
528
- }
529
-
530
- return (
531
- <Select defaultValue={defaultValue}
532
- required={field.required}
533
- style={{ width: '120' }}
534
- onChange={(value) => onChange(field, value)}
535
- >
536
- {field.options.map((option, key) => (
537
- <Option key={key} value={option.valueMember}>
538
- {option.displayMember}
539
- </Option>
540
- ))}
541
- </Select>
542
- );
543
- }
544
- // case 'checkbox':
545
- // return <Checkbox.Group options={field.options} />
546
-
547
- case 'datetime':
548
- return <DatePicker format={"DD/MM/YYYY"} onChange={(record) => {
549
-
550
- onChange(field, record.format('DD/MM/YYYY'))
551
-
552
- }} />
553
-
554
- case 'date':
555
- return <DatePicker format={"DD/MM/YYYY"} />
556
-
557
-
558
- case 'time':
559
- return <TimePicker format={"HH:mm A"} />
560
-
561
- // onChange={(record) => {
562
-
563
- // console.log(record);
564
-
565
- // onChange(field, record.format('HH:mm A'))
566
-
567
- // }}
568
-
569
-
570
- case 'upload':
571
- return <FileUpload multiple={field.multiple} maxSize={field.maxSize || 3} callback={(attachment) => onUpload(field, attachment)} onProgress={() => { }} />
572
-
573
- case 'camera':
574
- return <Camera />
575
-
576
-
577
- default:
578
- return <Input />
579
- }
580
- }
581
-
582
- // const getItemStyle = (draggableStyle, isDragging) => ({
583
- // // some basic styles to make the items look a bit nicer
584
- // userSelect: 'none',
585
- // // padding: grid,
586
- // // margin: `0 0 ${grid}px 0`,
587
- // // position: `absolute`,
588
- // // right: '40px',
589
-
590
- // // change background colour if dragging
591
- // // background: isDragging ? 'lightgreen' : 'whitesmoke',
592
-
593
- // boxShadow: isDragging ? '0px 0px 5px 5px #eeeeee' : '',
594
-
595
- // // styles we need to apply on draggables
596
- // ...draggableStyle
597
- // });
598
-
599
-
600
- return (
601
- <>
602
- {/* <Draggable
603
- key={`${field.caption}-${index}`}
604
- draggableId={`${field.caption}-${index}`}
605
- index={index}
606
- >
607
- {(provided, snapshot) => (
608
- <div>
609
- <div
610
-
611
- ref={provided.innerRef}
612
- {...provided.dragHandleProps}
613
- {...provided.draggableProps}
614
- style={getItemStyle(
615
- provided.draggableProps.style,
616
- snapshot.isDragging
617
- )}
618
-
619
- > */}
620
- {isVisible === true ? (
621
- <div className={`form-item-element ${field.type === 'search' ? 'form-item-element-search' : ''}`}>
622
-
623
- {/* <Button
624
- size="small"
625
- ref={provided.innerRef}
626
- {...provided.dragHandleProps}
627
- {...provided.draggableProps}
628
- style={getItemStyle(
629
- provided.draggableProps.style,
630
- snapshot.isDragging
631
- )}
632
- >
633
-
634
- <ColumnHeightOutlined />
635
-
636
- </Button> */}
637
-
638
-
639
- {/* Customizes the form */}
640
- <FieldCustomizer field={field} onFieldUpdate={onFieldUpdate} index={index} onFieldRemove={onFieldRemove} />
641
- {/* Customizes the form Ends */}
642
-
643
- <Form.Item
644
- {...props}
645
- name={field.field}
646
- label={field.caption}
647
- rules={[{ required: field.required, message: field.placeholder || 'Please enter ' + field.caption }]}
648
- style={{ marginBottom: '12px' }}
649
- >
650
-
651
- {inputElement(field, onChange)}
652
- {/* <InputElement field={field} /> */}
653
-
654
- </Form.Item>
655
-
656
- </div>
657
- ) : null}
658
- {/* </div>
659
- </div>
660
- )}
661
- </Draggable> */}
662
-
663
- </>
664
- )
665
- }
1
+ /**
2
+ *
3
+ * @author Ashique Mohammed
4
+ * @description Generic Form create accepts an array of fields to update any resource
5
+ * @version
6
+ *
7
+ */
8
+
9
+ // let forms = [{
10
+ // type: 'input'
11
+ // }, {
12
+ // type: 'tabs',
13
+ // tabs: [{}]
14
+ // }]
15
+
16
+ import React, { useState } from "react"
17
+
18
+ import moment from 'moment';
19
+
20
+ import Button from "../../../../../lib/elements/basic/button/button";
21
+
22
+ import { Form, Input, Radio, InputNumber, DatePicker, TimePicker, Checkbox, Select, Row, Col, Tabs } from 'antd';
23
+
24
+ // import { DragDropContext, Draggable, Droppable } from 'react-beautiful-dnd';
25
+
26
+ import FileUpload from './../../../../components/file-upload/file-upload';
27
+
28
+ import Camera from './../../../../components/camera/camera';
29
+
30
+ // import { ColumnHeightOutlined } from '@ant-design/icons';
31
+
32
+ import { DateUtils } from "../../../../utils";
33
+
34
+ import { FieldCustomizer, TabCustomizer } from "./../../../../";
35
+
36
+ import { prepareAndExecuteScript } from './../../../../utils/script.utils';
37
+
38
+ import AdvancedSearchSelect from "../../../../../modules/reporting/components/reporting-dashboard/adavance-search/advance-search";
39
+
40
+ const { TextArea } = Input;
41
+
42
+ const { Option } = Select;
43
+
44
+ const { TabPane } = Tabs;
45
+
46
+ // const grid = 4;
47
+
48
+
49
+ import './form-creator.scss'
50
+
51
+ /**
52
+ * Component accepts fields to render the necessary components and returns the values on submission
53
+ *
54
+ * @param {*} param0
55
+ * @returns
56
+ */
57
+ function FormCreator({
58
+ /**If we want to change the existing information first we need the current information ie, selectedInformation*/
59
+ selectedInformation,
60
+ model,
61
+ formContent = {},
62
+ onSubmit,
63
+ fields = [],
64
+ reportId,
65
+ callback,
66
+ layout,
67
+ onFormValuesChange,
68
+ // Below are arguments for use in form display
69
+ onFieldUpdate,
70
+ // onListUpdate,
71
+ onFieldRemove,
72
+ }) {
73
+ const [form] = Form.useForm();
74
+
75
+ let layoutValue;
76
+ if (layout) {
77
+ layoutValue = layout
78
+ } else {
79
+ layoutValue = {
80
+ labelCol: { span: 12 },
81
+ wrapperCol: { span: 12 },
82
+ };
83
+ }
84
+
85
+ // Variable used for loading state
86
+ const [loading, setLoading] = useState(false);
87
+
88
+ // Variable stores the form body values
89
+ const [content, setContent] = useState(() => {
90
+
91
+ // Body for the files
92
+ let body = formContent || { [model.name]: {} };
93
+
94
+ fields.forEach((entry) => {
95
+
96
+ if (entry.transform) {
97
+
98
+ body[entry.field] = entry.transform(body[entry.field]);
99
+ }
100
+
101
+ // If its a date
102
+ if (['date'].indexOf(entry.type) !== -1 && formContent[entry.field]) {
103
+
104
+ body[entry.field] = DateUtils.getMomentObject(formContent[entry.field]);
105
+ }
106
+
107
+ })
108
+
109
+ return body;
110
+
111
+ });
112
+
113
+ /**
114
+ * Function handles trigger of onupload
115
+ *
116
+ * @param {*} element
117
+ * @param {*} attachments
118
+ */
119
+ function onUpload(element, attachments) {
120
+ form.setFieldsValue({ [element.field]: attachments });
121
+ }
122
+
123
+ /**
124
+ * Custom Listener for onchange of input
125
+ *
126
+ * @param {*} element
127
+ * @param {*} attachments
128
+ */
129
+ function onChange(element, value) {
130
+
131
+ // Though we initially gave less respect to this method
132
+ // This is the game changer - 29/01/23
133
+
134
+ // Being able to listen to script , Bind onChange listeners to each input
135
+ // can avoid the need for building custom forms again
136
+
137
+ // console.log(element);
138
+
139
+ /** */
140
+ if (element.field) {
141
+
142
+ form.setFieldsValue({ [element.field]: value });
143
+ }
144
+ }
145
+
146
+ // const onDragEnd = (result) => {
147
+
148
+ // onListUpdate(result.source, result.destination);
149
+ // }
150
+
151
+ // const getListStyle = (isDraggingOver) => ({
152
+ // // background: isDraggingOver ? 'lightblue' : '',
153
+ // boxShadow: isDraggingOver ? '0px 0px 5px 5px #eeeeee' : '',
154
+
155
+ // // padding: grid,
156
+ // // width: 250
157
+ // });
158
+
159
+ /**
160
+ * Function triggered for any onChange of input
161
+ *
162
+ * @param {*} formFields
163
+ */
164
+ const onFieldsChange = (formFields) => {
165
+
166
+ formFields.forEach((field) => {
167
+ if (field.name[0].includes('date')) {
168
+
169
+ // values[field.field] = new Timestamp(moment(field.value).valueOf());
170
+
171
+ // content[field.name[0]] = moment(field.value).format('DD/MM/YYYY');
172
+ } else {
173
+ // content[field.name[0]] = field.value;
174
+ }
175
+ })
176
+ // setContent({ ...content })
177
+ }
178
+
179
+ /**
180
+ * Values Change
181
+ *
182
+ * @param {*} field
183
+ * @param {*} values
184
+ */
185
+ const onValuesChange = async (field, values) => {
186
+
187
+ // Find the input that is changed
188
+ let key = Object.keys(field)[0];
189
+
190
+ // Configuration
191
+ let fieldConfiguration = fields.filter((config) => config.field === key)[0];
192
+
193
+ // We have to check if there is an onChange script for the field
194
+ if (fieldConfiguration.on_change) {
195
+
196
+ // Before Submit of form , execute the script
197
+ values = await prepareAndExecuteScript(values, null, fieldConfiguration.on_change);
198
+
199
+ }
200
+
201
+ if (onFormValuesChange) {
202
+ onFormValuesChange(values);
203
+ }
204
+ }
205
+
206
+ const submitFormValues = async (values) => {
207
+ setLoading(true);
208
+
209
+ const nextValues = { ...values };
210
+
211
+ // Keep the same value preparation path for normal submit and search reset.
212
+ fields.forEach((field) => {
213
+
214
+ if (field.field && field.field.includes('date')) {
215
+
216
+ nextValues[field.field] = moment(nextValues[field.field]).valueOf();
217
+
218
+ }
219
+
220
+ if (field.type === ('time')) {
221
+
222
+ nextValues[field.field] = moment(nextValues[field.field]).format('HH:mm A');
223
+
224
+ }
225
+ })
226
+
227
+ try {
228
+ if (onSubmit) {
229
+ await onSubmit(nextValues);
230
+ }
231
+ } finally {
232
+ setLoading(false);
233
+ }
234
+ }
235
+
236
+ const handleSearchReset = async (fieldName) => {
237
+ if (!fieldName) return;
238
+
239
+ const values = {
240
+ ...form.getFieldsValue(true),
241
+ [fieldName]: [],
242
+ };
243
+
244
+ form.setFieldsValue({ [fieldName]: [] });
245
+
246
+ if (onFormValuesChange) {
247
+ onFormValuesChange(values);
248
+ }
249
+
250
+ await submitFormValues(values);
251
+ }
252
+
253
+ return (
254
+ <section className="form-creator">
255
+
256
+ {/* <DragDropContext onDragEnd={onDragEnd}>
257
+ <Droppable droppableId="droppable">
258
+
259
+ {(provided, snapshot) => (
260
+ <div
261
+ ref={provided.innerRef}
262
+ style={getListStyle(snapshot.isDraggingOver)}
263
+ {...provided.droppableProps}
264
+ > */}
265
+
266
+ <Form
267
+
268
+ form={form}
269
+ // layout="inline"
270
+ {...layoutValue}
271
+ className="new-record"
272
+ name="new-record"
273
+ onFinish={submitFormValues}
274
+ // layout="inline"
275
+
276
+ onFieldsChange={onFieldsChange}
277
+
278
+ onValuesChange={onValuesChange}
279
+ layout={layoutValue}
280
+ // validateMessages={validateMessages}
281
+ initialValues={{
282
+ ...content,
283
+ remarks: ''
284
+ }}
285
+ >
286
+
287
+ {/* Mapper maps each fields to build the form */}
288
+ <FieldMapper
289
+ fields={fields}
290
+ reportId={reportId}
291
+ onChange={onChange}
292
+ onSearchReset={handleSearchReset}
293
+ selectedInformation={selectedInformation}
294
+ onUpload={onUpload}
295
+ onFieldUpdate={onFieldUpdate}
296
+ onFieldRemove={onFieldRemove}
297
+ />
298
+
299
+ {/* Mapper Ends */}
300
+
301
+ <Button loading={loading} type="primary" htmlType="submit" className="submit-button">
302
+ SUBMIT
303
+ </Button>
304
+ </Form>
305
+
306
+ {/* </div>)}
307
+
308
+ </Droppable>
309
+ </DragDropContext> */}
310
+
311
+ </section>
312
+ );
313
+ }
314
+
315
+ export default FormCreator;
316
+
317
+
318
+ /**
319
+ * Field Mapper accepts fields to build the form
320
+ *
321
+ * @param {*} param0
322
+ * @returns
323
+ */
324
+ function FieldMapper({
325
+ fields = [],
326
+ reportId,
327
+ onChange,
328
+ onSearchReset,
329
+ selectedInformation,
330
+ onUpload,
331
+ onFieldUpdate,
332
+ onFieldRemove
333
+ }) {
334
+
335
+ return (<>
336
+
337
+ {
338
+ fields.map((field, index) => {
339
+
340
+ // For Tabs
341
+ if (field.type === 'Tabs') {
342
+
343
+ return (<Tabs defaultActiveKey="0">
344
+
345
+ {
346
+ field.tabs.map((tab, tabIndex) => {
347
+
348
+ return (
349
+ <TabPane tab={`${tab.caption}`} key={tabIndex} >
350
+
351
+ {/* Customizes the Tab */}
352
+ <TabCustomizer
353
+
354
+ tab={tab}
355
+ field={field}
356
+
357
+ onFieldUpdate={onFieldUpdate}
358
+ fieldIndex={tabIndex}
359
+ index={index}
360
+ onFieldRemove={onFieldRemove} />
361
+ {/* Customizes the Tab Ends */}
362
+
363
+ {/* Mapper maps each fields to build the form */}
364
+ <FieldMapper
365
+ fields={tab.fields}
366
+ reportId={reportId}
367
+ onChange={onChange}
368
+ onSearchReset={onSearchReset}
369
+ onUpload={onUpload}
370
+ onFieldUpdate={onFieldUpdate}
371
+ onFieldRemove={onFieldRemove}
372
+ />
373
+
374
+ </TabPane>
375
+ )
376
+ })
377
+ }
378
+
379
+ </Tabs>)
380
+
381
+ } else {
382
+
383
+ if (field.condition) {
384
+
385
+ return field.condition(content)
386
+ ?
387
+ <UserInput
388
+ onChange={onChange}
389
+ onSearchReset={onSearchReset}
390
+ reportId={reportId}
391
+ index={index}
392
+ key={index}
393
+ onUpload={onUpload}
394
+ field={field}
395
+ onFieldUpdate={onFieldUpdate}
396
+ onFieldRemove={onFieldRemove}
397
+ />
398
+ :
399
+ null
400
+
401
+ } else {
402
+ return <UserInput
403
+ onChange={onChange}
404
+ onSearchReset={onSearchReset}
405
+ reportId={reportId}
406
+ key={index}
407
+ selectedInformation={selectedInformation}
408
+ index={index}
409
+ field={field}
410
+ onUpload={onUpload}
411
+ onFieldUpdate={onFieldUpdate}
412
+
413
+ onFieldRemove={onFieldRemove}
414
+
415
+ />;
416
+ }
417
+ }
418
+ })
419
+ }
420
+
421
+ </>)
422
+
423
+ }
424
+
425
+
426
+
427
+ /**
428
+ * Component accepts user input according to type
429
+ *
430
+ * @param {*} param0
431
+ */
432
+ function UserInput({ field, onUpload, selectedInformation, onChange, onSearchReset, onFieldUpdate, onFieldRemove, index, reportId }) {
433
+
434
+ let props = {};
435
+
436
+ // The extra text
437
+ if (field.extra) {
438
+ props.extra = field.extra;
439
+ }
440
+
441
+ const isVisible = field.visible !== undefined ? field.visible : true;
442
+
443
+ /**
444
+ * According to the type render each element
445
+ *
446
+ * @param {*} field
447
+ */
448
+ const inputElement = (field, onChange) => {
449
+
450
+ if (field.visible) {
451
+
452
+ if (field.visible === false) return null;
453
+
454
+ }
455
+
456
+ switch (field.type) {
457
+
458
+ case 'search':
459
+ return <AdvancedSearchSelect {...field} reportId={reportId} style={{ width: '100%' }} onReset={onSearchReset} />
460
+
461
+ case 'number':
462
+ return <InputNumber required={field.required} />
463
+
464
+ case 'input':
465
+ return <Input required={field.required} />
466
+
467
+ case 'radio':
468
+ return (
469
+ <Radio.Group>
470
+
471
+ {field.options.map((option, key) => <Radio key={key} value={option}>{option ? 'Yes' : 'No'}</Radio>)}
472
+
473
+ </Radio.Group>
474
+
475
+ );
476
+
477
+ case 'checkbox':
478
+ return <Checkbox.Group style={{ width: '100%' }}>
479
+ <Col>
480
+ {
481
+ field.options.map((option, key) => {
482
+
483
+ let opt = typeof option === 'string' ? option : option.value;
484
+
485
+ return <Row><Checkbox key={key} value={opt}>{opt}</Checkbox></Row>
486
+ })
487
+ }
488
+ </Col>
489
+ </Checkbox.Group>
490
+
491
+ // case 'checkbox':
492
+ // return <Checkbox.Group options={field.options}/>
493
+ case 'textarea':
494
+ return <TextArea rows={4} required={field.required} />
495
+
496
+ case 'boolean':
497
+ return <Select style={{ width: '120' }} required={field.required}>
498
+ {[true, false].map((option, key) => <Option key={key} value={option}>{option ? 'Yes' : 'No'}</Option>)}
499
+ </Select>
500
+
501
+ case 'select':
502
+ // Handle static select options
503
+ if (Array.isArray(field.options)) {
504
+
505
+ let defaultValue = field.default ? field.default : '';
506
+
507
+ /**If there is selected Information ie, for change info if there is selected guest information
508
+ * then we will match and set a default value from the guest details
509
+ */
510
+ if (selectedInformation) {
511
+ // Get the field value dynamically from selectedInformation[0] using field.field
512
+ const fieldValue = selectedInformation[0] && selectedInformation[0][field.caption];
513
+
514
+ // Find the default value based on field value and matching DisplayMember or description
515
+ const defaultOption = field.options.find(
516
+ (option) =>
517
+ option.displayMember?.toLowerCase() === fieldValue?.toLowerCase()
518
+ )
519
+
520
+ // If a matching option is found, set the default value; otherwise, do not set a default value (i.e., null or undefined)
521
+ defaultValue = defaultOption ? defaultOption.valueMember : null;
522
+
523
+ }
524
+ /**In case of default selection we need to call the onchange manually */
525
+ if (defaultValue) {
526
+
527
+ onChange(field, defaultValue);
528
+ }
529
+
530
+ return (
531
+ <Select defaultValue={defaultValue}
532
+ required={field.required}
533
+ style={{ width: '120' }}
534
+ onChange={(value) => onChange(field, value)}
535
+ >
536
+ {field.options.map((option, key) => (
537
+ <Option key={key} value={option.valueMember}>
538
+ {option.displayMember}
539
+ </Option>
540
+ ))}
541
+ </Select>
542
+ );
543
+ }
544
+ // case 'checkbox':
545
+ // return <Checkbox.Group options={field.options} />
546
+
547
+ case 'datetime':
548
+ return <DatePicker format={"DD/MM/YYYY"} onChange={(record) => {
549
+
550
+ onChange(field, record.format('DD/MM/YYYY'))
551
+
552
+ }} />
553
+
554
+ case 'date':
555
+ return <DatePicker format={"DD/MM/YYYY"} />
556
+
557
+
558
+ case 'time':
559
+ return <TimePicker format={"HH:mm A"} />
560
+
561
+ // onChange={(record) => {
562
+
563
+ // console.log(record);
564
+
565
+ // onChange(field, record.format('HH:mm A'))
566
+
567
+ // }}
568
+
569
+
570
+ case 'upload':
571
+ return <FileUpload multiple={field.multiple} maxSize={field.maxSize || 3} callback={(attachment) => onUpload(field, attachment)} onProgress={() => { }} />
572
+
573
+ case 'camera':
574
+ return <Camera />
575
+
576
+
577
+ default:
578
+ return <Input />
579
+ }
580
+ }
581
+
582
+ // const getItemStyle = (draggableStyle, isDragging) => ({
583
+ // // some basic styles to make the items look a bit nicer
584
+ // userSelect: 'none',
585
+ // // padding: grid,
586
+ // // margin: `0 0 ${grid}px 0`,
587
+ // // position: `absolute`,
588
+ // // right: '40px',
589
+
590
+ // // change background colour if dragging
591
+ // // background: isDragging ? 'lightgreen' : 'whitesmoke',
592
+
593
+ // boxShadow: isDragging ? '0px 0px 5px 5px #eeeeee' : '',
594
+
595
+ // // styles we need to apply on draggables
596
+ // ...draggableStyle
597
+ // });
598
+
599
+
600
+ return (
601
+ <>
602
+ {/* <Draggable
603
+ key={`${field.caption}-${index}`}
604
+ draggableId={`${field.caption}-${index}`}
605
+ index={index}
606
+ >
607
+ {(provided, snapshot) => (
608
+ <div>
609
+ <div
610
+
611
+ ref={provided.innerRef}
612
+ {...provided.dragHandleProps}
613
+ {...provided.draggableProps}
614
+ style={getItemStyle(
615
+ provided.draggableProps.style,
616
+ snapshot.isDragging
617
+ )}
618
+
619
+ > */}
620
+ {isVisible === true ? (
621
+ <div className={`form-item-element ${field.type === 'search' ? 'form-item-element-search' : ''}`}>
622
+
623
+ {/* <Button
624
+ size="small"
625
+ ref={provided.innerRef}
626
+ {...provided.dragHandleProps}
627
+ {...provided.draggableProps}
628
+ style={getItemStyle(
629
+ provided.draggableProps.style,
630
+ snapshot.isDragging
631
+ )}
632
+ >
633
+
634
+ <ColumnHeightOutlined />
635
+
636
+ </Button> */}
637
+
638
+
639
+ {/* Customizes the form */}
640
+ <FieldCustomizer field={field} onFieldUpdate={onFieldUpdate} index={index} onFieldRemove={onFieldRemove} />
641
+ {/* Customizes the form Ends */}
642
+
643
+ <Form.Item
644
+ {...props}
645
+ name={field.field}
646
+ label={field.caption}
647
+ rules={[{ required: field.required, message: field.placeholder || 'Please enter ' + field.caption }]}
648
+ style={{ marginBottom: '12px' }}
649
+ >
650
+
651
+ {inputElement(field, onChange)}
652
+ {/* <InputElement field={field} /> */}
653
+
654
+ </Form.Item>
655
+
656
+ </div>
657
+ ) : null}
658
+ {/* </div>
659
+ </div>
660
+ )}
661
+ </Draggable> */}
662
+
663
+ </>
664
+ )
665
+ }