ui-soxo-bootstrap-core 2.6.5 → 2.6.6

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