@dashadmin/dash-admin 1.3.45 → 1.3.47
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.
- package/dist/components/i18n/BridgedLocalesMenuButton.js +1 -2
- package/dist/components/menu/DarkToggleMode.js +1 -1
- package/dist/components/subscription/PlanPricesSettings.js +4 -2
- package/dist/components/tenancy/GlobalTenantWrapper.js +64 -0
- package/dist/components/tenancy/TenantSwitcher.js +389 -0
- package/dist/contexts/com/components/EchoNotificationsCenter.js +40 -0
- package/dist/default-theme/menu/AppMenuComponents/expanded/SidebarItem.js +1 -0
- package/dist/index.js +60 -40
- package/dist/pages/Profile.js +32 -38
- package/dist/providers/i18n/en.js +33 -0
- package/dist/providers/i18n/es.js +33 -0
- package/dist/resources/User/components/AvatarUploadField.js +61 -0
- package/dist/resources/User/components/PasswordFields.js +67 -0
- package/dist/resources/User/getProfileMenu.js +36 -0
- package/dist/resources/User/profileResource.js +33 -0
- package/dist/resources/User/userLayout.js +58 -0
- package/dist/resources/User/userResource.js +90 -0
- package/dist/resources/User/userSchema.js +206 -0
- package/dist/resources/User/usersFilters.js +22 -0
- package/dist/systemResources.js +30 -19
- package/package.json +1 -1
- package/src/components/i18n/BridgedLocalesMenuButton.tsx +1 -2
- package/src/components/menu/DarkToggleMode.tsx +1 -1
- package/src/components/subscription/PlanPricesSettings.tsx +2 -2
- package/src/components/tenancy/GlobalTenantWrapper.tsx +84 -0
- package/src/components/tenancy/TenantSwitcher.tsx +485 -0
- package/src/contexts/com/components/EchoNotificationsCenter.tsx +65 -0
- package/src/default-theme/menu/AppMaterialMenu.tsx +1 -1
- package/src/default-theme/menu/AppMenuComponents/expanded/SidebarItem.tsx +1 -0
- package/src/default-theme/menu/SidebarActions.tsx +1 -1
- package/src/index.tsx +15 -0
- package/src/pages/Profile.tsx +69 -107
- package/src/providers/i18n/en.ts +33 -0
- package/src/providers/i18n/es.ts +33 -0
- package/src/resources/User/components/AvatarUploadField.tsx +57 -0
- package/src/resources/User/components/PasswordFields.tsx +73 -0
- package/src/resources/User/getProfileMenu.ts +57 -0
- package/src/resources/User/profileResource.tsx +51 -0
- package/src/resources/User/userLayout.tsx +62 -0
- package/src/resources/User/userResource.tsx +111 -0
- package/src/resources/User/userSchema.tsx +213 -0
- package/src/resources/User/usersFilters.tsx +21 -0
- package/src/systemResources.tsx +31 -20
package/dist/index.js
CHANGED
|
@@ -17,32 +17,44 @@ import { default as default15 } from "./utils/cache/CacheInvalidatorListenerComp
|
|
|
17
17
|
import { AuthContext } from "./contexts/auth";
|
|
18
18
|
import { NotificationComponent } from "./contexts/com/components/NotificationRenderer";
|
|
19
19
|
import { NotificationWrapper } from "./contexts/com/components/NotificationsWidget";
|
|
20
|
-
import { default as default16 } from "./contexts/com/
|
|
21
|
-
import { default as default17 } from "./
|
|
22
|
-
import { default as default18
|
|
23
|
-
import { default as default19 } from "./
|
|
24
|
-
import { default as default20
|
|
20
|
+
import { default as default16 } from "./contexts/com/components/EchoNotificationsCenter";
|
|
21
|
+
import { default as default17 } from "./contexts/com/useLaravelEcho";
|
|
22
|
+
import { default as default18 } from "./hooks/notifications/WSMessagesManager";
|
|
23
|
+
import { default as default19, FCMProvider } from "./contexts/com/FCMContext";
|
|
24
|
+
import { default as default20 } from "./components/custom/Redirect";
|
|
25
|
+
import { default as default21, AnimatedRoutesWrapper } from "./RoutingWrapper";
|
|
25
26
|
import { useAuthContext } from "./contexts/auth/AuthContext";
|
|
26
|
-
import { default as
|
|
27
|
-
import { default as
|
|
28
|
-
import { default as
|
|
27
|
+
import { default as default22 } from "./contexts/com/LaravelEchoContext";
|
|
28
|
+
import { default as default23, useDashQueryClient, useDashQueryPersister, useIsCachePersisted } from "./contexts/DashQueryClientContext";
|
|
29
|
+
import { default as default24, useSystemRequestsCache } from "./contexts/SystemRequestsCache";
|
|
29
30
|
import { SubscriptionPlanFormatsProvider, useSubscriptionPlanFormats } from "./contexts/SubscriptionPlanFormatsProvider";
|
|
30
|
-
import { default as
|
|
31
|
+
import { default as default25 } from "./components/misc/DASHGlobalErrorHandler";
|
|
31
32
|
export * from "./react-admin-dash/Resource";
|
|
32
|
-
import { default as
|
|
33
|
-
import { default as
|
|
34
|
-
import { default as
|
|
33
|
+
import { default as default26 } from "./components/logs/LogFileById";
|
|
34
|
+
import { default as default27 } from "./components/logs/LogFile";
|
|
35
|
+
import { default as default28 } from "./contexts/auth/DASHAuthenticationService";
|
|
35
36
|
export * from "./contexts/auth";
|
|
36
37
|
export * from "./utils";
|
|
37
38
|
export * from "./default-theme";
|
|
38
39
|
export * from "./providers/i18n/languages";
|
|
39
|
-
import { default as
|
|
40
|
-
import { default as
|
|
41
|
-
import { default as
|
|
42
|
-
import { default as
|
|
43
|
-
import { default as
|
|
44
|
-
import { default as
|
|
45
|
-
import { default as
|
|
40
|
+
import { default as default29 } from "./components/menu/DarkToggleMode";
|
|
41
|
+
import { default as default30 } from "./hooks/useFormPersistance";
|
|
42
|
+
import { default as default31 } from "./components/user/AvatarComponent";
|
|
43
|
+
import { default as default32 } from "./components/user/TenantAvatarComponent";
|
|
44
|
+
import { default as default33 } from "./components/user/UserPreferences";
|
|
45
|
+
import { default as default34 } from "./pages/Profile";
|
|
46
|
+
import { default as default35 } from "./components/misc/LanguageSwitcher";
|
|
47
|
+
import { default as default36 } from "./components/i18n/LangSwitcher";
|
|
48
|
+
import {
|
|
49
|
+
default as default37,
|
|
50
|
+
dispatchTenantSwitchEvent,
|
|
51
|
+
getActiveTenantId,
|
|
52
|
+
isTenantImpersonationEnabled
|
|
53
|
+
} from "./components/tenancy/TenantSwitcher";
|
|
54
|
+
import {
|
|
55
|
+
default as default38
|
|
56
|
+
} from "./components/tenancy/GlobalTenantWrapper";
|
|
57
|
+
import { default as default39 } from "./components/misc/DarkModeSwitcher";
|
|
46
58
|
import { Breadcrumbs, BreadcrumbsComponent, BreadcrumbsManager, BreadcrumbsManagerComponent } from "./components/navigation";
|
|
47
59
|
import { useBreadcrumbs } from "./hooks/useBreadcrumbs";
|
|
48
60
|
import {
|
|
@@ -53,13 +65,13 @@ import {
|
|
|
53
65
|
clearResourceCache,
|
|
54
66
|
getCachedResources
|
|
55
67
|
} from "./resources/DASHResourceLoader";
|
|
56
|
-
import { default as
|
|
68
|
+
import { default as default40, I18nBridgeProvider, useI18nBridge, useBridgedLocales, useBridgedChangeLocale, useBridgedLocale } from "./contexts/I18nBridgeContext";
|
|
57
69
|
export {
|
|
58
70
|
AnimatedRoutesWrapper,
|
|
59
71
|
default4 as AppAsyncWrapper,
|
|
60
72
|
default5 as AppWrapper,
|
|
61
73
|
AuthContext,
|
|
62
|
-
|
|
74
|
+
default31 as AvatarComponent,
|
|
63
75
|
Breadcrumbs,
|
|
64
76
|
BreadcrumbsComponent,
|
|
65
77
|
BreadcrumbsManager,
|
|
@@ -68,37 +80,45 @@ export {
|
|
|
68
80
|
default15 as CacheInvalidatorListenerComponent,
|
|
69
81
|
default9 as CustomImageInput,
|
|
70
82
|
default6 as DASHAdmin,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
default28 as DASHAuthenticationService,
|
|
84
|
+
default25 as DASHGlobalErrorHandler,
|
|
85
|
+
default39 as DarkModeSwitcher,
|
|
86
|
+
default29 as DarkToggleMode,
|
|
87
|
+
default23 as DashQueryClientContext,
|
|
88
|
+
default16 as EchoNotificationsCenter,
|
|
89
|
+
default19 as FCMContext,
|
|
77
90
|
FCMProvider,
|
|
78
91
|
default3 as GlobalLoader,
|
|
79
|
-
|
|
92
|
+
default38 as GlobalTenantWrapper,
|
|
93
|
+
default40 as I18nBridgeContext,
|
|
80
94
|
I18nBridgeProvider,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
default36 as LangSwitcher,
|
|
96
|
+
default35 as LanguageSwitcher,
|
|
97
|
+
default22 as LaravelEchoContext,
|
|
98
|
+
default27 as LogFile,
|
|
99
|
+
default26 as LogFileById,
|
|
85
100
|
default13 as MotionWrapper,
|
|
86
101
|
NotificationComponent,
|
|
87
102
|
NotificationWrapper,
|
|
88
|
-
|
|
103
|
+
default34 as Profile,
|
|
104
|
+
default20 as Redirect,
|
|
89
105
|
default10 as ResourceTemplate,
|
|
90
106
|
default11 as ResourceTemplateFull,
|
|
91
|
-
|
|
107
|
+
default21 as RoutingWrapper,
|
|
92
108
|
SubscriptionPlanFormatsProvider,
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
default24 as SystemRequestsCache,
|
|
110
|
+
default32 as TenantAvatarComponent,
|
|
111
|
+
default37 as TenantSwitcher,
|
|
95
112
|
default12 as TrashTemplate,
|
|
96
|
-
|
|
97
|
-
|
|
113
|
+
default33 as UserPreferences,
|
|
114
|
+
default18 as WSMessagesManager,
|
|
98
115
|
clearResourceCache,
|
|
99
116
|
createDASHResourceLoader,
|
|
117
|
+
dispatchTenantSwitchEvent,
|
|
118
|
+
getActiveTenantId,
|
|
100
119
|
getCachedResources,
|
|
101
120
|
getDASHResources,
|
|
121
|
+
isTenantImpersonationEnabled,
|
|
102
122
|
loadManifest,
|
|
103
123
|
loadResourcesFromManifest,
|
|
104
124
|
default7 as systemResources,
|
|
@@ -111,11 +131,11 @@ export {
|
|
|
111
131
|
useDashQueryClient,
|
|
112
132
|
useDashQueryPersister,
|
|
113
133
|
useDashResource,
|
|
114
|
-
|
|
134
|
+
default30 as useFormPersistence,
|
|
115
135
|
default2 as useGlobalLoaderMgr,
|
|
116
136
|
useI18nBridge,
|
|
117
137
|
useIsCachePersisted,
|
|
118
|
-
|
|
138
|
+
default17 as useLaravelEcho,
|
|
119
139
|
useSubscriptionPlanFormats,
|
|
120
140
|
useSystemRequestsCache,
|
|
121
141
|
default14 as useWindowSize
|
package/dist/pages/Profile.js
CHANGED
|
@@ -26,12 +26,13 @@ import {
|
|
|
26
26
|
useRefresh,
|
|
27
27
|
Loading,
|
|
28
28
|
useNotify,
|
|
29
|
+
useTranslate,
|
|
29
30
|
TextInput
|
|
30
31
|
} from "react-admin";
|
|
31
32
|
import { useDispatch } from "react-redux";
|
|
32
33
|
import { DASH_REDUX_ACTIONS } from "dash-admin-state";
|
|
33
|
-
import useAxios from "
|
|
34
|
-
import SingleImageUploader from "
|
|
34
|
+
import { useAxios } from "dash-axios-hook";
|
|
35
|
+
import { SingleImageUploader } from "dash-components";
|
|
35
36
|
import { useAuthContext } from "../contexts/auth";
|
|
36
37
|
import UserPreferences from "../components/user/UserPreferences";
|
|
37
38
|
const Profile = (_props) => {
|
|
@@ -40,31 +41,35 @@ const Profile = (_props) => {
|
|
|
40
41
|
const { user, fetchAuth } = useAuthContext();
|
|
41
42
|
const [avatar, setAvatar] = useState({ rawFile: null, urlFile: "" });
|
|
42
43
|
const notify = useNotify();
|
|
43
|
-
const
|
|
44
|
+
const translate = useTranslate();
|
|
45
|
+
const axios = useAxios();
|
|
44
46
|
const refresh = useRefresh();
|
|
47
|
+
const { showPreferences = false } = _props;
|
|
45
48
|
const dispatch = useDispatch();
|
|
46
49
|
useEffect(() => {
|
|
47
50
|
dispatch(
|
|
48
51
|
DASH_REDUX_ACTIONS.updatePage({
|
|
49
|
-
title: "Perfil",
|
|
52
|
+
title: translate("profile.title", { _: "Perfil" }),
|
|
50
53
|
//icon:
|
|
51
|
-
subTitle: "Configuraci\xF3n de perfil"
|
|
54
|
+
subTitle: translate("profile.subtitle", { _: "Configuraci\xF3n de perfil" })
|
|
52
55
|
})
|
|
53
56
|
);
|
|
54
|
-
}, []);
|
|
57
|
+
}, [translate]);
|
|
55
58
|
const validateUserCreation = (values) => {
|
|
56
59
|
const errors = {};
|
|
57
60
|
if (currTab === "auth/update/password") {
|
|
61
|
+
const required = translate("profile.validation.required", { _: "El campo es requerido" });
|
|
62
|
+
const mismatch = translate("profile.validation.password_mismatch", { _: "Las contrase\xF1as no coinciden" });
|
|
58
63
|
if ((values.password || values.password_confirmation) && !values.current_password) {
|
|
59
|
-
errors.current_password =
|
|
64
|
+
errors.current_password = required;
|
|
60
65
|
}
|
|
61
66
|
if (values.current_password && (!values.password || !values.password_confirmation)) {
|
|
62
|
-
errors.password =
|
|
63
|
-
errors.password_confirmation =
|
|
67
|
+
errors.password = required;
|
|
68
|
+
errors.password_confirmation = required;
|
|
64
69
|
}
|
|
65
70
|
if (values.password_confirmation !== values.password) {
|
|
66
|
-
errors.password =
|
|
67
|
-
errors.password_confirmation =
|
|
71
|
+
errors.password = mismatch;
|
|
72
|
+
errors.password_confirmation = mismatch;
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
return errors;
|
|
@@ -103,17 +108,17 @@ const Profile = (_props) => {
|
|
|
103
108
|
yield fetchAuth();
|
|
104
109
|
console.log("Auth context refreshed after profile update");
|
|
105
110
|
} catch (authError) {
|
|
106
|
-
console.error("
|
|
111
|
+
console.error("Failed to refresh auth context:", authError);
|
|
107
112
|
}
|
|
108
|
-
notify("Usuario actualizado correctamente", { type: "success" });
|
|
113
|
+
notify(translate("profile.notify.success", { _: "Usuario actualizado correctamente" }), { type: "success" });
|
|
109
114
|
refresh();
|
|
110
115
|
} catch (error) {
|
|
111
116
|
let mainMessage = ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || ((_c = error == null ? void 0 : error.body) == null ? void 0 : _c.message) || "";
|
|
112
117
|
let fieldErrors = ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.errors) || ((_f = error == null ? void 0 : error.body) == null ? void 0 : _f.errors) || error;
|
|
113
118
|
if (mainMessage) {
|
|
114
|
-
notify(`Error al actualizar el usuario, ${mainMessage}
|
|
119
|
+
notify(translate("profile.notify.error_with_message", { message: mainMessage, _: `Error al actualizar el usuario, ${mainMessage}` }), { type: "error" });
|
|
115
120
|
} else {
|
|
116
|
-
notify("Error al actualizar el usuario", { type: "error" });
|
|
121
|
+
notify(translate("profile.notify.error", { _: "Error al actualizar el usuario" }), { type: "error" });
|
|
117
122
|
}
|
|
118
123
|
if (fieldErrors && typeof fieldErrors === "object") {
|
|
119
124
|
const errors = {};
|
|
@@ -124,6 +129,7 @@ const Profile = (_props) => {
|
|
|
124
129
|
}
|
|
125
130
|
} finally {
|
|
126
131
|
setIsLoading(false);
|
|
132
|
+
window.location.reload();
|
|
127
133
|
}
|
|
128
134
|
});
|
|
129
135
|
const handleInfoSubmit = () => {
|
|
@@ -165,7 +171,6 @@ const Profile = (_props) => {
|
|
|
165
171
|
width: "100%"
|
|
166
172
|
},
|
|
167
173
|
children: [
|
|
168
|
-
"<!-- F -->",
|
|
169
174
|
/* @__PURE__ */ jsx(
|
|
170
175
|
SingleImageUploader,
|
|
171
176
|
{
|
|
@@ -211,7 +216,7 @@ const Profile = (_props) => {
|
|
|
211
216
|
CardHeader,
|
|
212
217
|
{
|
|
213
218
|
sx: { padding: "16px 25px 0" },
|
|
214
|
-
title: "Info"
|
|
219
|
+
title: translate("profile.info.title", { _: "Info" })
|
|
215
220
|
}
|
|
216
221
|
),
|
|
217
222
|
/* @__PURE__ */ jsx(CardContent, { sx: { padding: "25px" }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
@@ -219,7 +224,7 @@ const Profile = (_props) => {
|
|
|
219
224
|
TextInput,
|
|
220
225
|
{
|
|
221
226
|
source: "name",
|
|
222
|
-
label: "Nombre",
|
|
227
|
+
label: translate("profile.info.name", { _: "Nombre" }),
|
|
223
228
|
variant: "outlined",
|
|
224
229
|
fullWidth: true
|
|
225
230
|
}
|
|
@@ -228,7 +233,7 @@ const Profile = (_props) => {
|
|
|
228
233
|
TextInput,
|
|
229
234
|
{
|
|
230
235
|
source: "lastname",
|
|
231
|
-
label: "Apellido",
|
|
236
|
+
label: translate("profile.info.lastname", { _: "Apellido" }),
|
|
232
237
|
variant: "outlined",
|
|
233
238
|
fullWidth: true
|
|
234
239
|
}
|
|
@@ -237,7 +242,7 @@ const Profile = (_props) => {
|
|
|
237
242
|
TextInput,
|
|
238
243
|
{
|
|
239
244
|
source: "email",
|
|
240
|
-
label: "Email",
|
|
245
|
+
label: translate("profile.info.email", { _: "Email" }),
|
|
241
246
|
variant: "outlined",
|
|
242
247
|
fullWidth: true
|
|
243
248
|
}
|
|
@@ -258,7 +263,7 @@ const Profile = (_props) => {
|
|
|
258
263
|
color: "white"
|
|
259
264
|
}
|
|
260
265
|
},
|
|
261
|
-
children: isLoading && currTab === "auth/update/info" ? "Guardando..." : "Guardar"
|
|
266
|
+
children: isLoading && currTab === "auth/update/info" ? translate("profile.info.saving", { _: "Guardando..." }) : translate("profile.info.save", { _: "Guardar" })
|
|
262
267
|
}
|
|
263
268
|
) })
|
|
264
269
|
] }) })
|
|
@@ -268,7 +273,7 @@ const Profile = (_props) => {
|
|
|
268
273
|
CardHeader,
|
|
269
274
|
{
|
|
270
275
|
sx: { padding: "16px 25px 0" },
|
|
271
|
-
title: "Contrase\xF1as"
|
|
276
|
+
title: translate("profile.password.title", { _: "Contrase\xF1as" })
|
|
272
277
|
}
|
|
273
278
|
),
|
|
274
279
|
/* @__PURE__ */ jsx(CardContent, { sx: { padding: "25px" }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 2, children: [
|
|
@@ -277,7 +282,7 @@ const Profile = (_props) => {
|
|
|
277
282
|
{
|
|
278
283
|
type: "password",
|
|
279
284
|
source: "current_password",
|
|
280
|
-
label: "Contrase\xF1a actual",
|
|
285
|
+
label: translate("profile.password.current", { _: "Contrase\xF1a actual" }),
|
|
281
286
|
variant: "outlined",
|
|
282
287
|
fullWidth: true
|
|
283
288
|
}
|
|
@@ -287,7 +292,7 @@ const Profile = (_props) => {
|
|
|
287
292
|
{
|
|
288
293
|
type: "password",
|
|
289
294
|
source: "password",
|
|
290
|
-
label: "Nueva contrase\xF1a",
|
|
295
|
+
label: translate("profile.password.new", { _: "Nueva contrase\xF1a" }),
|
|
291
296
|
variant: "outlined",
|
|
292
297
|
fullWidth: true
|
|
293
298
|
}
|
|
@@ -295,7 +300,7 @@ const Profile = (_props) => {
|
|
|
295
300
|
/* @__PURE__ */ jsx(Grid, { size: 12, children: /* @__PURE__ */ jsx(
|
|
296
301
|
TextInput,
|
|
297
302
|
{
|
|
298
|
-
label: "Repita nueva contrase\xF1a",
|
|
303
|
+
label: translate("profile.password.confirm", { _: "Repita nueva contrase\xF1a" }),
|
|
299
304
|
type: "password",
|
|
300
305
|
source: "password_confirmation",
|
|
301
306
|
variant: "outlined",
|
|
@@ -318,23 +323,12 @@ const Profile = (_props) => {
|
|
|
318
323
|
color: "white"
|
|
319
324
|
}
|
|
320
325
|
},
|
|
321
|
-
children: isLoading && currTab === "auth/update/password" ? "Guardando Contrase\xF1as..." : "Guardar Contrase\xF1as"
|
|
326
|
+
children: isLoading && currTab === "auth/update/password" ? translate("profile.password.saving", { _: "Guardando Contrase\xF1as..." }) : translate("profile.password.save", { _: "Guardar Contrase\xF1as" })
|
|
322
327
|
}
|
|
323
328
|
) })
|
|
324
329
|
] }) })
|
|
325
330
|
] }),
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
xs: 12
|
|
328
|
-
}, children: [
|
|
329
|
-
/* @__PURE__ */ jsx(
|
|
330
|
-
CardHeader,
|
|
331
|
-
{
|
|
332
|
-
sx: { padding: "16px 25px 0" },
|
|
333
|
-
title: "Preferencias"
|
|
334
|
-
}
|
|
335
|
-
),
|
|
336
|
-
/* @__PURE__ */ jsx(CardContent, { sx: { padding: "25px" }, children: /* @__PURE__ */ jsx(UserPreferences, {}) })
|
|
337
|
-
] })
|
|
331
|
+
showPreferences && /* @__PURE__ */ jsx(Grid, { size: { xs: 12 }, children: /* @__PURE__ */ jsx(CardContent, { sx: { padding: "25px" }, children: /* @__PURE__ */ jsx(UserPreferences, {}) }) })
|
|
338
332
|
]
|
|
339
333
|
}
|
|
340
334
|
) })
|
|
@@ -581,6 +581,39 @@ const dashEnglish = {
|
|
|
581
581
|
generate_help_label: "Generate AI Theme:",
|
|
582
582
|
generate_help_desc: "Uses AI to create a complete color scheme based on extracted colors and your description"
|
|
583
583
|
}
|
|
584
|
+
},
|
|
585
|
+
// Profile page
|
|
586
|
+
profile: {
|
|
587
|
+
title: "Profile",
|
|
588
|
+
subtitle: "Profile settings",
|
|
589
|
+
info: {
|
|
590
|
+
title: "Info",
|
|
591
|
+
name: "Name",
|
|
592
|
+
lastname: "Last name",
|
|
593
|
+
email: "Email",
|
|
594
|
+
save: "Save",
|
|
595
|
+
saving: "Saving..."
|
|
596
|
+
},
|
|
597
|
+
password: {
|
|
598
|
+
title: "Passwords",
|
|
599
|
+
current: "Current password",
|
|
600
|
+
new: "New password",
|
|
601
|
+
confirm: "Confirm new password",
|
|
602
|
+
save: "Save Passwords",
|
|
603
|
+
saving: "Saving Passwords..."
|
|
604
|
+
},
|
|
605
|
+
preferences: {
|
|
606
|
+
title: "Preferences"
|
|
607
|
+
},
|
|
608
|
+
validation: {
|
|
609
|
+
required: "This field is required",
|
|
610
|
+
password_mismatch: "Passwords do not match"
|
|
611
|
+
},
|
|
612
|
+
notify: {
|
|
613
|
+
success: "User updated successfully",
|
|
614
|
+
error: "Error updating user",
|
|
615
|
+
error_with_message: "Error updating user, %{message}"
|
|
616
|
+
}
|
|
584
617
|
}
|
|
585
618
|
};
|
|
586
619
|
var en_default = __spreadValues(__spreadValues({}, raEnglish), dashEnglish);
|
|
@@ -587,6 +587,39 @@ const dashSpanish = {
|
|
|
587
587
|
generate_help_label: "Generar Tema con IA:",
|
|
588
588
|
generate_help_desc: "Usa IA para crear un esquema de color completo basado en los colores extra\xEDdos y tu descripci\xF3n"
|
|
589
589
|
}
|
|
590
|
+
},
|
|
591
|
+
// Profile page
|
|
592
|
+
profile: {
|
|
593
|
+
title: "Perfil",
|
|
594
|
+
subtitle: "Configuraci\xF3n de perfil",
|
|
595
|
+
info: {
|
|
596
|
+
title: "Info",
|
|
597
|
+
name: "Nombre",
|
|
598
|
+
lastname: "Apellido",
|
|
599
|
+
email: "Email",
|
|
600
|
+
save: "Guardar",
|
|
601
|
+
saving: "Guardando..."
|
|
602
|
+
},
|
|
603
|
+
password: {
|
|
604
|
+
title: "Contrase\xF1as",
|
|
605
|
+
current: "Contrase\xF1a actual",
|
|
606
|
+
new: "Nueva contrase\xF1a",
|
|
607
|
+
confirm: "Repita nueva contrase\xF1a",
|
|
608
|
+
save: "Guardar Contrase\xF1as",
|
|
609
|
+
saving: "Guardando Contrase\xF1as..."
|
|
610
|
+
},
|
|
611
|
+
preferences: {
|
|
612
|
+
title: "Preferencias"
|
|
613
|
+
},
|
|
614
|
+
validation: {
|
|
615
|
+
required: "El campo es requerido",
|
|
616
|
+
password_mismatch: "Las contrase\xF1as no coinciden"
|
|
617
|
+
},
|
|
618
|
+
notify: {
|
|
619
|
+
success: "Usuario actualizado correctamente",
|
|
620
|
+
error: "Error al actualizar el usuario",
|
|
621
|
+
error_with_message: "Error al actualizar el usuario, %{message}"
|
|
622
|
+
}
|
|
590
623
|
}
|
|
591
624
|
};
|
|
592
625
|
var es_default = __spreadValues(__spreadValues({}, raSpanish), dashSpanish);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { useRecordContext } from "react-admin";
|
|
22
|
+
import { SingleImageUploader } from "dash-components";
|
|
23
|
+
import { useFormContext } from "react-hook-form";
|
|
24
|
+
const AvatarHandler = (props) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const { method, attribute } = props;
|
|
27
|
+
const record = useRecordContext();
|
|
28
|
+
const {
|
|
29
|
+
setValue,
|
|
30
|
+
formState: { errors }
|
|
31
|
+
} = useFormContext();
|
|
32
|
+
const onChange = (file) => {
|
|
33
|
+
setValue(attribute.attribute, file, { shouldDirty: true });
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
SingleImageUploader,
|
|
38
|
+
__spreadProps(__spreadValues({
|
|
39
|
+
classNamePrefix: "dash-profile"
|
|
40
|
+
}, method === "edit" && { currentUrl: `${record.image_path}` }), {
|
|
41
|
+
onChange
|
|
42
|
+
})
|
|
43
|
+
),
|
|
44
|
+
errors[attribute.attribute] && /* @__PURE__ */ jsx("span", { style: { color: "red" }, children: ((_b = (_a = errors[attribute.attribute]) == null ? void 0 : _a.message) == null ? void 0 : _b.toString()) || "Error" })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
47
|
+
const AvatarUploadField = ({ method, attribute, resourceConfig }) => {
|
|
48
|
+
switch (method) {
|
|
49
|
+
case "edit":
|
|
50
|
+
return /* @__PURE__ */ jsx(AvatarHandler, { attribute, method, resourceConfig });
|
|
51
|
+
case "create":
|
|
52
|
+
return /* @__PURE__ */ jsx(AvatarHandler, { attribute, method, resourceConfig });
|
|
53
|
+
case "view":
|
|
54
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var AvatarUploadField_default = AvatarUploadField;
|
|
58
|
+
export {
|
|
59
|
+
AvatarHandler,
|
|
60
|
+
AvatarUploadField_default as default
|
|
61
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
PasswordInput
|
|
4
|
+
} from "react-admin";
|
|
5
|
+
import { Box } from "@mui/material";
|
|
6
|
+
const PasswordShow = (_props) => {
|
|
7
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
8
|
+
};
|
|
9
|
+
const PasswordEdit = (_props) => {
|
|
10
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
12
|
+
PasswordInput,
|
|
13
|
+
{
|
|
14
|
+
sx: { width: "100%" },
|
|
15
|
+
autoComplete: "off",
|
|
16
|
+
source: "Contrase\xF1a",
|
|
17
|
+
name: "password"
|
|
18
|
+
}
|
|
19
|
+
) }),
|
|
20
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
21
|
+
PasswordInput,
|
|
22
|
+
{
|
|
23
|
+
sx: { width: "100%" },
|
|
24
|
+
autoComplete: "off",
|
|
25
|
+
source: "Confirmar Contrase\xF1a",
|
|
26
|
+
name: "password_confirmation"
|
|
27
|
+
}
|
|
28
|
+
) })
|
|
29
|
+
] });
|
|
30
|
+
};
|
|
31
|
+
const PasswordCreate = (_props) => {
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
34
|
+
PasswordInput,
|
|
35
|
+
{
|
|
36
|
+
sx: { width: "100%" },
|
|
37
|
+
source: "Contrase\xF1a",
|
|
38
|
+
name: "password"
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
42
|
+
PasswordInput,
|
|
43
|
+
{
|
|
44
|
+
sx: { width: "100%" },
|
|
45
|
+
source: "Confirmar Contrase\xF1a",
|
|
46
|
+
name: "password_confirmation"
|
|
47
|
+
}
|
|
48
|
+
) })
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
const PasswordFields = ({ method, attribute, resourceConfig }) => {
|
|
52
|
+
switch (method) {
|
|
53
|
+
case "edit":
|
|
54
|
+
return /* @__PURE__ */ jsx(PasswordEdit, { attribute, method, resourceConfig });
|
|
55
|
+
case "create":
|
|
56
|
+
return /* @__PURE__ */ jsx(PasswordCreate, { attribute, method, resourceConfig });
|
|
57
|
+
case "view":
|
|
58
|
+
return /* @__PURE__ */ jsx(PasswordShow, { attribute, method, resourceConfig });
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var PasswordFields_default = PasswordFields;
|
|
62
|
+
export {
|
|
63
|
+
PasswordCreate,
|
|
64
|
+
PasswordEdit,
|
|
65
|
+
PasswordShow,
|
|
66
|
+
PasswordFields_default as default
|
|
67
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { dashStorage } from "dash-utils";
|
|
2
|
+
const getProfileMenu = (resourceConfig) => {
|
|
3
|
+
const userStr = dashStorage.getItem("user");
|
|
4
|
+
const rolesStr = dashStorage.getItem("roles");
|
|
5
|
+
const user = userStr ? JSON.parse(userStr) : null;
|
|
6
|
+
const roles = rolesStr ? JSON.parse(rolesStr) : [];
|
|
7
|
+
const profileMenu = [
|
|
8
|
+
{
|
|
9
|
+
title: "Perfil",
|
|
10
|
+
redirect: "/profile"
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
const isCliente = roles ? roles.map((role) => role.name).includes("Cliente") : false;
|
|
14
|
+
if (isCliente) {
|
|
15
|
+
profileMenu.push(
|
|
16
|
+
{
|
|
17
|
+
title: "Comunas",
|
|
18
|
+
redirect: "/profile/commune"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
title: "Centros Log\xEDsticos",
|
|
22
|
+
redirect: "/profile/logistic-center"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Notificaciones",
|
|
26
|
+
redirect: "/profile/notification"
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return profileMenu;
|
|
31
|
+
};
|
|
32
|
+
var getProfileMenu_default = getProfileMenu;
|
|
33
|
+
export {
|
|
34
|
+
getProfileMenu_default as default,
|
|
35
|
+
getProfileMenu
|
|
36
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import ResourceTemplate from "../../templates/ResourceTemplate";
|
|
3
|
+
import Dashboard from "@mui/icons-material/Dashboard";
|
|
4
|
+
import { DASHAdminSystemConstants } from "dash-constants";
|
|
5
|
+
import getProfileMenu from "./getProfileMenu";
|
|
6
|
+
const profileResource = {
|
|
7
|
+
filterWithSubmit: true,
|
|
8
|
+
roles: [
|
|
9
|
+
"*"
|
|
10
|
+
/*
|
|
11
|
+
DASHAdminSystemConstants.system.DASH_SYSTEM_ROLE,
|
|
12
|
+
DASHAppConstants.system.TENANT_ROLE,
|
|
13
|
+
DASHAppConstants.system.USER_ROLE,
|
|
14
|
+
DASHAppConstants.system.CREATOR_ROLE,
|
|
15
|
+
DASHAppConstants.system.CLOSING_ROLE,
|
|
16
|
+
DASHAppConstants.system.GUNNER_ROLE,
|
|
17
|
+
DASHAppConstants.system.DRIVER_ROLE
|
|
18
|
+
*/
|
|
19
|
+
],
|
|
20
|
+
component: ResourceTemplate,
|
|
21
|
+
hidden: true,
|
|
22
|
+
model: "profile",
|
|
23
|
+
group: "Perfil",
|
|
24
|
+
label: "Perfil",
|
|
25
|
+
icon: /* @__PURE__ */ jsx(Dashboard, {}),
|
|
26
|
+
schema: null,
|
|
27
|
+
menu: getProfileMenu,
|
|
28
|
+
listProps: { perPage: DASHAdminSystemConstants.system.DEFAULT_PER_PAGE || 50 }
|
|
29
|
+
};
|
|
30
|
+
var profileResource_default = profileResource;
|
|
31
|
+
export {
|
|
32
|
+
profileResource_default as default
|
|
33
|
+
};
|