@dashadmin/dash-admin 1.3.72 → 1.3.74-srcfree.1

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 (289) hide show
  1. package/dist/components/tenant/TenancyPlan.js +307 -0
  2. package/dist/systemResources.js +18 -2
  3. package/package.json +25 -22
  4. package/src/AppAsyncWrapper.tsx +0 -42
  5. package/src/AppWrapper.tsx +0 -45
  6. package/src/DASHAdmin.tsx +0 -502
  7. package/src/DASHAdmin.tsx.old +0 -456
  8. package/src/RoutingWrapper.tsx +0 -143
  9. package/src/classes/DASHStorageClass.tsx +0 -8
  10. package/src/components/Input/RichTextField.tsx +0 -27
  11. package/src/components/Redirect.tsx +0 -46
  12. package/src/components/avatar/Avatar.tsx +0 -71
  13. package/src/components/avatar/SingleImageUploader.tsx +0 -107
  14. package/src/components/currency/Format.tsx +0 -79
  15. package/src/components/custom/Redirect.tsx +0 -23
  16. package/src/components/error/Error.tsx +0 -168
  17. package/src/components/geocoding/GeocodingField.tsx +0 -167
  18. package/src/components/i18n/BridgedLocalesMenuButton.tsx +0 -160
  19. package/src/components/i18n/LangSwitcher.tsx +0 -204
  20. package/src/components/loader/GlobalLoader.tsx +0 -49
  21. package/src/components/logs/LogFile.tsx +0 -88
  22. package/src/components/logs/LogFileById.tsx +0 -68
  23. package/src/components/logs/LogViewer.tsx +0 -43
  24. package/src/components/menu/AppMenu.tsx +0 -22
  25. package/src/components/menu/CustomMenuItemLink.tsx +0 -61
  26. package/src/components/menu/DarkToggleMode.tsx +0 -65
  27. package/src/components/menu/LanguageToggleMode.tsx +0 -120
  28. package/src/components/misc/CustomImageInput.tsx +0 -62
  29. package/src/components/misc/DASHGlobalErrorHandler.tsx +0 -194
  30. package/src/components/misc/DarkModeSwitcher.tsx +0 -112
  31. package/src/components/misc/HorizontalScroller.tsx +0 -225
  32. package/src/components/misc/LanguageSwitcher.tsx +0 -199
  33. package/src/components/misc/MUIHtmlToolTip.tsx +0 -15
  34. package/src/components/misc/MuiSimpleJsonTable.tsx +0 -279
  35. package/src/components/misc/MultiLevelTable.tsx +0 -229
  36. package/src/components/misc/NoResults.tsx +0 -28
  37. package/src/components/misc/PDFViewer.tsx +0 -85
  38. package/src/components/navigation/Breadcrumbs.tsx +0 -220
  39. package/src/components/navigation/BreadcrumbsManager.tsx +0 -310
  40. package/src/components/navigation/index.tsx +0 -5
  41. package/src/components/panel/Error.tsx +0 -168
  42. package/src/components/permission/AvailablePermissionsContext.tsx +0 -173
  43. package/src/components/permission/PermissionsSelector.tsx +0 -834
  44. package/src/components/permission/PermissionsSelectorList.tsx +0 -473
  45. package/src/components/permission/tsx +0 -0
  46. package/src/components/racustombuttons/CustomRAButton.tsx +0 -87
  47. package/src/components/racustombuttons/QuickButton.tsx +0 -117
  48. package/src/components/racustombuttons/QuickEditButton.tsx +0 -115
  49. package/src/components/racustombuttons/QuickIconButton.tsx +0 -122
  50. package/src/components/scrollbar/Scrollbar.tsx +0 -31
  51. package/src/components/selects/MultiSelect.tsx +0 -53
  52. package/src/components/selects/RASearchableSelect.tsx +0 -282
  53. package/src/components/selects/RASearchableSelectChips.tsx +0 -308
  54. package/src/components/selects/SearchableSelect.tsx +0 -139
  55. package/src/components/serviceAccount/ApiKeyRevealDialog.tsx +0 -129
  56. package/src/components/serviceAccount/ServiceAccountStatusSwitch.tsx +0 -99
  57. package/src/components/subscription/BillingCycleSelectInput.tsx +0 -68
  58. package/src/components/subscription/PlanAddonsSettings.tsx +0 -563
  59. package/src/components/subscription/PlanAuditLog.tsx +0 -453
  60. package/src/components/subscription/PlanFeaturesSettings.tsx +0 -243
  61. package/src/components/subscription/PlanLimitsSettings.tsx +0 -230
  62. package/src/components/subscription/PlanMetadataSettings.tsx +0 -306
  63. package/src/components/subscription/PlanPricesSettings.tsx +0 -307
  64. package/src/components/subscription/index.ts +0 -7
  65. package/src/components/svgelements/SvgLoading.tsx +0 -229
  66. package/src/components/svgelements/SvgLogo.tsx +0 -53
  67. package/src/components/svgelements/SvgLogoMin.tsx +0 -64
  68. package/src/components/svgelements/SvgShipping.tsx +0 -673
  69. package/src/components/tenancy/GlobalTenantWrapper.tsx +0 -84
  70. package/src/components/tenancy/TenantSwitcher.tsx +0 -514
  71. package/src/components/tenant/AvailablePermissionsContext.tsx +0 -0
  72. package/src/components/tenant/SettingsSections.tsx +0 -151
  73. package/src/components/tenant/TenancySettings.tsx +0 -122
  74. package/src/components/tenant/TenantAttributes.tsx +0 -153
  75. package/src/components/tenant/TenantAttributesContext.tsx +0 -163
  76. package/src/components/tenant/TenantSelector.tsx +0 -142
  77. package/src/components/tenant/TenantSettings.tsx +0 -184
  78. package/src/components/tenant/TenantSettingsContext.tsx +0 -165
  79. package/src/components/tenant/TenantTheme.tsx +0 -172
  80. package/src/components/user/AvatarComponent.tsx +0 -317
  81. package/src/components/user/TenantAvatarComponent.tsx +0 -99
  82. package/src/components/user/UserPreferences.tsx +0 -677
  83. package/src/config/ACTIONS.tsx +0 -26
  84. package/src/config/ConstantsService.tsx +0 -44
  85. package/src/config/DASHAdminSystemConstants.tsx +0 -183
  86. package/src/config/PARSERS.tsx +0 -9
  87. package/src/contexts/DashQueryClientContext.tsx +0 -113
  88. package/src/contexts/DashResourceContext.tsx +0 -34
  89. package/src/contexts/I18nBridgeContext.tsx +0 -156
  90. package/src/contexts/I18nBridgeSetter.tsx +0 -39
  91. package/src/contexts/I18nReduxSync.tsx +0 -27
  92. package/src/contexts/SubscriptionPlanFormatsProvider.tsx +0 -217
  93. package/src/contexts/SystemRequestsCache.tsx +0 -215
  94. package/src/contexts/auth/AuthContext.tsx +0 -567
  95. package/src/contexts/auth/AuthContextLocalStorage.tsx +0 -140
  96. package/src/contexts/auth/DASHAuthenticationService.tsx +0 -915
  97. package/src/contexts/auth/WindowContext.tsx +0 -15
  98. package/src/contexts/auth/index.tsx +0 -3
  99. package/src/contexts/com/FCMContext.tsx +0 -415
  100. package/src/contexts/com/LaravelEchoContext.tsx +0 -41
  101. package/src/contexts/com/LaravelEchoMgr.tsx +0 -155
  102. package/src/contexts/com/components/DefaultNotificationComponent.tsx +0 -20
  103. package/src/contexts/com/components/EchoNotificationsCenter.tsx +0 -65
  104. package/src/contexts/com/components/NotificationAttributesTable.tsx +0 -54
  105. package/src/contexts/com/components/NotificationRenderer.tsx +0 -42
  106. package/src/contexts/com/components/NotificationsWidget.tsx +0 -182
  107. package/src/contexts/com/components/notificationFormats.tsx +0 -50
  108. package/src/contexts/com/useLaravelEcho.tsx +0 -432
  109. package/src/contexts/dictionary/DictionaryContext.tsx +0 -94
  110. package/src/declarations.d.ts +0 -17
  111. package/src/default-theme/DASHAppProviders.tsx +0 -117
  112. package/src/default-theme/DashThemeContext.tsx +0 -209
  113. package/src/default-theme/DashThemeContext.tsx.fast +0 -143
  114. package/src/default-theme/DashThemeContext.tsx.old +0 -306
  115. package/src/default-theme/DashThemeHelperProvider.tsx +0 -98
  116. package/src/default-theme/DomainAppLayout.tsx +0 -166
  117. package/src/default-theme/DomainHeader.tsx +0 -162
  118. package/src/default-theme/DomainTheme.tsx +0 -59
  119. package/src/default-theme/FullLayoutMarkup.tsx +0 -231
  120. package/src/default-theme/StaticLayout.tsx +0 -47
  121. package/src/default-theme/index.tsx +0 -11
  122. package/src/default-theme/menu/AppDashboardGrid.tsx +0 -279
  123. package/src/default-theme/menu/AppMaterialMenu.tsx +0 -546
  124. package/src/default-theme/menu/AppMenuComponents/SubmenuPortal.tsx +0 -61
  125. package/src/default-theme/menu/AppMenuComponents/collapsed/CollapsedSidebarItem.tsx +0 -264
  126. package/src/default-theme/menu/AppMenuComponents/collapsed/CollapsedSidebarItems.tsx +0 -31
  127. package/src/default-theme/menu/AppMenuComponents/expanded/CollapsableSidebarMenu.tsx +0 -293
  128. package/src/default-theme/menu/AppMenuComponents/expanded/SidebarItem.tsx +0 -92
  129. package/src/default-theme/menu/AppMenuComponents/getItem.tsx +0 -17
  130. package/src/default-theme/menu/AppMenuComponents/interfaces.tsx +0 -41
  131. package/src/default-theme/menu/AppMenuComponents/submenuConstants.ts +0 -90
  132. package/src/default-theme/menu/AppSidebarMaterial.tsx +0 -339
  133. package/src/default-theme/menu/SidebarActions.tsx +0 -84
  134. package/src/default-theme/updateDomCssVariables.tsx +0 -176
  135. package/src/helpers/checkRole.tsx +0 -66
  136. package/src/helpers/parseAxiosError.tsx +0 -41
  137. package/src/hooks/audio/useAudio.tsx +0 -39
  138. package/src/hooks/axios.tsx +0 -165
  139. package/src/hooks/data/useDashboardStats.tsx +0 -65
  140. package/src/hooks/data/usePackageByClientsStats.tsx +0 -44
  141. package/src/hooks/data/usePackageByCommunesStats.tsx +0 -44
  142. package/src/hooks/data/usePackageStats.tsx +0 -69
  143. package/src/hooks/data/usePackageWithdrawDetails.tsx +0 -61
  144. package/src/hooks/data/useStats.tsx +0 -86
  145. package/src/hooks/isCurrentPath.tsx +0 -22
  146. package/src/hooks/notifications/WSMessagesManager.tsx +0 -152
  147. package/src/hooks/notifications/WSPusherManager.tsx +0 -92
  148. package/src/hooks/useBreadcrumbs.tsx +0 -329
  149. package/src/hooks/useClickOutside.tsx +0 -57
  150. package/src/hooks/useFormPersistance.tsx +0 -150
  151. package/src/hooks/useGlobalErrorMediator.tsx +0 -43
  152. package/src/hooks/useGlobalLoaderMgr.tsx +0 -21
  153. package/src/hooks/useHash.tsx +0 -27
  154. package/src/hooks/useLocalStorage.tsx +0 -196
  155. package/src/hooks/usePolyglotTranslation.tsx +0 -62
  156. package/src/hooks/usePrevious.tsx +0 -9
  157. package/src/hooks/usePrintSelected.tsx +0 -37
  158. package/src/hooks/useVirtualHash.tsx +0 -33
  159. package/src/hooks/window/useWindowSize.tsx +0 -36
  160. package/src/index.tsx +0 -134
  161. package/src/interfaces/IAppResourceConfig.tsx +0 -20
  162. package/src/interfaces/Log.tsx +0 -16
  163. package/src/interfaces/Tenant.tsx +0 -25
  164. package/src/interfaces/communication/IActions.tsx +0 -5
  165. package/src/interfaces/communication/INotification.tsx +0 -21
  166. package/src/interfaces/communication/IPayload.tsx +0 -3
  167. package/src/interfaces/communication/IRequestAction.tsx +0 -10
  168. package/src/interfaces/communication/IRequestPayload.tsx +0 -7
  169. package/src/interfaces/communication/IResponseAction.tsx +0 -7
  170. package/src/interfaces/misc/IAny.tsx +0 -3
  171. package/src/interfaces/misc/IFlashMessage.tsx +0 -10
  172. package/src/interfaces/navigation/IAppMenu.ts +0 -14
  173. package/src/interfaces/navigation/ICollapsableSidebarMenu.ts +0 -12
  174. package/src/interfaces/navigation/IMenuItem.ts +0 -16
  175. package/src/interfaces/notifications/IModel.tsx +0 -6
  176. package/src/interfaces/notifications/IModelField.tsx +0 -8
  177. package/src/interfaces/notifications/IUserNotification.tsx +0 -12
  178. package/src/interfaces/notifications/IUserNotificationData.tsx +0 -13
  179. package/src/interfaces/notifications/IUserNotificationPayload.tsx +0 -8
  180. package/src/interfaces/user/IGetAuth.tsx +0 -92
  181. package/src/interfaces/user/ITenantSettings.tsx +0 -3
  182. package/src/interfaces/user/IUser.tsx +0 -60
  183. package/src/interfaces/user/IUserSettings.tsx +0 -43
  184. package/src/interfaces.tsx +0 -6
  185. package/src/layout/AppLayout.tsx +0 -112
  186. package/src/layout/ApplicationLayout.tsx +0 -197
  187. package/src/layout/MotionWrapper.original.tsx +0 -236
  188. package/src/layout/MotionWrapper.tsx +0 -236
  189. package/src/layout/ResourceMenu.tsx +0 -164
  190. package/src/layout/ResoureLayout.tsx +0 -105
  191. package/src/layout/TransitionWrapper.tsx +0 -125
  192. package/src/pages/ChangePassword.tsx +0 -179
  193. package/src/pages/DASHLanding.tsx +0 -22
  194. package/src/pages/DASHLightWeightLogin.tsx +0 -611
  195. package/src/pages/DASHSimpleLogin.tsx +0 -260
  196. package/src/pages/Login.tsx +0 -111
  197. package/src/pages/Profile.tsx +0 -357
  198. package/src/pages/RecoverPassword.tsx +0 -175
  199. package/src/pages/SingleImageUploader.tsx +0 -55
  200. package/src/pages/VerifyAccount.tsx +0 -128
  201. package/src/providers/authProvider.tsx +0 -217
  202. package/src/providers/dataProvider.tsx +0 -672
  203. package/src/providers/i18n/en.ts +0 -646
  204. package/src/providers/i18n/es.ts +0 -652
  205. package/src/providers/i18n/languages.tsx +0 -8
  206. package/src/providers/i18n/mergeTranslations.ts +0 -53
  207. package/src/providers/i18nProvider.tsx +0 -23
  208. package/src/react-admin-dash/RADashComponent.tsx +0 -240
  209. package/src/react-admin-dash/Resource.tsx +0 -77
  210. package/src/resources/Brand/BrandResource.tsx +0 -130
  211. package/src/resources/DASHResourceLoader.ts +0 -180
  212. package/src/resources/Log/LogResource.tsx +0 -73
  213. package/src/resources/Tenant/ImpersonateTenantResource.tsx +0 -113
  214. package/src/resources/Trash/TrashTemplate.tsx +0 -180
  215. package/src/resources/User/components/AvatarUploadField.tsx +0 -57
  216. package/src/resources/User/components/PasswordFields.tsx +0 -73
  217. package/src/resources/User/getProfileMenu.ts +0 -57
  218. package/src/resources/User/profileResource.tsx +0 -51
  219. package/src/resources/User/userLayout.tsx +0 -62
  220. package/src/resources/User/userResource.tsx +0 -111
  221. package/src/resources/User/userSchema.tsx +0 -213
  222. package/src/resources/User/usersFilters.tsx +0 -21
  223. package/src/resources.tsx +0 -280
  224. package/src/schemas/log.tsx +0 -45
  225. package/src/schemas/notification.tsx +0 -42
  226. package/src/schemas/permissions.tsx +0 -44
  227. package/src/schemas/roles.tsx +0 -48
  228. package/src/schemas/rolesDataGrid.tsx +0 -48
  229. package/src/schemas/subscription/components/SubscriptionActions.tsx +0 -153
  230. package/src/schemas/subscription/components/SubscriptionPaymentHistory.tsx +0 -127
  231. package/src/schemas/subscription/components/SubscriptionPlanFeatures.tsx +0 -162
  232. package/src/schemas/subscription/components/SubscriptionPlanPreview.tsx +0 -141
  233. package/src/schemas/subscription/components/SubscriptionPlanStats.tsx +0 -318
  234. package/src/schemas/subscription/components/SubscriptionStatusIndicator.tsx +0 -72
  235. package/src/schemas/subscription/subscriptionPlanSchema.tsx +0 -185
  236. package/src/schemas/subscription/subscriptionSchema.tsx +0 -152
  237. package/src/schemas/subscriptionPlan.ts +0 -422
  238. package/src/schemas/tenant.tsx +0 -129
  239. package/src/schemas/tenantUser.tsx +0 -96
  240. package/src/schemas/tenant_superadmin.tsx +0 -119
  241. package/src/schemas/user.tsx +0 -26
  242. package/src/systemResources.old.tsx +0 -928
  243. package/src/systemResources.tsx +0 -1369
  244. package/src/templates/ResourceTemplate.tsx +0 -240
  245. package/src/templates/ResourceTemplate.tsx.memoized_experiment +0 -350
  246. package/src/templates/ResourceTemplate.tsx.original +0 -396
  247. package/src/templates/ResourceTemplateCreate.tsx +0 -182
  248. package/src/templates/ResourceTemplateEdit.tsx +0 -176
  249. package/src/templates/ResourceTemplateFull.tsx +0 -581
  250. package/src/templates/ResourceTemplateList.tsx +0 -340
  251. package/src/templates/ResourceTemplateOld.tsx.bkup +0 -567
  252. package/src/templates/ResourceTemplateShow.tsx +0 -88
  253. package/src/templates/TrashTemplate.tsx +0 -179
  254. package/src/tenantResources.tsx +0 -223
  255. package/src/test_portal_bubbles.tsx +0 -40
  256. package/src/theme/AppHeader.tsx +0 -52
  257. package/src/theme/AppLayoutSetting.tsx +0 -33
  258. package/src/theme/AppLogo.tsx +0 -13
  259. package/src/theme/AppSidebar.tsx +0 -12
  260. package/src/theme/AppSidebarContent.tsx +0 -105
  261. package/src/theme/AppSidebarLogo.tsx +0 -48
  262. package/src/theme/components/PageTitle.tsx +0 -37
  263. package/src/utils/cache/CacheInvalidatorContext.tsx +0 -125
  264. package/src/utils/cache/CacheInvalidatorListenerComponent.tsx +0 -10
  265. package/src/utils/cache/useCacheInvalidatorListener.tsx +0 -27
  266. package/src/utils/convertFileToBase64.tsx +0 -9
  267. package/src/utils/convertToFile.tsx +0 -14
  268. package/src/utils/cookies.tsx +0 -33
  269. package/src/utils/dashDefaultQueryClient.tsx +0 -34
  270. package/src/utils/dataUrlToBlob.tsx +0 -30
  271. package/src/utils/deepReplace.tsx +0 -19
  272. package/src/utils/getProfileMenu.tsx +0 -41
  273. package/src/utils/getTenantSettings.tsx +0 -9
  274. package/src/utils/getType.tsx +0 -8
  275. package/src/utils/getUserSettings.tsx +0 -8
  276. package/src/utils/hasCode.tsx +0 -14
  277. package/src/utils/index.ts +0 -19
  278. package/src/utils/injectTenantStyles.ts +0 -28
  279. package/src/utils/isComponent.tsx +0 -45
  280. package/src/utils/navEvents.tsx +0 -91
  281. package/src/utils/prototypes.tsx +0 -5
  282. package/src/utils/regexp.tsx +0 -4
  283. package/src/utils/resolveObjectPath.tsx +0 -4
  284. package/src/utils/setNativeValue.tsx +0 -24
  285. package/src/utils/slugify.tsx +0 -11
  286. package/src/utils/validators/emailValidator.tsx +0 -6
  287. package/src/utils/validators/requiredValidator.tsx +0 -5
  288. package/src/utils/validators/rutValidator.tsx +0 -31
  289. package/src/utils/validators.tsx +0 -96
@@ -1,567 +0,0 @@
1
- import { PropsWithChildren, useEffect } from 'react';
2
- import { Route, useParams } from 'react-router';
3
- import { toast } from 'react-toastify';
4
- import { useDialog } from 'dash-dialog';
5
- import { IDASHAppConstants } from 'dash-constants';
6
- import {
7
- Create,
8
- Edit,
9
- EditButton,
10
- CustomRoutes,
11
- Loading,
12
- Resource,
13
- Show,
14
- SimpleForm,
15
- TabbedShowLayout,
16
- TopToolbar,
17
- Toolbar,
18
- useNotify,
19
- useRedirect,
20
- useRefresh
21
- } from 'react-admin';
22
-
23
- import { DashResourceProvider } from '../../contexts/DashResourceContext';
24
- import { IDashAutoAdminResourceConfig, evalActionPermission, DashRedirect, DashAutoList, DashAutoDrawer, DashAutoEdit, DashAutoCreate, DashAutoTitle, DashAutoTabs, DashAutoReferenceTab } from 'dash-auto-admin';
25
- import DashAutoAdminSaveButton from 'dash-auto-admin/src/DashAutoAdminSaveButton';
26
- // TODO: The following dependencies shpuld not depend on @dashboard
27
-
28
- export const ResourceTemplate = (
29
- resourceConfig: IDashAutoAdminResourceConfig,
30
- ResourceLayout: React.FC<PropsWithChildren<{ resourceConfig: IDashAutoAdminResourceConfig }>>,
31
- dashConstants: IDASHAppConstants,
32
- ) => {
33
- const _create = evalActionPermission(resourceConfig, resourceConfig?.create);
34
- const _edit = evalActionPermission(resourceConfig, resourceConfig?.edit);
35
- //const _delete = evalActionPermission(resourceConfig,resourceConfig?.delete)
36
-
37
- const _showNotifyAfterSubmit =
38
- resourceConfig?.showNotifyAfterSubmit === false ? false : true;
39
- const _showDialogAfterSubmit =
40
- resourceConfig?.showDialogAfterSubmit === false ? false : true;
41
-
42
- const showError = (error: any) => {
43
- if (error && error.nativeEvent) return;
44
-
45
- let _error: any = error;
46
- try {
47
- const _parsedError =
48
- typeof error === 'string' ? JSON.parse(error) : error;
49
- if (typeof _parsedError === 'object') {
50
- _error = <>{JSON.stringify(_parsedError)}</>;
51
- }
52
- } catch (e) {
53
- console.error(e);
54
- }
55
-
56
- toast.error(<>{_error}</>, {
57
- position: 'bottom-center',
58
- //autoClose: 10000,
59
- autoClose: false,
60
- hideProgressBar: true,
61
- closeOnClick: true,
62
- pauseOnHover: true,
63
- draggable: true,
64
- //progress: undefined,
65
- /*onClose: () => {
66
- }*/
67
- });
68
- };
69
-
70
- return (
71
- <DashResourceProvider resourceConfig={resourceConfig}>
72
- <CustomRoutes>
73
- {typeof resourceConfig.customRoutes === 'function' &&
74
- resourceConfig.customRoutes(resourceConfig)}
75
- <Route
76
- path={resourceConfig.model + '/inline'}
77
- element={
78
- <DashRedirect
79
- stateHashPattern={dashConstants.system.URL_PREFIX + resourceConfig.model + '/inline'}
80
- method='list'
81
- drawerMethod='edit'
82
- resourceConfig={resourceConfig}
83
- />
84
- }
85
- />
86
- <Route
87
- path={resourceConfig.model + '/inline/:id'}
88
- element={
89
- <DashRedirect
90
- stateHashPattern={
91
- dashConstants.system.URL_PREFIX + resourceConfig.model + '/inline/:id/:method'
92
- }
93
- method='list'
94
- drawerMethod='edit'
95
- resourceConfig={resourceConfig}
96
- />
97
- }
98
- />
99
- <Route
100
- path={resourceConfig.model + '/inline/:id/edit'}
101
- element={
102
- <DashRedirect
103
- stateHashPattern={
104
- dashConstants.system.URL_PREFIX + resourceConfig.model + '/inline/:id/:method'
105
- }
106
- method='list'
107
- drawerMethod='edit'
108
- resourceConfig={resourceConfig}
109
- />
110
- }
111
- />
112
- <Route
113
- path={resourceConfig.model + '/inline/:id/show'}
114
- element={
115
- <DashRedirect
116
- stateHashPattern={
117
- dashConstants.system.URL_PREFIX + resourceConfig.model + '/inline/:id/:method'
118
- }
119
- method='list'
120
- drawerMethod='show'
121
- resourceConfig={resourceConfig}
122
- />
123
- }
124
- />
125
- <Route
126
- path={resourceConfig.model + '/inline/create'}
127
- element={
128
- <DashRedirect
129
- stateHashPattern={dashConstants.system.URL_PREFIX + resourceConfig.model + '/inline/create'}
130
- method='list'
131
- drawerMethod='create'
132
- resourceConfig={resourceConfig}
133
- />
134
- }
135
- />
136
- </CustomRoutes>
137
- <Resource
138
- options={{ label: resourceConfig.label, group: resourceConfig.group }}
139
- name={resourceConfig.model}
140
- list={() => {
141
- const notify = useNotify();
142
- const redirect = useRedirect();
143
- const dialog = useDialog();
144
- const refresh = useRefresh();
145
-
146
- useEffect(() => {
147
- console.log('LIST', resourceConfig);
148
- }, []);
149
-
150
- const onSubmit = (data: any) => {
151
- if (_showNotifyAfterSubmit) {
152
- notify('Recurso Actualizado', { type: 'success' });
153
- }
154
-
155
- if (_showDialogAfterSubmit) {
156
- dialog({
157
- variant: 'info',
158
- title: 'Recurso Actualizado',
159
- content:
160
- 'Se ha actualizado el recurso ' + resourceConfig.label,
161
- onConfirm: () => {
162
- //resourceConfig.refreshAfter && refresh();
163
- switch (resourceConfig.redirectAfterUpdate) {
164
- case false:
165
- return;
166
- case 'view':
167
- redirect(
168
- '/' + resourceConfig.model + '/' + data.id + '/show',
169
- );
170
- break;
171
- case 'edit':
172
- redirect('/' + resourceConfig.model + '/' + data.id);
173
- break;
174
- case 'list':
175
- default:
176
- redirect('/' + resourceConfig.model);
177
- break;
178
- }
179
- },
180
- onClose: () => { },
181
- });
182
- }
183
-
184
- if (!_showDialogAfterSubmit && resourceConfig.redirectAfterUpdate) {
185
- switch (resourceConfig.redirectAfterUpdate) {
186
- case 'view':
187
- redirect(
188
- '/' + resourceConfig.model + '/' + data.id + '/show',
189
- );
190
- break;
191
- case 'edit':
192
- redirect('/' + resourceConfig.model + '/' + data.id);
193
- break;
194
- case 'list':
195
- default:
196
- redirect('/' + resourceConfig.model);
197
- break;
198
- }
199
- }
200
-
201
- if (resourceConfig.refreshAfter) {
202
- refresh();
203
- }
204
- }; const onError = (error: any) => {
205
- //notify(`Error!`);
206
- showError(error);
207
- };
208
-
209
- return (
210
- <ResourceLayout resourceConfig={resourceConfig}>
211
- {resourceConfig.listComponent ? (
212
- resourceConfig.listComponent(resourceConfig, onSubmit, onError)
213
- ) : (
214
- <DashAutoList
215
- resourceConfig={resourceConfig}
216
- onSubmit={onSubmit}
217
- onError={onError}
218
- // custom form Domain project:
219
- //stickyHeader={true}
220
- {...(resourceConfig.Pagination && {
221
- Pagination: resourceConfig.Pagination,
222
- })}
223
- />
224
- )}
225
- {resourceConfig.drawer && (
226
- <DashAutoDrawer
227
- resourceConfig={resourceConfig}
228
- {...(resourceConfig.drawerProps && {
229
- ...resourceConfig.drawerProps,
230
- })}
231
- />
232
- )}
233
- </ResourceLayout>
234
- );
235
- }}
236
- edit={
237
- _edit &&
238
- (() => {
239
- useEffect(() => {
240
- console.log('EDIT', resourceConfig);
241
- }, []);
242
-
243
- const notify = useNotify();
244
- const redirect = useRedirect();
245
- const dialog = useDialog();
246
- const refresh = useRefresh();
247
- //const location = useLocation();
248
-
249
- const onEdit = (data: any) => {
250
- if (_showNotifyAfterSubmit) {
251
- notify('Recurso Editado');
252
- }
253
- if (_showDialogAfterSubmit) {
254
- dialog({
255
- variant: 'info',
256
- title: 'Recurso Actualizado',
257
- content:
258
- 'Se ha actualizado el recurso ' + resourceConfig.label,
259
- onConfirm: () => {
260
- //resourceConfig.refreshAfter && refresh();
261
- switch (resourceConfig.redirectAfterUpdate) {
262
- case false:
263
- return;
264
- case 'view':
265
- redirect(
266
- '/' + resourceConfig.model + '/' + data.id + '/show',
267
- );
268
- break;
269
- case 'edit':
270
- redirect('/' + resourceConfig.model + '/' + data.id);
271
- break;
272
- case 'list':
273
- default:
274
- redirect('/' + resourceConfig.model);
275
- break;
276
- }
277
- },
278
- onClose: () => { },
279
- });
280
- }
281
-
282
- if (
283
- !_showDialogAfterSubmit &&
284
- resourceConfig.redirectAfterUpdate
285
- ) {
286
- switch (resourceConfig.redirectAfterUpdate) {
287
- case 'view':
288
- redirect(
289
- '/' + resourceConfig.model + '/' + data.id + '/show',
290
- );
291
- break;
292
- case 'edit':
293
- redirect('/' + resourceConfig.model + '/' + data.id);
294
- break;
295
- case 'list':
296
- default:
297
- redirect('/' + resourceConfig.model);
298
- break;
299
- }
300
- }
301
-
302
- if (resourceConfig.refreshAfter) {
303
- refresh();
304
- }
305
- }; const onError = (error: any) => {
306
- //notify(`Error!`);
307
- showError(error);
308
- };
309
-
310
- const onBeforeSubmit = (values: any) => {
311
- return resourceConfig.beforeSubmit
312
- ? resourceConfig.beforeSubmit(values)
313
- : values;
314
- };
315
-
316
- const ToolBar = () => {
317
- return (
318
- <Toolbar>
319
- <DashAutoAdminSaveButton
320
- resourceConfig={resourceConfig}
321
- alwaysEnable={
322
- resourceConfig?.saveButtonAlwaysEnabled === true
323
- ? true
324
- : false
325
- }
326
-
327
- />
328
- </Toolbar>
329
- );
330
- };
331
-
332
- return resourceConfig.editComponent ? (
333
- <ResourceLayout resourceConfig={resourceConfig}>
334
- <Edit>
335
- {' '}
336
- <SimpleForm reValidateMode="onBlur">
337
- {resourceConfig.editComponent(resourceConfig)}
338
- </SimpleForm>
339
- </Edit>
340
- {resourceConfig.drawer && (
341
- <DashAutoDrawer
342
- onError={onError}
343
- onSubmit={onEdit}
344
- resourceConfig={resourceConfig}
345
- {...(resourceConfig.drawerProps && {
346
- ...resourceConfig.drawerProps,
347
- })}
348
- />
349
- )}
350
- </ResourceLayout>
351
- ) : (
352
- <ResourceLayout resourceConfig={resourceConfig}>
353
- <DashAutoEdit
354
- toolbar={<ToolBar />}
355
- onError={onError}
356
- onSubmit={onEdit}
357
- beforeSubmit={onBeforeSubmit}
358
- resourceConfig={resourceConfig}
359
- />
360
- {resourceConfig.drawer && (
361
- <DashAutoDrawer
362
- onError={onError}
363
- onSubmit={onEdit}
364
- resourceConfig={resourceConfig}
365
- {...(resourceConfig.drawerProps && {
366
- ...resourceConfig.drawerProps,
367
- })}
368
- />
369
- )}
370
- </ResourceLayout>
371
- );
372
- })
373
- }
374
- create={
375
- _create &&
376
- (() => {
377
- const notify = useNotify();
378
- const redirect = useRedirect();
379
- const refresh = useRefresh();
380
- //console.log("CREATE", resourceConfig)
381
- const dialog = useDialog();
382
-
383
- const onCreate = (data: any) => {
384
- if (_showNotifyAfterSubmit) {
385
- notify('Recurso Creado');
386
- }
387
- if (_showDialogAfterSubmit) {
388
- dialog({
389
- variant: 'info',
390
- title: 'Recurso Creado',
391
- content: 'Se ha creado el recurso ' + resourceConfig.label,
392
- onConfirm: () => {
393
- switch (resourceConfig?.redirectAfterCreate) {
394
- case false:
395
- return;
396
- case 'view':
397
- redirect(
398
- '/' + resourceConfig.model + '/' + data.id + '/show',
399
- );
400
- break;
401
- case 'edit':
402
- redirect('/' + resourceConfig.model + '/' + data.id);
403
- break;
404
- case 'list':
405
- default:
406
- redirect('/' + resourceConfig.model);
407
- break;
408
- }
409
- },
410
- onClose: () => { },
411
- });
412
- }
413
-
414
- if (
415
- !_showDialogAfterSubmit &&
416
- resourceConfig.redirectAfterCreate
417
- ) {
418
- switch (resourceConfig?.redirectAfterCreate) {
419
- case 'view':
420
- redirect(
421
- '/' + resourceConfig.model + '/' + data.id + '/show',
422
- );
423
- break;
424
- case 'edit':
425
- redirect('/' + resourceConfig.model + '/' + data.id);
426
- break;
427
- case 'list':
428
- default:
429
- redirect('/' + resourceConfig.model);
430
- break;
431
- }
432
- }
433
-
434
- if (resourceConfig.refreshAfter) {
435
- refresh();
436
- }
437
- };
438
-
439
- const onError = (error: any) => {
440
- //notify(`Error!`);
441
-
442
- showError(error);
443
- };
444
-
445
- const onBeforeSubmit = (values: any) => {
446
- return resourceConfig.beforeSubmit
447
- ? resourceConfig.beforeSubmit(values)
448
- : values;
449
- };
450
-
451
- const ToolBar = () => {
452
- return (
453
- <Toolbar>
454
- <DashAutoAdminSaveButton
455
- resourceConfig={resourceConfig}
456
- alwaysEnable={
457
- resourceConfig?.saveButtonAlwaysEnabled === true
458
- ? true
459
- : false
460
- }
461
-
462
- />
463
- </Toolbar>
464
- );
465
- };
466
-
467
- return resourceConfig.createComponent ? (
468
- <ResourceLayout resourceConfig={resourceConfig}>
469
- <Create>
470
- <SimpleForm reValidateMode="onBlur">
471
- {resourceConfig.createComponent(resourceConfig)}
472
- </SimpleForm>
473
- </Create>
474
- {resourceConfig.drawer && (
475
- <DashAutoDrawer
476
- resourceConfig={resourceConfig}
477
- {...(resourceConfig.drawerProps && {
478
- ...resourceConfig.drawerProps,
479
- })}
480
- />
481
- )}
482
- </ResourceLayout>
483
- ) : (
484
- <ResourceLayout resourceConfig={resourceConfig}>
485
- <DashAutoCreate
486
- toolbar={<ToolBar />}
487
- onError={onError}
488
- onSubmit={onCreate}
489
- beforeSubmit={onBeforeSubmit}
490
- resourceConfig={resourceConfig}
491
- />
492
- {resourceConfig.drawer && (
493
- <DashAutoDrawer
494
- resourceConfig={resourceConfig}
495
- {...(resourceConfig.drawerProps && {
496
- ...resourceConfig.drawerProps,
497
- })}
498
- />
499
- )}
500
- </ResourceLayout>
501
- );
502
- })
503
- }
504
- show={() => {
505
- const ShowActions = ({ edit }) => (
506
- <TopToolbar sx={{ mb: 2 }} >{edit !== false && <EditButton />}</TopToolbar>
507
- );
508
-
509
- return resourceConfig.showComponent ? (
510
- <ResourceLayout resourceConfig={resourceConfig}>
511
- <Show
512
- title={
513
- <DashAutoTitle
514
- //schema={resourceConfig.showSchema ? resourceConfig.showSchema : resourceConfig.schema}
515
- resourceConfig={resourceConfig}
516
- />
517
- }
518
- actions={<ShowActions edit={resourceConfig.edit} />}
519
- >
520
- {resourceConfig.showComponent(resourceConfig)}
521
- </Show>
522
- {resourceConfig.drawer && (
523
- <DashAutoDrawer
524
- resourceConfig={resourceConfig}
525
- {...(resourceConfig.drawerProps && {
526
- ...resourceConfig.drawerProps,
527
- })}
528
- />
529
- )}
530
- </ResourceLayout>
531
- ) : (
532
- <ResourceLayout resourceConfig={resourceConfig}>
533
- <Show
534
- title={
535
- <DashAutoTitle
536
- //schema={resourceConfig.showSchema ? resourceConfig.showSchema : resourceConfig.schema}
537
- resourceConfig={resourceConfig}
538
- />
539
- }
540
- actions={<ShowActions edit={resourceConfig.edit} />}
541
- >
542
- <TabbedShowLayout syncWithLocation={false}>
543
- {DashAutoTabs(resourceConfig)}
544
- {resourceConfig.references &&
545
- resourceConfig.references.map((reference) =>
546
- DashAutoReferenceTab(reference),
547
- )}
548
- </TabbedShowLayout>
549
- </Show>
550
- {resourceConfig.drawer && (
551
- <DashAutoDrawer
552
- resourceConfig={resourceConfig}
553
- {...(resourceConfig.drawerProps && {
554
- ...resourceConfig.drawerProps,
555
- })}
556
- />
557
- )}
558
- </ResourceLayout>
559
- );
560
- }}
561
- /* @ts-ignore */
562
- icon={resourceConfig.icon}
563
- />
564
- </DashResourceProvider>
565
- );
566
- };
567
- export default ResourceTemplate;
@@ -1,88 +0,0 @@
1
-
2
- /* eslint-disable no-mixed-spaces-and-tabs */
3
-
4
-
5
-
6
-
7
- import { FC, useEffect } from 'react';
8
-
9
-
10
- //import { Outlet } from 'react-router';
11
- import {
12
- DashAutoDrawer,
13
- } from 'dash-auto-admin';
14
-
15
-
16
-
17
- import DashAutoShow from 'dash-auto-admin/src/DashAutoShow';
18
- //import {DASHAdminSystemConstants} from 'dash-constants';
19
- //import { AnimatePresence, motion } from 'framer-motion';
20
-
21
-
22
- //import { useForm } from 'react-hook-form';
23
- import React from 'react';
24
- import ResourceLayout from '../layout/ResoureLayout';
25
- import { useDashResource } from '../contexts/DashResourceContext';
26
- import { IResourceTemplate } from './ResourceTemplate';
27
-
28
-
29
- export const ResourceTemplateShow: FC<IResourceTemplate> = (props) => {
30
- //const {resourceConfig} = useDashResource()
31
- const {resourceConfig, locale} = props;
32
-
33
- /*const ShowActions = ({ edit }) => (
34
- <TopToolbar>{edit !== false && <EditButton />}</TopToolbar>
35
- );*/
36
- /*useEffect(() => {
37
- debugger;
38
- },[]);*/
39
-
40
- return resourceConfig.showComponent ? (
41
- <ResourceLayout resourceConfig={resourceConfig} locale={locale}>
42
- {/* <Show
43
- title={
44
- <DashAutoTitle
45
- //schema={resourceConfig.showSchema ? resourceConfig.showSchema : resourceConfig.schema}
46
- resourceConfig={resourceConfig}
47
- />
48
- }
49
- actions={<ShowActions edit={resourceConfig.edit} />}
50
- >
51
- {resourceConfig.showComponent(resourceConfig)}
52
- </Show>*/}
53
- <DashAutoShow resourceConfig={resourceConfig} locale={locale} />
54
-
55
- {resourceConfig.drawer && (
56
- <DashAutoDrawer
57
- resourceConfig={resourceConfig}
58
- {...(resourceConfig.drawerProps && {
59
- ...resourceConfig.drawerProps,
60
- })}
61
- />
62
- )}
63
- </ResourceLayout>
64
- ) : (
65
- <ResourceLayout resourceConfig={resourceConfig} locale={locale}>
66
- {/*<Show
67
- title={
68
- <DashAutoTitle
69
- //schema={resourceConfig.showSchema ? resourceConfig.showSchema : resourceConfig.schema}
70
- resourceConfig={resourceConfig}
71
- />
72
- }
73
- actions={<ShowActions edit={resourceConfig.edit} />}
74
- >
75
- <DashAutoShow resourceConfig={resourceConfig} />
76
- </Show>*/}
77
- <DashAutoShow resourceConfig={resourceConfig} locale={locale} />
78
- {resourceConfig.drawer && (
79
- <DashAutoDrawer
80
- resourceConfig={resourceConfig}
81
- {...(resourceConfig.drawerProps && {
82
- ...resourceConfig.drawerProps,
83
- })}
84
- />
85
- )}
86
- </ResourceLayout>
87
- );
88
- };