@dashadmin/dash-admin 1.3.73 → 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,42 +0,0 @@
1
- import { IDashAutoAdminAttribute } from 'dash-auto-admin';
2
- import NotificationRenderer from '../contexts/com/components/NotificationRenderer';
3
-
4
- const notificationSchema: IDashAutoAdminAttribute[] = [
5
- {
6
- label: 'Fecha',
7
- attribute: 'created_at',
8
- fieldProps: { showTime: true, fullWidth: true},
9
- type: Date,
10
- },
11
- ,
12
- {
13
- label: 'Tipo',
14
- attribute: 'type',
15
- type: String,
16
- inList: false,
17
- },
18
-
19
- {
20
- label: 'Clase',
21
- attribute: 'class',
22
- type: String,
23
- inList: true,
24
- },
25
-
26
- {
27
- label: 'Título',
28
- attribute: 'notificationPayload.title',
29
- type: String,
30
- },
31
-
32
- {
33
- label: 'Contenido',
34
- attribute: 'notificationPayload',
35
- type: String,
36
- custom: true,
37
- inList: false,
38
- component: NotificationRenderer,
39
- },
40
- ];
41
-
42
- export default notificationSchema;
@@ -1,44 +0,0 @@
1
- import {IDashAutoAdminAttribute} from 'dash-auto-admin'
2
-
3
- enum Guards {
4
- Web = 'web',
5
- }
6
-
7
- enum Levels {
8
- 'Level 1' = '1',
9
- 'Level 2' = '2',
10
- 'Level 3' = '3',
11
- }
12
-
13
- const permissionSchema: IDashAutoAdminAttribute[] = [
14
- /*{
15
- attribute: 'id',
16
- type: Number
17
- },*/
18
- {
19
- attribute: 'name',
20
- type: String,
21
- },
22
- {
23
- attribute: 'guard_name',
24
- type: Guards,
25
- },
26
- {
27
- attribute: 'group',
28
- type: String,
29
- },
30
- {
31
- attribute: 'route_name',
32
- type: String,
33
- },
34
- {
35
- attribute: 'level',
36
- type: Levels,
37
- },
38
- /* {
39
- attribute: 'scope',
40
- type: String
41
- }*/
42
- ];
43
-
44
- export default permissionSchema;
@@ -1,48 +0,0 @@
1
- import { IDashAutoAdminAttribute } from 'dash-auto-admin';
2
- import PermissionsSelector from '../components/permission/PermissionsSelector';
3
-
4
- const roleSchema: IDashAutoAdminAttribute[] = [
5
- {
6
- label: 'Nombre',
7
- attribute: 'name',
8
- type: String,
9
- },
10
- {
11
- label: 'Nivel',
12
- attribute: 'level',
13
- type: Number,
14
- inList: false,
15
- // @TODO Agregar validador que no se pueda seleccionar un nivel superior
16
- },
17
- {
18
- label: 'Redirección',
19
- attribute: 'redirect',
20
- type: String,
21
- inList: false,
22
- fieldProps: {
23
- placeholder: '/tab/kitchentab',
24
- },
25
- // Ensure redirect starts with /
26
- validate: (value: string) => {
27
- if (value && !value.startsWith('/')) {
28
- throw Error('La ruta debe comenzar con /');
29
- }
30
- },
31
- },
32
- {
33
- label: 'Grupo (web)',
34
- attribute: 'guard_name',
35
- type: String,
36
- inList: false,
37
- },
38
- {
39
- label: 'Permisos',
40
- attribute: 'permission_ids',
41
- type: String,
42
- custom: true,
43
- component: PermissionsSelector,
44
- inList: false,
45
- },
46
- ];
47
-
48
- export default roleSchema;
@@ -1,48 +0,0 @@
1
- import { IDashAutoAdminAttribute } from 'dash-auto-admin';
2
- import PermissionsSelectorList from '../components/permission/PermissionsSelectorList';
3
-
4
- const roleSchemaDataGrid: IDashAutoAdminAttribute[] = [
5
- {
6
- label: 'Nombre',
7
- attribute: 'name',
8
- type: String,
9
- },
10
- {
11
- label: 'Nivel',
12
- attribute: 'level',
13
- type: Number,
14
- inList: false,
15
- // @TODO Agregar validador que no se pueda seleccionar un nivel superior
16
- },
17
- {
18
- label: 'Redirección',
19
- attribute: 'redirect',
20
- type: String,
21
- inList: false,
22
- fieldProps: {
23
- placeholder: '/tab/kitchentab',
24
- },
25
- // Ensure redirect starts with /
26
- validate: (value: string) => {
27
- if (value && !value.startsWith('/')) {
28
- throw Error('La ruta debe comenzar con /');
29
- }
30
- },
31
- },
32
- {
33
- label: 'Grupo (web)',
34
- attribute: 'guard_name',
35
- type: String,
36
- inList: false,
37
- },
38
- {
39
- label: 'Permisos',
40
- attribute: 'permission_ids',
41
- type: String,
42
- custom: true,
43
- component: PermissionsSelectorList,
44
- inList: false,
45
- },
46
- ];
47
-
48
- export default roleSchemaDataGrid;
@@ -1,153 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- Button,
4
- ButtonGroup,
5
- Dialog,
6
- DialogTitle,
7
- DialogContent,
8
- DialogActions,
9
- Typography,
10
- Alert,
11
- Box
12
- } from '@mui/material';
13
- import {
14
- Cancel as CancelIcon,
15
- Refresh as RefreshIcon,
16
- Upgrade as UpgradeIcon
17
- } from '@mui/icons-material';
18
- import { useRecordContext, useDataProvider, useNotify, useRefresh } from 'react-admin';
19
- import { IDashAutoAdminCustomFieldComponent } from "dash-auto-admin";
20
-
21
- const ActionComponent: React.FC<IDashAutoAdminCustomFieldComponent> = ({ method, attribute, resourceConfig }) => {
22
- const record = useRecordContext();
23
- const dataProvider = useDataProvider();
24
- const notify = useNotify();
25
- const refresh = useRefresh();
26
- const [loading, setLoading] = useState(false);
27
- const [cancelDialogOpen, setCancelDialogOpen] = useState(false);
28
-
29
- if (!record) return null;
30
-
31
- const handleCancelSubscription = async () => {
32
- try {
33
- setLoading(true);
34
- await dataProvider.create('system/subscription/cancel/subscription', {
35
- data: { subscription_id: record.id }
36
- });
37
- notify('Suscripción cancelada exitosamente', { type: 'success' });
38
- refresh();
39
- setCancelDialogOpen(false);
40
- } catch (error) {
41
- notify('Error al cancelar la suscripción', { type: 'error' });
42
- } finally {
43
- setLoading(false);
44
- }
45
- };
46
-
47
- const handleReactivateSubscription = async () => {
48
- try {
49
- setLoading(true);
50
- await dataProvider.update('system/subscription',{
51
- id: record.id,
52
- data: { status: 'active' },
53
- previousData: {}
54
- });
55
- notify('Suscripción reactivada exitosamente', { type: 'success' });
56
- refresh();
57
- } catch (error) {
58
- notify('Error al reactivar la suscripción', { type: 'error' });
59
- } finally {
60
- setLoading(false);
61
- }
62
- };
63
-
64
- const canCancel = ['active', 'trial'].includes(record.status);
65
- const canReactivate = record.status === 'cancelled';
66
-
67
- return (
68
- <Box>
69
- <ButtonGroup variant="outlined" size="small">
70
- {canCancel && (
71
- <Button
72
- startIcon={<CancelIcon />}
73
- color="error"
74
- onClick={() => setCancelDialogOpen(true)}
75
- disabled={loading}
76
- >
77
- Cancelar
78
- </Button>
79
- )}
80
-
81
- {canReactivate && (
82
- <Button
83
- startIcon={<RefreshIcon />}
84
- color="success"
85
- onClick={handleReactivateSubscription}
86
- disabled={loading}
87
- >
88
- Reactivar
89
- </Button>
90
- )}
91
-
92
- <Button
93
- startIcon={<UpgradeIcon />}
94
- color="primary"
95
- disabled={loading || record.status === 'expired'}
96
- >
97
- Cambiar Plan
98
- </Button>
99
- </ButtonGroup>
100
-
101
- <Dialog
102
- open={cancelDialogOpen}
103
- onClose={() => setCancelDialogOpen(false)}
104
- maxWidth="sm"
105
- fullWidth
106
- >
107
- <DialogTitle>Confirmar Cancelación</DialogTitle>
108
- <DialogContent>
109
- <Alert severity="warning" sx={{ mb: 2 }}>
110
- Esta acción cancelará la suscripción inmediatamente.
111
- </Alert>
112
- <Typography>
113
- ¿Estás seguro de que deseas cancelar la suscripción de{' '}
114
- <strong>{record.subscription_plan?.name}</strong>?
115
- </Typography>
116
- <Typography variant="body2" color="textSecondary" sx={{ mt: 1 }}>
117
- El usuario perderá acceso a las funcionalidades premium al final del período actual.
118
- </Typography>
119
- </DialogContent>
120
- <DialogActions>
121
- <Button
122
- onClick={() => setCancelDialogOpen(false)}
123
- disabled={loading}
124
- >
125
- Cancelar
126
- </Button>
127
- <Button
128
- onClick={handleCancelSubscription}
129
- color="error"
130
- variant="contained"
131
- disabled={loading}
132
- >
133
- Confirmar Cancelación
134
- </Button>
135
- </DialogActions>
136
- </Dialog>
137
- </Box>
138
- );
139
- };
140
-
141
- const SubscriptionActions = ({ method, attribute, resourceConfig }: IDashAutoAdminCustomFieldComponent) => {
142
- switch (method) {
143
- case "edit":
144
- case "create":
145
- case "view":
146
- case "list":
147
- return <ActionComponent attribute={attribute} method={method} resourceConfig={resourceConfig} />
148
- default:
149
- return <></>;
150
- }
151
- }
152
-
153
- export default SubscriptionActions;
@@ -1,127 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import {
3
- Table,
4
- TableBody,
5
- TableCell,
6
- TableContainer,
7
- TableHead,
8
- TableRow,
9
- Paper,
10
- Typography,
11
- CircularProgress,
12
- Box
13
- } from '@mui/material';
14
- import { useRecordContext, useDataProvider } from 'react-admin';
15
- import { IDashAutoAdminCustomFieldComponent } from "dash-auto-admin";
16
- import { priceFormatter } from 'dash-utils';
17
-
18
- interface Payment {
19
- id: number;
20
- amount: number;
21
- status: string;
22
- transaction_id: string;
23
- created_at: string;
24
- }
25
-
26
- const PaymentHistoryView: React.FC<IDashAutoAdminCustomFieldComponent> = () => {
27
- const record = useRecordContext();
28
- const dataProvider = useDataProvider();
29
- const [payments, setPayments] = useState<Payment[]>([]);
30
- const [loading, setLoading] = useState(true);
31
-
32
- useEffect(() => {
33
- if (record?.id) {
34
- fetchPayments();
35
- }
36
- }, [record?.id]);
37
-
38
- const fetchPayments = async () => {
39
- try {
40
- setLoading(true);
41
- const { data } = await dataProvider.getList('payments', {
42
- filter: { subscription_id: record.id },
43
- sort: { field: 'created_at', order: 'DESC' },
44
- pagination: { page: 1, perPage: 10 },
45
- });
46
- setPayments(data);
47
- } catch (error) {
48
- console.error('Error fetching payments:', error);
49
- } finally {
50
- setLoading(false);
51
- }
52
- };
53
-
54
- if (loading) {
55
- return (
56
- <Box
57
- sx={{
58
- display: "flex",
59
- justifyContent: "center",
60
- p: 2
61
- }}>
62
- <CircularProgress />
63
- </Box>
64
- );
65
- }
66
-
67
- if (payments.length === 0) {
68
- return (
69
- <Typography variant="body2" color="textSecondary">
70
- No hay historial de pagos disponible
71
- </Typography>
72
- );
73
- }
74
-
75
- return (
76
- <TableContainer component={Paper} variant="outlined">
77
- <Table size="small">
78
- <TableHead>
79
- <TableRow>
80
- <TableCell>Fecha</TableCell>
81
- <TableCell>Monto</TableCell>
82
- <TableCell>Estado</TableCell>
83
- <TableCell>ID Transacción</TableCell>
84
- </TableRow>
85
- </TableHead>
86
- <TableBody>
87
- {payments.map((payment) => (
88
- <TableRow key={payment.id}>
89
- <TableCell>
90
- {new Date(payment.created_at).toLocaleDateString()}
91
- </TableCell>
92
- <TableCell>
93
- {priceFormatter(payment.amount, 'CLP')}
94
- </TableCell>
95
- <TableCell>
96
- <Typography
97
- variant="body2"
98
- color={payment.status === 'completed' ? 'success.main' : 'error.main'}
99
- >
100
- {payment.status === 'completed' ? 'Completado' : 'Fallido'}
101
- </Typography>
102
- </TableCell>
103
- <TableCell>
104
- <Typography variant="body2" sx={{
105
- fontFamily: "monospace"
106
- }}>
107
- {payment.transaction_id}
108
- </Typography>
109
- </TableCell>
110
- </TableRow>
111
- ))}
112
- </TableBody>
113
- </Table>
114
- </TableContainer>
115
- );
116
- };
117
-
118
- const SubscriptionPaymentHistory = ({ method, attribute, resourceConfig }: IDashAutoAdminCustomFieldComponent) => {
119
- switch (method) {
120
- case "view":
121
- return <PaymentHistoryView attribute={attribute} method={method} resourceConfig={resourceConfig} />;
122
- default:
123
- return <></>;
124
- }
125
- };
126
-
127
- export default SubscriptionPaymentHistory;
@@ -1,162 +0,0 @@
1
- import React, { useState } from 'react';
2
- import {
3
- Box,
4
- TextField,
5
- Button,
6
- Typography,
7
- IconButton,
8
- Paper,
9
- List,
10
- ListItem,
11
- ListItemText,
12
- ListItemSecondaryAction
13
- } from '@mui/material';
14
- import { Add as AddIcon, Delete as DeleteIcon } from '@mui/icons-material';
15
- import { useRecordContext, useInput } from 'react-admin';
16
- import { IDashAutoAdminCustomFieldComponent } from "dash-auto-admin";
17
-
18
- const EditComponent: React.FC<IDashAutoAdminCustomFieldComponent> = ({ method, attribute, resourceConfig }) => {
19
- const record = useRecordContext();
20
- const { field } = useInput({ source: 'features' });
21
- const [newFeature, setNewFeature] = useState('');
22
- const [features, setFeatures] = useState<string[]>(record?.features || []);
23
-
24
- const handleAddFeature = () => {
25
- if (newFeature.trim() && !features.includes(newFeature.trim())) {
26
- const updatedFeatures = [...features, newFeature.trim()];
27
- setFeatures(updatedFeatures);
28
- field.onChange(updatedFeatures);
29
- setNewFeature('');
30
- }
31
- };
32
-
33
- const handleRemoveFeature = (featureToRemove: string) => {
34
- const updatedFeatures = features.filter(feature => feature !== featureToRemove);
35
- setFeatures(updatedFeatures);
36
- field.onChange(updatedFeatures);
37
- };
38
-
39
- const handleKeyPress = (event: React.KeyboardEvent) => {
40
- if (event.key === 'Enter') {
41
- event.preventDefault();
42
- handleAddFeature();
43
- }
44
- };
45
-
46
- return (
47
- <Box>
48
- <Typography variant="h6" gutterBottom>
49
- Características del Plan
50
- </Typography>
51
-
52
- <Box
53
- sx={{
54
- display: "flex",
55
- gap: 1,
56
- mb: 2
57
- }}>
58
- <TextField
59
- fullWidth
60
- size="small"
61
- label="Nueva característica"
62
- value={newFeature}
63
- onChange={(e) => setNewFeature(e.target.value)}
64
- onKeyPress={handleKeyPress}
65
- placeholder="Ej: Acceso ilimitado, Soporte 24/7"
66
- />
67
- <Button
68
- variant="contained"
69
- startIcon={<AddIcon />}
70
- onClick={handleAddFeature}
71
- disabled={!newFeature.trim()}
72
- >
73
- Agregar
74
- </Button>
75
- </Box>
76
-
77
- {features.length > 0 ? (
78
- <Paper variant="outlined">
79
- <List dense>
80
- {features.map((feature, index) => (
81
- <ListItem key={index}>
82
- <ListItemText primary={feature} />
83
- <ListItemSecondaryAction>
84
- <IconButton
85
- edge="end"
86
- size="small"
87
- onClick={() => handleRemoveFeature(feature)}
88
- color="error"
89
- >
90
- <DeleteIcon />
91
- </IconButton>
92
- </ListItemSecondaryAction>
93
- </ListItem>
94
- ))}
95
- </List>
96
- </Paper>
97
- ) : (
98
- <Typography variant="body2" color="textSecondary" style={{ fontStyle: 'italic' }}>
99
- No hay características definidas para este plan
100
- </Typography>
101
- )}
102
-
103
- <Box sx={{
104
- mt: 2
105
- }}>
106
- <Typography variant="body2" color="textSecondary">
107
- Las características se mostrarán a los usuarios al seleccionar este plan de suscripción.
108
- </Typography>
109
- </Box>
110
- </Box>
111
- );
112
- };
113
-
114
- const ViewComponent: React.FC<IDashAutoAdminCustomFieldComponent> = ({ method, attribute, resourceConfig }) => {
115
- const record = useRecordContext();
116
- const features = record?.features || [];
117
-
118
- return (
119
- <Box>
120
- <Typography variant="h6" gutterBottom>
121
- Características del Plan
122
- </Typography>
123
-
124
- {features.length > 0 ? (
125
- <Paper variant="outlined">
126
- <List dense>
127
- {features.map((feature: string, index: number) => (
128
- <ListItem key={index}>
129
- <ListItemText primary={feature} />
130
- </ListItem>
131
- ))}
132
- </List>
133
- </Paper>
134
- ) : (
135
- <Typography variant="body2" color="textSecondary" style={{ fontStyle: 'italic' }}>
136
- No hay características definidas para este plan
137
- </Typography>
138
- )}
139
- </Box>
140
- );
141
- };
142
-
143
- const ListComponent: React.FC<IDashAutoAdminCustomFieldComponent> = ({ method, attribute, resourceConfig }) => {
144
- const record = useRecordContext();
145
- return <>{record?.features?.length || 0} características</>;
146
- };
147
-
148
- const SubscriptionPlanFeatures = ({ method, attribute, resourceConfig }: IDashAutoAdminCustomFieldComponent) => {
149
- switch (method) {
150
- case "edit":
151
- case "create":
152
- return <EditComponent attribute={attribute} method={method} resourceConfig={resourceConfig} />;
153
- case "view":
154
- return <ViewComponent attribute={attribute} method={method} resourceConfig={resourceConfig} />;
155
- case "list":
156
- return <ListComponent attribute={attribute} method={method} resourceConfig={resourceConfig} />;
157
- default:
158
- return <></>;
159
- }
160
- };
161
-
162
- export default SubscriptionPlanFeatures;